class ClickToStart(DirectObject):
    notify = directNotify.newCategory('ClickToStart')

    def __init__(self, version='n/a'):
        DirectObject.__init__(self)

        self.backgroundNodePath = render2d.attachNewNode('background', 0)
        self.backgroundModel = loader.loadModel(
            'phase_3/models/gui/loading-background.bam')
        self.backgroundModel.reparentTo(self.backgroundNodePath)
        self.backgroundNodePath.find('**/fg').removeNode()
        self.backgroundNodePath.setScale(1, 1, 1)

        self.logo = OnscreenImage(
            parent=base.a2dTopCenter, image='phase_3/maps/toontown-logo.png',
            scale=(1.0, 1, 0.5), pos=(0, 0, -0.85))
        self.logo.setTransparency(TransparencyAttrib.MAlpha)

        self.label = OnscreenText(
            TTLocalizer.ClickToStartLabel, parent=base.a2dBottomCenter,
            font=ToontownGlobals.getMinnieFont(), fg=Vec4(1, 1, 1, 1),
            scale=0.1, align=TextNode.ACenter)
        self.label.setZ(0.35)

        self.versionLabel = OnscreenText(
            '\x01white_shadow\x01%s\x02' % version, parent=base.a2dBottomRight,
            font=ToontownGlobals.getMinnieFont(), fg=Vec4(0, 0, 0, 1),
            scale=0.06, align=TextNode.ARight)
        self.versionLabel.setPos(-0.025, 0.025)

        self.setColorScale(Vec4(0, 0, 0, 0))

        self.fadeTrack = None
        self.logoPosTrack = None
        self.logoScaleTrack = None
        self.labelPosTrack = None
        self.labelColorScaleTrack = None

    def delete(self):
        if self.labelColorScaleTrack is not None:
            self.labelColorScaleTrack.finish()
            self.labelColorScaleTrack = None

        if self.labelPosTrack is not None:
            self.labelPosTrack.finish()
            self.labelPosTrack = None

        if self.logoScaleTrack is not None:
            self.logoScaleTrack.finish()
            self.logoScaleTrack = None

        if self.logoPosTrack is not None:
            self.logoPosTrack.finish()
            self.logoPosTrack = None

        if self.fadeTrack is not None:
            self.fadeTrack.finish()
            self.fadeTrack = None

        if self.versionLabel is not None:
            self.versionLabel.destroy()
            self.versionLabel = None

        if self.label is not None:
            self.label.destroy()
            self.label = None

        if self.logo is not None:
            self.logo.destroy()
            self.logo = None

        if self.backgroundNodePath is not None:
            self.backgroundNodePath.removeNode()
            self.backgroundNodePath = None

        if self.backgroundModel is not None:
            self.backgroundModel.removeNode()
            self.backgroundModel = None

    def start(self):
        base.transitions.fadeOut(t=0)

        self.setColorScale(Vec4(1, 1, 1, 1))

        if self.fadeTrack is not None:
            self.fadeTrack.finish()
            self.fadeTrack = None

        self.fadeTrack = base.transitions.getFadeInIval(t=2)
        self.fadeTrack.start()

        if self.logoScaleTrack is not None:
            self.logoScaleTrack.finish()
            self.logoScaleTrack = None

        self.logoScaleTrack = Sequence(
            LerpScaleInterval(self.logo, 2, Vec3(1.1, 1, 0.55), Vec3(1, 1, 0.5),
                              blendType='easeInOut'),
            LerpScaleInterval(self.logo, 2, Vec3(1, 1, 0.5), Vec3(1.1, 1, 0.55),
                              blendType='easeInOut')
        )

        if self.logoPosTrack is not None:
            self.logoPosTrack.finish()
            self.logoPosTrack = None

        self.logoPosTrack = Sequence(
            LerpPosInterval(self.logo, 2, Point3(0, 0, -0.85),
                            Point3(0, 0, -0.7), blendType='easeOut'),
            Func(self.logoScaleTrack.loop)
        )
        self.logoPosTrack.start()

        if self.labelColorScaleTrack is not None:
            self.labelColorScaleTrack.finish()
            self.labelColorScaleTrack = None

        self.labelColorScaleTrack = Sequence(
            LerpColorScaleInterval(self.label, 1, Vec4(1, 1, 1, 0.6),
                                   Vec4(1, 1, 1, 1)),
            LerpColorScaleInterval(self.label, 1, Vec4(1, 1, 1, 1),
                                   Vec4(1, 1, 1, 0.6))
        )

        if self.labelPosTrack is not None:
            self.labelPosTrack.finish()
            self.labelPosTrack = None

        self.labelPosTrack = Sequence(
            LerpPosInterval(self.label, 2, Point3(0, 0, 0.35),
                            Point3(0, 0, 0.15), blendType='easeOut'),
            Func(self.labelColorScaleTrack.loop)
        )
        self.labelPosTrack.start()

        self.acceptOnce('mouse1', self.begin)

    def stop(self):
        self.ignore('mouse1')

        if self.labelPosTrack is not None:
            self.labelPosTrack.finish()
            self.labelPosTrack = None

        if self.labelColorScaleTrack is not None:
            self.labelColorScaleTrack.finish()
            self.labelColorScaleTrack = None

        if self.logoPosTrack is not None:
            self.logoPosTrack.finish()
            self.logoPosTrack = None

        if self.logoScaleTrack is not None:
            self.logoScaleTrack.finish()
            self.logoScaleTrack = None

        if self.fadeTrack is not None:
            self.fadeTrack.finish()
            self.fadeTrack = None

        self.setColorScale(Vec4(0, 0, 0, 0))

    def begin(self):
        base.cr.introDone = True

        if self.fadeTrack is not None:
            self.fadeTrack.finish()
            self.fadeTrack = None

        self.fadeTrack = base.transitions.getFadeOutIval(t=2)

        Sequence(
            Func(self.fadeTrack.start),
            Wait(2),
            Func(self.delete),
            Func(base.cr.introduction.delete),
            Func(base.cr.loginFSM.request, 'chooseAvatar', [base.cr.avList]),
            Func(base.transitions.fadeIn, 2)
        ).start()

    def setColorScale(self, *args, **kwargs):
        self.backgroundNodePath.setColorScale(*args, **kwargs)
        self.logo.setColorScale(*args, **kwargs)
        self.label.setColorScale(*args, **kwargs)
        self.versionLabel.setColorScale(*args, **kwargs)
