From b6cf9c8f22f2cf84f33a29f9dededc7c13dba991 Mon Sep 17 00:00:00 2001 From: DenialMC Date: Sat, 4 Apr 2015 13:14:39 +0300 Subject: [PATCH] Clean up more options page, add strings to the localizer, add new strings to the more options page, add cogLevel settings properly. --- toontown/shtiker/OptionsPage.py | 37 ++++++------------------- toontown/toon/Toon.py | 7 +++-- toontown/toonbase/ClientStart.py | 3 ++ toontown/toonbase/TTLocalizerEnglish.py | 2 ++ toontown/toonbase/ToonBase.py | 2 -- toontown/town/TownBattle.py | 4 +-- 6 files changed, 21 insertions(+), 34 deletions(-) diff --git a/toontown/shtiker/OptionsPage.py b/toontown/shtiker/OptionsPage.py index b5c6ed56..7c8211fb 100644 --- a/toontown/shtiker/OptionsPage.py +++ b/toontown/shtiker/OptionsPage.py @@ -732,8 +732,8 @@ class MoreOptionsTabPage(DirectFrame): options_text_scale = 0.052 disabled_arrow_color = Vec4(0.6, 0.6, 0.6, 1.0) self.speed_chat_scale = 0.055 - self.CogLevel_toggleButton = DirectButton(parent=self, relief=None, image=(guiButton.find('**/QuitBtn_UP'), guiButton.find('**/QuitBtn_DN'), guiButton.find('**/QuitBtn_RLVR')), image_scale=button_image_scale, text='', text_scale=options_text_scale, text_pos=button_textpos, pos=(buttonbase_xcoord, 0.0, buttonbase_ycoord), command=self.__doToggleCogLevelGui) - self.CogLevel_Label = DirectLabel(parent=self, relief=None, text='', text_align=TextNode.ALeft, text_scale=options_text_scale, text_wordwrap=16, pos=(leftMargin, 0, textStartHeight)) + self.cogLevel_toggleButton = DirectButton(parent=self, relief=None, image=(guiButton.find('**/QuitBtn_UP'), guiButton.find('**/QuitBtn_DN'), guiButton.find('**/QuitBtn_RLVR')), image_scale=button_image_scale, text='', text_scale=options_text_scale, text_pos=button_textpos, pos=(buttonbase_xcoord, 0.0, buttonbase_ycoord), command=self.__doToggleCogLevelGui) + self.cogLevel_label = DirectLabel(parent=self, relief=None, text='', text_align=TextNode.ALeft, text_scale=options_text_scale, text_wordwrap=16, pos=(leftMargin, 0, textStartHeight)) gui.removeNode() guiButton.removeNode() @@ -747,36 +747,17 @@ class MoreOptionsTabPage(DirectFrame): self.hide() def unload(self): - self.CogLevel_Label.destroy() - del self.CogLevel_Label - self.CogLevel_toggleButton.destroy() - del self.CogLevel_toggleButton + self.cogLevel_label.destroy() + del self.cogLevel_label + self.cogLevel_toggleButton.destroy() + del self.cogLevel_toggleButton def __doToggleCogLevelGui(self): messenger.send('wakeup') - if base.wantCogLevelGui: - base.wantCogLevelGui = False - settings['want-Cog-Level-GUI'] = False - else: - base.wantCogLevelGui = True - settings['want-Cog-Level-GUI'] = True + settings['cogLevel'] = not settings['cogLevel'] self.settingsChanged = 1 self.__setCogLevelGuiButton() def __setCogLevelGuiButton(self): - if base.wantCogLevelGui: - self.CogLevel_Label['text'] = 'Cog Level GUI In-Battle:' - self.CogLevel_toggleButton['text'] = 'On' - else: - self.CogLevel_Label['text'] = 'Cog Level GUI In-Battle:' - self.CogLevel_toggleButton['text'] = 'Off' - - def __doToggleAntialiasing(self): - # To toggle anti-aliasing in the future. - pass - - def __setAntialiasingGuiButton(self): - # More anti-aliasing stuff. - pass - - + self.cogLevel_label['text'] = TTLocalizer.CogLevelLabelOn if settings['cogLevel'] else TTLocalizer.CogLevelLabelOff + self.cogLevel_toggleButton['text'] = TTLocalizer.OptionsPageToggleOff if settings['cogLevel'] else TTLocalizer.OptionsPageToggleOn \ No newline at end of file diff --git a/toontown/toon/Toon.py b/toontown/toon/Toon.py index 61f28622..56c62244 100644 --- a/toontown/toon/Toon.py +++ b/toontown/toon/Toon.py @@ -828,7 +828,7 @@ class Toon(Avatar.Avatar, ToonHead): if headStyle > -1: self.style.head = headStyle if laughingMan > -1: - self.style.laughingMan = True if laughingMan else self.getWantLaughingMan() + self.style.laughingMan = True if laughingMan else self.getWantLaughingManHoliday() self.generateToonHead(copy) self.generateToonColor() self.parentToonParts() @@ -1149,7 +1149,10 @@ class Toon(Avatar.Avatar, ToonHead): return self.hat def getWantLaughingMan(self): - return self.style.laughingMan or (base.cr.newsManager and base.cr.newsManager.isHolidayRunning(ToontownGlobals.LAUGHING_MAN)) + return self.style.laughingMan or self.getWantLaughingManHoliday() + + def getWantLaughingManHoliday(self): + return base.cr.newsManager and base.cr.newsManager.isHolidayRunning(ToontownGlobals.LAUGHING_MAN) def setGlasses(self, glassesIdx, textureIdx, colorIdx, fromRTM = False): self.glasses = (glassesIdx, textureIdx, colorIdx) diff --git a/toontown/toonbase/ClientStart.py b/toontown/toonbase/ClientStart.py index f9b6da2f..f0d3fbab 100644 --- a/toontown/toonbase/ClientStart.py +++ b/toontown/toonbase/ClientStart.py @@ -83,6 +83,8 @@ if 'toonChatSounds' not in settings: settings['toonChatSounds'] = True if 'language' not in settings: settings['language'] = 'English' +if 'cogLevel' not in settings: + settings['cogLevel'] = True loadPrcFileData('Settings: res', 'win-size %d %d' % tuple(settings.get('res', (800, 600)))) loadPrcFileData('Settings: fullscreen', 'fullscreen %s' % settings['fullscreen']) loadPrcFileData('Settings: music', 'audio-music-active %s' % settings['music']) @@ -92,6 +94,7 @@ loadPrcFileData('Settings: sfxVol', 'audio-master-sfx-volume %s' % settings['sfx loadPrcFileData('Settings: loadDisplay', 'load-display %s' % settings['loadDisplay']) loadPrcFileData('Settings: toonChatSounds', 'toon-chat-sounds %s' % settings['toonChatSounds']) loadPrcFileData('Settings: language', 'language %s' % settings['language']) +loadPrcFileData('Settings: cogLevel', 'cogLevel %s' % settings['cogLevel']) import os diff --git a/toontown/toonbase/TTLocalizerEnglish.py b/toontown/toonbase/TTLocalizerEnglish.py index 9a4a5813..17d84a45 100644 --- a/toontown/toonbase/TTLocalizerEnglish.py +++ b/toontown/toonbase/TTLocalizerEnglish.py @@ -8984,6 +8984,8 @@ LanguageSelectorSameLanguage = "You're already using that language!" PickTrackTitle = 'Pick your third track!' PickTrackNotice = 'Choose a track!' UnknownTrack = 'None' +CogLevelLabelOn = 'The cog level GUI is on.' +CogLevelLabelOff = 'The cog level GUI is off.' HouseNames = ("Bungalow", "Tiki", "Teepee", "Castle", "Cupcake", "Cabin") CatalogPurchaseHouseType = "When you buy a new house type, the current one is replaced by it. To recover the old type, you'll need to buy it back. Continue?" diff --git a/toontown/toonbase/ToonBase.py b/toontown/toonbase/ToonBase.py index c920b797..009cac9c 100644 --- a/toontown/toonbase/ToonBase.py +++ b/toontown/toonbase/ToonBase.py @@ -235,8 +235,6 @@ class ToonBase(OTPBase.OTPBase): self.filters = CommonFilters(self.win, self.cam) - self.wantCogLevelGui = settings.get('want-Cog-Level-GUI', True) - def openMainWindow(self, *args, **kw): result = OTPBase.OTPBase.openMainWindow(self, *args, **kw) self.setCursorAndIcon() diff --git a/toontown/town/TownBattle.py b/toontown/town/TownBattle.py index 0bc18b14..d981f96d 100644 --- a/toontown/town/TownBattle.py +++ b/toontown/town/TownBattle.py @@ -368,7 +368,7 @@ class TownBattle(StateData.StateData): def exitOff(self): if self.isLoaded: self.__enterPanels(self.numToons, self.localNum) - if base.wantCogLevelGui: + if settings['cogLevel']: self.__enterCogPanels(self.numCogs) self.timer.show() self.track = -1 @@ -516,7 +516,7 @@ class TownBattle(StateData.StateData): for i in xrange(len(toons)): self.toonPanels[i].setLaffMeter(toons[i]) - if base.wantCogLevelGui: + if settings['cogLevel']: self.__enterCogPanels(self.numCogs) for i in xrange(len(cogs)): self.cogPanels[i].setSuit(cogs[i])