Beispiel #1
0
    def load(self, purchaseModels=None):
        localLoad = 0
        if purchaseModels == None:
            localLoad = 1
            purchaseModels = loader.loadModel(
                'phase_4/models/gui/purchase_gui')

        self.music = base.loadMusic('phase_4/audio/bgm/FF_safezone.mid')
        self.jarImage = purchaseModels.find('**/Jar')
        self.jarImage.reparentTo(hidden)
        self.frame = DirectFrame(relief=None)
        self.frame.hide()
        self.title = DirectLabel(parent=self.frame,
                                 relief=None,
                                 pos=(0.0, 0.0, 0.82999999999999996),
                                 scale=1.2,
                                 image=purchaseModels.find('**/Goofys_Sign'),
                                 text=Localizer.GagShopName,
                                 text_fg=(0.59999999999999998,
                                          0.20000000000000001, 0, 1),
                                 text_scale=0.089999999999999997,
                                 text_wordwrap=10,
                                 text_pos=(0, 0.025000000000000001, 0),
                                 text_font=ToontownGlobals.getSignFont())
        self.pointDisplay = DirectLabel(
            parent=self.frame,
            relief=None,
            pos=(-1.0800000000000001, 0.0, 0.16),
            text=str(self.toon.getMoney()),
            text_scale=0.20000000000000001,
            text_fg=(0.94999999999999996, 0.94999999999999996, 0, 1),
            text_shadow=(0, 0, 0, 1),
            text_pos=(0, -0.10000000000000001, 0),
            image=self.jarImage,
            text_font=ToontownGlobals.getSignFont())
        self.statusLabel = DirectLabel(
            parent=self.frame,
            relief=None,
            pos=(-0.25, 0, 0.625),
            text=Localizer.GagShopYouHave % self.toon.getMoney(),
            text_scale=0.080000000000000002,
            text_fg=(0.050000000000000003, 0.14000000000000001,
                     0.40000000000000002, 1))
        if self.toon.getMoney() == 1:
            self.statusLabel['text'] = Localizer.GagShopYouHaveOne

        if localLoad == 1:
            purchaseModels.removeNode()

        return None
 def showLaffString(self, text, duration=0.85, scale=0.7):
     if self.LaffNumbersEnabled:
         if text != '':
             if self.laffNumber:
                 self.hideLaffNumber()
             self.LaffNumberGenerator.setFont(ToontownGlobals.getSignFont())
             self.LaffNumberGenerator.setText(text)
             self.LaffNumberGenerator.clearShadow()
             self.LaffNumberGenerator.setAlign(TextNode.ACenter)
             r = a = 1.0
             g = b = 0.0
             self.LaffNumberGenerator.setTextColor(r, g, b, a)
             self.laffNumberNode = self.LaffNumberGenerator.generate()
             self.laffNumber = self.attachNewNode(self.laffNumberNode)
             self.laffNumber.setScale(scale)
             self.laffNumber.setBillboardAxis()
             self.laffNumber.setPos(0, 0, self.height / 2)
             seq = Task.sequence(
                 self.laffNumber.lerpPos(Point3(0, 0, self.height + 1.5),
                                         1.0,
                                         blendType='easeOut'),
                 Task.pause(duration),
                 self.laffNumber.lerpColor(Vec4(r, g, b, a),
                                           Vec4(r, g, b, 0), 0.1),
                 Task.Task(self.hideLaffNumberTask))
             taskMgr.add(seq, self.uniqueName('laffNumber'))
     return None
     return
Beispiel #3
0
    def _DistributedHouse__setupNamePlate(self):
        self.notify.debug('__setupNamePlate')
        if self.namePlate:
            self.namePlate.removeNode()
            del self.namePlate
            self.namePlate = None

        nameText = TextNode('nameText')
        r = self.randomGenerator.random()
        g = self.randomGenerator.random()
        b = self.randomGenerator.random()
        nameText.setTextColor(r, g, b, 1)
        nameText.setAlign(nameText.ACenter)
        nameText.setFont(ToontownGlobals.getSignFont())
        xScale = 1.0
        numLines = 0
        if self.name == '':
            houseName = ''
        else:
            (prettyName, numLines,
             xScale) = self._DistributedHouse__getPrettyName(16)
            houseName = Localizer.AvatarsHouse % Localizer.GetPossesive(
                prettyName)
        nameText.setText(houseName)
        self.nameText = nameText
        sign_origin = self.house.find('**/sign_origin')
        pos = sign_origin.getPos()
        sign_origin.setPosHpr(pos[0], pos[1],
                              pos[2] + 0.14999999999999999 * numLines, 90, 0,
                              0)
        self.namePlate = sign_origin.attachNewNode(self.nameText)
        self.namePlate.setPos(0, -0.050000000000000003, 0)
        self.namePlate.setScale(xScale)
Beispiel #4
0
 def __init__(self):
     self.__expectedCount = 0
     self.__count = 0
     self.gui = loader.loadModel(
         'phase_3/models/gui/progress-background.bam')
     self.banner = loader.loadModel(
         'phase_3/models/gui/toon_council.bam').find('**/scroll')
     self.banner.reparentTo(self.gui)
     self.banner.setScale(0.4, 0.4, 0.4)
     self.tip = DirectLabel(guiId='ToontownLoadingScreenTip',
                            parent=self.banner,
                            relief=None,
                            text='',
                            text_scale=TTLocalizer.TLStip,
                            textMayChange=1,
                            pos=(-1.2, 0.0, 0.1),
                            text_fg=(0.4, 0.3, 0.2, 1),
                            text_wordwrap=13,
                            text_align=TextNode.ALeft)
     self.title = DirectLabel(guiId='ToontownLoadingScreenTitle',
                              parent=self.gui,
                              relief=None,
                              pos=(0, 0, -0.77),
                              text='',
                              textMayChange=1,
                              text_scale=0.15,
                              text_fg=(0, 0, 0.5, 1),
                              text_align=TextNode.ACenter,
                              text_font=ToontownGlobals.getSignFont())
     self.waitBar = DirectWaitBar(guiId='ToontownLoadingScreenWaitBar',
                                  parent=self.gui,
                                  frameSize=(-1.06, 1.06, -0.03, 0.03),
                                  pos=(0, 0, -0.85),
                                  text='')
     return
Beispiel #5
0
    def _DistributedHouse__setupFloorMat(self):
        if self.floorMat:
            self.floorMat.removeNode()
            del self.floorMat
            self.floorMat = None

        mat = self.house.find('**/mat')
        mat.setColor(0.40000000000000002, 0.35699999999999998,
                     0.25900000000000001, 1.0)
        color = HouseGlobals.houseColors[self.housePosInd]
        matText = TextNode('matText')
        matText.setTextColor(color[0], color[1], color[2], 1)
        matText.setAlign(matText.ACenter)
        matText.setFont(ToontownGlobals.getSignFont())
        xScale = 1.0
        numLines = 0
        if self.name == '':
            houseName = ''
        else:
            (prettyName, numLines,
             xScale) = self._DistributedHouse__getPrettyName(9)
            houseName = Localizer.AvatarsHouse % Localizer.GetPossesive(
                prettyName)
        matText.setText(houseName)
        self.matText = matText
        mat_origin = self.house.find('**/mat_origin')
        pos = mat_origin.getPos()
        mat_origin.setPosHpr(pos[0] - 0.14999999999999999 * numLines, pos[1],
                             pos[2], 90, -90, 0)
        self.floorMat = mat_origin.attachNewNode(self.matText)
        self.floorMat.setPos(0, -0.025000000000000001, 0)
        self.floorMat.setScale(0.5 * xScale)
 def showLaffString(self, text, duration = 0.84999999999999998, scale = 0.69999999999999996):
     if self.LaffNumbersEnabled:
         if text != '':
             if self.laffNumber:
                 self.hideLaffNumber()
             
             self.LaffNumberGenerator.setFont(ToontownGlobals.getSignFont())
             self.LaffNumberGenerator.setText(text)
             self.LaffNumberGenerator.clearShadow()
             self.LaffNumberGenerator.setAlign(TextNode.ACenter)
             r = 1.0
             a = 1.0
             g = 0.0
             b = 0.0
             self.LaffNumberGenerator.setTextColor(r, g, b, a)
             self.laffNumberNode = self.LaffNumberGenerator.generate()
             self.laffNumber = self.attachNewNode(self.laffNumberNode)
             self.laffNumber.setScale(scale)
             self.laffNumber.setBillboardAxis()
             self.laffNumber.setPos(0, 0, self.height / 2)
             seq = Task.sequence(self.laffNumber.lerpPos(Point3(0, 0, self.height + 1.5), 1.0, blendType = 'easeOut'), Task.pause(duration), self.laffNumber.lerpColor(Vec4(r, g, b, a), Vec4(r, g, b, 0), 0.10000000000000001), Task.Task(self.hideLaffNumberTask))
             taskMgr.add(seq, self.uniqueName('laffNumber'))
         
     
     return None
 def load(self):
     self.notify.debug('load')
     DistributedMinigame.load(self)
     self.defineConstants()
     self.music = base.loadMusic('phase_4/audio/bgm/MG_toontag.mid')
     self.sndAmbience = base.loadSfx('phase_4/audio/sfx/AV_ambient_water.mp3')
     self.sndPerfect = base.loadSfx('phase_4/audio/sfx/ring_perfect.mp3')
     loadBase = 'phase_4/models/minigames/'
     self.environModel = loader.loadModel(loadBase + 'swimming_game.bam')
     self.environModel.setPos(0, self.ENVIRON_LENGTH / 2.0, self.SEA_FLOOR_Z)
     self.environModel.flattenMedium()
     self.ringModel = loader.loadModel(loadBase + 'swimming_game_ring.bam')
     self.ringModel.setTransparency(1)
     modelRadius = 4.0
     self.ringModel.setScale(RingGameGlobals.RING_RADIUS / modelRadius)
     self.ringModel.flattenMedium()
     self.dropShadowModel = loader.loadModel('phase_3/models/props/drop_shadow')
     self.dropShadowModel.setColor(0, 0, 0, 0.5)
     self.dropShadowModel.flattenMedium()
     self.toonDropShadows = []
     self.ringDropShadows = []
     self._DistributedRingGame__textGen = TextNode('ringGame')
     self._DistributedRingGame__textGen.freeze()
     self._DistributedRingGame__textGen.setFont(ToontownGlobals.getSignFont())
     self._DistributedRingGame__textGen.setAlign(TextNode.ACenter)
 def load(self):
     self.notify.debug('load')
     DistributedMinigame.load(self)
     self.defineConstants()
     self.music = base.loadMusic('phase_4/audio/bgm/MG_toontag.mid')
     self.sndAmbience = base.loadSfx(
         'phase_4/audio/sfx/AV_ambient_water.mp3')
     self.sndPerfect = base.loadSfx('phase_4/audio/sfx/ring_perfect.mp3')
     loadBase = 'phase_4/models/minigames/'
     self.environModel = loader.loadModel(loadBase + 'swimming_game.bam')
     self.environModel.setPos(0, self.ENVIRON_LENGTH / 2.0,
                              self.SEA_FLOOR_Z)
     self.environModel.flattenMedium()
     self.ringModel = loader.loadModel(loadBase + 'swimming_game_ring.bam')
     self.ringModel.setTransparency(1)
     modelRadius = 4.0
     self.ringModel.setScale(RingGameGlobals.RING_RADIUS / modelRadius)
     self.ringModel.flattenMedium()
     self.dropShadowModel = loader.loadModel(
         'phase_3/models/props/drop_shadow')
     self.dropShadowModel.setColor(0, 0, 0, 0.5)
     self.dropShadowModel.flattenMedium()
     self.toonDropShadows = []
     self.ringDropShadows = []
     self.__textGen = TextNode('ringGame')
     self.__textGen.freeze()
     self.__textGen.setFont(ToontownGlobals.getSignFont())
     self.__textGen.setAlign(TextNode.ACenter)
 def load(self):
     ShtikerPage.ShtikerPage.load(self)
     self.title = DirectLabel(parent=self,
                              relief=None,
                              text=Localizer.InventoryPageTitle,
                              text_scale=0.12,
                              textMayChange=1,
                              pos=(0, 0, 0.62))
     self.gagFrame = DirectFrame(
         parent=self,
         relief=None,
         pos=(0.1, 0, -0.47),
         scale=(0.35, 0.35, 0.35),
         geom=getDefaultDialogGeom(),
         geom_color=ToontownGlobals.GlobalDialogColor)
     self.trackInfo = DirectFrame(
         parent=self,
         relief=None,
         pos=(-0.4, 0, -0.47),
         scale=(0.35, 0.35, 0.35),
         geom=getDefaultDialogGeom(),
         geom_scale=(1.4, 1, 1),
         geom_color=ToontownGlobals.GlobalDialogColor,
         text='',
         text_wordwrap=11,
         text_align=TextNode.ALeft,
         text_scale=0.12,
         text_pos=(-0.65, 0.3),
         text_fg=(0.05, 0.14, 0.4, 1))
     self.trackProgress = DirectWaitBar(parent=self.trackInfo,
                                        pos=(0, 0, -0.2),
                                        relief=SUNKEN,
                                        frameSize=(-0.6, 0.6, -0.1, 0.1),
                                        borderWidth=(0.025, 0.025),
                                        scale=1.1,
                                        frameColor=(0.4, 0.6, 0.4, 1),
                                        barColor=(0.9, 1, 0.7, 1),
                                        text='0/0',
                                        text_scale=0.15,
                                        text_fg=(0.05, 0.14, 0.4, 1),
                                        text_align=TextNode.ACenter,
                                        text_pos=(0, -0.22))
     self.trackProgress.hide()
     jarGui = loader.loadModel('phase_3.5/models/gui/jar_gui')
     self.moneyDisplay = DirectLabel(
         parent=self,
         relief=None,
         pos=(0.55, 0, -0.5),
         scale=0.8,
         text=str(toonbase.localToon.getMoney()),
         text_scale=0.18,
         text_fg=(0.95, 0.95, 0, 1),
         text_shadow=(0, 0, 0, 1),
         text_pos=(0, -0.1, 0),
         image=jarGui.find('**/Jar'),
         text_font=ToontownGlobals.getSignFont())
     jarGui.removeNode()
     return
 def _DistributedRingGame__initTallyDisplay(self):
     self._DistributedRingGame__tallyTextNode = TextNode('tally')
     self._DistributedRingGame__tallyTextNode.freeze()
     self._DistributedRingGame__tallyTextNode.setFont(ToontownGlobals.getSignFont())
     self._DistributedRingGame__tallyTextNode.setAlign(TextNode.ACenter)
     self.tallyMarkers = [
         None] * self._DistributedRingGame__numRingGroups
     for i in range(0, self._DistributedRingGame__numRingGroups):
         self._DistributedRingGame__createTallyMarker(i, self.RT_UNKNOWN)
 def loadDnaStore(self):
     if not hasattr(self, 'dnaStore'):
         self.dnaStore = DNAStorage()
         loader.loadDNAFile(self.dnaStore, 'phase_4/dna/storage.dna')
         self.dnaStore.storeFont('humanist',
                                 ToontownGlobals.getInterfaceFont())
         self.dnaStore.storeFont('mickey', ToontownGlobals.getSignFont())
         self.dnaStore.storeFont('suit', ToontownGlobals.getSuitFont())
         loader.loadDNAFile(self.dnaStore,
                            'phase_3.5/dna/storage_interior.dna')