Esempio n. 2
0
class ClickToStart(DirectObject):
    notify = directNotify.newCategory('ClickToStart')

    def __init__(self, version='n/a'):
        DirectObject.__init__(self)

        self.backgroundNodePath = render2d.attachNewNode('background', 0)
        self.backgroundModel = loader.loadModel(
            'phase_3/models/gui/loading-background.bam')
        self.backgroundModel.reparentTo(self.backgroundNodePath)
        self.backgroundNodePath.find('**/fg').removeNode()
        self.backgroundNodePath.setScale(1, 1, 1)

        self.logo = OnscreenImage(parent=base.a2dTopCenter,
                                  image='phase_3/maps/toontown-logo.png',
                                  scale=(1.0, 1, 0.5),
                                  pos=(0, 0, -0.85))
        self.logo.setTransparency(TransparencyAttrib.MAlpha)

        self.label = OnscreenText(TTLocalizer.ClickToStartLabel,
                                  parent=base.a2dBottomCenter,
                                  font=ToontownGlobals.getMinnieFont(),
                                  fg=Vec4(1, 1, 1, 1),
                                  scale=0.1,
                                  align=TextNode.ACenter)
        self.label.setZ(0.35)

        self.versionLabel = OnscreenText('\x01white_shadow\x01%s\x02' %
                                         version,
                                         parent=base.a2dBottomRight,
                                         font=ToontownGlobals.getMinnieFont(),
                                         fg=Vec4(0, 0, 0, 1),
                                         scale=0.06,
                                         align=TextNode.ARight)
        self.versionLabel.setPos(-0.025, 0.025)

        self.setColorScale(Vec4(0, 0, 0, 0))

        self.fadeTrack = None
        self.logoPosTrack = None
        self.logoScaleTrack = None
        self.labelPosTrack = None
        self.labelColorScaleTrack = None

    def delete(self):
        if self.labelColorScaleTrack is not None:
            self.labelColorScaleTrack.finish()
            self.labelColorScaleTrack = None

        if self.labelPosTrack is not None:
            self.labelPosTrack.finish()
            self.labelPosTrack = None

        if self.logoScaleTrack is not None:
            self.logoScaleTrack.finish()
            self.logoScaleTrack = None

        if self.logoPosTrack is not None:
            self.logoPosTrack.finish()
            self.logoPosTrack = None

        if self.fadeTrack is not None:
            self.fadeTrack.finish()
            self.fadeTrack = None

        if self.versionLabel is not None:
            self.versionLabel.destroy()
            self.versionLabel = None

        if self.label is not None:
            self.label.destroy()
            self.label = None

        if self.logo is not None:
            self.logo.destroy()
            self.logo = None

        if self.backgroundNodePath is not None:
            self.backgroundNodePath.removeNode()
            self.backgroundNodePath = None

        if self.backgroundModel is not None:
            self.backgroundModel.removeNode()
            self.backgroundModel = None

    def start(self):
        base.transitions.fadeOut(t=0)

        self.setColorScale(Vec4(1, 1, 1, 1))

        if self.fadeTrack is not None:
            self.fadeTrack.finish()
            self.fadeTrack = None

        self.fadeTrack = base.transitions.getFadeInIval(t=2)
        self.fadeTrack.start()

        if self.logoScaleTrack is not None:
            self.logoScaleTrack.finish()
            self.logoScaleTrack = None

        self.logoScaleTrack = Sequence(
            LerpScaleInterval(self.logo,
                              2,
                              Vec3(1.1, 1, 0.55),
                              Vec3(1, 1, 0.5),
                              blendType='easeInOut'),
            LerpScaleInterval(self.logo,
                              2,
                              Vec3(1, 1, 0.5),
                              Vec3(1.1, 1, 0.55),
                              blendType='easeInOut'))

        if self.logoPosTrack is not None:
            self.logoPosTrack.finish()
            self.logoPosTrack = None

        self.logoPosTrack = Sequence(
            LerpPosInterval(self.logo,
                            2,
                            Point3(0, 0, -0.85),
                            Point3(0, 0, -0.7),
                            blendType='easeOut'),
            Func(self.logoScaleTrack.loop))
        self.logoPosTrack.start()

        if self.labelColorScaleTrack is not None:
            self.labelColorScaleTrack.finish()
            self.labelColorScaleTrack = None

        self.labelColorScaleTrack = Sequence(
            LerpColorScaleInterval(self.label, 1, Vec4(1, 1, 1, 0.6),
                                   Vec4(1, 1, 1, 1)),
            LerpColorScaleInterval(self.label, 1, Vec4(1, 1, 1, 1),
                                   Vec4(1, 1, 1, 0.6)))

        if self.labelPosTrack is not None:
            self.labelPosTrack.finish()
            self.labelPosTrack = None

        self.labelPosTrack = Sequence(
            LerpPosInterval(self.label,
                            2,
                            Point3(0, 0, 0.35),
                            Point3(0, 0, 0.15),
                            blendType='easeOut'),
            Func(self.labelColorScaleTrack.loop))
        self.labelPosTrack.start()

        self.acceptOnce('mouse1', self.begin)

    def stop(self):
        self.ignore('mouse1')

        if self.labelPosTrack is not None:
            self.labelPosTrack.finish()
            self.labelPosTrack = None

        if self.labelColorScaleTrack is not None:
            self.labelColorScaleTrack.finish()
            self.labelColorScaleTrack = None

        if self.logoPosTrack is not None:
            self.logoPosTrack.finish()
            self.logoPosTrack = None

        if self.logoScaleTrack is not None:
            self.logoScaleTrack.finish()
            self.logoScaleTrack = None

        if self.fadeTrack is not None:
            self.fadeTrack.finish()
            self.fadeTrack = None

        self.setColorScale(Vec4(0, 0, 0, 0))

    def begin(self):
        base.cr.introDone = True

        if self.fadeTrack is not None:
            self.fadeTrack.finish()
            self.fadeTrack = None

        self.fadeTrack = base.transitions.getFadeOutIval(t=2)

        Sequence(
            Func(self.fadeTrack.start), Wait(2), Func(self.delete),
            Func(base.cr.introduction.delete),
            Func(base.cr.loginFSM.request, 'chooseAvatar', [base.cr.avList]),
            Func(base.transitions.fadeIn, 2)).start()

    def setColorScale(self, *args, **kwargs):
        self.backgroundNodePath.setColorScale(*args, **kwargs)
        self.logo.setColorScale(*args, **kwargs)
        self.label.setColorScale(*args, **kwargs)
        self.versionLabel.setColorScale(*args, **kwargs)
