def next_garden(self): sound.click() garden_cls = type(self.game.garden) idx = garden.all_gardens.index(garden_cls) garden_cls = garden.all_gardens[idx + 1] self.animate_fade_out() self.animate_wait_call(self.control.switch_handler, "game", garden_cls)
def option_credits(self): sound.click() self.show_credits = True self.animate_title_fade_to(u"Credits") self.animate_main_menu_slide_out() self.animate_credits_slide_in() self.animate_wait_call(self.set_credits)
def option_options(self): sound.click() self.show_options = True self.animate_title_fade_to(u"Options") self.animate_main_menu_slide_out() self.animate_options_menu_slide_in() self.animate_wait_call(self.set_options)
def option_credits_back(self): sound.click() self.show_main = True self.animate_title_fade_to(CAPTION) self.animate_credits_slide_out() self.animate_main_menu_slide_in() self.animate_wait_call(self.set_main)
def option_achievements_back(self): sound.click() self.show_main = True self.animate_title_fade_to(CAPTION) self.animate_achievements_slide_out() self.animate_main_menu_slide_in() self.animate_wait_call(self.set_main) self.animate_flowers_slide_up()
def option_achievements(self): sound.click() self.show_achievements = True self.animate_flowers_slide_down() self.animate_wait_call(lambda: None) self.animate_title_fade_to(u"Awards") self.animate_main_menu_slide_out() self.animate_achievements_slide_in() self.animate_wait_call(self.set_achievements)
def option_gardens(self): sound.click() self.show_gardens = True self.animate_flowers_slide_down() self.animate_wait_call(lambda: None) self.animate_title_fade_to(u"Gardens") self.animate_main_menu_slide_out() self.animate_gardens_slide_in() self.animate_wait_call(self.set_gardens)
def option_bestiary(self): sound.click() self.show_bestiary = True self.animate_flowers_slide_down() self.animate_wait_call(lambda: None) self.animate_title_fade_to(u"Bestiary") self.animate_main_menu_slide_out() self.animate_bestiary_slide_in() self.animate_wait_call(self.set_bestiary)
def open_menus(self): sound.click() if self.show_tool_menu and self.show_status_area: self.clear_state() self.tool_menu.set_current(None) self.show_status_area = False else: self.set_tool_menu() self.show_status_area = True
def option_options_sound_effects(self): if not pyglet.media.have_avbin: self.set_show_no_avbin() return config.save_option("sound_effects", not config.sound_effects) sound.click() text = self.options_menu.options[2].label.text.rsplit(":", 1)[0] text = text + [": Off", ": On"][config.sound_effects] self.options_menu.options[2].label.text = text self.options_menu.clear_cache()
def option_bestiary_activate(self, index): if achievement.creature_gets[index].value > 0 or DEBUG: sound.click() self.show_bestiary_entry = True c = creature.Creature.all_creatures[index] self.bestiary_left.graphic = data.load_image(c.img_name) self.bestiary_right = self.bestiary_textboxes[index] self.animate_fade_out(target=0.5) self.animate_bestiary_entry_slide_in() self.animate_wait_call(self.set_bestiary_entry)
def option_options_fullscreen(self): sound.click() config.save_option("fullscreen", not config.fullscreen) text = self.options_menu.options[0].label.text.rsplit(":", 1)[0] text = text + [": Off", ": On"][config.fullscreen] self.options_menu.options[0].label.text = text self.window.set_fullscreen(config.fullscreen) for component in self.interface_components: component.clear_cache() self.refresh_options = True self.set_options()
def option_options_music(self): sound.click() if not pyglet.media.have_avbin: self.set_show_no_avbin() return config.save_option("music", not config.music) text = self.options_menu.options[1].label.text.rsplit(":", 1)[0] text = text + [": Off", ": On"][config.music] self.options_menu.options[1].label.text = text self.options_menu.clear_cache() if config.music: self.control.music.start_song(MENU_MUSIC, 1.0) else: self.control.music.stop_song(2.0)
def option_bestiary_back(self): sound.click() if self.show_bestiary_entry: self.animate_fade_in(start=0.5) self.animate_bestiary_entry_slide_out() self.animate_wait_call(self.set_bestiary) elif self.show_bestiary: self.show_main = True self.animate_title_fade_to(CAPTION) self.animate_bestiary_slide_out() self.animate_main_menu_slide_in() self.animate_wait_call(self.set_main) self.animate_flowers_slide_up()
def on_mouse_release(self, x, y, buttons, mods): scx, scy = self.scissor_shape[:2] gx, gy = x - scx, y - scy if (gx, gy) in self.status_button: sound.click() self.show_status_area = not self.show_status_area return EVENT_HANDLED if self.show_advisor: sound.click() self.advance_page() return EVENT_HANDLED x, y = self.screen_to_world(x, y) if x is not None: p = self.game.add_plant_at(self.plant_type_to_add, Vector((x, y))) if p: sound.plant() else: sound.bad()
def option_gardens_activate(self, index): if DEBUG or index == 0 or achievement.levels[index-1].value > 0: sound.click() self.control.music.stop_song(2.0) self.animate_fade_out() self.animate_wait_call(self.control.switch_handler, "game", garden.all_gardens[index])
def tool_menu_activate(self, index): sound.click() self.set_plant_to_add(self.game.garden.plants[index]) self.tool_menu.set_current(None) self.clear_state()
def tool_button_click(self): sound.click() if not self.show_tool_menu: self.set_tool_menu() else: self.clear_state()
def option_quit(self): sound.click() self.control.music.stop_song(2.0) self.animate_fade_out() self.animate_wait_call(app.exit)
def restart_garden(self): sound.click() garden_cls = type(self.game.garden) self.animate_fade_out() self.animate_wait_call(self.control.switch_handler, "game", garden_cls)
def back_to_menu(self): sound.click() self.animate_fade_out() self.animate_wait_call(self.control.switch_handler, "menu")
def option_achievements_scroll_down(self): if self.achievements.scroll_max > 0: sound.click() self.achievements.scroll_relative(2) self.achievements.set_current(None)
def option_bestiary_scroll_down(self): if self.bestiary.scroll_max > 0: sound.click() self.bestiary.scroll_relative(2) self.bestiary.set_current(None)
light.init(client) client.connect("iemxblog.fr", 1883, 60) client.loop_start() except Exception as e: print(e) sound.failure() sound.failure() sound.failure() stack = [] while True: l = input("> ") try: if l.isdecimal(): sound.click() stack.append(int(l)) elif l == "/": sound.click() cmd = stack.pop() if cmd == 0: sound.shutdown() os.system("sudo reboot") elif cmd == 1: action = stack.pop() shutter = stack.pop() if action == shutters.OPEN: if shutter == shutters.DOOR: shutters.openDoor() elif shutter == shutters.BEDROOM: shutters.openBedroom()