Beispiel #12
0
    def load(self):
        self.notify.debug('load')
        DistributedMinigame.load(self)
        self.raceBoard = loader.loadModel('phase_4/models/minigames/race')
        self.raceBoard.setPosHpr(0, 0, 0, 0, 0, 0)
        self.raceBoard.setScale(0.8)
        self.dice = loader.loadModel('phase_4/models/minigames/dice')
        self.dice1 = self.dice.find('**/dice_button1')
        self.dice2 = self.dice.find('**/dice_button2')
        self.dice3 = self.dice.find('**/dice_button3')
        self.dice4 = self.dice.find('**/dice_button4')
        self.diceList = [self.dice1, self.dice2, self.dice3, self.dice4]
        self.music = base.loadMusic('phase_4/audio/bgm/minigame_race.mid')
        self.posBuzzer = base.loadSfx('phase_4/audio/sfx/MG_pos_buzzer.wav')
        self.negBuzzer = base.loadSfx('phase_4/audio/sfx/MG_neg_buzzer.wav')
        self.winSting = base.loadSfx('phase_4/audio/sfx/MG_win.mp3')
        self.loseSting = base.loadSfx('phase_4/audio/sfx/MG_lose.mp3')
        self.diceButtonList = []
        for i in range(1, 5):
            button = self.dice.find('**/dice_button' + str(i))
            button_down = self.dice.find('**/dice_button' + str(i) + '_down')
            button_ro = self.dice.find('**/dice_button' + str(i) + '_ro')
            diceButton = DirectButton(image=(button, button_down, button_ro,
                                             None),
                                      relief=None,
                                      pos=(-0.9 + (i - 1) * 0.2, 0.0, -0.85),
                                      scale=0.25,
                                      command=self.handleInputChoice,
                                      extraArgs=[i])
            diceButton.hide()
            self.diceButtonList.append(diceButton)

        self.waitingChoicesLabel = DirectLabel(
            text=Localizer.RaceGameWaitingChoices,
            text_fg=VBase4(1, 1, 1, 1),
            relief=None,
            pos=(-0.6, 0, -0.75),
            scale=0.075)
        self.waitingChoicesLabel.hide()
        self.chanceMarker = loader.loadModelOnce(
            'phase_4/models/minigames/question_mark')
        self.chanceCard = loader.loadModelOnce(
            'phase_4/models/minigames/chance_card')
        self.chanceCard.text = OnscreenText('',
                                            fg=(1.0, 0, 0, 1),
                                            scale=0.14,
                                            font=ToontownGlobals.getSignFont(),
                                            wordwrap=14,
                                            pos=(0.0, 0.2),
                                            mayChange=1)
        self.chanceCard.text.hide()
        self.cardSound = base.loadSfx(
            'phase_3.5/audio/sfx/GUI_stickerbook_turn.mp3')
        self.chanceMarkers = []
        return
Beispiel #13
0
 def showDebugPointText(self, text, point):
     if not hasattr(self, 'debugText'):
         self.debugText = self.loader.geom.attachNewNode('debugText')
         self.debugTextNode = TextNode('debugTextNode')
         self.debugTextNode.freeze()
         self.debugTextNode.setTextColor(1, 0, 0, 1)
         self.debugTextNode.setAlign(TextNode.ACenter)
         self.debugTextNode.setFont(ToontownGlobals.getSignFont())
     self.debugTextNode.setText(text)
     np = self.debugText.attachNewNode(self.debugTextNode.generate())
     np.setPos(point[0], point[1], point[2])
     np.setScale(4.0)
     np.setBillboardPointEye()
 def showLaffNumber(self, number, bonus=0):
     if self.LaffNumbersEnabled:
         if number != 0:
             if self.laffNumber:
                 self.hideLaffNumber()
             self.LaffNumberGenerator.setFont(ToontownGlobals.getSignFont())
             if number < 0:
                 self.LaffNumberGenerator.setText(str(number))
             else:
                 self.LaffNumberGenerator.setText('+' + str(number))
             self.LaffNumberGenerator.clearShadow()
             self.LaffNumberGenerator.setAlign(TextNode.ACenter)
             if bonus == 1:
                 r = 1.0
                 g = 1.0
                 b = 0
                 a = 1
             else:
                 if bonus == 2:
                     r = 1.0
                     g = 0.5
                     b = 0
                     a = 1
                 else:
                     if number < 0:
                         r = 0.9
                         g = 0
                         b = 0
                         a = 1
                     else:
                         r = 0
                         g = 0.9
                         b = 0
                         a = 1
             self.LaffNumberGenerator.setTextColor(r, g, b, a)
             self.laffNumberNode = self.LaffNumberGenerator.generate()
             self.laffNumber = self.attachNewNode(self.laffNumberNode)
             self.laffNumber.setBillboardAxis()
             self.laffNumber.setBin('fixed', 100)
             self.laffNumber.setPos(0, 0, self.height / 2)
             seq = Task.sequence(
                 self.laffNumber.lerpPos(Point3(0, 0, self.height + 1.5),
                                         1.0,
                                         blendType='easeOut'),
                 Task.pause(0.85),
                 self.laffNumber.lerpColor(Vec4(r, g, b, a),
                                           Vec4(r, g, b, 0), 0.1),
                 Task.Task(self.hideLaffNumberTask))
             taskMgr.add(seq, self.uniqueName('laffNumber'))
     return None
     return
Beispiel #15
0
 def showDebugPointText(self, text, point):
     if not hasattr(self, 'debugText'):
         self.debugText = self.loader.geom.attachNewNode('debugText')
         self.debugTextNode = TextNode('debugTextNode')
         self.debugTextNode.freeze()
         self.debugTextNode.setTextColor(1, 0, 0, 1)
         self.debugTextNode.setAlign(TextNode.ACenter)
         self.debugTextNode.setFont(ToontownGlobals.getSignFont())
     
     self.debugTextNode.setText(text)
     np = self.debugText.attachNewNode(self.debugTextNode.generate())
     np.setPos(point[0], point[1], point[2])
     np.setScale(4.0)
     np.setBillboardPointEye()
Beispiel #16
0
 def enterWaitCountdown(self, ts):
     self._DistributedTrolley__enableCollisions()
     self.accept('trolleyExitButton', self.handleExitButton)
     self.clockNode = TextNode('trolleyClock')
     self.clockNode.setFont(ToontownGlobals.getSignFont())
     self.clockNode.setAlign(TextNode.ACenter)
     self.clockNode.setTextColor(0.90000000000000002, 0.10000000000000001, 0.10000000000000001, 1)
     self.clockNode.setText('10')
     self.clock = self.trolleyStation.attachNewNode(self.clockNode)
     self.clock.setBillboardAxis()
     self.clock.setPosHprScale(15.859999999999999, 13.82, 11.68, -0.0, 0.0, 0.0, 3.02, 3.02, 3.02)
     if ts < self.trolleyCountdownTime:
         self.countdown(self.trolleyCountdownTime - ts)
     
     return None
 def setupNametag(self):
     if self.nametag == None:
         self.nametag = NametagGroup()
         self.nametag.setFont(ToontownGlobals.getSignFont())
         self.nametag.setContents(Nametag.CName)
         self.nametag.setColorCode(NametagGroup.CCSuitBuilding)
         self.nametag.setActive(0)
         self.nametag.setAvatar(self.bldg.getElevatorNodePath())
         name = self.cr.playGame.dnaStore.getTitleFromBlockNumber(self.bldg.block)
         if name:
             name += ', Inc.'
         else:
             name = 'COGS, Inc.'
         self.nametag.setName(name)
         self.nametag.manage(toonbase.marginManager)
 def setupNametag(self):
     if ZoneUtil.isInterior(self.zoneId):
         return None
     
     if self.nametag == None:
         self.nametag = NametagGroup()
         self.nametag.setFont(ToontownGlobals.getSignFont())
         self.nametag.setContents(Nametag.CName)
         self.nametag.setColorCode(NametagGroup.CCToonBuilding)
         self.nametag.setActive(0)
         self.nametag.setAvatar(self.getDoorNodePath())
         self.nametag.setObjectCode(self.block)
         name = self.cr.playGame.dnaStore.getTitleFromBlockNumber(self.block)
         self.nametag.setName(name)
         self.nametag.manage(toonbase.marginManager)
 def setupNametag(self):
     if self.nametag == None:
         self.nametag = NametagGroup()
         self.nametag.setFont(ToontownGlobals.getSignFont())
         self.nametag.setContents(Nametag.CName)
         self.nametag.setColorCode(NametagGroup.CCSuitBuilding)
         self.nametag.setActive(0)
         self.nametag.setAvatar(self.bldg.getElevatorNodePath())
         name = self.cr.playGame.dnaStore.getTitleFromBlockNumber(
             self.bldg.block)
         if name:
             name += ', Inc.'
         else:
             name = 'COGS, Inc.'
         self.nametag.setName(name)
         self.nametag.manage(toonbase.marginManager)
     return
 def enterWaitCountdown(self, ts):
     self.elevatorSphereNodePath.unstash()
     self.forceDoorsOpen()
     self.accept(self.uniqueName('enterelevatorSphere'), self.handleEnterSphere)
     self.accept(self.uniqueName('enterElevatorOK'), self.handleEnterElevator)
     self.accept('elevatorExitButton', self.handleExitButton)
     self.clockNode = TextNode('elevatorClock')
     self.clockNode.setFont(ToontownGlobals.getSignFont())
     self.clockNode.setAlign(TextNode.ACenter)
     self.clockNode.setTextColor(0.5, 0.5, 0.5, 1)
     self.clockNode.setText(str(ELEVATOR_COUNTDOWN_TIME))
     self.clock = self.bldg.getElevatorNodePath().attachNewNode(self.clockNode)
     self.clock.setPosHprScale(0, 6.4000000000000004, 6.0, 0, 0, 0, 2.0, 2.0, 2.0)
     if ts < ELEVATOR_COUNTDOWN_TIME:
         self.countdown(ELEVATOR_COUNTDOWN_TIME - ts)
     
     return None
 def __setupNametag(self):
     if self.nametag:
         self.clearNametag()
     if self.name == '':
         houseName = ''
     else:
         houseName = Localizer.AvatarsHouse % Localizer.GetPossesive(
             self.name)
     self.nametag = NametagGroup()
     self.nametag.setFont(ToontownGlobals.getSignFont())
     self.nametag.setContents(Nametag.CName)
     self.nametag.setColorCode(NametagGroup.CCHouseBuilding)
     self.nametag.setActive(0)
     self.nametag.setAvatar(self.house)
     self.nametag.setObjectCode(self.doId)
     self.nametag.setName(houseName)
     self.nametag.manage(toonbase.marginManager)