class Introduction(DirectObject, FSM):
    notify = directNotify.newCategory('Introduction')

    def __init__(self):
        DirectObject.__init__(self)
        FSM.__init__(self, self.__class__.__name__)

        self.label = OnscreenText('',
                                  parent=hidden,
                                  font=ToontownGlobals.getMinnieFont(),
                                  fg=Vec4(1, 1, 1, 1),
                                  scale=0.06,
                                  align=TextNode.ACenter,
                                  wordwrap=35)
        self.label.setColorScale(Vec4(0, 0, 0, 0))

        gui = loader.loadModel('phase_3/models/gui/tt_m_gui_mat_mainGui.bam')
        shuffleUp = gui.find('**/tt_t_gui_mat_shuffleUp')
        shuffleDown = gui.find('**/tt_t_gui_mat_shuffleDown')
        okUp = gui.find('**/tt_t_gui_mat_okUp')
        okDown = gui.find('**/tt_t_gui_mat_okDown')
        closeUp = gui.find('**/tt_t_gui_mat_closeUp')
        closeDown = gui.find('**/tt_t_gui_mat_closeDown')
        gui.removeNode()
        del gui

        self.exitButton = DirectButton(
            parent=hidden,
            relief=None,
            image=(shuffleUp, shuffleDown, shuffleUp),
            image_scale=(0.6, 0.6, 0.6),
            image1_scale=(0.63, 0.6, 0.6),
            image2_scale=(0.63, 0.6, 0.6),
            text=(TTLocalizer.IntroExitButton, TTLocalizer.IntroExitButton,
                  TTLocalizer.IntroExitButton, ''),
            text_font=ToontownGlobals.getInterfaceFont(),
            text_scale=TTLocalizer.SBshuffleBtn,
            text_pos=(0, -0.02),
            text_fg=(1, 1, 1, 1),
            text_shadow=(0, 0, 0, 1))

        self.yesButton = DirectButton(
            parent=hidden,
            relief=None,
            image=(okUp, okDown, okUp, okDown),
            image_scale=(0.6, 0.6, 0.6),
            image1_scale=(0.7, 0.7, 0.7),
            image2_scale=(0.7, 0.7, 0.7),
            text=('', TTLocalizer.IntroYesButton, TTLocalizer.IntroYesButton),
            text_font=ToontownGlobals.getInterfaceFont(),
            text_scale=0.08,
            text_align=TextNode.ACenter,
            text_pos=(0, -0.175),
            text_fg=(1, 1, 1, 1),
            text_shadow=(0, 0, 0, 1))
        self.noButton = DirectButton(
            parent=hidden,
            relief=None,
            image=(closeUp, closeDown, closeUp, closeDown),
            image_scale=(0.6, 0.6, 0.6),
            image1_scale=(0.7, 0.7, 0.7),
            image2_scale=(0.7, 0.7, 0.7),
            text=('', TTLocalizer.IntroNoButton, TTLocalizer.IntroNoButton),
            text_font=ToontownGlobals.getInterfaceFont(),
            text_scale=0.08,
            text_align=TextNode.ACenter,
            text_pos=(0, -0.175),
            text_fg=(1, 1, 1, 1),
            text_shadow=(0, 0, 0, 1))

        self.disclaimerTrack = None
        self.presentsTrack = None

    def delete(self):
        if self.presentsTrack is not None:
            self.presentsTrack.finish()
            self.presentsTrack = None

        if self.disclaimerTrack is not None:
            self.disclaimerTrack.finish()
            self.disclaimerTrack = None

        if self.noButton is not None:
            self.noButton.destroy()
            self.noButton = None

        if self.yesButton is not None:
            self.yesButton.destroy()
            self.yesButton = None

        if self.exitButton is not None:
            self.exitButton.destroy()
            self.exitButton = None

        if self.label is not None:
            self.label.destroy()
            self.label = None

    def calcLabelY(self):
        sy = self.label.getScale()[1]
        height = self.label.textNode.getHeight()
        return (height * sy) / 2.0

    def enterOff(self):
        pass

    def enterDisclaimer(self):
        self.label.setText(TTLocalizer.IntroDisclaimer)
        self.label.setPos(0, self.calcLabelY())
        self.label.reparentTo(aspect2d)

        if self.disclaimerTrack is not None:
            self.disclaimerTrack.finish()
            self.disclaimerTrack = None

        self.disclaimerTrack = Sequence(
            LerpColorScaleInterval(self.label,
                                   2,
                                   Vec4(1, 1, 1, 1),
                                   Vec4(0, 0, 0, 0),
                                   blendType='easeIn'),
            Wait(3),
            LerpColorScaleInterval(self.label,
                                   2,
                                   Vec4(0, 0, 0, 0),
                                   Vec4(1, 1, 1, 1),
                                   blendType='easeOut'),
        )
        self.disclaimerTrack.start()

    def exitDisclaimer(self):
        if self.disclaimerTrack is not None:
            self.disclaimerTrack.finish()
            self.disclaimerTrack = None

        self.label.reparentTo(hidden)
        self.label.setPos(0, 0)
        self.label.setText('')

    def enterPresents(self):
        self.label.setText(TTLocalizer.IntroPresents)
        self.label.setPos(0, self.calcLabelY())
        self.label.reparentTo(aspect2d)

        if self.presentsTrack is not None:
            self.presentsTrack.finish()
            self.presentsTrack = None

        self.presentsTrack = Sequence(
            LerpColorScaleInterval(self.label,
                                   2,
                                   Vec4(1, 1, 1, 1),
                                   Vec4(0, 0, 0, 0),
                                   blendType='easeIn'),
            Wait(3),
            LerpColorScaleInterval(self.label,
                                   2,
                                   Vec4(0, 0, 0, 0),
                                   Vec4(1, 1, 1, 1),
                                   blendType='easeOut'),
        )
        self.presentsTrack.start()

    def exitPresents(self):
        if self.presentsTrack is not None:
            self.presentsTrack.finish()
            self.presentsTrack = None

        self.label.reparentTo(hidden)
        self.label.setPos(0, 0)
        self.label.setText('')

    def enterLabel(self, text):
        self.label.setText(text)
        self.label.setPos(0, self.calcLabelY())
        self.label.reparentTo(aspect2d)
        self.label.setColorScale(Vec4(1, 1, 1, 1))

    def exitLabel(self):
        self.label.setColorScale(Vec4(0, 0, 0, 0))
        self.label.reparentTo(hidden)
        self.label.setPos(0, 0)
        self.label.setText('')

    def enterExitDialog(self,
                        text,
                        exitButtonCommand=None,
                        exitButtonExtraArgs=[]):
        self.label.setText(text)

        sy = self.label.getScale()[1]
        bottom = self.label.textNode.getBottom() * sy
        lineHeight = self.label.textNode.getLineHeight() * sy
        self.exitButton.setPos(0, 0, bottom - (lineHeight * 2))
        self.exitButton['command'] = exitButtonCommand
        self.exitButton['extraArgs'] = exitButtonExtraArgs

        labelY = self.calcLabelY()

        self.label.setPos(0, labelY)

        self.exitButton.setZ(self.exitButton, labelY)

        self.exitButton.reparentTo(aspect2d)
        self.label.reparentTo(aspect2d)

        self.label.setColorScale(Vec4(1, 1, 1, 1))

    def exitExitDialog(self):
        self.label.setColorScale(Vec4(0, 0, 0, 0))

        self.label.reparentTo(hidden)
        self.exitButton.reparentTo(hidden)

        self.label.setPos(0, 0)
        self.label.setText('')

        self.exitButton['command'] = None
        self.exitButton['extraArgs'] = []
        self.exitButton.setPos(0, 0, 0)

    def enterYesNoDialog(self,
                         text,
                         yesButtonCommand=None,
                         yesButtonExtraArgs=[],
                         noButtonCommand=None,
                         noButtonExtraArgs=[]):
        self.label.setText(text)

        sy = self.label.getScale()[1]
        bottom = self.label.textNode.getBottom() * sy
        lineHeight = self.label.textNode.getLineHeight() * sy
        self.yesButton.setPos(-0.1, 0, bottom - (lineHeight * 2))
        self.yesButton['command'] = yesButtonCommand
        self.yesButton['extraArgs'] = yesButtonExtraArgs
        self.noButton.setPos(0.1, 0, bottom - (lineHeight * 2))
        self.noButton['command'] = noButtonCommand
        self.noButton['extraArgs'] = noButtonExtraArgs

        labelY = self.calcLabelY()

        self.label.setPos(0, labelY)

        self.yesButton.setZ(self.yesButton, labelY)
        self.noButton.setZ(self.noButton, labelY)

        self.yesButton.reparentTo(aspect2d)
        self.noButton.reparentTo(aspect2d)
        self.label.reparentTo(aspect2d)

        self.label.setColorScale(Vec4(1, 1, 1, 1))

    def exitYesNoDialog(self):
        self.label.setColorScale(Vec4(0, 0, 0, 0))

        self.label.reparentTo(hidden)
        self.noButton.reparentTo(hidden)
        self.yesButton.reparentTo(hidden)

        self.label.setPos(0, 0)
        self.label.setText('')

        self.noButton['command'] = None
        self.noButton['extraArgs'] = []
        self.noButton.setPos(0, 0, 0)
        self.yesButton['command'] = None
        self.yesButton['extraArgs'] = []
        self.yesButton.setPos(0, 0, 0)

    def enterClickToStart(self):
        base.cr.clickToStart.start()

    def exitClickToStart(self):
        base.cr.clickToStart.stop()
