Example #1
0
    def delete(self):
        try:
            self.LocalToon_deleted
        except:
            self.LocalToon_deleted = 1
            Toon.unloadDialog()
            QuestParser.clear()
            DistributedToon.DistributedToon.delete(self)
            LocalAvatar.LocalAvatar.delete(self)

        return
Example #2
0
    def delete(self):
        
        try:
            pass
        except:
            self.LocalToon_deleted = 1
            Toon.unloadDialog()
            QuestParser.clear()
            DistributedToon.DistributedToon.delete(self)
            LocalAvatar.LocalAvatar.delete(self)

        return None
 def showPosts(self):
     self.hidePosts()
     self.posts = [Toon.Toon(), Toon.Toon(), Toon.Toon(), Toon.Toon()]
     for i in range(len(self.posts)):
         toon = self.posts[i]
         toon.setDNA(toonbase.localToon.getStyle())
         toon.reparentTo(render)
         x = self.StageHalfWidth
         y = self.StageHalfHeight
         if i > 1:
             x = -x
         if i % 2:
             y = -y
         toon.setPos(x, y, 0)
Example #4
0
    def playTutorialReward_3(self, value):
        self.tutRewardDialog_2.cleanup()
        import Toon, AvatarDNA

        def doneChat1(page, elapsed=0):
            self.track2.start()

        def doneChat2(elapsed):
            self.track2.pause()
            self.track3.start()

        def uniqueName(hook):
            return 'TutorialTom-' + hook

        self.tutorialTom = Toon.Toon()
        dna = AvatarDNA.AvatarDNA()
        dnaList = ('dls', 'ms', 'm', 'm', 7, 0, 7, 7, 2, 6, 2, 6, 2, 16)
        dna.newToonFromProperties(*dnaList)
        self.tutorialTom.setDNA(dna)
        self.tutorialTom.setName(Localizer.NPCToonNames[20000])
        self.tutorialTom.uniqueName = uniqueName
        questList = self.rewardPanel.getQuestIntervalList(toonbase.localToon, [
         0, 1])
        if questList:
            self.track1 = Sequence(Wait(1.0), Func(self.rewardPanel.initQuestFrame, toonbase.localToon, copy.deepcopy(toonbase.localToon.quests)), Wait(1.0), Sequence(questList), Wait(1.0), Func(self.rewardPanel.hide), Func(camera.setPosHpr, render, 34, 19.88, 3.48, 270.0, 60.0, 297.64), Func(toonbase.localToon.animFSM.request, 'neutral'), Func(toonbase.localToon.setPosHpr, 40.31, 22.0, -0.47, 150.0, 360.0, 0.0), Wait(0.5), Func(self.tutorialTom.reparentTo, render), Func(self.tutorialTom.show), Func(self.tutorialTom.setPosHpr, 40.29, 17.9, -0.47, 11.31, 0.0, 0.07), Func(self.tutorialTom.animFSM.request, 'TeleportIn'), Wait(1.517), Func(self.tutorialTom.animFSM.request, 'neutral'), Func(self.acceptOnce, self.tutorialTom.uniqueName('doneChatPage'), doneChat1), Func(self.tutorialTom.addActive), Func(self.tutorialTom.setLocalPageChat, Localizer.MovieTutorialReward3, None), name='tutorial-reward-3a')
            self.track2 = Sequence(Func(self.acceptOnce, self.tutorialTom.uniqueName('doneChatPage'), doneChat2), Func(self.tutorialTom.setLocalPageChat, Localizer.MovieTutorialReward4, 1), Func(self.tutorialTom.setPlayRate, 1.5, 'right-hand-start'), Func(self.tutorialTom.play, 'right-hand-start'), Wait(self.tutorialTom.getDuration('right-hand-start') / 1.5), Func(self.tutorialTom.loop, 'right-hand'), name='tutorial-reward-3b')
            self.track3 = Parallel(Sequence(Func(self.tutorialTom.setPlayRate, -1.8, 'right-hand-start'), Func(self.tutorialTom.play, 'right-hand-start'), Wait(self.tutorialTom.getDuration('right-hand-start') / 1.8), Func(self.tutorialTom.animFSM.request, 'neutral'), name='tutorial-reward-3ca'), Sequence(Wait(0.5), Func(self.tutorialTom.setChatAbsolute, Localizer.MovieTutorialReward5, CFSpeech | CFTimeout), Wait(1.0), Func(self.tutorialTom.animFSM.request, 'TeleportOut'), Wait(self.tutorialTom.getDuration('teleport')), Wait(1.0), Func(self.playTutorialReward_4, 0), name='tutorial-reward-3cb'), name='tutorial-reward-3c')
            self.track1.start()
        else:
            self.playTutorialReward_4(0)
        return
        return
