def build(self, back_btn=True): frm = Frame( frame_size=(-1.5, 1.5, -.9, .9), frame_col=(.95, .95, .7, .85)) question_txt = _( "What do you want to do?\n\nNote: use '%s' for pausing the game.") question_txt = question_txt % self.keys.pause menu_props = self.menu_props txt = Text( question_txt, pos=(0, .64), scale=.08, wordwrap=32, fg=menu_props.text_active_col, font=menu_props.font) on_back = lambda: self.on_end(True) on_end = lambda: self.on_end(False) menu_data = [ ('back to the game', _('back to the game'), on_back), ('back to the main menu', _('back to the main menu'), on_end)] btn_args = menu_props.btn_args btn_visit = Btn( text=menu_data[0][1], pos=(0, 0), cmd=menu_data[0][2], text_scale=.8, **btn_args) btn_dont_visit = Btn( text=menu_data[1][1], pos=(0, -.5), cmd=menu_data[1][2], text_scale=.8, **btn_args) self.add_widgets([frm, txt, btn_visit, btn_dont_visit]) PageGui.build(self, False) self.eng.show_cursor()
def build(self, back_btn=True): frm = Frame( frameSize=(-1.5, 1.5, -.9, .9), frameColor=(.95, .95, .7, .85)) question_txt = _( "What do you want to do?\n\nNote: use '%s' for pausing the game.") question_txt = question_txt % self.keys.pause menu_args = self.menu_args txt = Text( question_txt, pos=(0, .64), scale=.08, wordwrap=32, fg=menu_args.text_active, font=menu_args.font) on_back = lambda: self.on_end(True) on_end = lambda: self.on_end(False) menu_data = [ ('back to the game', _('back to the game'), on_back), ('back to the main menu', _('back to the main menu'), on_end)] btn_args = menu_args.btn_args btn_visit = Btn( text=menu_data[0][1], pos=(0, 1, 0), command=menu_data[0][2], text_scale=.8, **btn_args) btn_dont_visit = Btn( text=menu_data[1][1], pos=(0, 1, -.5), command=menu_data[1][2], text_scale=.8, **btn_args) self.add_widgets([frm, txt, btn_visit, btn_dont_visit]) PageGui.build(self, False) if self.eng.lib.version().startswith('1.10'): self.eng.show_cursor() else: self.eng.hide_cursor() self.eng.show_standard_cursor()
def build(self, back_btn=True): frm = Frame(frame_size=(-1.5, 1.5, -.9, .9), frame_col=(.95, .95, .7, .85)) question_txt = _( "What do you want to do?\n\nNote: use '%s' for pausing the game.") question_txt = question_txt % self.keys.pause menu_props = self.menu_props txt = Text(question_txt, pos=(0, .64), scale=.08, wordwrap=32, fg=menu_props.text_active_col, font=menu_props.font) on_back = lambda: self.on_end(True) on_end = lambda: self.on_end(False) menu_data = [('back to the game', _('back to the game'), on_back), ('back to the main menu', _('back to the main menu'), on_end)] btn_args = menu_props.btn_args btn_visit = Btn(text=menu_data[0][1], pos=(0, 0), cmd=menu_data[0][2], text_scale=.8, **btn_args) btn_dont_visit = Btn(text=menu_data[1][1], pos=(0, -.5), cmd=menu_data[1][2], text_scale=.8, **btn_args) self.add_widgets([frm, txt, btn_visit, btn_dont_visit]) PageGui.build(self, False) self.eng.show_cursor()
def build(self, back_btn=True): # parameters differ from overridden self.eng.init_gfx() self.font = self.mediator.menu.gui.menu_props.font self.text_fg = self.mediator.menu.gui.menu_props.text_active_col self.text_bg = self.mediator.menu.gui.menu_props.text_normal_col self.text_err_col = self.mediator.menu.gui.menu_props.text_err_col self.load_txt = Text(_('LOADING...'), scale=.2, pos=(0, .78), font=self.font, fg=(.75, .75, .75, 1), wordwrap=12) track_number = '' if not self.rprops.season_props.single_race: track_names = self.rprops.season_props.gameprops.season_tracks track_num = track_names.index(self.rprops.track_name) + 1 track_number = ' (%s/%s)' % (track_num, len(track_names)) track_txt = Text(_('track: ') + self.track_name_transl + track_number, scale=.08, pos=(0, .62), font=self.font, fg=self.text_bg, wordwrap=12) self.set_wld_img() self.set_grid() self.set_ranking() self.set_controls() self.set_upgrades() self.add_widgets([self.load_txt, track_txt]) PageGui.build(self, False)
def build(self, back_btn=True): menu_props = self.menu_props frm = Frame( frame_size=(-1.5, 1.5, -.9, .9), frame_col=(.95, .95, .7, .85)) txt = _( 'Please, visit our site after exiting!\n\nIt helps us! Thank you!') txt = Text( txt, pos=(0, .64), scale=.08, wordwrap=32, fg=menu_props.text_active_col, font=menu_props.font) menu_data = [ ('visit our site after exiting', _('visit our site after exiting'), lambda: self.on_end(True)), ("don't visit our site after exiting", _("don't visit our site after exiting"), lambda: self.on_end(False))] btn_args = self.menu_props.btn_args btn_args['frame_size'] = (-12, 12, -.8, 1.2) btn_visit = Btn( text=menu_data[0][1], pos=(0, 0), cmd=menu_data[0][2], text_scale=.9, **btn_args) btn_dont_visit = Btn( text=menu_data[1][1], pos=(0, -.5), cmd=menu_data[1][2], text_scale=.7, **btn_args) widgets = [frm, txt, btn_visit, btn_dont_visit] self.add_widgets(widgets) PageGui.build(self, False)
def build(self, back_btn=True, exit_behav=False): menu_props = self.menu_props t_a = menu_props.text_args t_a['fg'] = menu_props.text_normal_col t_a['scale'] = .06 thanks_txt = Text( _('Thanks to: ') + ThanksNames.get_thanks(1, 3)[0], pos=(.05, .05), align=TextNode.A_left, parent='bottomleft', wordwrap=64, **t_a) self.add_widgets([thanks_txt]) PageGui.build(self, back_btn, exit_behav)
def build(self, back_btn=True, exit_behav=False): menu_args = self.menu_args t_a = menu_args.text_args t_a['fg'] = menu_args.text_normal t_a['scale'] = .06 thanks_txt = Text(_('Thanks to: ') + ThanksNames.get_thanks(1, 3)[0], pos=(.05, .05), align=TextNode.A_left, parent='bottomleft', wordwrap=64, **t_a) self.add_widgets([thanks_txt]) PageGui.build(self, back_btn, exit_behav)
def build(self, back_btn=True): # parameters differ from overridden self.eng.init_gfx() self.font = self.menu_props.font self.text_fg = self.menu_props.text_active_col self.text_bg = self.menu_props.text_normal_col self.text_err_col = self.menu_props.text_err_col # items = self.ranking.carname2points.items() items = [(player.car, player.points) for player in self.__players] sorted_ranking = reversed(sorted(items, key=lambda el: el[1])) txt = Text(_('Ranking'), scale=.1, pos=(0, .76), font=self.font, fg=self.text_bg) self.add_widgets([txt]) for i, car in enumerate(sorted_ranking): txt, img = RankingGui.set_drv_txt_img(self, i, car[0], 0, .52, str(car[1]) + ' %s', self.__players) self.add_widgets([txt, img]) track = self.rprops.track_name ntracks = len(self.sprops.gameprops.season_tracks) if self.sprops.gameprops.season_tracks.index(track) == ntracks - 1: cont_btn_cmd = self.notify cont_btn_ea = ['on_ranking_next_race'] img = Img('assets/images/gui/trophy.txo', parent=base.a2dRightCenter, pos=(-.58, 0), scale=.55) img.set_transparent() txt = Text(_('Congratulations!'), fg=(.8, .6, .2, 1), scale=.16, pos=(0, -.3), font=loader.loadFont(self.sprops.font), parent='leftcenter') txt.set_r(-79) self.add_widgets([txt, img]) else: cont_btn_cmd = self.notify cont_btn_ea = ['on_ranking_end', self.__players] cont_btn = Btn(text=_('Continue'), pos=(0, -.8), cmd=cont_btn_cmd, extra_args=cont_btn_ea, **self.menu_props.btn_args) self.add_widgets([cont_btn]) PageGui.build(self, False)