Beispiel #22
0
 def showfont(self, fontname):
     fontname = string.strip(string.lower(fontname))
     if fontname == '' or fontname == 'interface':
         font = ToontownGlobals.getInterfaceFont()
     else:
         if fontname == 'toon':
             font = ToontownGlobals.getToonFont()
         else:
             if fontname == 'suit':
                 font = ToontownGlobals.getSuitFont()
             else:
                 if fontname == 'sign':
                     font = ToontownGlobals.getSignFont()
                 else:
                     self.setMagicWordResponse('Unknown font: %s' % fontname)
                     return
     if not isinstance(font, DynamicTextFont):
         self.setMagicWordResponse('Font %s is not dynamic.' % fontname)
         return
     self.hidefont()
     self.shownFontNode = aspect2d.attachNewNode('shownFont')
     tn = TextNode('square')
     tn.freeze()
     tn.setCardActual(0.0, 1.0, -1.0, 0.0)
     tn.setFrameActual(0.0, 1.0, -1.0, 0.0)
     tn.setCardColor(1, 1, 1, 0.5)
     tn.setFrameColor(1, 1, 1, 1)
     tn.setFont(font)
     tn.setText(' ')
     numXPages = 2
     numYPages = 2
     pageScale = 0.8
     pageMargin = 0.1
     numPages = font.getNumPages()
     x = 0
     y = 0
     for pi in range(numPages):
         page = font.getPage(pi)
         tn.setCardTexture(page)
         np = self.shownFontNode.attachNewNode(tn.generate())
         np.setScale(pageScale)
         (
          np.setPos(float(x) / numXPages * 2 - 1 + pageMargin, 0, 1 - float(y) / numYPages * 2 - pageMargin),)
         x += 1
         if x >= numXPages:
             y += 1
Beispiel #23
0
 def loadAirplane(self):
     self.airplane = loader.loadModel('phase_4/models/props/airplane.bam')
     self.airplane.setScale(8)
     self.airplane.setPos(0, 0, 1)
     self.banner = self.airplane.find('**/*banner')
     bannerText = TextNode('bannerText')
     bannerText.freeze()
     bannerText.setTextColor(1, 0, 0, 1)
     bannerText.setAlign(bannerText.ACenter)
     bannerText.setFont(ToontownGlobals.getSignFont())
     bannerText.setText('Cog invasion!!!')
     self.bn = self.banner.attachNewNode(bannerText.generate())
     self.bn.setHpr(180, 0, 0)
     self.bn.setPos(-1.8, 0.1, 0)
     self.bn.setScale(0.35)
     self.banner.hide()
     self.__startAirplaneTask()
     self.airplane.reparentTo(render)
 def showLaffNumber(self, number, bonus = 0):
     if self.LaffNumbersEnabled:
         if number != 0:
             if self.laffNumber:
                 self.hideLaffNumber()
             
             self.LaffNumberGenerator.setFont(ToontownGlobals.getSignFont())
             if number < 0:
                 self.LaffNumberGenerator.setText(str(number))
             else:
                 self.LaffNumberGenerator.setText('+' + str(number))
             self.LaffNumberGenerator.clearShadow()
             self.LaffNumberGenerator.setAlign(TextNode.ACenter)
             if bonus == 1:
                 r = 1.0
                 g = 1.0
                 b = 0
                 a = 1
             elif bonus == 2:
                 r = 1.0
                 g = 0.5
                 b = 0
                 a = 1
             elif number < 0:
                 r = 0.90000000000000002
                 g = 0
                 b = 0
                 a = 1
             else:
                 r = 0
                 g = 0.90000000000000002
                 b = 0
                 a = 1
             self.LaffNumberGenerator.setTextColor(r, g, b, a)
             self.laffNumberNode = self.LaffNumberGenerator.generate()
             self.laffNumber = self.attachNewNode(self.laffNumberNode)
             self.laffNumber.setBillboardAxis()
             self.laffNumber.setBin('fixed', 100)
             self.laffNumber.setPos(0, 0, self.height / 2)
             seq = Task.sequence(self.laffNumber.lerpPos(Point3(0, 0, self.height + 1.5), 1.0, blendType = 'easeOut'), Task.pause(0.84999999999999998), self.laffNumber.lerpColor(Vec4(r, g, b, a), Vec4(r, g, b, 0), 0.10000000000000001), Task.Task(self.hideLaffNumberTask))
             taskMgr.add(seq, self.uniqueName('laffNumber'))
         
     
     return None
    def showfont(self, fontname):
        fontname = string.strip(string.lower(fontname))
        if fontname == '' or fontname == 'interface':
            font = ToontownGlobals.getInterfaceFont()
        elif fontname == 'toon':
            font = ToontownGlobals.getToonFont()
        elif fontname == 'suit':
            font = ToontownGlobals.getSuitFont()
        elif fontname == 'sign':
            font = ToontownGlobals.getSignFont()
        else:
            self.setMagicWordResponse('Unknown font: %s' % fontname)
            return None
        if not isinstance(font, DynamicTextFont):
            self.setMagicWordResponse('Font %s is not dynamic.' % fontname)
            return None

        self.hidefont()
        self.shownFontNode = aspect2d.attachNewNode('shownFont')
        tn = TextNode('square')
        tn.freeze()
        tn.setCardActual(0.0, 1.0, -1.0, 0.0)
        tn.setFrameActual(0.0, 1.0, -1.0, 0.0)
        tn.setCardColor(1, 1, 1, 0.5)
        tn.setFrameColor(1, 1, 1, 1)
        tn.setFont(font)
        tn.setText(' ')
        numXPages = 2
        numYPages = 2
        pageScale = 0.80000000000000004
        pageMargin = 0.10000000000000001
        numPages = font.getNumPages()
        x = 0
        y = 0
        for pi in range(numPages):
            page = font.getPage(pi)
            tn.setCardTexture(page)
            np = self.shownFontNode.attachNewNode(tn.generate())
            np.setScale(pageScale)
            (np.setPos(((float(x) / numXPages) * 2 - 1) + pageMargin, 0,
                       1 - (float(y) / numYPages) * 2 - pageMargin), )
            x += 1
            if x >= numXPages:
                y += 1
 def enterWaitCountdown(self, ts):
     self.elevatorSphereNodePath.unstash()
     self.forceDoorsOpen()
     self.accept(self.uniqueName('enterelevatorSphere'),
                 self.handleEnterSphere)
     self.accept(self.uniqueName('enterElevatorOK'),
                 self.handleEnterElevator)
     self.accept('elevatorExitButton', self.handleExitButton)
     self.clockNode = TextNode('elevatorClock')
     self.clockNode.setFont(ToontownGlobals.getSignFont())
     self.clockNode.setAlign(TextNode.ACenter)
     self.clockNode.setTextColor(0.5, 0.5, 0.5, 1)
     self.clockNode.setText(str(ELEVATOR_COUNTDOWN_TIME))
     self.clock = self.bldg.getElevatorNodePath().attachNewNode(
         self.clockNode)
     self.clock.setPosHprScale(0, 6.4, 6.0, 0, 0, 0, 2.0, 2.0, 2.0)
     if ts < ELEVATOR_COUNTDOWN_TIME:
         self.countdown(ELEVATOR_COUNTDOWN_TIME - ts)
     return