Example #5
0
 def makeToon(self):
     self.toon = Toon.Toon()
     self.toon.setDNA(toonbase.localToon.getStyle())
     self.toon.getGeomNode().setDepthWrite(1)
     self.toon.getGeomNode().setDepthTest(1)
     self.toon.useLOD(500)
     self.toon.reparentTo(self.frame)
     self.toon.setPosHprScale(0, 10, -0.25, 210, 0, 0, 0.12, 0.12, 0.12)
Example #6
0
    def __init__(self, cr):
        
        try:
            pass
        except:
            self.LocalToon_initialized = 1
            DistributedToon.DistributedToon.__init__(self, cr)
            LocalAvatar.LocalAvatar.__init__(self, cr)
            self.nametag2dContents = Nametag.CSpeech
            self.nametag.getNametag2d().setContents(self.nametag2dContents & self.nametag2dDist)
            self.setPickable(0)
            Toon.loadDialog()
            self.isIt = 0
            self.inTutorial = 0
            self.tunnelX = 0.0
            self.estate = None

        return None
Example #7
0
    def __init__(self, cr):
        try:
            self.LocalToon_initialized
        except:
            self.LocalToon_initialized = 1
            DistributedToon.DistributedToon.__init__(self, cr)
            LocalAvatar.LocalAvatar.__init__(self, cr)
            self.nametag2dContents = Nametag.CSpeech
            self.nametag.getNametag2d().setContents(self.nametag2dContents & self.nametag2dDist)
            self.setPickable(0)
            Toon.loadDialog()
            self.isIt = 0
            self.inTutorial = 0
            self.tunnelX = 0.0
            self.estate = None

        return None
        return
 def __addToonModel(self):
     toon = Toon.Toon()
     toon.setDNA(self.avatar.style)
     toon.reparentTo(self)
     toon.setPos(0.45, 0, 0.3)
     toon.setH(180)
     toon.setScale(0.11)
     toon.loop('neutral')
     toon.setDepthWrite(True)
     toon.setDepthTest(True)
 def getIntroToon(toonProperties, parent, pos):
     toon = Toon.Toon()
     dna = AvatarDNA.AvatarDNA()
     dna.newToonFromProperties(*toonProperties)
     toon.setDNA(dna)
     toon.reparentTo(parent)
     toon.setPos(*pos)
     toon.setH(180)
     toon.startBlink()
     return toon
Example #10
0
 def _addToonModel(self):
     if self.avatar.style:
         toon = Toon.Toon()
         print(self.avatar.style)
         toon.setDNA(self.avatar.style)
         toon.reparentTo(self)
         toon.setPos(0.45, 0, 0.255)
         toon.setH(180)
         toon.setScale(0.11)
         toon.loop('neutral')
         toon.setDepthWrite(True)
         toon.setDepthTest(True)
         print(self.avatar.style)
         LerpHprInterval(toon, 10, (-180, 0, 0), (180, 0, 0)).loop()
     else:
         pass
 def showDropGrid(self):
     self.hideDropGrid()
     self.dropMarkers = []
     print 'dropRows: %s' % self.DropRows
     print 'dropCols: %s' % self.DropColumns
     for row in range(self.DropRows):
         self.dropMarkers.append([])
         rowList = self.dropMarkers[row]
         for column in range(self.DropColumns):
             toon = Toon.Toon()
             toon.setDNA(toonbase.localToon.getStyle())
             toon.reparentTo(render)
             toon.setScale(1.0 / 3)
             (x, y) = self.grid2world(column, row)
             toon.setPos(x, y, 0)
             rowList.append(toon)