class Introduction(DirectObject, FSM):
    notify = directNotify.newCategory('Introduction')

    def __init__(self):
        DirectObject.__init__(self)
        FSM.__init__(self, self.__class__.__name__)

        self.label = OnscreenText(
            '', parent=hidden, font=ToontownGlobals.getMinnieFont(),
            fg=Vec4(1, 1, 1, 1), scale=0.06, align=TextNode.ACenter,
            wordwrap=35)
        self.label.setColorScale(Vec4(0, 0, 0, 0))

        gui = loader.loadModel('phase_3/models/gui/tt_m_gui_mat_mainGui.bam')
        shuffleUp = gui.find('**/tt_t_gui_mat_shuffleUp')
        shuffleDown = gui.find('**/tt_t_gui_mat_shuffleDown')
        okUp = gui.find('**/tt_t_gui_mat_okUp')
        okDown = gui.find('**/tt_t_gui_mat_okDown')
        closeUp = gui.find('**/tt_t_gui_mat_closeUp')
        closeDown = gui.find('**/tt_t_gui_mat_closeDown')
        gui.removeNode()
        del gui

        self.exitButton = DirectButton(
            parent=hidden, relief=None,
            image=(shuffleUp, shuffleDown, shuffleUp),
            image_scale=(0.6, 0.6, 0.6), image1_scale=(0.63, 0.6, 0.6),
            image2_scale=(0.63, 0.6, 0.6),
            text=(TTLocalizer.IntroExitButton, TTLocalizer.IntroExitButton,
                  TTLocalizer.IntroExitButton, ''),
            text_font=ToontownGlobals.getInterfaceFont(),
            text_scale=TTLocalizer.SBshuffleBtn, text_pos=(0, -0.02),
            text_fg=(1, 1, 1, 1), text_shadow=(0, 0, 0, 1))

        self.yesButton = DirectButton(
            parent=hidden, relief=None, image=(okUp, okDown, okUp, okDown),
            image_scale=(0.6, 0.6, 0.6), image1_scale=(0.7, 0.7, 0.7),
            image2_scale=(0.7, 0.7, 0.7),
            text=('', TTLocalizer.IntroYesButton, TTLocalizer.IntroYesButton),
            text_font=ToontownGlobals.getInterfaceFont(), text_scale=0.08,
            text_align=TextNode.ACenter, text_pos=(0, -0.175),
            text_fg=(1, 1, 1, 1), text_shadow=(0, 0, 0, 1))
        self.noButton = DirectButton(
            parent=hidden, relief=None,
            image=(closeUp, closeDown, closeUp, closeDown),
            image_scale=(0.6, 0.6, 0.6), image1_scale=(0.7, 0.7, 0.7),
            image2_scale=(0.7, 0.7, 0.7),
            text=('', TTLocalizer.IntroNoButton, TTLocalizer.IntroNoButton),
            text_font=ToontownGlobals.getInterfaceFont(), text_scale=0.08,
            text_align=TextNode.ACenter, text_pos=(0, -0.175),
            text_fg=(1, 1, 1, 1), text_shadow=(0, 0, 0, 1))

        self.disclaimerTrack = None
        self.presentsTrack = None

    def delete(self):
        if self.presentsTrack is not None:
            self.presentsTrack.finish()
            self.presentsTrack = None

        if self.disclaimerTrack is not None:
            self.disclaimerTrack.finish()
            self.disclaimerTrack = None

        if self.noButton is not None:
            self.noButton.destroy()
            self.noButton = None

        if self.yesButton is not None:
            self.yesButton.destroy()
            self.yesButton = None

        if self.exitButton is not None:
            self.exitButton.destroy()
            self.exitButton = None

        if self.label is not None:
            self.label.destroy()
            self.label = None

    def calcLabelY(self):
        sy = self.label.getScale()[1]
        height = self.label.textNode.getHeight()
        return (height * sy) / 2.0

    def enterOff(self):
        pass

    def enterDisclaimer(self):
        self.label.setText(TTLocalizer.IntroDisclaimer)
        self.label.setPos(0, self.calcLabelY())
        self.label.reparentTo(aspect2d)

        if self.disclaimerTrack is not None:
            self.disclaimerTrack.finish()
            self.disclaimerTrack = None

        self.disclaimerTrack = Sequence(
            LerpColorScaleInterval(
                self.label, 2, Vec4(1, 1, 1, 1), Vec4(0, 0, 0, 0),
                blendType='easeIn'),
            Wait(3),
            LerpColorScaleInterval(
                self.label, 2, Vec4(0, 0, 0, 0), Vec4(1, 1, 1, 1),
                blendType='easeOut'),
        )
        self.disclaimerTrack.start()

    def exitDisclaimer(self):
        if self.disclaimerTrack is not None:
            self.disclaimerTrack.finish()
            self.disclaimerTrack = None

        self.label.reparentTo(hidden)
        self.label.setPos(0, 0)
        self.label.setText('')

    def enterPresents(self):
        self.label.setText(TTLocalizer.IntroPresents)
        self.label.setPos(0, self.calcLabelY())
        self.label.reparentTo(aspect2d)

        if self.presentsTrack is not None:
            self.presentsTrack.finish()
            self.presentsTrack = None

        self.presentsTrack = Sequence(
            LerpColorScaleInterval(
                self.label, 2, Vec4(1, 1, 1, 1), Vec4(0, 0, 0, 0),
                blendType='easeIn'),
            Wait(3),
            LerpColorScaleInterval(
                self.label, 2, Vec4(0, 0, 0, 0), Vec4(1, 1, 1, 1),
                blendType='easeOut'),
        )
        self.presentsTrack.start()

    def exitPresents(self):
        if self.presentsTrack is not None:
            self.presentsTrack.finish()
            self.presentsTrack = None

        self.label.reparentTo(hidden)
        self.label.setPos(0, 0)
        self.label.setText('')

    def enterLabel(self, text):
        self.label.setText(text)
        self.label.setPos(0, self.calcLabelY())
        self.label.reparentTo(aspect2d)
        self.label.setColorScale(Vec4(1, 1, 1, 1))

    def exitLabel(self):
        self.label.setColorScale(Vec4(0, 0, 0, 0))
        self.label.reparentTo(hidden)
        self.label.setPos(0, 0)
        self.label.setText('')

    def enterExitDialog(self, text, exitButtonCommand=None,
                        exitButtonExtraArgs=[]):
        self.label.setText(text)

        sy = self.label.getScale()[1]
        bottom = self.label.textNode.getBottom() * sy
        lineHeight = self.label.textNode.getLineHeight() * sy
        self.exitButton.setPos(0, 0, bottom - (lineHeight * 2))
        self.exitButton['command'] = exitButtonCommand
        self.exitButton['extraArgs'] = exitButtonExtraArgs

        labelY = self.calcLabelY()

        self.label.setPos(0, labelY)

        self.exitButton.setZ(self.exitButton, labelY)

        self.exitButton.reparentTo(aspect2d)
        self.label.reparentTo(aspect2d)

        self.label.setColorScale(Vec4(1, 1, 1, 1))

    def exitExitDialog(self):
        self.label.setColorScale(Vec4(0, 0, 0, 0))

        self.label.reparentTo(hidden)
        self.exitButton.reparentTo(hidden)

        self.label.setPos(0, 0)
        self.label.setText('')

        self.exitButton['command'] = None
        self.exitButton['extraArgs'] = []
        self.exitButton.setPos(0, 0, 0)

    def enterYesNoDialog(self, text, yesButtonCommand=None,
                         yesButtonExtraArgs=[], noButtonCommand=None,
                         noButtonExtraArgs=[]):
        self.label.setText(text)

        sy = self.label.getScale()[1]
        bottom = self.label.textNode.getBottom() * sy
        lineHeight = self.label.textNode.getLineHeight() * sy
        self.yesButton.setPos(-0.1, 0, bottom - (lineHeight * 2))
        self.yesButton['command'] = yesButtonCommand
        self.yesButton['extraArgs'] = yesButtonExtraArgs
        self.noButton.setPos(0.1, 0, bottom - (lineHeight * 2))
        self.noButton['command'] = noButtonCommand
        self.noButton['extraArgs'] = noButtonExtraArgs

        labelY = self.calcLabelY()

        self.label.setPos(0, labelY)

        self.yesButton.setZ(self.yesButton, labelY)
        self.noButton.setZ(self.noButton, labelY)

        self.yesButton.reparentTo(aspect2d)
        self.noButton.reparentTo(aspect2d)
        self.label.reparentTo(aspect2d)

        self.label.setColorScale(Vec4(1, 1, 1, 1))

    def exitYesNoDialog(self):
        self.label.setColorScale(Vec4(0, 0, 0, 0))

        self.label.reparentTo(hidden)
        self.noButton.reparentTo(hidden)
        self.yesButton.reparentTo(hidden)

        self.label.setPos(0, 0)
        self.label.setText('')

        self.noButton['command'] = None
        self.noButton['extraArgs'] = []
        self.noButton.setPos(0, 0, 0)
        self.yesButton['command'] = None
        self.yesButton['extraArgs'] = []
        self.yesButton.setPos(0, 0, 0)

    def enterClickToStart(self):
        base.cr.clickToStart.start()

    def exitClickToStart(self):
        base.cr.clickToStart.stop()