Beispiel #27
0
 def load(self):
     self.notify.debug('load')
     DistributedMinigame.load(self)
     self.itText = OnscreenText.OnscreenText(
         'itText',
         fg=(0.94999999999999996, 0.94999999999999996, 0.65000000000000002,
             1),
         scale=0.14000000000000001,
         font=ToontownGlobals.getSignFont(),
         pos=(0.0, -0.80000000000000004),
         wordwrap=15,
         mayChange=1)
     self.itText.hide()
     self.sky = loader.loadModel('phase_3.5/models/props/TT_sky')
     self.ground = loader.loadModel('phase_4/models/minigames/tag_arena')
     self.music = base.loadMusic('phase_4/audio/bgm/MG_toontag.mid')
     self.tagSfx = base.loadSfx('phase_4/audio/sfx/MG_Tag_C.mp3')
     self.itPointer = loader.loadModel(
         'phase_4/models/minigames/bboard-pointer')
     self.tracks = []
     self.IT = None
 def _DistributedFishingSpot__makeGui(self):
     if self.madeGui:
         return None
     
     buttonModels = loader.loadModelOnce('phase_3.5/models/gui/inventory_gui')
     upButton = buttonModels.find('**/InventoryButtonUp')
     downButton = buttonModels.find('**/InventoryButtonDown')
     rolloverButton = buttonModels.find('**/InventoryButtonRollover')
     buttonModels.removeNode()
     crankModels = loader.loadModelOnce('phase_4/models/gui/fishing_crank')
     crank = crankModels.find('**/fishing_crank')
     crankArrow = crankModels.find('**/fishing_crank_arrow')
     crankModels.removeNode()
     jarGui = loader.loadModelOnce('phase_3.5/models/gui/jar_gui')
     jarImage = jarGui.find('**/Jar')
     jarGui.removeNode()
     self.castGui = NodePath('castGui')
     self.exitButton = DirectButton(parent = self.castGui, relief = None, text = Localizer.FishingExit, text_fg = (1, 1, 0.65000000000000002, 1), text_pos = (0, -0.23000000000000001), text_scale = 0.80000000000000004, image = (upButton, downButton, rolloverButton), image_color = (1, 0, 0, 1), image_scale = (15, 1, 11), pos = (-0.20000000000000001, 0, -0.80000000000000004), scale = 0.12, command = self._DistributedFishingSpot__userExit)
     self.castButton = DirectButton(parent = self.castGui, relief = None, text = Localizer.FishingCast, text_fg = (1, 1, 0.65000000000000002, 1), text3_fg = (0.80000000000000004, 0.80000000000000004, 0.80000000000000004, 1), text_pos = (0, -0.23000000000000001), text_scale = 0.80000000000000004, image = (upButton, downButton, rolloverButton), image_color = (1, 0, 0, 1), image3_color = (0.80000000000000004, 0.5, 0.5, 1), image_scale = (15, 1, 11), pos = (-0.20000000000000001, 0, -0.62), scale = 0.12, command = self._DistributedFishingSpot__userCast)
     self.jar = DirectLabel(parent = self.castGui, relief = None, text = str(self.av.getMoney()), text_scale = 0.20000000000000001, text_fg = (0.94999999999999996, 0.94999999999999996, 0, 1), text_shadow = (0, 0, 0, 1), text_pos = (0, -0.10000000000000001, 0), text_font = ToontownGlobals.getSignFont(), image = jarImage, pos = (-0.20000000000000001, 0, -0.34999999999999998), scale = 0.65000000000000002)
     self.reelGui = NodePath('reelGui')
     self.reelButton = DirectButton(parent = self.reelGui, relief = None, text = Localizer.FishingAutoReel, text_fg = (1, 1, 0.65000000000000002, 1), text_pos = (0, -0.23000000000000001), text_scale = 0.80000000000000004, image = (upButton, downButton, rolloverButton), image_color = (0, 0.69999999999999996, 0, 1), image_scale = (24, 1, 11), pos = (1.0, 0, -0.29999999999999999), scale = 0.10000000000000001, command = self._DistributedFishingSpot__userReel)
     self.crankGui = self.reelGui.attachNewNode('crankGui')
     arrow1 = crankArrow.copyTo(self.crankGui)
     arrow1.setColor(1, 0, 0, 1)
     arrow1.setPos(0.25, 0, -0.25)
     arrow2 = crankArrow.copyTo(self.crankGui)
     arrow2.setColor(1, 0, 0, 1)
     arrow2.setPos(-0.25, 0, 0.25)
     arrow2.setR(180)
     self.crankGui.setPos(-0.20000000000000001, 0, -0.69999999999999996)
     self.crankGui.setScale(0.5)
     self.crankHandle = DirectFrame(parent = self.crankGui, state = NORMAL, relief = None, image = crank)
     self.speedGauge = DirectWaitBar(parent = self.crankGui, relief = SUNKEN, frameSize = (-0.80000000000000004, 0.80000000000000004, -0.14999999999999999, 0.14999999999999999), borderWidth = (0.02, 0.02), scale = 0.41999999999999998, pos = (0, 0, 0.75), barColor = (0, 0.69999999999999996, 0, 1))
     self.speedGauge.hide()
     self.tooSlow = DirectLabel(parent = self.speedGauge, relief = None, text = Localizer.FishingCrankTooSlow, scale = 0.20000000000000001, pos = (-1, 0, 0.050000000000000003))
     self.tooFast = DirectLabel(parent = self.speedGauge, relief = None, text = Localizer.FishingCrankTooFast, scale = 0.20000000000000001, pos = (1, 0, 0.050000000000000003))
     self.tooSlow.hide()
     self.tooFast.hide()
     self.itemGui = NodePath('itemGui')
     self.itemFrame = DirectFrame(parent = self.itemGui, relief = None, geom = getDefaultDialogGeom(), geom_color = ToontownGlobals.GlobalDialogColor, geom_scale = (1, 1, 0.5), text = Localizer.FishingItemFound, text_pos = (0, 0.080000000000000002), text_scale = 0.080000000000000002, pos = (0, 0, 0.58699999999999997))
     self.itemLabel = DirectLabel(parent = self.itemFrame, text = '', text_scale = 0.059999999999999998, pos = (0, 0, -0.080000000000000002))
     self.failureGui = NodePath('failureGui')
     self.failureFrame = DirectFrame(parent = self.failureGui, relief = None, geom = getDefaultDialogGeom(), geom_color = ToontownGlobals.GlobalDialogColor, geom_scale = (1.2, 1, 0.59999999999999998), text = Localizer.FishingFailure, text_pos = (0, 0.12), text_scale = 0.080000000000000002, pos = (0, 0, 0.58699999999999997))
     self.failureLabel = DirectLabel(parent = self.failureFrame, text = '', text_scale = 0.059999999999999998, text_wordwrap = 16, pos = (0, 0, -0.040000000000000001))
     self.brokeGui = NodePath('brokeGui')
     self.brokeFrame = DirectFrame(parent = self.brokeGui, relief = None, geom = getDefaultDialogGeom(), geom_color = ToontownGlobals.GlobalDialogColor, geom_scale = (1.2, 1, 0.59999999999999998), text = Localizer.FishingBrokeHeader, text_pos = (0, 0.12), text_scale = 0.080000000000000002, pos = (0, 0, 0.58699999999999997))
     self.brokeLabel = DirectLabel(parent = self.brokeFrame, relief = None, text = Localizer.FishingBroke, text_scale = 0.059999999999999998, text_wordwrap = 16, pos = (0, 0, -0.040000000000000001))
     self.madeGui = 1
 def load(self):
     self.notify.debug('load')
     DistributedMinigame.load(self)
     self.raceBoard = loader.loadModel('phase_4/models/minigames/race')
     self.raceBoard.setPosHpr(0, 0, 0, 0, 0, 0)
     self.raceBoard.setScale(0.80000000000000004)
     self.dice = loader.loadModel('phase_4/models/minigames/dice')
     self.dice1 = self.dice.find('**/dice_button1')
     self.dice2 = self.dice.find('**/dice_button2')
     self.dice3 = self.dice.find('**/dice_button3')
     self.dice4 = self.dice.find('**/dice_button4')
     self.diceList = [
         self.dice1,
         self.dice2,
         self.dice3,
         self.dice4]
     self.music = base.loadMusic('phase_4/audio/bgm/minigame_race.mid')
     self.posBuzzer = base.loadSfx('phase_4/audio/sfx/MG_pos_buzzer.wav')
     self.negBuzzer = base.loadSfx('phase_4/audio/sfx/MG_neg_buzzer.wav')
     self.winSting = base.loadSfx('phase_4/audio/sfx/MG_win.mp3')
     self.loseSting = base.loadSfx('phase_4/audio/sfx/MG_lose.mp3')
     self.diceButtonList = []
     for i in range(1, 5):
         button = self.dice.find('**/dice_button' + str(i))
         button_down = self.dice.find('**/dice_button' + str(i) + '_down')
         button_ro = self.dice.find('**/dice_button' + str(i) + '_ro')
         diceButton = DirectButton(image = (button, button_down, button_ro, None), relief = None, pos = (-0.90000000000000002 + (i - 1) * 0.20000000000000001, 0.0, -0.84999999999999998), scale = 0.25, command = self.handleInputChoice, extraArgs = [
             i])
         diceButton.hide()
         self.diceButtonList.append(diceButton)
     
     self.waitingChoicesLabel = DirectLabel(text = Localizer.RaceGameWaitingChoices, text_fg = VBase4(1, 1, 1, 1), relief = None, pos = (-0.59999999999999998, 0, -0.75), scale = 0.074999999999999997)
     self.waitingChoicesLabel.hide()
     self.chanceMarker = loader.loadModelOnce('phase_4/models/minigames/question_mark')
     self.chanceCard = loader.loadModelOnce('phase_4/models/minigames/chance_card')
     self.chanceCard.text = OnscreenText('', fg = (1.0, 0, 0, 1), scale = 0.14000000000000001, font = ToontownGlobals.getSignFont(), wordwrap = 14, pos = (0.0, 0.20000000000000001), mayChange = 1)
     self.chanceCard.text.hide()
     self.cardSound = base.loadSfx('phase_3.5/audio/sfx/GUI_stickerbook_turn.mp3')
     self.chanceMarkers = []
 def load(self):
     self.notify.debug('load')
     DistributedMinigame.load(self)
     self.itText = OnscreenText.OnscreenText('itText', fg = (0.94999999999999996, 0.94999999999999996, 0.65000000000000002, 1), scale = 0.14000000000000001, font = ToontownGlobals.getSignFont(), pos = (0.0, -0.80000000000000004), wordwrap = 15, mayChange = 1)
     self.itText.hide()
     self.sky = loader.loadModel('phase_3.5/models/props/TT_sky')
     self.ground = loader.loadModel('phase_4/models/minigames/tag_arena')
     self.music = base.loadMusic('phase_4/audio/bgm/MG_toontag.mid')
     self.tagSfx = base.loadSfx('phase_4/audio/sfx/MG_Tag_C.mp3')
     self.itPointer = loader.loadModel('phase_4/models/minigames/bboard-pointer')
     self.tracks = []
     self.IT = None
    def load(self):
        self.notify.debug('load')
        DistributedMinigame.load(self)
        self.sky = loader.loadModel('phase_3.5/models/props/TT_sky')
        self.ground = loader.loadModel('phase_4/models/minigames/toon_cannon_gameground')
        self.tower = loader.loadModel('phase_4/models/minigames/toon_cannon_water_tower')
        self.cannon = loader.loadModel('phase_4/models/minigames/toon_cannon')
        self.dropShadow = loader.loadModel('phase_3/models/props/drop_shadow')
        self.hill = loader.loadModel('phase_4/models/minigames/cannon_hill')
        self.sky.setScale(WORLD_SCALE)
        self.ground.setScale(GROUND_SCALE)
        self.cannon.setScale(CANNON_SCALE)
        self.dropShadow.setColor(0, 0, 0, 0.5)
        self.ground.setColor(0.84999999999999998, 0.84999999999999998, 0.84999999999999998, 1.0)
        self.hill.setScale(1, 1, CANNON_Z / 20.0)
        self.dropShadow.setBin('fixed', 0, 1)
        self.splash = Splash.Splash(render)
        self.dustCloud = DustCloud.DustCloud(render)
        purchaseModels = loader.loadModel('phase_4/models/gui/purchase_gui')
        self.jarImage = purchaseModels.find('**/Jar')
        self.jarImage.reparentTo(hidden)
        self.rewardPanel = DirectLabel(parent = hidden, relief = None, pos = (1.1599999999999999, 0.0, 0.45000000000000001), scale = 0.65000000000000002, text = '', text_scale = 0.20000000000000001, text_fg = (0.94999999999999996, 0.94999999999999996, 0, 1), text_pos = (0, -0.13), text_font = ToontownGlobals.getSignFont(), image = self.jarImage)
        self.rewardPanelTitle = DirectLabel(parent = self.rewardPanel, relief = None, pos = (0, 0, 0.059999999999999998), scale = 0.080000000000000002, text = Localizer.CannonGameReward, text_fg = (0.94999999999999996, 0.94999999999999996, 0, 1), text_shadow = (0, 0, 0, 1))
        self.music = base.loadMusic('phase_4/audio/bgm/MG_cannon_game.mid')
        self.sndCannonMove = base.loadSfx('phase_4/audio/sfx/MG_cannon_adjust.mp3')
        self.sndCannonFire = base.loadSfx('phase_4/audio/sfx/MG_cannon_fire_alt.mp3')
        self.sndHitGround = base.loadSfx('phase_4/audio/sfx/MG_cannon_hit_dirt.mp3')
        self.sndHitTower = base.loadSfx('phase_4/audio/sfx/MG_cannon_hit_tower.mp3')
        self.sndHitWater = base.loadSfx('phase_4/audio/sfx/MG_cannon_splash.mp3')
        self.sndWhizz = base.loadSfx('phase_4/audio/sfx/MG_cannon_whizz.mp3')
        self.sndWin = base.loadSfx('phase_4/audio/sfx/MG_win.mp3')
        self.sndRewardTick = base.loadSfx('phase_3.5/audio/sfx/tick_counter.mp3')
        guiModel = 'phase_4/models/gui/cannon_game_gui'
        cannonGui = loader.loadModel(guiModel)
        self.aimPad = DirectFrame(image = cannonGui.find('**/CannonFire_PAD'), relief = None, pos = (0.69999999999999996, 0, -0.55333299999999996), scale = 0.80000000000000004)
        cannonGui.removeNode()
        self.aimPad.hide()
        self.fireButton = DirectButton(parent = self.aimPad, image = ((guiModel, '**/Fire_Btn_UP'), (guiModel, '**/Fire_Btn_DN'), (guiModel, '**/Fire_Btn_RLVR')), relief = None, pos = (0.0115741, 0, 0.0050505100000000002), scale = 1.0, command = self._DistributedCannonGame__firePressed)
        self.upButton = DirectButton(parent = self.aimPad, image = ((guiModel, '**/Cannon_Arrow_UP'), (guiModel, '**/Cannon_Arrow_DN'), (guiModel, '**/Cannon_Arrow_RLVR')), relief = None, pos = (0.0115741, 0, 0.221717))
        self.downButton = DirectButton(parent = self.aimPad, image = ((guiModel, '**/Cannon_Arrow_UP'), (guiModel, '**/Cannon_Arrow_DN'), (guiModel, '**/Cannon_Arrow_RLVR')), relief = None, pos = (0.0136112, 0, -0.21010100000000001), image_hpr = (0, 0, 180))
        self.leftButton = DirectButton(parent = self.aimPad, image = ((guiModel, '**/Cannon_Arrow_UP'), (guiModel, '**/Cannon_Arrow_DN'), (guiModel, '**/Cannon_Arrow_RLVR')), relief = None, pos = (-0.199352, 0, -0.00050526900000000003), image_hpr = (0, 0, 90))
        self.rightButton = DirectButton(parent = self.aimPad, image = ((guiModel, '**/Cannon_Arrow_UP'), (guiModel, '**/Cannon_Arrow_DN'), (guiModel, '**/Cannon_Arrow_RLVR')), relief = None, pos = (0.219167, 0, -0.0010102399999999999), image_hpr = (0, 0, -90))
        self.aimPad.setColor(1, 1, 1, 0.90000000000000002)
        
        def bindButton(button, upHandler, downHandler):
            button.bind(B1PRESS, lambda x, handler = upHandler: handler())
            button.bind(B1RELEASE, lambda x, handler = downHandler: handler())

        bindButton(self.upButton, self._DistributedCannonGame__upPressed, self._DistributedCannonGame__upReleased)
        bindButton(self.downButton, self._DistributedCannonGame__downPressed, self._DistributedCannonGame__downReleased)
        bindButton(self.leftButton, self._DistributedCannonGame__leftPressed, self._DistributedCannonGame__leftReleased)
        bindButton(self.rightButton, self._DistributedCannonGame__rightPressed, self._DistributedCannonGame__rightReleased)
        self.timer = ToontownTimer.ToontownTimer()
        self.timer.posInTopRightCorner()
        self.timer.hide()
        self.DEBUG_TOWER_RANGE = 0
        self.DEBUG_CANNON_FAR_LEFT = 0
        self.DEBUG_TOWER_NEAR = 1
        self.DEBUG_TOWER_FAR_LEFT = 1
        self.cheat = config.GetBool('cannon-game-cheat', 0)