Example #12
0
    def makeToon(self):
        if self.toon != None:
            del self.toon
        self.toon = Toon.Toon()
        self.toon.setDNA(toonbase.localToon.getStyle())
        self.toon.getGeomNode().setDepthWrite(1)
        self.toon.getGeomNode().setDepthTest(1)
        self.toon.useLOD(500)
        self.toon.reparentTo(self.frame)
        self.toon.setPosHprScale(0, 10, -0.25, 210, 0, 0, 0.15, 0.15, 0.15)
        self.toon.loop('neutral')
        try:
            anim = emoteAnimDict[self.name]
        except:
            print 'we didnt get the right animation'
            anim = 'neutral'

        self.toon.animFSM.request(anim)
        return
Example #13
0
 def unload(self):
     self.notify.debug('BASE: unload')
     del toonbase.curMinigame
     Toon.unloadMinigameAnims()
Example #14
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
Example #15
0
 def unloadBattleAnims(self):
     Toon.unloadBattleAnims()
Example #16
0
 def loadBattleAnims(self):
     Toon.loadBattleAnims()
Example #17
0
    return c, delta[2]

def lookAtToon():
    if lookAtTarget == 'head':
        c,height = calcHeadBounds()
    else:
        c,height = calcBodyBounds()
    # Move camera there
    camera.setHpr(render, -180, 0, 0)
    camera.setPos(render, c)
    # Move it back to fit around the target
    offset = ((height/2.0)/
              tan(deg2Rad((fillFactor * effectiveFOV)/2.0)))
    camera.setY(camera, -offset)
    
tt = Toon()
dna = ToonDNA.ToonDNA()
dna.newToonRandom(gender = 'f')
tt.setDNA(dna)
tt.reparentTo(render)

base.disableMouse()
base.camLens.setFov(fov,fov)

def convertServerDNAString(serverString):
    # Strip out blank space and take last 30 characters
    serverString = serverString.replace(' ', '')
    stringLen = 30
    serverString = serverString[-stringLen:]
    # Create a datagram from server string
    dg = PyDatagram()
 def unload(self):
     self.notify.debug('BASE: unload')
     del toonbase.curMinigame
     Toon.unloadMinigameAnims()
Example #19
0
 def load(self):
     Place.Place.load(self)
     Toon.loadBattleAnims()
     self.parentFSM.getStateNamed('street').addChild(self.fsm)
     self.tunnelOriginList = toonbase.tcr.hoodMgr.addLinkTunnelHooks(self, self.loader.nodeList)
 def loadBattleAnims(self):
     Toon.loadTutorialBattleAnims()
 def load(self):
     self.notify.debug('BASE: load')
     Toon.loadMinigameAnims()
 def unloadBattleAnims(self):
     Toon.unloadTutorialBattleAnims()
Example #23
0
 def load(self):
     Place.Place.load(self)
     Toon.loadBattleAnims()
     self.parentFSM.getStateNamed('street').addChild(self.fsm)
     self.tunnelOriginList = toonbase.tcr.hoodMgr.addLinkTunnelHooks(self, self.loader.nodeList)
Example #24
0
 def load(self):
     self.notify.debug('BASE: load')
     Toon.loadMinigameAnims()
 def unloadBattleAnims(self):
     Toon.unloadTutorialBattleAnims()
 def loadBattleAnims(self):
     Toon.loadTutorialBattleAnims()