Beispiel #1
0
 def load(self):
     self.displaySettings = None
     self.displaySettingsChanged = 0
     self.displaySettingsSize = (None, None)
     self.displaySettingsFullscreen = None
     self.displaySettingsApi = None
     self.displaySettingsApiChanged = 0
     guiButton = loader.loadModel('phase_3/models/gui/quit_button')
     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
     textStartHeight = 0.45
     textRowHeight = 0.145
     leftMargin = -0.72
     buttonbase_xcoord = 0.35
     buttonbase_ycoord = 0.45
     button_image_scale = (0.7, 1, 1)
     button_textpos = (0, -0.02)
     options_text_scale = 0.052
     disabled_arrow_color = Vec4(0.6, 0.6, 0.6, 1.0)
     self.speed_chat_scale = 0.055
     self.Music_Label = DirectLabel(parent=self, relief=None, text=TTLocalizer.OptionsPageMusic, text_align=TextNode.ALeft, text_scale=options_text_scale, pos=(leftMargin, 0, textStartHeight))
     self.SoundFX_Label = DirectLabel(parent=self, relief=None, text=TTLocalizer.OptionsPageSFX, 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.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.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.setScale(0.9)
     self.Music_toggleSlider = DirectSlider(parent=self, pos=(buttonbase_xcoord, 0.0, buttonbase_ycoord),
                                            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.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.speedChatStyleLeftArrow = DirectButton(parent=self, relief=None, image=(gui.find('**/Horiz_Arrow_UP'),
      gui.find('**/Horiz_Arrow_DN'),
      gui.find('**/Horiz_Arrow_Rllvr'),
      gui.find('**/Horiz_Arrow_UP')), image3_color=Vec4(1, 1, 1, 0.5), scale=(-1.0, 1.0, 1.0), pos=(0.25, 0, buttonbase_ycoord - textRowHeight * 6), command=self.__doSpeedChatStyleLeft)
     self.speedChatStyleRightArrow = DirectButton(parent=self, relief=None, image=(gui.find('**/Horiz_Arrow_UP'),
      gui.find('**/Horiz_Arrow_DN'),
      gui.find('**/Horiz_Arrow_Rllvr'),
      gui.find('**/Horiz_Arrow_UP')), image3_color=Vec4(1, 1, 1, 0.5), pos=(0.65, 0, buttonbase_ycoord - textRowHeight * 6), command=self.__doSpeedChatStyleRight)
     self.ToonChatSounds_toggleButton = DirectButton(parent=self, relief=None, image=(guiButton.find('**/QuitBtn_UP'),
      guiButton.find('**/QuitBtn_DN'),
      guiButton.find('**/QuitBtn_RLVR'),
      guiButton.find('**/QuitBtn_UP')), image3_color=Vec4(0.5, 0.5, 0.5, 0.5), image_scale=button_image_scale, text='', 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 * 2 + 0.025), command=self.__doToggleToonChatSounds)
     self.ToonChatSounds_toggleButton.setScale(0.8)
     self.speedChatStyleText = SpeedChat.SpeedChat(name='OptionsPageStyleText', structure=[2000], backgroundModelName='phase_3/models/gui/ChatPanel', guiModelName='phase_3.5/models/gui/speedChatGui')
     self.speedChatStyleText.setScale(self.speed_chat_scale)
     self.speedChatStyleText.setPos(0.37, 0, buttonbase_ycoord - textRowHeight * 6 + 0.03)
     self.speedChatStyleText.reparentTo(self, DGG.FOREGROUND_SORT_INDEX)
     self.exitButton = DirectButton(parent=self, relief=None, image=(guiButton.find('**/QuitBtn_UP'), guiButton.find('**/QuitBtn_DN'), guiButton.find('**/QuitBtn_RLVR')), image_scale=1.15, text=TTLocalizer.OptionsPageExitToontown, text_scale=options_text_scale, text_pos=button_textpos, textMayChange=0, pos=(0.45, 0, -0.6), command=self.__handleExitShowWithConfirm)
     guiButton.removeNode()
     gui.removeNode()
Beispiel #2
0
    def load(self):
        """
        Purpose: The load Method handles the construction of the specific
        UI components that make up the OptionsTabPage object.
        Params: None
        Return: None
        """
        assert self.notify.debugStateCall(self)

        self.displaySettings = None

        # These properties are set when we come back from looking at
        # the DisplaySettings page.  At some later point, we'll
        # actually save these to the Settings file.
        self.displaySettingsChanged = 0
        self.displaySettingsSize = (None, None)
        self.displaySettingsFullscreen = None
        self.displaySettingsEmbedded = None
        self.displaySettingsApi = None
        self.displaySettingsApiChanged = 0

        guiButton = loader.loadModel("phase_3/models/gui/quit_button")
        gui = loader.loadModel("phase_3.5/models/gui/friendslist_gui")

        # tweak these constants to change the layout
        # the coordinate system is (0,0) in the middle of the page
        # Vertical: -1.0 is the bottom, and 1.0 is the top  of the screen
        # Horizontal: -1.0 is left edge of shticker book, 1.0 is right edge
        titleHeight = 0.61 # bigger number means higher the title
        textStartHeight = 0.45 # bigger number means higher text
        textRowHeight = 0.15 # bigger number means more space between rows
        leftMargin = -0.72 # smaller number means farther left
        buttonbase_xcoord = 0.35 # bigger number means farther right
        buttonbase_ycoord = 0.45 # bigger number means higher buttons
        button_image_scale = (0.7,1,1)
        button_textpos = (0,-0.02)
        options_text_scale = 0.052
        disabled_arrow_color = Vec4(0.6, 0.6, 0.6, 1.0)  # Make the disabled button darker
        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.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.Friends_Label = DirectLabel(
            parent = self,
            relief = None,
            text = "",
            text_align = TextNode.ALeft,
            text_scale = options_text_scale,
            text_wordwrap = 16,
            # adjust for taller two-row text
            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.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.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.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.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,
            )

        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.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.speedChatStyleLeftArrow = DirectButton(
            parent = self,
            relief = None,
            image = (gui.find("**/Horiz_Arrow_UP"),
                     gui.find("**/Horiz_Arrow_DN"),
                     gui.find("**/Horiz_Arrow_Rllvr"),
                     gui.find("**/Horiz_Arrow_UP"),
                     ),
            # make the disabled color more transparent
            image3_color = Vec4(1, 1, 1, 0.5),
            scale = (-1.0, 1.0, 1.0),  # make the arrow point left
            pos = (0.25, 0, buttonbase_ycoord - textRowHeight * 6),
            command = self.__doSpeedChatStyleLeft,
            )

        self.speedChatStyleRightArrow = DirectButton(
            parent = self,
            relief = None,
            image = (gui.find("**/Horiz_Arrow_UP"),
                     gui.find("**/Horiz_Arrow_DN"),
                     gui.find("**/Horiz_Arrow_Rllvr"),
                     gui.find("**/Horiz_Arrow_UP"),
                     ),
            # make the disabled color more transparent
            image3_color = Vec4(1, 1, 1, 0.5),
            pos = (0.65, 0, buttonbase_ycoord - textRowHeight * 6),
            command = self.__doSpeedChatStyleRight,
            )

        self.ToonChatSounds_toggleButton = DirectButton(
            parent = self,
            relief = None,
            image = (guiButton.find("**/QuitBtn_UP"),
                     guiButton.find("**/QuitBtn_DN"),
                     guiButton.find("**/QuitBtn_RLVR"),
                     guiButton.find("**/QuitBtn_UP"),
                     ),
            image3_color = Vec4(0.5, 0.5, 0.5, 0.5),
            image_scale = button_image_scale,
            text = "",
            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 * 2) + 0.025),
            command = self.__doToggleToonChatSounds,
            )
        self.ToonChatSounds_toggleButton.setScale(0.8)

        # The [2000] refers to the default color.  In the localizer, refer
        # to the SpeedChatStaticText variable
        self.speedChatStyleText = SpeedChat.SpeedChat(
            name='OptionsPageStyleText', structure=[2000],
            backgroundModelName='phase_3/models/gui/ChatPanel',
            guiModelName='phase_3.5/models/gui/speedChatGui')
        self.speedChatStyleText.setScale(self.speed_chat_scale)
        # This will be horizontally centered later