Beispiel #32
0
 def __init__(self, av = None, position = 0, paid = 0):
     DirectButton.__init__(self, relief = None, text = '', text_font = ToontownGlobals.getSignFont())
     self.initialiseoptions(AvatarChoice)
     self.hasPaid = paid
     if not av:
         self.create = 1
         self.name = ''
         self.dna = None
     else:
         self.create = 0
         self.name = av.name
         self.dna = AvatarDNA.AvatarDNA(av.dna)
         self.wantName = av.wantName
         self.approvedName = av.approvedName
         self.rejectedName = av.rejectedName
         self.allowedName = av.allowedName
     self.position = position
     self.doneEvent = 'avChoicePanel-' + str(self.position)
     self.deleteWithPasswordFrame = None
     self.pickAToonGui = loader.loadModelOnce('phase_3/models/gui/pick_a_toon_gui')
     self['image'] = self.pickAToonGui.find('**/av-chooser_Square_UP')
     self.setScale(1.01)
     if self.create:
         self['command'] = self._AvatarChoice__handleCreate
         self['text'] = (Localizer.AvatarChoiceMakeAToon,)
         self['text_pos'] = (0, 0)
         self['text0_scale'] = 0.10000000000000001
         self['text1_scale'] = 0.12
         self['text2_scale'] = 0.12
         self['text0_fg'] = (0, 1, 0.80000000000000004, 0.5)
         self['text1_fg'] = (0, 1, 0.80000000000000004, 1)
         self['text2_fg'] = (0.29999999999999999, 1, 0.90000000000000002, 1)
     else:
         self['command'] = self._AvatarChoice__handleChoice
         self['text'] = ('', Localizer.AvatarChoicePlayThisToon, Localizer.AvatarChoicePlayThisToon)
         self['text_scale'] = 0.12
         self['text_fg'] = (1, 0.90000000000000002, 0.10000000000000001, 1)
         self.nameText = DirectLabel(parent = self, relief = None, scale = 0.089999999999999997, pos = (0, 0, 0.27000000000000002), text = self.name, text_fg = (1, 1, 1, 1), text_shadow = (0, 0, 0, 1), text_wordwrap = 7.5, text_font = ToontownGlobals.getToonFont(), state = DISABLED)
         if self.approvedName != '':
             self.nameText['text'] = self.approvedName
         
         guiButton = loader.loadModelOnce('phase_3/models/gui/quit_button')
         self.nameYourToonButton = DirectButton(parent = self, relief = None, image = (guiButton.find('**/QuitBtn_UP'), guiButton.find('**/QuitBtn_DN'), guiButton.find('**/QuitBtn_RLVR')), text = (Localizer.AvatarChoiceNameYourToon, Localizer.AvatarChoiceNameYourToon, Localizer.AvatarChoiceNameYourToon), text_fg = (1, 1, 1, 1), text_shadow = (0, 0, 0, 1), text_scale = 0.14999999999999999, text_pos = (0, 0.029999999999999999), text_font = ToontownGlobals.getInterfaceFont(), pos = (-0.20000000000000001, 0, -0.29999999999999999), scale = 0.45000000000000001, image_scale = (2, 1, 3), command = self._AvatarChoice__handleNameYourToon)
         guiButton.removeNode()
         self.statusText = DirectLabel(parent = self, relief = None, scale = 0.089999999999999997, pos = (0, 0, -0.23999999999999999), text = '', text_fg = (1, 1, 1, 1), text_shadow = (0, 0, 0, 1), text_wordwrap = 7.5, text_font = ToontownGlobals.getToonFont(), state = DISABLED)
         if self.wantName != '':
             self.nameYourToonButton.hide()
             self.statusText['text'] = Localizer.AvatarChoiceNameReview
         elif self.approvedName != '':
             self.nameYourToonButton.hide()
             self.statusText['text'] = Localizer.AvatarChoiceNameApproved
         elif self.rejectedName != '':
             self.nameYourToonButton.hide()
             self.statusText['text'] = Localizer.AvatarChoiceNameRejected
         elif self.allowedName == 1 and toonbase.tcr.allowFreeNames() or self.hasPaid:
             self.nameYourToonButton.show()
             self.statusText['text'] = ''
         else:
             self.nameYourToonButton.hide()
             self.statusText['text'] = ''
         self.head = hidden.attachNewNode('head')
         self.head.setPosHprScale(0, 5, -0.10000000000000001, 180, 0, 0, 0.23999999999999999, 0.23999999999999999, 0.23999999999999999)
         self.head.reparentTo(self.stateNodePath[0], 20)
         self.head.instanceTo(self.stateNodePath[1], 20)
         self.head.instanceTo(self.stateNodePath[2], 20)
         self.headModel = ToonHead.ToonHead()
         self.headModel.setupHead(self.dna, forGui = 1)
         self.headModel.reparentTo(self.head)
         self.headModel.startBlink()
         self.headModel.startLookAround()
         trashcanGui = loader.loadModelOnce('phase_3/models/gui/trashcan_gui')
         self.deleteButton = DirectButton(parent = self, image = (trashcanGui.find('**/TrashCan_CLSD'), trashcanGui.find('**/TrashCan_OPEN'), trashcanGui.find('**/TrashCan_RLVR')), text = ('', Localizer.AvatarChoiceDelete, Localizer.AvatarChoiceDelete), text_fg = (1, 1, 1, 1), text_shadow = (0, 0, 0, 1), text_scale = 0.14999999999999999, text_pos = (0, -0.10000000000000001), text_font = ToontownGlobals.getInterfaceFont(), relief = None, pos = (0.27000000000000002, 0, -0.25), scale = 0.45000000000000001, command = self._AvatarChoice__handleDelete)
         trashcanGui.removeNode()
     self.resetFrameSize()
     return None
