def do_it(self, all_consoles=False, consoles=None, console=None, all_roms=False, roms=None, rom=None): search_consoles = tuple() if not all_consoles: search_consoles = consoles or tuple(console) # If not all_roms, search either roms one at a time or rom if not all_roms: self.search_many(roms=roms or tuple(rom), consoles=search_consoles) # If all_roms, go through all_consoles, consoles, or console and download each else: c_l = ConsoleLoader(driver=self.driver, consoles=search_consoles) for console_name in c_l.iter_consoles(): print(f'Starting console "{console_name}"') page_manager = PageManager(driver=self.driver, page=1) while True: r_l = RomLoader(driver=self.driver) r_l.download_all_roms() try: page_manager.next() except: break try: os.mkdir(f'roms/{console_name}') except OSError: pass files = os.listdir('roms') for fname in files: if not os.path.isdir(f'roms/{fname}'): shutil.move(f'roms/{fname}', f'roms/{console_name}/{fname}')
self.__title_text = text self.__title_pos = ((self.size[0] - text.get_width()) // 2, self.title_y_off) def __init_level_list(self): xs = [x['name'] for x in self.__level_info] self.__level_info = {a: b for a, b in zip(xs, self.__level_info)} drop_down = pygame_gui.elements.UIDropDownMenu(xs, xs[0], self.level_list_rect, self.gui_manager, 'expanded') self.register_gui_event_handler('ui_drop_down_menu_changed', drop_down, self.__list_event_handle) def __list_event_handle(self, event): level_name = event.text self.page_manager.replace( game_page.GamePage(self.page_manager, self.__level_info[level_name]['map'], level_name)) def draw(self, window_surface): window_surface.blit(self.__background, (0, 0)) window_surface.blit(self.__title_text, self.__title_pos) if __name__ == '__main__': pm = PageManager(common.WIN_SIZE, 'level page') pm.push(LevelPage(pm)) pm.run()
from page_manager import PageManager if __name__ == '__main__': pm = PageManager( game_url='https://www.kongregate.com/games/juppiomenz/bit-heroes', path_to_extension='E:\Coding\chromedriver\Adblock-Plus_v1.12.4.crx', executable_path='E:\Coding\chromedriver\chromedriver.exe') pm.start_selenium() pm.login(email='*****@*****.**', password='******') pm.start_bot()
self.__controller.start() else: self.__controller.reset_state() def draw(self, win_surf): win_surf.blit(self.__background, (0, 0)) win_surf.blit(self.__map_surf.surface, self.__map_surf_rect) win_surf.blit(self.__switch.surface, self.__switch.rect) # game state check self.__controller.state_check() # roles self.__role_group.draw(win_surf) self.__role_group.update() def draw_after_gui(self, win_surf): # the tool on mouse should be drew on the top of toolbox if self.__tool_on_mouse: self.__tool_on_mouse_rect.center = pygame.mouse.get_pos() win_surf.blit(self.__tool_on_mouse.texture, self.__tool_on_mouse_rect) if __name__ == '__main__': if len(sys.argv) == 2: map_file = sys.argv[1] else: map_file = 'config/map_1.json' pm = PageManager(common.WIN_SIZE, 'hello') pm.push(GamePage(pm, map_file)) pm.run()
'point_size': 24, 'style': 'regular' }]) self.__text = pygame_gui.elements.UITextBox( '<font face=noto-sans size=6.0 color=#111111ff>' '在很久以前,一位漂亮的公主被大魔王抓走了。<br>' '勇敢的英雄为了拯救美丽的公主,踏上了一条xx的道路<br>' '...<br>' '你能帮助大魔王打败英雄吗<br>' '你能帮助大魔王打败英雄吗<br>' '你能帮助大魔王打败英雄吗<br>' '你能帮助大魔王打败英雄吗<br>' '你能帮助大魔王打败英雄吗<br>' '你能帮助大魔王打败英雄吗<br>' '你能帮助大魔王打败英雄吗<br>' '你能帮助大魔王打败英雄吗<br>' '你能帮助大魔王打败英雄吗<br>' '你能帮助大魔王打败英雄吗<br>' '</font>', pygame.Rect(self.text_pos, self.text_size), self.gui_manager) self.__text.set_active_effect('typing_appear') def draw(self, window_surface): window_surface.blit(self.__background, (0, 0)) if __name__ == '__main__': pm = PageManager(common.WIN_SIZE, 'hello') pm.push(BackgroundInfoPage(pm)) pm.run()
self.btn_margin) // 2 retry_btn = pygame_gui.elements.UIButton( pygame.Rect((btn_x_off, self.btn_y_off), self.btn_size), '重试', self.gui_manager) self.register_gui_event_handler('ui_button_pressed', retry_btn, self.__retry_handle) quit_btn = pygame_gui.elements.UIButton( pygame.Rect((btn_x_off + self.btn_size[0] + self.btn_margin, self.btn_y_off), self.btn_size), '退出', self.gui_manager) self.register_gui_event_handler('ui_button_pressed', quit_btn, lambda e: self.page_manager.pop()) def __init_title(self): font = get_font('noto-sans-bold', self.title_text_size) text = font.render(self.title_str, True, self.title_color) self.__title_text = text self.__title_pos = ((self.size[0] - text.get_width()) // 2, self.title_y_off) def draw(self, window_surface): window_surface.blit(self.__background, (0, 0)) window_surface.blit(self.__title_text, self.__title_pos) if __name__ == '__main__': pm = PageManager(common.WIN_SIZE, 'Hello') pm.push(FailPage(pm, '')) pm.run()
elif key in ("n"): # Move to next performer in the list next_performer = self.setlist.next() self.setlist.start(next_performer) self.update() return None elif key in ("a"): # Add a new performer ui = suggestion_ui.SuggestionUI(self.manager.pop_callback(self.signup), self.manager) self.manager.push(ui) else: return parent(size, key) return keypress if __name__ == "__main__": # Create some example performers setlist = SetList() # for performer in [data.performer.Performer(name="Dominic Rout", email="", mobile = "213123123"), # data.performer.Performer(name="Al G", email="*****@*****.**", mobile = "1234123412312"), # data.performer.Performer(name="Al P", email="*****@*****.**", mobile = "12341231123412312")]: # setlist.signup(performer) manager = PageManager() ui = SetListMenuUI(setlist, manager) manager.push(ui) ui.update_loop(manager.loop) manager.run()
# setting button self.__setting_btn = pygame_gui.elements.UIButton( btn_rect[1], "设置", self.gui_manager) self.register_gui_event_handler( 'ui_button_pressed', self.__setting_btn, lambda e: print('setting')) # map editor button self.__map_editor_btn = pygame_gui.elements.UIButton( btn_rect[2], "地图编辑", self.gui_manager) self.register_gui_event_handler( 'ui_button_pressed', self.__map_editor_btn, lambda e: self.page_manager.push(EditorPage(self.page_manager))) # quit button self.__quit_btn = pygame_gui.elements.UIButton( btn_rect[3], "退出", self.gui_manager) self.register_gui_event_handler('ui_button_pressed', self.__quit_btn, lambda e: self.page_manager.pop()) def draw(self, window_surface): window_surface.blit(self.__background, (0, 0)) window_surface.blit(self.__title_text, self.__title_pos) if __name__ == '__main__': page_manager = PageManager((808, 700), 'Hello') page_manager.push(StartPage(page_manager)) page_manager.run()
"name": "down", "object_id": "down_toolbox", "texture": "tools/down.png", "number": toolbox_num[1], "position": [] }, { "name": "left", "object_id": "left_toolbox", "texture": "tools/left.png", "number": toolbox_num[2], "position": [] }, { "name": "right", "object_id": "right_toolbox", "texture": "tools/right.png", "number": toolbox_num[3], "position": [] }, ] filename = 'config/%s.json' % map_name save_json(filename, map_now) if __name__ == '__main__': pm1 = PageManager(common.WIN_SIZE, 'hello') pm1.push(EditorPage(pm1)) pm1.run()