#        self.speedChatStyleText.setPos(0.37, 0, -0.27)
        self.speedChatStyleText.setPos(0.37, 0, buttonbase_ycoord - textRowHeight * 6 + 0.03)
        self.speedChatStyleText.reparentTo(self, DGG.FOREGROUND_SORT_INDEX)

        self.exitButton = DirectButton(
            parent = self,
            relief = None,
            image = (guiButton.find("**/QuitBtn_UP"),
                     guiButton.find("**/QuitBtn_DN"),
                     guiButton.find("**/QuitBtn_RLVR"),
                     ),
            image_scale = 1.15,
            text = TTLocalizer.OptionsPageExitToontown,
            text_scale = options_text_scale,
            text_pos = button_textpos,
            textMayChange = 0,
            pos = (0.45,0,-0.6),
            command = self.__handleExitShowWithConfirm,
            )

        guiButton.removeNode()
        gui.removeNode()
 def load(self):
     self.displaySettings = None
     self.displaySettingsChanged = 0
     self.displaySettingsSize = (None, None)
     self.displaySettingsFullscreen = None
     self.displaySettingsEmbedded = None
     self.displaySettingsApi = None
     self.displaySettingsApiChanged = 0
     self.visualEffectIndex = 0
     wantShaders = config.GetBool('want-shaders', 0)
     guiButton = loader.loadModel('phase_3/models/gui/quit_button')
     gui = loader.loadModel('phase_3.5/models/gui/friendslist_gui')
     if wantShaders:
         titleHeight = 0.71
         textStartHeight = 0.5
         textRowHeight = 0.135
     else:
         titleHeight = 0.61
         textStartHeight = 0.45
         textRowHeight = 0.145
     leftMargin = -0.72
     buttonbase_xcoord = 0.35
     if wantShaders:
         buttonbase_ycoord = 0.5
     else:
         buttonbase_ycoord = 0.45
     button_image_scale = (0.7, 1, 1)
     button_textpos = (0, -0.02)
     options_text_scale = 0.052
     disabled_arrow_color = Vec4(0.6, 0.6, 0.6, 1.0)
     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.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.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.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))
     if wantShaders:
         self.VisualEffect_Label = DirectLabel(
             parent=self,
             relief=None,
             text='Visual Effect',
             text_align=TextNode.ALeft,
             text_scale=options_text_scale,
             text_wordwrap=10,
             pos=(leftMargin, 0, textStartHeight - 7 * 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.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.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)
     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.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.speedChatStyleLeftArrow = DirectButton(
         parent=self,
         relief=None,
         image=(gui.find('**/Horiz_Arrow_UP'),
                gui.find('**/Horiz_Arrow_DN'),
                gui.find('**/Horiz_Arrow_Rllvr'),
                gui.find('**/Horiz_Arrow_UP')),
         image3_color=Vec4(1, 1, 1, 0.5),
         scale=(-1.0, 1.0, 1.0),
         pos=(0.25, 0, buttonbase_ycoord - textRowHeight * 6),
         command=self.__doSpeedChatStyleLeft)
     self.speedChatStyleRightArrow = DirectButton(
         parent=self,
         relief=None,
         image=(gui.find('**/Horiz_Arrow_UP'),
                gui.find('**/Horiz_Arrow_DN'),
                gui.find('**/Horiz_Arrow_Rllvr'),
                gui.find('**/Horiz_Arrow_UP')),
         image3_color=Vec4(1, 1, 1, 0.5),
         pos=(0.65, 0, buttonbase_ycoord - textRowHeight * 6),
         command=self.__doSpeedChatStyleRight)
     if wantShaders:
         self.visualEffectLeftArrow = DirectButton(
             parent=self,
             relief=None,
             image=(gui.find('**/Horiz_Arrow_UP'),
                    gui.find('**/Horiz_Arrow_DN'),
                    gui.find('**/Horiz_Arrow_Rllvr'),
                    gui.find('**/Horiz_Arrow_UP')),
             image3_color=Vec4(1, 1, 1, 0.5),
             scale=(-1.0, 1.0, 1.0),
             pos=(0.25, 0, buttonbase_ycoord - textRowHeight * 7),
             command=self.__doVisualEffectLeft)
         self.visualEffectRightArrow = DirectButton(
             parent=self,
             relief=None,
             image=(gui.find('**/Horiz_Arrow_UP'),
                    gui.find('**/Horiz_Arrow_DN'),
                    gui.find('**/Horiz_Arrow_Rllvr'),
                    gui.find('**/Horiz_Arrow_UP')),
             image3_color=Vec4(1, 1, 1, 0.5),
             pos=(0.65, 0, buttonbase_ycoord - textRowHeight * 7),
             command=self.__doVisualEffectRight)
     else:
         self.visualEffectLeftArrow = None
         self.visualEffectRightArrow = None
     self.ToonChatSounds_toggleButton = DirectButton(
         parent=self,
         relief=None,
         image=(guiButton.find('**/QuitBtn_UP'),
                guiButton.find('**/QuitBtn_DN'),
                guiButton.find('**/QuitBtn_RLVR'),
                guiButton.find('**/QuitBtn_UP')),
         image3_color=Vec4(0.5, 0.5, 0.5, 0.5),
         image_scale=button_image_scale,
         text='',
         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 * 2 + 0.025),
         command=self.__doToggleToonChatSounds)
     self.ToonChatSounds_toggleButton.setScale(0.8)
     self.speedChatStyleText = SpeedChat.SpeedChat(
         name='OptionsPageStyleText',
         structure=[2000],
         backgroundModelName='phase_3/models/gui/ChatPanel',
         guiModelName='phase_3.5/models/gui/speedChatGui')
     self.speedChatStyleText.setScale(self.speed_chat_scale)
     self.speedChatStyleText.setPos(
         0.37, 0, buttonbase_ycoord - textRowHeight * 6 + 0.03)
     self.speedChatStyleText.reparentTo(self, DGG.FOREGROUND_SORT_INDEX)
     if wantShaders:
         self.visualEffectText = SpeedChat.SpeedChat(
             name='OptionsPageStyleText',
             structure=[2000],
             backgroundModelName='phase_3/models/gui/ChatPanel',
             guiModelName='phase_3.5/models/gui/speedChatGui')
         self.visualEffectText.setScale(self.speed_chat_scale)
         self.visualEffectText.setPos(
             0.37, 0, buttonbase_ycoord - textRowHeight * 7 + 0.03)
         self.visualEffectText.reparentTo(self, DGG.FOREGROUND_SORT_INDEX)
     else:
         self.visualEffectText = None
     self.exitButton = DirectButton(
         parent=self,
         relief=None,
         image=(guiButton.find('**/QuitBtn_UP'),
                guiButton.find('**/QuitBtn_DN'),
                guiButton.find('**/QuitBtn_RLVR')),
         image_scale=1.15,
         text=TTLocalizer.OptionsPageExitToontown,
         text_scale=options_text_scale,
         text_pos=button_textpos,
         textMayChange=0,
         pos=(0.45, 0, -0.6),
         command=self.__handleExitShowWithConfirm)
     guiButton.removeNode()
     gui.removeNode()
     return
    def load(self):
        self.displaySettings = None
        self.displaySettingsChanged = 0
        self.displaySettingsSize = (None, None)
        self.displaySettingsFullscreen = None
        self.displaySettingsApi = None
        self.displaySettingsApiChanged = 0
        self.speed_chat_scale = 0.055
        buttonbase_ycoord = 0.45
        textRowHeight = 0.145
        textStartHeight = 0.45
        self.Music_Label = OptionLabel(parent=self)
        self.SoundFX_Label = OptionLabel(parent=self,
                                         z=textStartHeight - textRowHeight)
        self.Friends_Label = OptionLabel(parent=self,
                                         z=textStartHeight - 3 * textRowHeight)
        self.Whispers_Label = OptionLabel(parent=self,
                                          z=textStartHeight -
                                          4 * textRowHeight)
        self.DisplaySettings_Label = OptionLabel(parent=self,
                                                 text_wordwrap=10,
                                                 z=textStartHeight -
                                                 5 * textRowHeight)
        self.SpeedChatStyle_Label = OptionLabel(
            parent=self,
            text=TTLocalizer.OptionsPageSpeedChatStyleLabel,
            text_wordwrap=10,
            z=textStartHeight - 6 * textRowHeight)
        self.ToonChatSounds_Label = OptionLabel(parent=self,
                                                z=textStartHeight -
                                                2 * textRowHeight + 0.025)
        self.ToonChatSounds_Label.setScale(0.9)
        self.Music_toggleButton = OptionButton(parent=self,
                                               command=self.__doToggleMusic)
        self.SoundFX_toggleButton = OptionButton(parent=self,
                                                 z=buttonbase_ycoord -
                                                 textRowHeight,
                                                 command=self.__doToggleSfx)
        self.Friends_toggleButton = OptionButton(
            parent=self,
            z=buttonbase_ycoord - textRowHeight * 3,
            command=self.__doToggleAcceptFriends)
        self.Whispers_toggleButton = OptionButton(
            parent=self,
            z=buttonbase_ycoord - textRowHeight * 4,
            command=self.__doToggleAcceptWhispers)
        self.DisplaySettingsButton = OptionButton(
            parent=self,
            image3_color=Vec4(0.5, 0.5, 0.5, 0.5),
            text=TTLocalizer.OptionsPageChange,
            z=buttonbase_ycoord - textRowHeight * 5,
            command=self.__doDisplaySettings)

        gui = loader.loadModel('phase_3.5/models/gui/friendslist_gui')
        self.speedChatStyleLeftArrow = DirectButton(
            parent=self,
            relief=None,
            image=(gui.find('**/Horiz_Arrow_UP'),
                   gui.find('**/Horiz_Arrow_DN'),
                   gui.find('**/Horiz_Arrow_Rllvr'),
                   gui.find('**/Horiz_Arrow_UP')),
            image3_color=Vec4(1, 1, 1, 0.5),
            scale=(-1.0, 1.0, 1.0),
            pos=(0.25, 0, buttonbase_ycoord - textRowHeight * 6),
            command=self.__doSpeedChatStyleLeft)
        self.speedChatStyleRightArrow = DirectButton(
            parent=self,
            relief=None,
            image=(gui.find('**/Horiz_Arrow_UP'),
                   gui.find('**/Horiz_Arrow_DN'),
                   gui.find('**/Horiz_Arrow_Rllvr'),
                   gui.find('**/Horiz_Arrow_UP')),
            image3_color=Vec4(1, 1, 1, 0.5),
            pos=(0.65, 0, buttonbase_ycoord - textRowHeight * 6),
            command=self.__doSpeedChatStyleRight)
        self.ToonChatSounds_toggleButton = OptionButton(
            parent=self,
            image3_color=Vec4(0.5, 0.5, 0.5, 0.5),
            z=buttonbase_ycoord - textRowHeight * 2 + 0.025,
            command=self.__doToggleToonChatSounds)
        self.ToonChatSounds_toggleButton.setScale(0.8)
        self.speedChatStyleText = SpeedChat.SpeedChat(
            name='OptionsPageStyleText',
            structure=[2000],
            backgroundModelName='phase_3/models/gui/ChatPanel',
            guiModelName='phase_3.5/models/gui/speedChatGui')
        self.speedChatStyleText.setScale(self.speed_chat_scale)
        self.speedChatStyleText.setPos(
            0.37, 0, buttonbase_ycoord - textRowHeight * 6 + 0.03)
        self.speedChatStyleText.reparentTo(self, DGG.FOREGROUND_SORT_INDEX)
        self.exitButton = OptionButton(
            parent=self,
            image_scale=1.15,
            text=TTLocalizer.OptionsPageExitToontown,
            pos=(0.45, 0, -0.6),
            command=self.__handleExitShowWithConfirm)
        gui.removeNode()