Beispiel #33
0
 def load(self, purchaseModels = None):
     localLoad = 0
     if purchaseModels == None:
         localLoad = 1
         purchaseModels = loader.loadModel('phase_4/models/gui/purchase_gui')
     
     self.music = base.loadMusic('phase_4/audio/bgm/FF_safezone.mid')
     self.jarImage = purchaseModels.find('**/Jar')
     self.jarImage.reparentTo(hidden)
     self.frame = DirectFrame(relief = None)
     self.frame.hide()
     self.title = DirectLabel(parent = self.frame, relief = None, pos = (0.0, 0.0, 0.82999999999999996), scale = 1.2, image = purchaseModels.find('**/Goofys_Sign'), text = Localizer.GagShopName, text_fg = (0.59999999999999998, 0.20000000000000001, 0, 1), text_scale = 0.089999999999999997, text_wordwrap = 10, text_pos = (0, 0.025000000000000001, 0), text_font = ToontownGlobals.getSignFont())
     self.pointDisplay = DirectLabel(parent = self.frame, relief = None, pos = (-1.0800000000000001, 0.0, 0.16), text = str(self.toon.getMoney()), text_scale = 0.20000000000000001, text_fg = (0.94999999999999996, 0.94999999999999996, 0, 1), text_shadow = (0, 0, 0, 1), text_pos = (0, -0.10000000000000001, 0), image = self.jarImage, text_font = ToontownGlobals.getSignFont())
     self.statusLabel = DirectLabel(parent = self.frame, relief = None, pos = (-0.25, 0, 0.625), text = Localizer.GagShopYouHave % self.toon.getMoney(), text_scale = 0.080000000000000002, text_fg = (0.050000000000000003, 0.14000000000000001, 0.40000000000000002, 1))
     if self.toon.getMoney() == 1:
         self.statusLabel['text'] = Localizer.GagShopYouHaveOne
     
     if localLoad == 1:
         purchaseModels.removeNode()
     
     return None
 def load(self):
     self.notify.debug('load')
     DistributedMinigame.load(self)
     self.timer = ToontownTimer.ToontownTimer()
     self.timer.posInTopRightCorner()
     self.timer.hide()
     self.room = loader.loadModel('phase_4/models/minigames/matching_room')
     self.buttonSounds = []
     for soundName in self.ButtonSoundNames:
         self.buttonSounds.append(base.loadSfx(soundName))
     
     self.correctSound = base.loadSfx('phase_4/audio/sfx/MG_pos_buzzer.wav')
     self.incorrectSound = base.loadSfx('phase_4/audio/sfx/MG_neg_buzzer.wav')
     self.perfectSound = base.loadSfx('phase_4/audio/sfx/MG_win.mp3')
     self.fallSound = base.loadSfx('phase_4/audio/sfx/Mg_Tag_A.mp3')
     self.music = base.loadMusic(self.bgm)
     self.waitingText = DirectLabel(text = self.strPleaseWait, text_fg = (0.90000000000000002, 0.90000000000000002, 0.90000000000000002, 1.0), frameColor = (1, 1, 1, 0), text_font = ToontownGlobals.getSignFont(), pos = (0, 0, -0.78000000000000003), scale = 0.12)
     self.roundText = DirectLabel(text = 'Round 1!', text_fg = self.normalTextColor, frameColor = (1, 1, 1, 0), text_font = ToontownGlobals.getSignFont(), pos = (0.014, 0, -0.83999999999999997), scale = 0.12)
     self.roundText.hide()
     self.waitingText.hide()
     matchingGameGui = loader.loadModel('phase_3.5/models/gui/matching_game_gui')
     minnieArrow = matchingGameGui.find('**/minnieArrow')
     minnieX = matchingGameGui.find('**/minnieX')
     minnieCircle = matchingGameGui.find('**/minnieCircle')
     self.arrows = [
         None] * 5
     for x in range(0, 5):
         self.arrows[x] = minnieArrow.copyTo(hidden)
         self.arrows[x].hide()
     
     self.xs = [
         None] * 5
     for x in range(0, 5):
         self.xs[x] = minnieX.copyTo(hidden)
         self.xs[x].hide()
     
     self.statusBalls = []
     self.totalMoves = PatternGameGlobals.INITIAL_ROUND_LENGTH + PatternGameGlobals.ROUND_LENGTH_INCREMENT * (PatternGameGlobals.NUM_ROUNDS - 1)
     for x in range(0, 4):
         self.statusBalls.append([
             None] * self.totalMoves)
     
     for x in range(0, 4):
         for y in range(0, self.totalMoves):
             self.statusBalls[x][y] = minnieCircle.copyTo(hidden)
             self.statusBalls[x][y].hide()
         
     
     minnieArrow.removeNode()
     minnieX.removeNode()
     minnieCircle.removeNode()
     matchingGameGui.removeNode()
     self.minnie = Char.Char()
     m = self.minnie
     dna = AvatarDNA.AvatarDNA()
     dna.newChar('mn')
     m.setDNA(dna)
     m.setName(Localizer.Minnie)
     m.reparentTo(hidden)
     self.backRowHome = Point3(3, 11, 0)
     self.backRowXSpacing = 1.8
     self.frontRowHome = Point3(0, 18, 0)
     self.frontRowXSpacing = 3.0
     self.stdNumDanceStepPingFrames = self.minnie.getNumFrames(self.minnieAnimNames[0])
     self.stdNumDanceStepPingPongFrames = self._DistributedPatternGame__numPingPongFrames(self.stdNumDanceStepPingFrames)
     self.buttonPressDelayPercent = (self.stdNumDanceStepPingFrames - 1.0) / self.stdNumDanceStepPingPongFrames
     self.animPlayRates = []
     animPlayRate = 1.3999999999999999
     animPlayRateMult = 1.0600000000000001
     for i in range(PatternGameGlobals.NUM_ROUNDS):
         self.animPlayRates.append(animPlayRate)
         animPlayRate *= animPlayRateMult
 def __init__(self, doneEvent, allowWithdraw = 1):
     DirectFrame.__init__(self, relief = None, geom = getDefaultDialogGeom(), geom_color = ToontownGlobals.GlobalDialogColor, geom_scale = (1.3300000000000001, 1, 1.1000000000000001), pos = (0, 0, 0))
     self.initialiseoptions(BankGui)
     self.doneEvent = doneEvent
     self._BankGui__transactionAmount = 0
     buttons = loader.loadModelOnce('phase_3/models/gui/dialog_box_buttons_gui')
     jarGui = loader.loadModel('phase_3.5/models/gui/jar_gui')
     arrowGui = loader.loadModelOnce('phase_3/models/gui/create_a_toon_gui')
     bankModel = loader.loadModel('phase_5.5/models/estate/jellybeanBank.bam')
     bankModel.find('**/pig').setDepthWrite(1)
     bankModel.find('**/pig').setDepthTest(1)
     okImageList = (buttons.find('**/ChtBx_OKBtn_UP'), buttons.find('**/ChtBx_OKBtn_DN'), buttons.find('**/ChtBx_OKBtn_Rllvr'))
     cancelImageList = (buttons.find('**/CloseBtn_UP'), buttons.find('**/CloseBtn_DN'), buttons.find('**/CloseBtn_Rllvr'))
     arrowImageList = (arrowGui.find('**/CrtATn_R_Arrow_UP'), arrowGui.find('**/CrtATn_R_Arrow_DN'), arrowGui.find('**/CrtATn_R_Arrow_RLVR'), arrowGui.find('**/CrtATn_R_Arrow_UP'))
     self.cancelButton = DirectButton(parent = self, relief = None, image = cancelImageList, pos = (-0.20000000000000001, 0, -0.40000000000000002), text = Localizer.BankGuiCancel, text_scale = 0.059999999999999998, text_pos = (0, -0.10000000000000001), command = self._BankGui__cancel)
     self.okButton = DirectButton(parent = self, relief = None, image = okImageList, pos = (0.20000000000000001, 0, -0.40000000000000002), text = Localizer.BankGuiOk, text_scale = 0.059999999999999998, text_pos = (0, -0.10000000000000001), command = self._BankGui__requestTransaction)
     self.jarDisplay = DirectLabel(parent = self, relief = None, pos = (-0.40000000000000002, 0, 0), scale = 0.80000000000000004, text = str(toonbase.localToon.getMoney()), text_scale = 0.20000000000000001, text_fg = (0.94999999999999996, 0.94999999999999996, 0, 1), text_shadow = (0, 0, 0, 1), text_pos = (0, -0.10000000000000001, 0), image = jarGui.find('**/Jar'), text_font = ToontownGlobals.getSignFont())
     self.bankDisplay = DirectLabel(parent = self, relief = None, pos = (0.40000000000000002, 0, 0), scale = 1.1000000000000001, text = str(toonbase.localToon.getBankMoney()), text_scale = 0.20000000000000001, text_fg = (0.94999999999999996, 0.94999999999999996, 0, 1), text_shadow = (0, 0, 0, 1), text_pos = (0, -0.10000000000000001, 0), geom = bankModel, geom_scale = 0.080000000000000002, geom_pos = (0, 10, -0.26000000000000001), geom_hpr = (0, 0, 0), text_font = ToontownGlobals.getSignFont())
     self.depositArrow = DirectButton(parent = self, relief = None, image = arrowImageList, image_scale = (1, 1, 1), image3_color = Vec4(0.59999999999999998, 0.59999999999999998, 0.59999999999999998, 0.25), pos = (0.01, 0, 0.14999999999999999))
     self.withdrawArrow = DirectButton(parent = self, relief = None, image = arrowImageList, image_scale = (-1, 1, 1), image3_color = Vec4(0.59999999999999998, 0.59999999999999998, 0.59999999999999998, 0.25), pos = (-0.01, 0, -0.14999999999999999))
     self.depositArrow.bind(B1PRESS, self._BankGui__depositButtonDown)
     self.depositArrow.bind(B1RELEASE, self._BankGui__depositButtonUp)
     self.withdrawArrow.bind(B1PRESS, self._BankGui__withdrawButtonDown)
     self.withdrawArrow.bind(B1RELEASE, self._BankGui__withdrawButtonUp)
     if allowWithdraw:
         self.depositArrow.setPos(0.01, 0, 0.14999999999999999)
         self.withdrawArrow.setPos(-0.01, 0, -0.14999999999999999)
     else:
         self.depositArrow.setPos(0, 0, 0)
         self.withdrawArrow.hide()
     buttons.removeNode()
     jarGui.removeNode()
     arrowGui.removeNode()
     self._BankGui__updateTransaction(0)
 def load(self):
     self.notify.debug('load')
     DistributedMinigame.load(self)
     self.defineConstants()
     groundModels = [
         'phase_4/models/minigames/treehouse_2players',
         'phase_4/models/minigames/treehouse_2players',
         'phase_4/models/minigames/treehouse_3players',
         'phase_4/models/minigames/treehouse_4players']
     index = self.getNumPlayers() - 1
     self.ground = loader.loadModel(groundModels[index])
     self.ground.setHpr(180, -90, 0)
     self.dropShadow = loader.loadModelOnce('phase_3/models/props/drop_shadow')
     self.dropObjModels = { }
     for objType in DropObjectTypes:
         if objType.name not in [
             'anvil',
             self.fruitName]:
             continue
         
         model = loader.loadModel(objType.modelPath)
         self.dropObjModels[objType.name] = model
         modelScales = {
             'apple': 0.69999999999999996,
             'orange': 0.69999999999999996,
             'pear': 0.5,
             'coconut': 0.69999999999999996,
             'watermelon': 0.59999999999999998,
             'pineapple': 0.45000000000000001 }
         if modelScales.has_key(objType.name):
             model.setScale(modelScales[objType.name])
         
         if objType == Name2DropObjectType['pear']:
             model.setZ(-0.59999999999999998)
         
         if objType == Name2DropObjectType['coconut']:
             model.setP(180)
         
         if objType == Name2DropObjectType['watermelon']:
             model.setH(135)
             model.setZ(-0.5)
         
         if objType == Name2DropObjectType['pineapple']:
             model.setZ(-1.7)
         
         if objType == Name2DropObjectType['anvil']:
             model.setZ(-(self.ObjRadius))
         
         model.flattenMedium()
     
     self.music = base.loadMusic('phase_4/audio/bgm/MG_toontag.mid')
     self.sndGoodCatch = base.loadSfx('phase_4/audio/sfx/SZ_DD_treasure.mp3')
     self.sndOof = base.loadSfx('phase_4/audio/sfx/MG_cannon_hit_dirt.mp3')
     self.sndAnvilLand = base.loadSfx('phase_4/audio/sfx/AA_drop_anvil_miss.mp3')
     self.sndPerfect = base.loadSfx('phase_4/audio/sfx/ring_perfect.mp3')
     self.toonSDs = { }
     avId = self.localAvId
     toonSD = CatchGameToonSD.CatchGameToonSD(avId, self)
     self.toonSDs[avId] = toonSD
     toonSD.load()
     if self.WantSuits:
         suitTypes = [
             'f',
             'tm',
             'pp',
             'dt']
         self.suits = []
         for type in suitTypes:
             suit = Suit.Suit()
             d = AvatarDNA.AvatarDNA()
             d.newSuit(type)
             suit.setDNA(d)
             suit.pose('walk', 0)
             self.suits.append(suit)
         
     
     self._DistributedCatchGame__textGen = TextNode('ringGame')
     self._DistributedCatchGame__textGen.freeze()
     self._DistributedCatchGame__textGen.setFont(ToontownGlobals.getSignFont())
     self._DistributedCatchGame__textGen.setAlign(TextNode.ACenter)
     self.introMovie = self.getIntroMovie()
    def load(self):
        self.notify.debug('load')
        DistributedMinigame.load(self)
        self.timer = ToontownTimer.ToontownTimer()
        self.timer.posInTopRightCorner()
        self.timer.hide()
        self.room = loader.loadModel('phase_4/models/minigames/matching_room')
        self.buttonSounds = []
        for soundName in self.ButtonSoundNames:
            self.buttonSounds.append(base.loadSfx(soundName))

        self.correctSound = base.loadSfx('phase_4/audio/sfx/MG_pos_buzzer.wav')
        self.incorrectSound = base.loadSfx(
            'phase_4/audio/sfx/MG_neg_buzzer.wav')
        self.perfectSound = base.loadSfx('phase_4/audio/sfx/MG_win.mp3')
        self.fallSound = base.loadSfx('phase_4/audio/sfx/Mg_Tag_A.mp3')
        self.music = base.loadMusic(self.bgm)
        self.waitingText = DirectLabel(text=self.strPleaseWait,
                                       text_fg=(0.9, 0.9, 0.9, 1.0),
                                       frameColor=(1, 1, 1, 0),
                                       text_font=ToontownGlobals.getSignFont(),
                                       pos=(0, 0, -0.78),
                                       scale=0.12)
        self.roundText = DirectLabel(text='Round 1!',
                                     text_fg=self.normalTextColor,
                                     frameColor=(1, 1, 1, 0),
                                     text_font=ToontownGlobals.getSignFont(),
                                     pos=(0.014, 0, -0.84),
                                     scale=0.12)
        self.roundText.hide()
        self.waitingText.hide()
        matchingGameGui = loader.loadModel(
            'phase_3.5/models/gui/matching_game_gui')
        minnieArrow = matchingGameGui.find('**/minnieArrow')
        minnieX = matchingGameGui.find('**/minnieX')
        minnieCircle = matchingGameGui.find('**/minnieCircle')
        self.arrows = [None] * 5
        for x in range(0, 5):
            self.arrows[x] = minnieArrow.copyTo(hidden)
            self.arrows[x].hide()

        self.xs = [None] * 5
        for x in range(0, 5):
            self.xs[x] = minnieX.copyTo(hidden)
            self.xs[x].hide()

        self.statusBalls = []
        self.totalMoves = PatternGameGlobals.INITIAL_ROUND_LENGTH + PatternGameGlobals.ROUND_LENGTH_INCREMENT * (
            PatternGameGlobals.NUM_ROUNDS - 1)
        for x in range(0, 4):
            self.statusBalls.append([None] * self.totalMoves)

        for x in range(0, 4):
            for y in range(0, self.totalMoves):
                self.statusBalls[x][y] = minnieCircle.copyTo(hidden)
                self.statusBalls[x][y].hide()

        minnieArrow.removeNode()
        minnieX.removeNode()
        minnieCircle.removeNode()
        matchingGameGui.removeNode()
        self.minnie = Char.Char()
        m = self.minnie
        dna = AvatarDNA.AvatarDNA()
        dna.newChar('mn')
        m.setDNA(dna)
        m.setName(Localizer.Minnie)
        m.reparentTo(hidden)
        self.backRowHome = Point3(3, 11, 0)
        self.backRowXSpacing = 1.8
        self.frontRowHome = Point3(0, 18, 0)
        self.frontRowXSpacing = 3.0
        self.stdNumDanceStepPingFrames = self.minnie.getNumFrames(
            self.minnieAnimNames[0])
        self.stdNumDanceStepPingPongFrames = self.__numPingPongFrames(
            self.stdNumDanceStepPingFrames)
        self.buttonPressDelayPercent = (self.stdNumDanceStepPingFrames - 1.0
                                        ) / self.stdNumDanceStepPingPongFrames
        self.animPlayRates = []
        animPlayRate = 1.4
        animPlayRateMult = 1.06
        for i in range(PatternGameGlobals.NUM_ROUNDS):
            self.animPlayRates.append(animPlayRate)
            animPlayRate *= animPlayRateMult

        return
 def load(self, isPaid):
     if self.isLoaded == 1:
         return None
     
     self.isPaid = isPaid
     gui = loader.loadModelOnce('phase_3/models/gui/pick_a_toon_gui')
     gui2 = loader.loadModelOnce('phase_3/models/gui/quit_button')
     self.pickAToonBG = gui.find('**/av-chooser_FnlBG')
     self.pickAToonBG.reparentTo(hidden)
     self.pickAToonBG.setPos(0.0, 2.73, 0.0)
     self.pickAToonBG.setScale(1, 1, 1)
     self.title = OnscreenText(Localizer.AvatarChooserPickAToon, scale = 0.125, parent = hidden, font = ToontownGlobals.getSignFont(), fg = (1, 0.90000000000000002, 0.10000000000000001, 1), pos = (0.0, 0.81999999999999995))
     self.quitButton = DirectButton(image = (gui.find('**/QuitBtn_UP'), gui.find('**/QuitBtn_DN'), gui.find('**/QuitBtn_RLVR')), relief = None, text = Localizer.AvatarChooserQuit, text_font = ToontownGlobals.getSignFont(), text0_fg = (0.152, 0.75, 0.25800000000000001, 1), text1_fg = (0.152, 0.75, 0.25800000000000001, 1), text2_fg = (0.97699999999999998, 0.81599999999999995, 0.13300000000000001, 1), text_pos = (0, -0.035000000000000003), text_scale = 0.10000000000000001, scale = 1.05, pos = (0, 0, -0.92400000000000004), command = self._AvatarChooser__handleQuit)
     self.logoutButton = DirectButton(relief = None, image = (gui2.find('**/QuitBtn_UP'), gui2.find('**/QuitBtn_DN'), gui2.find('**/QuitBtn_RLVR')), image_scale = 1.1499999999999999, text = Localizer.OptionsPageLogout, text_font = ToontownGlobals.getSignFont(), text0_fg = (0.152, 0.75, 0.25800000000000001, 1), text1_fg = (0.152, 0.75, 0.25800000000000001, 1), text2_fg = (0.97699999999999998, 0.81599999999999995, 0.13300000000000001, 1), text_scale = 0.10000000000000001, text_pos = (0, -0.035000000000000003), pos = (1.105, 0, -0.92400000000000004), scale = 0.5, command = self._AvatarChooser__handleLogoutWithoutConfirm)
     self.logoutButton.hide()
     gui.removeNode()
     gui2.removeNode()
     self.panelList = []
     used_position_indexs = []
     for av in self.avatarList:
         panel = AvatarChoice.AvatarChoice(av, position = av.position, paid = isPaid)
         panel.setPos(POSITIONS[av.position])
         panel['image_color'] = COLORS[av.position]
         used_position_indexs.append(av.position)
         self.panelList.append(panel)
     
     for panelNum in range(0, MAX_AVATARS):
         if panelNum not in used_position_indexs:
             panel = AvatarChoice.AvatarChoice(position = panelNum)
             panel.setPos(POSITIONS[panelNum])
             panel['image_color'] = COLORS[panelNum]
             self.panelList.append(panel)
         
     
     if len(self.avatarList) > 0:
         self.initLookAtInfo()
     
     self.isLoaded = 1
