From 160315ff391104985246a35bcb5864559d32f9c7 Mon Sep 17 00:00:00 2001 From: John Date: Sat, 29 Aug 2015 22:05:53 +0300 Subject: [PATCH] Add FPS meter and option to Shticker Book --- toontown/shtiker/OptionsPage.py | 26 +++++++++++++++++++++---- toontown/toonbase/TTLocalizerEnglish.py | 7 +++++++ toontown/toonbase/ToontownStart.py | 3 +++ 3 files changed, 32 insertions(+), 4 deletions(-) diff --git a/toontown/shtiker/OptionsPage.py b/toontown/shtiker/OptionsPage.py index afa5cdeb..cda4d2f5 100755 --- a/toontown/shtiker/OptionsPage.py +++ b/toontown/shtiker/OptionsPage.py @@ -731,27 +731,30 @@ class ExtraOptionsTabPage(DirectFrame): self.fov_label = DirectLabel(parent=self, relief=None, text=TTLocalizer.FieldOfViewLabel, text_align=TextNode.ALeft, text_scale=options_text_scale, text_wordwrap=16, pos=(leftMargin, 0, textStartHeight)) self.cogInterface_label = DirectLabel(parent=self, relief=None, text='', text_align=TextNode.ALeft, text_scale=options_text_scale, text_wordwrap=16, pos=(leftMargin, 0, textStartHeight - textRowHeight)) self.tpTransition_label = DirectLabel(parent=self, relief=None, text='', text_align=TextNode.ALeft, text_scale=options_text_scale, text_wordwrap=16, pos=(leftMargin, 0, textStartHeight - 2 * textRowHeight)) - self.teleport_label = DirectLabel(parent=self, relief=None, text='', text_align=TextNode.ALeft, text_scale=options_text_scale, text_wordwrap=16, pos=(leftMargin, 0, textStartHeight - 3 * textRowHeight)) + self.fpsMeter_label = DirectLabel(parent=self, relief=None, text='', text_align=TextNode.ALeft, text_scale=options_text_scale, text_wordwrap=16, pos=(leftMargin, 0, textStartHeight - 3 * textRowHeight)) + self.teleport_label = DirectLabel(parent=self, relief=None, text='', text_align=TextNode.ALeft, text_scale=options_text_scale, text_wordwrap=16, pos=(leftMargin, 0, textStartHeight - 4 * textRowHeight)) self.fov_slider = DirectSlider(parent=self, pos=(buttonbase_xcoord, 0.0, buttonbase_ycoord), value=settings['fov'], pageSize=5, range=(ToontownGlobals.DefaultCameraFov, ToontownGlobals.MaxCameraFov), command=self.__doFov, thumb_geom=(circleModel.find('**/tt_t_gui_mat_namePanelCircle')), thumb_relief=None, thumb_geom_scale=2) self.fov_slider.setScale(0.25) self.cogInterface_toggleButton = DirectButton(parent=self, relief=None, image=button_image, image_scale=button_image_scale, text='', text_scale=options_text_scale, text_pos=button_textpos, pos=(buttonbase_xcoord, 0.0, buttonbase_ycoord - textRowHeight), command=self.__doToggleCogInterface) self.tpTransition_toggleButton = DirectButton(parent=self, relief=None, image=button_image, image_scale=button_image_scale, text='', text_scale=options_text_scale, text_pos=button_textpos, pos=(buttonbase_xcoord, 0.0, buttonbase_ycoord - 2 * textRowHeight), command=self.__doToggleTpTransition) - self.teleport_toggleButton = DirectButton(parent=self, relief=None, image=button_image, image_scale=button_image_scale, text='', text_scale=options_text_scale, text_pos=button_textpos, pos=(buttonbase_xcoord, 0.0, buttonbase_ycoord - 3 * textRowHeight), command=self.__doToggleTeleport) + self.fpsMeter_toggleButton = DirectButton(parent=self, relief=None, image=button_image, image_scale=button_image_scale, text='', text_scale=options_text_scale, text_pos=button_textpos, pos=(buttonbase_xcoord, 0.0, buttonbase_ycoord - 3 * textRowHeight), command=self.__doToggleFpsMeter) + self.teleport_toggleButton = DirectButton(parent=self, relief=None, image=button_image, image_scale=button_image_scale, text='', text_scale=options_text_scale, text_pos=button_textpos, pos=(buttonbase_xcoord, 0.0, buttonbase_ycoord - 4 * textRowHeight), command=self.__doToggleTeleport) self.bugReportButton = DirectButton(parent=self, relief=None, text=TTLocalizer.BugReportButton, image=button_image, image_scale=button_image_scale, text_pos=(0, -0.01), text_fg=(0, 0, 0, 1), command=self.showReportNotice, pos=(0.0, 0.0, -0.6), text_scale=(0.045)) guiButton.removeNode() circleModel.removeNode() - self.optionChoosers['pole'] = OptionChooser.OptionChooser(self, TTLocalizer.FishingPoleLabel, 4, self.__updateFishingPole, [False], self.__applyFishingPole) - self.optionChoosers['nametag_style'] = OptionChooser.OptionChooser(self, TTLocalizer.NametagStyleLabel, 5, self.__updateNametagStyle, [False], self.__applyNametagStyle) + self.optionChoosers['pole'] = OptionChooser.OptionChooser(self, TTLocalizer.FishingPoleLabel, 5, self.__updateFishingPole, [False], self.__applyFishingPole) + self.optionChoosers['nametag_style'] = OptionChooser.OptionChooser(self, TTLocalizer.NametagStyleLabel, 6, self.__updateNametagStyle, [False], self.__applyNametagStyle) def enter(self): self.show() self.settingsChanged = 0 self.__setCogInterfaceButton() self.__setTpTransitionButton() + self.__setFpsMeterButton() self.__setTeleportButton() self.__updateNametagStyle() self.__updateFishingPole() @@ -779,6 +782,10 @@ class ExtraOptionsTabPage(DirectFrame): del self.tpTransition_label self.tpTransition_toggleButton.destroy() del self.tpTransition_toggleButton + self.fpsMeter_label.destroy() + del self.fpsMeter_label + self.fpsMeter_toggleButton.destroy() + del self.fpsMeter_toggleButton self.teleport_label.destroy() del self.teleport_label self.teleport_toggleButton.destroy() @@ -815,6 +822,17 @@ class ExtraOptionsTabPage(DirectFrame): self.tpTransition_label['text'] = TTLocalizer.TpTransitionLabelOn if settings['tpTransition'] else TTLocalizer.TpTransitionLabelOff self.tpTransition_toggleButton['text'] = TTLocalizer.OptionsPageToggleOff if settings['tpTransition'] else TTLocalizer.OptionsPageToggleOn + def __doToggleFpsMeter(self): + messenger.send('wakeup') + settings['fpsMeter'] = not settings['fpsMeter'] + base.setFrameRateMeter(settings['fpsMeter']) + self.settingsChanged = 1 + self.__setFpsMeterButton() + + def __setFpsMeterButton(self): + self.fpsMeter_label['text'] = TTLocalizer.FpsMeterLabelOn if settings['fpsMeter'] else TTLocalizer.FpsMeterLabelOff + self.fpsMeter_toggleButton['text'] = TTLocalizer.OptionsPageToggleOff if settings['fpsMeter'] else TTLocalizer.OptionsPageToggleOn + def __doToggleTeleport(self): messenger.send('wakeup') acceptingTeleport = settings.get('acceptingTeleport', {}) diff --git a/toontown/toonbase/TTLocalizerEnglish.py b/toontown/toonbase/TTLocalizerEnglish.py index 6545a166..57d71e14 100755 --- a/toontown/toonbase/TTLocalizerEnglish.py +++ b/toontown/toonbase/TTLocalizerEnglish.py @@ -8528,9 +8528,12 @@ def convertSecondsToDate(seconds): return '%d:%02d:%02d' % (h, m, s) ToonDefeatedMessage = '%s was defeated!' + BugReportButton = 'Report a Bug' BugReportNotice = 'Attention!\n\nThis button will open a browser which will send you to a third party bug tracker website. This site requires an Ubuntu One account to login. It may ask you to create an account.\n\nAre you sure you want to continue?' + CodeRedemptionWarning = 'NOTICE: All codes can only be entered once!' + CogInterfaceLabelOn = 'The cog battle interface is on.' CogInterfaceLabelOff = 'The cog battle interface is off.' TpTransitionLabelOn = 'The teleport transition is on.' @@ -8538,6 +8541,7 @@ TpTransitionLabelOff = 'The teleport transition is off.' FieldOfViewLabel = 'Field of View:' NametagStyleLabel = 'Nametag Style:' FishingPoleLabel = 'Fishing Rod:' + BossLocations = { 'c': 'Bossbot Clubhouse\nBanquet', 'l': "Lawbot Courthouse\nBumpy Bumblebehr's Trial", @@ -8757,6 +8761,9 @@ InventoryDeleteConfirm = "Are you sure you want to delete all your gags? Don't w ClothesGUICount = '%s/%s' +FpsMeterLabelOn = 'The frame rate meter is on.' +FpsMeterLabelOff = 'The frame rate meter is off.' + Blacklist = [ "$1ut", "$h1t", diff --git a/toontown/toonbase/ToontownStart.py b/toontown/toonbase/ToontownStart.py index c4a9249e..d620890f 100644 --- a/toontown/toonbase/ToontownStart.py +++ b/toontown/toonbase/ToontownStart.py @@ -116,6 +116,8 @@ if 'fov' not in settings: settings['fov'] = OTPGlobals.DefaultCameraFov if 'talk2speech' not in settings: settings['talk2speech'] = False +if 'fpsMeter' not in settings: + settings['fpsMeter'] = False loadPrcFileData('Settings: res', 'win-size %d %d' % tuple(settings['res'])) loadPrcFileData('Settings: fullscreen', 'fullscreen %s' % settings['fullscreen']) @@ -189,6 +191,7 @@ cr = ToontownClientRepository.ToontownClientRepository(serverVersion) cr.music = music del music base.initNametagGlobals() +base.setFrameRateMeter(settings['fpsMeter']) base.cr = cr loader.endBulkLoad('init') from otp.friends import FriendManager