Beispiel #5
0
 def load(self):
     self.displaySettings = None
     self.displaySettingsChanged = 0
     self.displaySettingsSize = (None, None)
     self.displaySettingsFullscreen = None
     self.displaySettingsEmbedded = None
     self.displaySettingsApi = None
     self.displaySettingsApiChanged = 0
     guiButton = loader.loadModel('phase_3/models/gui/quit_button')
     gui = loader.loadModel('phase_3.5/models/gui/friendslist_gui')
     titleHeight = 0.60999999999999999
     textStartHeight = 0.45000000000000001
     textRowHeight = 0.14499999999999999
     leftMargin = -0.71999999999999997
     buttonbase_xcoord = 0.34999999999999998
     buttonbase_ycoord = 0.45000000000000001
     button_image_scale = (0.69999999999999996, 1, 1)
     button_textpos = (0, -0.02)
     options_text_scale = 0.051999999999999998
     disabled_arrow_color = Vec4(0.59999999999999998, 0.59999999999999998,
                                 0.59999999999999998, 1.0)
     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.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.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.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.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.025000000000000001))
     self.ToonChatSounds_Label.setScale(0.90000000000000002)
     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._OptionsTabPage__doToggleMusic)
     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._OptionsTabPage__doToggleSfx)
     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._OptionsTabPage__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._OptionsTabPage__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._OptionsTabPage__doDisplaySettings)
     self.speedChatStyleLeftArrow = DirectButton(
         parent=self,
         relief=None,
         image=(gui.find('**/Horiz_Arrow_UP'),
                gui.find('**/Horiz_Arrow_DN'),
                gui.find('**/Horiz_Arrow_Rllvr'),
                gui.find('**/Horiz_Arrow_UP')),
         image3_color=Vec4(1, 1, 1, 0.5),
         scale=(-1.0, 1.0, 1.0),
         pos=(0.25, 0, buttonbase_ycoord - textRowHeight * 6),
         command=self._OptionsTabPage__doSpeedChatStyleLeft)
     self.speedChatStyleRightArrow = DirectButton(
         parent=self,
         relief=None,
         image=(gui.find('**/Horiz_Arrow_UP'),
                gui.find('**/Horiz_Arrow_DN'),
                gui.find('**/Horiz_Arrow_Rllvr'),
                gui.find('**/Horiz_Arrow_UP')),
         image3_color=Vec4(1, 1, 1, 0.5),
         pos=(0.65000000000000002, 0,
              buttonbase_ycoord - textRowHeight * 6),
         command=self._OptionsTabPage__doSpeedChatStyleRight)
     self.ToonChatSounds_toggleButton = DirectButton(
         parent=self,
         relief=None,
         image=(guiButton.find('**/QuitBtn_UP'),
                guiButton.find('**/QuitBtn_DN'),
                guiButton.find('**/QuitBtn_RLVR'),
                guiButton.find('**/QuitBtn_UP')),
         image3_color=Vec4(0.5, 0.5, 0.5, 0.5),
         image_scale=button_image_scale,
         text='',
         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 * 2) +
              0.025000000000000001),
         command=self._OptionsTabPage__doToggleToonChatSounds)
     self.ToonChatSounds_toggleButton.setScale(0.80000000000000004)
     self.speedChatStyleText = SpeedChat.SpeedChat(
         name='OptionsPageStyleText',
         structure=[2000],
         backgroundModelName='phase_3/models/gui/ChatPanel',
         guiModelName='phase_3.5/models/gui/speedChatGui')
     self.speedChatStyleText.setScale(self.speed_chat_scale)
     self.speedChatStyleText.setPos(
         0.37, 0,
         (buttonbase_ycoord - textRowHeight * 6) + 0.029999999999999999)
     self.speedChatStyleText.reparentTo(self, DGG.FOREGROUND_SORT_INDEX)
     self.exitButton = DirectButton(
         parent=self,
         relief=None,
         image=(guiButton.find('**/QuitBtn_UP'),
                guiButton.find('**/QuitBtn_DN'),
                guiButton.find('**/QuitBtn_RLVR')),
         image_scale=1.1499999999999999,
         text=TTLocalizer.OptionsPageExitToontown,
         text_scale=options_text_scale,
         text_pos=button_textpos,
         textMayChange=0,
         pos=(0.45000000000000001, 0, -0.59999999999999998),
         command=self._OptionsTabPage__handleExitShowWithConfirm)
     guiButton.removeNode()
     gui.removeNode()