Beispiel #39
0
    def __init__(self, av=None, position=0, paid=0):
        DirectButton.__init__(self,
                              relief=None,
                              text='',
                              text_font=ToontownGlobals.getSignFont())
        self.initialiseoptions(AvatarChoice)
        self.hasPaid = paid
        if not av:
            self.create = 1
            self.name = ''
            self.dna = None
        else:
            self.create = 0
            self.name = av.name
            self.dna = AvatarDNA.AvatarDNA(av.dna)
            self.wantName = av.wantName
            self.approvedName = av.approvedName
            self.rejectedName = av.rejectedName
            self.allowedName = av.allowedName
        self.position = position
        self.doneEvent = 'avChoicePanel-' + str(self.position)
        self.deleteWithPasswordFrame = None
        self.pickAToonGui = loader.loadModelOnce(
            'phase_3/models/gui/pick_a_toon_gui')
        self['image'] = self.pickAToonGui.find('**/av-chooser_Square_UP')
        self.setScale(1.01)
        if self.create:
            self['command'] = self._AvatarChoice__handleCreate
            self['text'] = (Localizer.AvatarChoiceMakeAToon, )
            self['text_pos'] = (0, 0)
            self['text0_scale'] = 0.10000000000000001
            self['text1_scale'] = 0.12
            self['text2_scale'] = 0.12
            self['text0_fg'] = (0, 1, 0.80000000000000004, 0.5)
            self['text1_fg'] = (0, 1, 0.80000000000000004, 1)
            self['text2_fg'] = (0.29999999999999999, 1, 0.90000000000000002, 1)
        else:
            self['command'] = self._AvatarChoice__handleChoice
            self['text'] = ('', Localizer.AvatarChoicePlayThisToon,
                            Localizer.AvatarChoicePlayThisToon)
            self['text_scale'] = 0.12
            self['text_fg'] = (1, 0.90000000000000002, 0.10000000000000001, 1)
            self.nameText = DirectLabel(
                parent=self,
                relief=None,
                scale=0.089999999999999997,
                pos=(0, 0, 0.27000000000000002),
                text=self.name,
                text_fg=(1, 1, 1, 1),
                text_shadow=(0, 0, 0, 1),
                text_wordwrap=7.5,
                text_font=ToontownGlobals.getToonFont(),
                state=DISABLED)
            if self.approvedName != '':
                self.nameText['text'] = self.approvedName

            guiButton = loader.loadModelOnce('phase_3/models/gui/quit_button')
            self.nameYourToonButton = DirectButton(
                parent=self,
                relief=None,
                image=(guiButton.find('**/QuitBtn_UP'),
                       guiButton.find('**/QuitBtn_DN'),
                       guiButton.find('**/QuitBtn_RLVR')),
                text=(Localizer.AvatarChoiceNameYourToon,
                      Localizer.AvatarChoiceNameYourToon,
                      Localizer.AvatarChoiceNameYourToon),
                text_fg=(1, 1, 1, 1),
                text_shadow=(0, 0, 0, 1),
                text_scale=0.14999999999999999,
                text_pos=(0, 0.029999999999999999),
                text_font=ToontownGlobals.getInterfaceFont(),
                pos=(-0.20000000000000001, 0, -0.29999999999999999),
                scale=0.45000000000000001,
                image_scale=(2, 1, 3),
                command=self._AvatarChoice__handleNameYourToon)
            guiButton.removeNode()
            self.statusText = DirectLabel(
                parent=self,
                relief=None,
                scale=0.089999999999999997,
                pos=(0, 0, -0.23999999999999999),
                text='',
                text_fg=(1, 1, 1, 1),
                text_shadow=(0, 0, 0, 1),
                text_wordwrap=7.5,
                text_font=ToontownGlobals.getToonFont(),
                state=DISABLED)
            if self.wantName != '':
                self.nameYourToonButton.hide()
                self.statusText['text'] = Localizer.AvatarChoiceNameReview
            elif self.approvedName != '':
                self.nameYourToonButton.hide()
                self.statusText['text'] = Localizer.AvatarChoiceNameApproved
            elif self.rejectedName != '':
                self.nameYourToonButton.hide()
                self.statusText['text'] = Localizer.AvatarChoiceNameRejected
            elif self.allowedName == 1 and toonbase.tcr.allowFreeNames(
            ) or self.hasPaid:
                self.nameYourToonButton.show()
                self.statusText['text'] = ''
            else:
                self.nameYourToonButton.hide()
                self.statusText['text'] = ''
            self.head = hidden.attachNewNode('head')
            self.head.setPosHprScale(0, 5, -0.10000000000000001, 180, 0, 0,
                                     0.23999999999999999, 0.23999999999999999,
                                     0.23999999999999999)
            self.head.reparentTo(self.stateNodePath[0], 20)
            self.head.instanceTo(self.stateNodePath[1], 20)
            self.head.instanceTo(self.stateNodePath[2], 20)
            self.headModel = ToonHead.ToonHead()
            self.headModel.setupHead(self.dna, forGui=1)
            self.headModel.reparentTo(self.head)
            self.headModel.startBlink()
            self.headModel.startLookAround()
            trashcanGui = loader.loadModelOnce(
                'phase_3/models/gui/trashcan_gui')
            self.deleteButton = DirectButton(
                parent=self,
                image=(trashcanGui.find('**/TrashCan_CLSD'),
                       trashcanGui.find('**/TrashCan_OPEN'),
                       trashcanGui.find('**/TrashCan_RLVR')),
                text=('', Localizer.AvatarChoiceDelete,
                      Localizer.AvatarChoiceDelete),
                text_fg=(1, 1, 1, 1),
                text_shadow=(0, 0, 0, 1),
                text_scale=0.14999999999999999,
                text_pos=(0, -0.10000000000000001),
                text_font=ToontownGlobals.getInterfaceFont(),
                relief=None,
                pos=(0.27000000000000002, 0, -0.25),
                scale=0.45000000000000001,
                command=self._AvatarChoice__handleDelete)
            trashcanGui.removeNode()
        self.resetFrameSize()
        return None
