mirror of
https://github.com/Sneed-Group/Poodletooth-iLand
synced 2024-12-24 20:22:33 -06:00
gui sliders for audio
This commit is contained in:
parent
023cbc6acb
commit
bca7063344
1 changed files with 32 additions and 40 deletions
|
@ -283,6 +283,7 @@ class OptionsTabPage(DirectFrame):
|
||||||
self.displaySettingsApiChanged = 0
|
self.displaySettingsApiChanged = 0
|
||||||
guiButton = loader.loadModel('phase_3/models/gui/quit_button')
|
guiButton = loader.loadModel('phase_3/models/gui/quit_button')
|
||||||
gui = loader.loadModel('phase_3.5/models/gui/friendslist_gui')
|
gui = loader.loadModel('phase_3.5/models/gui/friendslist_gui')
|
||||||
|
circleModel = loader.loadModel('phase_3/models/gui/tt_m_gui_mat_nameShop')
|
||||||
titleHeight = 0.61
|
titleHeight = 0.61
|
||||||
textStartHeight = 0.45
|
textStartHeight = 0.45
|
||||||
textRowHeight = 0.145
|
textRowHeight = 0.145
|
||||||
|
@ -294,16 +295,22 @@ class OptionsTabPage(DirectFrame):
|
||||||
options_text_scale = 0.052
|
options_text_scale = 0.052
|
||||||
disabled_arrow_color = Vec4(0.6, 0.6, 0.6, 1.0)
|
disabled_arrow_color = Vec4(0.6, 0.6, 0.6, 1.0)
|
||||||
self.speed_chat_scale = 0.055
|
self.speed_chat_scale = 0.055
|
||||||
self.Music_Label = DirectLabel(parent=self, relief=None, text='', text_align=TextNode.ALeft, text_scale=options_text_scale, pos=(leftMargin, 0, textStartHeight))
|
self.Music_Label = DirectLabel(parent=self, relief=None, text='Music Volume:', text_align=TextNode.ALeft, text_scale=options_text_scale, pos=(leftMargin, 0, textStartHeight))
|
||||||
self.SoundFX_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.SoundFX_Label = DirectLabel(parent=self, relief=None, text='SFX Volume:', text_align=TextNode.ALeft, text_scale=options_text_scale, text_wordwrap=16, pos=(leftMargin, 0, textStartHeight - textRowHeight))
|
||||||
self.Friends_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.Friends_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.Whispers_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.Whispers_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.DisplaySettings_Label = DirectLabel(parent=self, relief=None, text='', text_align=TextNode.ALeft, text_scale=options_text_scale, text_wordwrap=10, pos=(leftMargin, 0, textStartHeight - 5 * textRowHeight))
|
self.DisplaySettings_Label = DirectLabel(parent=self, relief=None, text='', text_align=TextNode.ALeft, text_scale=options_text_scale, text_wordwrap=10, pos=(leftMargin, 0, textStartHeight - 5 * textRowHeight))
|
||||||
self.SpeedChatStyle_Label = DirectLabel(parent=self, relief=None, text=TTLocalizer.OptionsPageSpeedChatStyleLabel, text_align=TextNode.ALeft, text_scale=options_text_scale, text_wordwrap=10, pos=(leftMargin, 0, textStartHeight - 6 * textRowHeight))
|
self.SpeedChatStyle_Label = DirectLabel(parent=self, relief=None, text=TTLocalizer.OptionsPageSpeedChatStyleLabel, text_align=TextNode.ALeft, text_scale=options_text_scale, text_wordwrap=10, pos=(leftMargin, 0, textStartHeight - 6 * textRowHeight))
|
||||||
self.ToonChatSounds_Label = DirectLabel(parent=self, relief=None, text='', text_align=TextNode.ALeft, text_scale=options_text_scale, text_wordwrap=15, pos=(leftMargin, 0, textStartHeight - 2 * textRowHeight + 0.025))
|
self.ToonChatSounds_Label = DirectLabel(parent=self, relief=None, text='', text_align=TextNode.ALeft, text_scale=options_text_scale, text_wordwrap=15, pos=(leftMargin, 0, textStartHeight - 2 * textRowHeight + 0.025))
|
||||||
self.ToonChatSounds_Label.setScale(0.9)
|
self.ToonChatSounds_Label.setScale(0.9)
|
||||||
self.Music_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.__doToggleMusic)
|
self.Music_toggleSlider = DirectSlider(parent=self, pos=(buttonbase_xcoord, 0.0, buttonbase_ycoord),
|
||||||
self.SoundFX_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 - textRowHeight), command=self.__doToggleSfx)
|
value=settings['musicVol']*100, pageSize=5, range=(0, 100), command=self.__doMusicLevel,
|
||||||
|
thumb_geom=(circleModel.find('**/tt_t_gui_mat_namePanelCircle')), thumb_relief=None, thumb_geom_scale=2)
|
||||||
|
self.Music_toggleSlider.setScale(0.25)
|
||||||
|
self.SoundFX_toggleSlider = DirectSlider(parent=self, pos=(buttonbase_xcoord, 0.0, buttonbase_ycoord - textRowHeight),
|
||||||
|
value=settings['sfxVol']*100, pageSize=5, range=(0, 100), command=self.__doSfxLevel,
|
||||||
|
thumb_geom=(circleModel.find('**/tt_t_gui_mat_namePanelCircle')), thumb_relief=None, thumb_geom_scale=2)
|
||||||
|
self.SoundFX_toggleSlider.setScale(0.25)
|
||||||
self.Friends_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 - textRowHeight * 3), command=self.__doToggleAcceptFriends)
|
self.Friends_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 - textRowHeight * 3), command=self.__doToggleAcceptFriends)
|
||||||
self.Whispers_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 - textRowHeight * 4), command=self.__doToggleAcceptWhispers)
|
self.Whispers_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 - textRowHeight * 4), command=self.__doToggleAcceptWhispers)
|
||||||
self.DisplaySettingsButton = DirectButton(parent=self, relief=None, image=(guiButton.find('**/QuitBtn_UP'), guiButton.find('**/QuitBtn_DN'), guiButton.find('**/QuitBtn_RLVR')), image3_color=Vec4(0.5, 0.5, 0.5, 0.5), image_scale=button_image_scale, text=TTLocalizer.OptionsPageChange, text3_fg=(0.5, 0.5, 0.5, 0.75), text_scale=options_text_scale, text_pos=button_textpos, pos=(buttonbase_xcoord, 0.0, buttonbase_ycoord - textRowHeight * 5), command=self.__doDisplaySettings)
|
self.DisplaySettingsButton = DirectButton(parent=self, relief=None, image=(guiButton.find('**/QuitBtn_UP'), guiButton.find('**/QuitBtn_DN'), guiButton.find('**/QuitBtn_RLVR')), image3_color=Vec4(0.5, 0.5, 0.5, 0.5), image_scale=button_image_scale, text=TTLocalizer.OptionsPageChange, text3_fg=(0.5, 0.5, 0.5, 0.75), text_scale=options_text_scale, text_pos=button_textpos, pos=(buttonbase_xcoord, 0.0, buttonbase_ycoord - textRowHeight * 5), command=self.__doDisplaySettings)
|
||||||
|
@ -332,8 +339,6 @@ class OptionsTabPage(DirectFrame):
|
||||||
self.show()
|
self.show()
|
||||||
taskMgr.remove(self.DisplaySettingsTaskName)
|
taskMgr.remove(self.DisplaySettingsTaskName)
|
||||||
self.settingsChanged = 0
|
self.settingsChanged = 0
|
||||||
self.__setMusicButton()
|
|
||||||
self.__setSoundFXButton()
|
|
||||||
self.__setAcceptFriendsButton()
|
self.__setAcceptFriendsButton()
|
||||||
self.__setAcceptWhispersButton()
|
self.__setAcceptWhispersButton()
|
||||||
self.__setDisplaySettings()
|
self.__setDisplaySettings()
|
||||||
|
@ -361,8 +366,8 @@ class OptionsTabPage(DirectFrame):
|
||||||
self.displaySettings.unload()
|
self.displaySettings.unload()
|
||||||
self.displaySettings = None
|
self.displaySettings = None
|
||||||
self.exitButton.destroy()
|
self.exitButton.destroy()
|
||||||
self.Music_toggleButton.destroy()
|
self.Music_toggleSlider.destroy()
|
||||||
self.SoundFX_toggleButton.destroy()
|
self.SoundFX_toggleSlider.destroy()
|
||||||
self.Friends_toggleButton.destroy()
|
self.Friends_toggleButton.destroy()
|
||||||
self.Whispers_toggleButton.destroy()
|
self.Whispers_toggleButton.destroy()
|
||||||
self.DisplaySettingsButton.destroy()
|
self.DisplaySettingsButton.destroy()
|
||||||
|
@ -385,35 +390,31 @@ class OptionsTabPage(DirectFrame):
|
||||||
del self.speedChatStyleText
|
del self.speedChatStyleText
|
||||||
self.currentSizeIndex = None
|
self.currentSizeIndex = None
|
||||||
|
|
||||||
def __doToggleMusic(self):
|
def __doMusicLevel(self):
|
||||||
messenger.send('wakeup')
|
vol = self.Music_toggleSlider['value']
|
||||||
if base.musicActive:
|
vol = float(vol) / 100
|
||||||
base.enableMusic(0)
|
settings['musicVol'] = vol
|
||||||
|
base.musicManager.setVolume(vol)
|
||||||
|
if vol == 0.0:
|
||||||
settings['music'] = False
|
settings['music'] = False
|
||||||
|
base.musicActive = False
|
||||||
else:
|
else:
|
||||||
base.enableMusic(1)
|
|
||||||
settings['music'] = True
|
settings['music'] = True
|
||||||
self.settingsChanged = 1
|
base.musicActive = True
|
||||||
self.__setMusicButton()
|
|
||||||
|
|
||||||
def __setMusicButton(self):
|
def __doSfxLevel(self):
|
||||||
if base.musicActive:
|
vol = self.SoundFX_toggleSlider['value']
|
||||||
self.Music_Label['text'] = TTLocalizer.OptionsPageMusicOnLabel
|
vol = float(vol) / 100
|
||||||
self.Music_toggleButton['text'] = TTLocalizer.OptionsPageToggleOff
|
settings['sfxVol'] = vol
|
||||||
else:
|
for sfm in base.sfxManagerList:
|
||||||
self.Music_Label['text'] = TTLocalizer.OptionsPageMusicOffLabel
|
sfm.setVolume(vol)
|
||||||
self.Music_toggleButton['text'] = TTLocalizer.OptionsPageToggleOn
|
if vol == 0.0:
|
||||||
|
|
||||||
def __doToggleSfx(self):
|
|
||||||
messenger.send('wakeup')
|
|
||||||
if base.sfxActive:
|
|
||||||
base.enableSoundEffects(0)
|
|
||||||
settings['sfx'] = False
|
settings['sfx'] = False
|
||||||
|
base.sfxActive = False
|
||||||
else:
|
else:
|
||||||
base.enableSoundEffects(1)
|
|
||||||
settings['sfx'] = True
|
settings['sfx'] = True
|
||||||
self.settingsChanged = 1
|
base.sfxActive = True
|
||||||
self.__setSoundFXButton()
|
self.__setToonChatSoundsButton()
|
||||||
|
|
||||||
def __doToggleToonChatSounds(self):
|
def __doToggleToonChatSounds(self):
|
||||||
messenger.send('wakeup')
|
messenger.send('wakeup')
|
||||||
|
@ -426,15 +427,6 @@ class OptionsTabPage(DirectFrame):
|
||||||
self.settingsChanged = 1
|
self.settingsChanged = 1
|
||||||
self.__setToonChatSoundsButton()
|
self.__setToonChatSoundsButton()
|
||||||
|
|
||||||
def __setSoundFXButton(self):
|
|
||||||
if base.sfxActive:
|
|
||||||
self.SoundFX_Label['text'] = TTLocalizer.OptionsPageSFXOnLabel
|
|
||||||
self.SoundFX_toggleButton['text'] = TTLocalizer.OptionsPageToggleOff
|
|
||||||
else:
|
|
||||||
self.SoundFX_Label['text'] = TTLocalizer.OptionsPageSFXOffLabel
|
|
||||||
self.SoundFX_toggleButton['text'] = TTLocalizer.OptionsPageToggleOn
|
|
||||||
self.__setToonChatSoundsButton()
|
|
||||||
|
|
||||||
def __setToonChatSoundsButton(self):
|
def __setToonChatSoundsButton(self):
|
||||||
if base.toonChatSounds:
|
if base.toonChatSounds:
|
||||||
self.ToonChatSounds_Label['text'] = TTLocalizer.OptionsPageToonChatSoundsOnLabel
|
self.ToonChatSounds_Label['text'] = TTLocalizer.OptionsPageToonChatSoundsOnLabel
|
||||||
|
|
Loading…
Reference in a new issue