Beispiel #40
0
 def load(self):
     gui = loader.loadModelOnce('phase_3/models/gui/create_a_toon_gui')
     self.guiTopBar = DirectFrame(relief = None, image = gui.find('**/CrtATn_TopBar'), text = Localizer.CreateYourToon, text_font = ToontownGlobals.getSignFont(), text_fg = (0.0, 0.65000000000000002, 0.34999999999999998, 1), text_scale = 0.17999999999999999, text_pos = (0, -0.029999999999999999), pos = (0, 0, 0.85999999999999999))
     self.guiTopBar.hide()
     self.guiBottomBar = DirectFrame(relief = None, image = gui.find('**/CrtATn_BtmBar'), image_scale = (1.25, 1, 1), pos = (0.01, 0, -0.85999999999999999))
     self.guiBottomBar.hide()
     self.guiCheckButton = DirectButton(parent = self.guiBottomBar, relief = None, image = (gui.find('**/CrtAtoon_Btn1_UP'), gui.find('**/CrtAtoon_Btn1_DOWN'), gui.find('**/CrtAtoon_Btn1_RLLVR')), pos = (1.165, 0, -0.017999999999999999), command = self._MakeAToon__handleNext, text = ('', Localizer.MakeAToonDone, Localizer.MakeAToonDone), text_font = ToontownGlobals.getInterfaceFont(), text_scale = 0.080000000000000002, text_pos = (0, -0.029999999999999999), text_fg = (1, 1, 1, 1), text_shadow = (0, 0, 0, 1))
     self.guiCheckButton.hide()
     self.guiCancelButton = DirectButton(parent = self.guiBottomBar, relief = None, image = (gui.find('**/CrtAtoon_Btn2_UP'), gui.find('**/CrtAtoon_Btn2_DOWN'), gui.find('**/CrtAtoon_Btn2_RLLVR')), pos = (-1.179, 0, -0.010999999999999999), command = self._MakeAToon__handleCancel, text = ('', Localizer.MakeAToonCancel, Localizer.MakeAToonCancel), text_font = ToontownGlobals.getInterfaceFont(), text_scale = 0.080000000000000002, text_pos = (0, -0.029999999999999999), text_fg = (1, 1, 1, 1), text_shadow = (0, 0, 0, 1))
     self.guiCancelButton.hide()
     self.guiNextButton = DirectButton(parent = self.guiBottomBar, relief = None, image = (gui.find('**/CrtAtoon_Btn3_UP'), gui.find('**/CrtAtoon_Btn3_DN'), gui.find('**/CrtAtoon_Btn3_RLVR')), pos = (1.165, 0, -0.017999999999999999), command = self._MakeAToon__handleNext, text = ('', Localizer.MakeAToonNext, Localizer.MakeAToonNext), text_font = ToontownGlobals.getInterfaceFont(), text_scale = 0.080000000000000002, text_pos = (0, -0.029999999999999999), text_fg = (1, 1, 1, 1), text_shadow = (0, 0, 0, 1))
     self.guiNextButton.hide()
     self.guiLastButton = DirectButton(parent = self.guiBottomBar, relief = None, image = (gui.find('**/CrtAtoon_Btn3_UP'), gui.find('**/CrtAtoon_Btn3_DN'), gui.find('**/CrtAtoon_Btn3_RLVR')), image_scale = (-1.0, 1, 1), pos = (0.82499999999999996, 0, -0.017999999999999999), command = self._MakeAToon__handleLast, text = ('', Localizer.MakeAToonLast, Localizer.MakeAToonLast), text_font = ToontownGlobals.getInterfaceFont(), text_scale = 0.080000000000000002, text_pos = (0, -0.029999999999999999), text_fg = (1, 1, 1, 1), text_shadow = (0, 0, 0, 1))
     self.guiLastButton.hide()
     gui.removeNode()
     self.room = loader.loadModel('phase_3/models/gui/create_a_toon')
     self.roomWalls = self.room.find('**/wall_floor')
     self.draftingTable = self.room.find('**/drafting_table')
     self.easel = self.room.find('**/easel')
     self.sewingMachine = self.room.find('**/sewing_machine')
     ee = DirectFrame(pos = (-1, 1, 1), frameSize = (-0.01, 0.01, -0.01, 0.01), frameColor = (0, 0, 0, 0.050000000000000003), state = 'normal')
     ee.bind(B1PRESS, lambda x, ee = ee: self.toggleSlide())
     self.eee = ee
     self.stool = self.room.find('**/stool')
     self.stool.hide()
     self.draftingTable.hide()
     self.easel.hide()
     self.sewingMachine.hide()
     if not (self.warp):
         self.dna = AvatarDNA.AvatarDNA()
         animal = whrandom.choice(AvatarDNA.toonHeadAnimalIndices)
         head = AvatarDNA.toonHeadTypes[animal]
         torso = whrandom.choice(AvatarDNA.toonTorsoTypes[-3:])
         leg = whrandom.choice(AvatarDNA.toonLegTypes)
         self.dna.newToon((head, torso, leg, 'm'))
     else:
         self.dna = AvatarDNA.AvatarDNA()
         self.dna.makeFromNetString(self.namelessPotAv.dna)
     self.toon = Toon.Toon()
     self.toon.setDNA(self.dna)
     self.toon.useLOD(1000)
     self.toon.setNameVisible(0)
     self.toon.startBlink()
     self.toon.startLookAround()
     self.mickey = Char.Char()
     mickeyDNA = AvatarDNA.AvatarDNA()
     mickeyDNA.newChar('mk')
     self.mickey.setDNA(mickeyDNA)
     self.mickey.addActive()
     self.mickey.startEarTask()
     self.mickey.setNametagScale(0.80000000000000004)
     self.mickey.hideName()
     self.mickey.setPickable(1)
     self.mickey.nametag.getNametag3d().setChatWordwrap(8)
     self.minnie = Char.Char()
     minnieDNA = AvatarDNA.AvatarDNA()
     minnieDNA.newChar('mn')
     self.minnie.setDNA(minnieDNA)
     self.minnie.addActive()
     self.minnie.startEarTask()
     self.minnie.setNametagScale(0.80000000000000004)
     self.minnie.hideName()
     self.minnie.setPickable(1)
     self.minnie.nametag.getNametag3d().setChatWordwrap(8)
     self.gs.load()
     self.bs.load()
     self.cos.load()
     self.cls.load()
     self.ns.load()
     self.music = base.loadMusic('phase_3/audio/bgm/create_a_toon.mid')
     self.soundBack = base.loadSfx('phase_3/audio/sfx/GUI_create_toon_back.mp3')
     return None
 def __makeGui(self):
     if self.madeGui:
         return
     buttonModels = loader.loadModelOnce('phase_3.5/models/gui/inventory_gui')
     upButton = buttonModels.find('**/InventoryButtonUp')
     downButton = buttonModels.find('**/InventoryButtonDown')
     rolloverButton = buttonModels.find('**/InventoryButtonRollover')
     buttonModels.removeNode()
     crankModels = loader.loadModelOnce('phase_4/models/gui/fishing_crank')
     crank = crankModels.find('**/fishing_crank')
     crankArrow = crankModels.find('**/fishing_crank_arrow')
     crankModels.removeNode()
     jarGui = loader.loadModelOnce('phase_3.5/models/gui/jar_gui')
     jarImage = jarGui.find('**/Jar')
     jarGui.removeNode()
     self.castGui = NodePath('castGui')
     self.exitButton = DirectButton(parent=self.castGui, relief=None, text=Localizer.FishingExit, text_fg=(1, 1, 0.65, 1), text_pos=(0, -0.23), text_scale=0.8, image=(upButton, downButton, rolloverButton), image_color=(1, 0, 0, 1), image_scale=(15, 1, 11), pos=(-0.2, 0, -0.8), scale=0.12, command=self.__userExit)
     self.castButton = DirectButton(parent=self.castGui, relief=None, text=Localizer.FishingCast, text_fg=(1, 1, 0.65, 1), text3_fg=(0.8, 0.8, 0.8, 1), text_pos=(0, -0.23), text_scale=0.8, image=(upButton, downButton, rolloverButton), image_color=(1, 0, 0, 1), image3_color=(0.8, 0.5, 0.5, 1), image_scale=(15, 1, 11), pos=(-0.2, 0, -0.62), scale=0.12, command=self.__userCast)
     self.jar = DirectLabel(parent=self.castGui, relief=None, text=str(self.av.getMoney()), text_scale=0.2, text_fg=(0.95, 0.95, 0, 1), text_shadow=(0, 0, 0, 1), text_pos=(0, -0.1, 0), text_font=ToontownGlobals.getSignFont(), image=jarImage, pos=(-0.2, 0, -0.35), scale=0.65)
     self.reelGui = NodePath('reelGui')
     self.reelButton = DirectButton(parent=self.reelGui, relief=None, text=Localizer.FishingAutoReel, text_fg=(1, 1, 0.65, 1), text_pos=(0, -0.23), text_scale=0.8, image=(upButton, downButton, rolloverButton), image_color=(0, 0.7, 0, 1), image_scale=(24, 1, 11), pos=(1.0, 0, -0.3), scale=0.1, command=self.__userReel)
     self.crankGui = self.reelGui.attachNewNode('crankGui')
     arrow1 = crankArrow.copyTo(self.crankGui)
     arrow1.setColor(1, 0, 0, 1)
     arrow1.setPos(0.25, 0, -0.25)
     arrow2 = crankArrow.copyTo(self.crankGui)
     arrow2.setColor(1, 0, 0, 1)
     arrow2.setPos(-0.25, 0, 0.25)
     arrow2.setR(180)
     self.crankGui.setPos(-0.2, 0, -0.7)
     self.crankGui.setScale(0.5)
     self.crankHandle = DirectFrame(parent=self.crankGui, state=NORMAL, relief=None, image=crank)
     self.speedGauge = DirectWaitBar(parent=self.crankGui, relief=SUNKEN, frameSize=(-0.8, 0.8, -0.15, 0.15), borderWidth=(0.02, 0.02), scale=0.42, pos=(0, 0, 0.75), barColor=(0, 0.7, 0, 1))
     self.speedGauge.hide()
     self.tooSlow = DirectLabel(parent=self.speedGauge, relief=None, text=Localizer.FishingCrankTooSlow, scale=0.2, pos=(-1, 0, 0.05))
     self.tooFast = DirectLabel(parent=self.speedGauge, relief=None, text=Localizer.FishingCrankTooFast, scale=0.2, pos=(1, 0, 0.05))
     self.tooSlow.hide()
     self.tooFast.hide()
     self.itemGui = NodePath('itemGui')
     self.itemFrame = DirectFrame(parent=self.itemGui, relief=None, geom=getDefaultDialogGeom(), geom_color=ToontownGlobals.GlobalDialogColor, geom_scale=(1, 1, 0.5), text=Localizer.FishingItemFound, text_pos=(0, 0.08), text_scale=0.08, pos=(0, 0, 0.587))
     self.itemLabel = DirectLabel(parent=self.itemFrame, text='', text_scale=0.06, pos=(0, 0, -0.08))
     self.failureGui = NodePath('failureGui')
     self.failureFrame = DirectFrame(parent=self.failureGui, relief=None, geom=getDefaultDialogGeom(), geom_color=ToontownGlobals.GlobalDialogColor, geom_scale=(1.2, 1, 0.6), text=Localizer.FishingFailure, text_pos=(0, 0.12), text_scale=0.08, pos=(0, 0, 0.587))
     self.failureLabel = DirectLabel(parent=self.failureFrame, text='', text_scale=0.06, text_wordwrap=16, pos=(0, 0, -0.04))
     self.brokeGui = NodePath('brokeGui')
     self.brokeFrame = DirectFrame(parent=self.brokeGui, relief=None, geom=getDefaultDialogGeom(), geom_color=ToontownGlobals.GlobalDialogColor, geom_scale=(1.2, 1, 0.6), text=Localizer.FishingBrokeHeader, text_pos=(0, 0.12), text_scale=0.08, pos=(0, 0, 0.587))
     self.brokeLabel = DirectLabel(parent=self.brokeFrame, relief=None, text=Localizer.FishingBroke, text_scale=0.06, text_wordwrap=16, pos=(0, 0, -0.04))
     self.madeGui = 1
     return