def getPartyPlannerStyle(self): if self.partyPlannerStyle: return self.partyPlannerStyle else: dna = ToonDNA.ToonDNA() dna.newToonRandom() return dna
def __makeResistanceToon(self): if self.resistanceToon: return npc = Toon.Toon() npc.setName(TTLocalizer.ResistanceToonName) npc.setPickable(0) npc.setPlayerType(NametagGroup.CCNonPlayer) dna = ToonDNA.ToonDNA() dna.newToonRandom(11237, 'f', 1) dna.head = 'pls' npc.setDNAString(dna.makeNetString()) npc.animFSM.request('neutral') self.resistanceToon = npc self.resistanceToon.setPosHpr(*ToontownGlobals.CashbotRTBattleOneStartPosHpr) state = random.getstate() random.seed(self.doId) self.resistanceToon.suitType = SuitDNA.getRandomSuitByDept('m') random.setstate(state) self.fakeGoons = [] for i in xrange(self.numFakeGoons): goon = DistributedCashbotBossGoon.DistributedCashbotBossGoon(base.cr) goon.doId = -1 - i goon.setBossCogId(self.doId) goon.generate() goon.announceGenerate() self.fakeGoons.append(goon) self.__hideFakeGoons()
def buildFrame(self, name, dnaTuple): frame = loader.loadModel('phase_3.5/models/modules/trophy_frame') dna = ToonDNA.ToonDNA() apply(dna.newToonFromProperties, dnaTuple) head = ToonHead.ToonHead() head.setupHead(dna) head.setPosHprScale(0, -0.05, -0.05, 180, 0, 0, 0.55, 0.02, 0.55) if dna.head[0] == 'r': head.setZ(-0.15) elif dna.head[0] == 'h': head.setZ(0.05) elif dna.head[0] == 'm': head.setScale(0.45, 0.02, 0.45) head.reparentTo(frame) nameText = TextNode('trophy') nameText.setFont(ToontownGlobals.getToonFont()) nameText.setAlign(TextNode.ACenter) nameText.setTextColor(0, 0, 0, 1) nameText.setWordwrap(5.36 * FrameScale) nameText.setText(name) namePath = frame.attachNewNode(nameText.generate()) namePath.setPos(0, -0.03, -.6) namePath.setScale(0.186 / FrameScale) frame.setScale(FrameScale, 1.0, FrameScale) return frame
def getPicture(self, avatar): from src.toontown.toon import Toon self.hasPicture = True dna = ToonDNA.ToonDNA(type='t', dna=avatar.style) str = ClothingTypes[self.clothingType][CTString] if self.isShirt(): defn = ToonDNA.ShirtStyles[str] dna.topTex = defn[0] dna.topTexColor = defn[2][self.colorIndex][0] dna.sleeveTex = defn[1] dna.sleeveTexColor = defn[2][self.colorIndex][1] pieceNames = ('**/1000/**/torso-top', '**/1000/**/sleeves') else: defn = ToonDNA.BottomStyles[str] dna.botTex = defn[0] dna.botTexColor = defn[1][self.colorIndex] pieceNames = ('**/1000/**/torso-bot',) toon = Toon.Toon() toon.setDNA(dna) model = NodePath('clothing') for name in pieceNames: for piece in toon.findAllMatches(name): piece.wrtReparentTo(model) model.setH(180) toon.delete() return self.makeFrameModel(model)
def loadModel(self): DistributedStatuary.DistributedStatuary.loadModel(self) self.model.setScale(self.worldScale * 1.5, self.worldScale * 1.5, self.worldScale) self.getToonPropertiesFromOptional() dna = ToonDNA.ToonDNA() dna.newToonFromProperties(self.headType, self.torsoType, self.legType, self.gender, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0) self.setupStoneToon(dna) self.poseToonFromTypeIndex(self.typeIndex) self.toon.reparentTo(self.model)
def getIntroToon(toonProperties, parent, pos): toon = Toon.Toon() dna = ToonDNA.ToonDNA() dna.newToonFromProperties(*toonProperties) toon.setDNA(dna) toon.reparentTo(parent) toon.setPos(*pos) toon.setH(180) toon.startBlink() return toon
def load(self): self.notify.debug('load()') CogdoGameMovie.load(self) backgroundGui = loader.loadModel('phase_5/models/cogdominium/tt_m_gui_csa_flyThru') self.bg = backgroundGui.find('**/background') self.chatBubble = backgroundGui.find('**/chatBubble') self.chatBubble.setScale(6.5, 6.5, 7.3) self.chatBubble.setPos(0.32, 0, -0.78) self.bg.setScale(5.2) self.bg.setPos(0.14, 0, -0.6667) self.bg.reparentTo(aspect2d) self.chatBubble.reparentTo(aspect2d) self.frame = DirectFrame(geom=self.bg, relief=None, pos=(0.2, 0, -0.6667)) self.bg.wrtReparentTo(self.frame) self.gameTitleText = DirectLabel(parent=self.frame, text=TTLocalizer.CogdoExecutiveSuiteTitle, scale=TTLocalizer.MRPgameTitleText * 0.8, text_align=TextNode.ACenter, text_font=getSignFont(), text_fg=(1.0, 0.33, 0.33, 1.0), pos=TTLocalizer.MRgameTitleTextPos, relief=None) self.chatBubble.wrtReparentTo(self.frame) self.frame.hide() backgroundGui.removeNode() self.toonDNA = ToonDNA.ToonDNA() self.toonDNA.newToonFromProperties('dss', 'ss', 'm', 'm', 2, 0, 2, 2, 1, 8, 1, 8, 1, 14, 0) self.toonHead = Toon.Toon() self.toonHead.setDNA(self.toonDNA) self.makeSuit('sc') self.toonHead.getGeomNode().setDepthWrite(1) self.toonHead.getGeomNode().setDepthTest(1) self.toonHead.loop('neutral') self.toonHead.setPosHprScale(-0.73, 0, -1.27, 180, 0, 0, 0.18, 0.18, 0.18) self.toonHead.reparentTo(hidden) self.toonHead.startBlink() self.clipPlane = self.toonHead.attachNewNode(PlaneNode('clip')) self.clipPlane.node().setPlane(Plane(0, 0, 1, 0)) self.clipPlane.setPos(0, 0, 2.45) self._toonDialogueSfx = loader.loadSfx('phase_3.5/audio/dial/AV_dog_long.ogg') self._camHelperNode = NodePath('CamHelperNode') self._camHelperNode.reparentTo(render) dialogue = TTLocalizer.CogdoExecutiveSuiteIntroMessage def start(): self.frame.show() base.setCellsAvailable(base.bottomCells + base.leftCells + base.rightCells, 0) def showShopOwner(): self._setCamTarget(self._shopOwner, -10, offset=Point3(0, 0, 5)) def end(): self._dialogueLabel.reparentTo(hidden) self.toonHead.reparentTo(hidden) self.frame.hide() base.setCellsAvailable(base.bottomCells + base.leftCells + base.rightCells, 1) self._stopUpdateTask() self._ival = Sequence(Func(start), Func(self.displayLine, dialogue), Func(showShopOwner), ParallelEndTogether(camera.posInterval(self.cameraMoveDuration, Point3(8, 0, 13), blendType='easeInOut'), camera.hprInterval(0.5, self._camHelperNode.getHpr(), blendType='easeInOut')), Wait(self.introDuration), Func(end)) self._startUpdateTask() return
def createNpcToonHead(self, toNpcId): npcInfo = NPCToons.NPCToonDict[toNpcId] dnaList = npcInfo[2] gender = npcInfo[3] if dnaList == 'r': dnaList = NPCToons.getRandomDNA(toNpcId, gender) dna = ToonDNA.ToonDNA() dna.newToonFromProperties(*dnaList) head = ToonHead.ToonHead() head.setupHead(dna, forGui=1) self.fitGeometry(head, fFlip=1) return head
def enterCreateHouse(self): style = ToonDNA.ToonDNA() style.makeFromNetString(self.toon['setDNAString'][0]) self.mgr.air.dbInterface.createObject( self.mgr.air.dbId, self.mgr.air.dclassesByName['DistributedHouseAI'], { 'setName' : [self.toon['setName'][0]], 'setAvatarId' : [self.toon['ID']], 'setGender': [0 if style.getGender() == 'm' else 1] }, self.__handleCreate)
def resetCloset(self): self.ignoreAll() taskMgr.remove(self.uniqueName('popupChangeClothesGUI')) taskMgr.remove(self.uniqueName('lerpCamera')) taskMgr.remove(self.uniqueName('lerpToon')) if self.closetGUI: self.closetGUI.hideButtons() self.closetGUI.exit() self.closetGUI.unload() self.closetGUI = None del self.av self.av = base.localAvatar style = self.av.getStyle() self.oldStyle = ToonDNA.ToonDNA() self.oldStyle.makeFromNetString(style.makeNetString()) self.topDeleted = 0 self.bottomDeleted = 0 return Task.done
def _createRandomToon(self, gender): if self.toon: self.toon.stopBlink() self.toon.stopLookAroundNow() self.toon.delete() self.dna = ToonDNA.ToonDNA() self.dna.newToonRandom(gender=gender, stage=1) self.toon = Toon.Toon() self.toon.setDNA(self.dna) self.toon.useLOD(1000) self.toon.setNameVisible(0) self.toon.startBlink() self.toon.startLookAround() self.toon.reparentTo(render) self.toon.setPos(self.makeAToon.toonPosition) self.toon.setHpr(self.makeAToon.toonHpr) self.toon.setScale(self.makeAToon.toonScale) self.toon.loop('neutral') self.makeAToon.setNextButtonState(DGG.NORMAL) self.makeAToon.setToon(self.toon) messenger.send('MAT-newToonCreated')
def __handleDelete(self, t_or_b): if t_or_b == ClosetGlobals.SHIRT: itemList = self.closetGUI.tops trashIndex = self.closetGUI.topChoice swapFunc = self.closetGUI.swapTop removeFunc = self.closetGUI.removeTop self.topDeleted = self.topDeleted | 1 def setItemChoice(i): self.closetGUI.topChoice = i else: itemList = self.closetGUI.bottoms trashIndex = self.closetGUI.bottomChoice swapFunc = self.closetGUI.swapBottom removeFunc = self.closetGUI.removeBottom self.bottomDeleted = self.bottomDeleted | 1 def setItemChoice(i): self.closetGUI.bottomChoice = i if len(itemList) > 1: trashDNA = ToonDNA.ToonDNA() trashItem = self.av.getStyle().makeNetString() trashDNA.makeFromNetString(trashItem) if trashIndex == 0: swapFunc(1) else: swapFunc(-1) removeFunc(trashIndex) self.sendUpdate('removeItem', [trashItem, t_or_b]) swapFunc(0) self.closetGUI.updateTrashButtons() else: self.notify.warning( "cant delete this item(type = %s), since we don't have a replacement" % t_or_b)
def popupChangeClothesGUI(self, task): self.notify.debug('popupChangeClothesGUI') self.purchaseDoneEvent = self.uniqueName('purchaseDone') self.swapEvent = self.uniqueName('swap') self.cancelEvent = self.uniqueName('cancel') self.accept(self.purchaseDoneEvent, self.__proceedToCheckout) self.accept(self.swapEvent, self.__handleSwap) self.accept(self.cancelEvent, self._handleCancel) self.deleteEvent = self.uniqueName('delete') if self.isOwner: self.accept(self.deleteEvent, self.__handleDelete) if not self.closetGUI: self.closetGUI = ClosetGUI.ClosetGUI( self.isOwner, self.purchaseDoneEvent, self.cancelEvent, self.swapEvent, self.deleteEvent, self.topList, self.botList) self.closetGUI.load() if self.gender != self.ownerGender: self.closetGUI.setGender(self.ownerGender) self.closetGUI.enter(base.localAvatar) self.closetGUI.showButtons() style = self.av.getStyle() self.oldStyle = ToonDNA.ToonDNA() self.oldStyle.makeFromNetString(style.makeNetString()) return Task.done
def rpc_getAvatarDetails(self, avId): """ Summary: Responds with basic details on the avatar associated with the provided [avId]. Parameters: [int avId] = The ID of the avatar to query basic details on. Example response: On success: { 'name': 'Toon Name', 'species': 'cat', 'head-color': 'Red', 'max-hp': 15, 'online': True } On failure: None """ dclassName, fields = self.rpc_queryObject(avId) if dclassName == 'DistributedToon': result = {} result['name'] = fields['setName'][0] dna = ToonDNA.ToonDNA() dna.makeFromNetString(fields['setDNAString'][0]) result['species'] = ToonDNA.getSpeciesName(dna.head) result['head-color'] = TTLocalizer.NumToColor[dna.headColor] result['max-hp'] = fields['setMaxHp'][0] result['online'] = (avId in self.air.friendsManager.onlineToons) result['lastSeen'] = fields['setLastSeen'][0] return result
def load(self): gui = loader.loadModel('phase_3/models/gui/tt_m_gui_mat_mainGui') gui.flattenMedium() guiAcceptUp = gui.find('**/tt_t_gui_mat_okUp') guiAcceptUp.flattenStrong() guiAcceptDown = gui.find('**/tt_t_gui_mat_okDown') guiAcceptDown.flattenStrong() guiCancelUp = gui.find('**/tt_t_gui_mat_closeUp') guiCancelUp.flattenStrong() guiCancelDown = gui.find('**/tt_t_gui_mat_closeDown') guiCancelDown.flattenStrong() guiNextUp = gui.find('**/tt_t_gui_mat_nextUp') guiNextUp.flattenStrong() guiNextDown = gui.find('**/tt_t_gui_mat_nextDown') guiNextDown.flattenStrong() guiNextDisabled = gui.find('**/tt_t_gui_mat_nextDisabled') guiNextDisabled.flattenStrong() skipTutorialUp = gui.find('**/tt_t_gui_mat_skipUp') skipTutorialUp.flattenStrong() skipTutorialDown = gui.find('**/tt_t_gui_mat_skipDown') skipTutorialDown.flattenStrong() rotateUp = gui.find('**/tt_t_gui_mat_arrowRotateUp') rotateUp.flattenStrong() rotateDown = gui.find('**/tt_t_gui_mat_arrowRotateDown') rotateDown.flattenStrong() self.guiTopBar = DirectFrame(relief=None, text=TTLocalizer.CreateYourToon, text_font=ToontownGlobals.getSignFont(), text_fg=(0.0, 0.65, 0.35, 1), text_scale=0.18, text_pos=(0, -0.03), pos=(0, 0, 0.86)) self.guiTopBar.hide() self.guiBottomBar = DirectFrame(relief=None, image_scale=(1.25, 1, 1), pos=(0.01, 0, -0.86)) self.guiBottomBar.hide() self.guiCheckButton = DirectButton( parent=self.guiBottomBar, relief=None, image=(guiAcceptUp, guiAcceptDown, guiAcceptUp, guiAcceptDown), image_scale=halfButtonScale, image1_scale=halfButtonHoverScale, image2_scale=halfButtonHoverScale, pos=(1.165, 0, -0.018), command=self.__handleNext, text=('', TTLocalizer.MakeAToonDone, TTLocalizer.MakeAToonDone), text_font=ToontownGlobals.getInterfaceFont(), text_scale=0.08, text_align=TextNode.ARight, text_pos=(0.075, 0.13), text_fg=(1, 1, 1, 1), text_shadow=(0, 0, 0, 1)) self.guiCheckButton.setPos(-0.13, 0, 0.13) self.guiCheckButton.reparentTo(base.a2dBottomRight) self.guiCheckButton.hide() self.guiCancelButton = DirectButton( parent=self.guiBottomBar, relief=None, image=(guiCancelUp, guiCancelDown, guiCancelUp, guiCancelDown), image_scale=halfButtonScale, image1_scale=halfButtonHoverScale, image2_scale=halfButtonHoverScale, pos=(-1.179, 0, -0.011), command=self.__handleCancel, text=('', TTLocalizer.MakeAToonCancel, TTLocalizer.MakeAToonCancel), text_font=ToontownGlobals.getInterfaceFont(), text_scale=TTLocalizer.MATguiCancelButton, text_pos=(0, 0.115), text_fg=(1, 1, 1, 1), text_shadow=(0, 0, 0, 1)) self.guiCancelButton.setPos(0.13, 0, 0.13) self.guiCancelButton.reparentTo(base.a2dBottomLeft) self.guiCancelButton.hide() self.guiNextButton = DirectButton( parent=self.guiBottomBar, relief=None, image=(guiNextUp, guiNextDown, guiNextUp, guiNextDisabled), image_scale=(0.3, 0.3, 0.3), image1_scale=(0.35, 0.35, 0.35), image2_scale=(0.35, 0.35, 0.35), pos=(1.165, 0, -0.018), command=self.__handleNext, text=('', TTLocalizer.MakeAToonNext, TTLocalizer.MakeAToonNext, ''), text_font=ToontownGlobals.getInterfaceFont(), text_scale=TTLocalizer.MATguiNextButton, text_pos=(0, 0.115), text_fg=(1, 1, 1, 1), text_shadow=(0, 0, 0, 1)) self.guiNextButton.setPos(-0.13, 0, 0.13) self.guiNextButton.reparentTo(base.a2dBottomRight) self.guiNextButton.hide() self.guiLastButton = DirectButton( parent=self.guiBottomBar, relief=None, image=(guiNextUp, guiNextDown, guiNextUp, guiNextDown), image3_color=Vec4(0.5, 0.5, 0.5, 0.75), image_scale=(-0.3, 0.3, 0.3), image1_scale=(-0.35, 0.35, 0.35), image2_scale=(-0.35, 0.35, 0.35), pos=(0.825, 0, -0.018), command=self.__handleLast, text=('', TTLocalizer.MakeAToonLast, TTLocalizer.MakeAToonLast, ''), text_font=ToontownGlobals.getInterfaceFont(), text_scale=0.08, text_pos=(0, 0.115), text_fg=(1, 1, 1, 1), text_shadow=(0, 0, 0, 1)) self.guiLastButton.setPos(-0.37, 0, 0.13) self.guiLastButton.reparentTo(base.a2dBottomRight) self.guiLastButton.hide() self.rotateLeftButton = DirectButton(parent=self.guiBottomBar, relief=None, image=(rotateUp, rotateDown, rotateUp, rotateDown), image_scale=(-0.4, 0.4, 0.4), image1_scale=(-0.5, 0.5, 0.5), image2_scale=(-0.5, 0.5, 0.5), pos=(-0.355, 0, 0.36)) self.rotateLeftButton.flattenMedium() self.rotateLeftButton.reparentTo(base.a2dBottomCenter) self.rotateLeftButton.hide() self.rotateLeftButton.bind(DGG.B1PRESS, self.rotateToonLeft) self.rotateLeftButton.bind(DGG.B1RELEASE, self.stopToonRotateLeftTask) self.rotateRightButton = DirectButton(parent=self.guiBottomBar, relief=None, image=(rotateUp, rotateDown, rotateUp, rotateDown), image_scale=(0.4, 0.4, 0.4), image1_scale=(0.5, 0.5, 0.5), image2_scale=(0.5, 0.5, 0.5), pos=(0.355, 0, 0.36)) self.rotateRightButton.flattenStrong() self.rotateRightButton.reparentTo(base.a2dBottomCenter) self.rotateRightButton.hide() self.rotateRightButton.bind(DGG.B1PRESS, self.rotateToonRight) self.rotateRightButton.bind(DGG.B1RELEASE, self.stopToonRotateRightTask) gui.removeNode() self.roomDropActor = Actor() self.roomDropActor.loadModel('phase_3/models/makeatoon/roomAnim_model') self.roomDropActor.loadAnims( {'drop': 'phase_3/models/makeatoon/roomAnim_roomDrop'}) self.roomDropActor.reparentTo(render) self.dropJoint = self.roomDropActor.find('**/droppingJoint') self.roomSquishActor = Actor() self.roomSquishActor.loadModel( 'phase_3/models/makeatoon/roomAnim_model') self.roomSquishActor.loadAnims( {'squish': 'phase_3/models/makeatoon/roomAnim_roomSquish'}) self.roomSquishActor.reparentTo(render) self.squishJoint = self.roomSquishActor.find('**/scalingJoint') self.propSquishActor = Actor() self.propSquishActor.loadModel( 'phase_3/models/makeatoon/roomAnim_model') self.propSquishActor.loadAnims( {'propSquish': 'phase_3/models/makeatoon/roomAnim_propSquish'}) self.propSquishActor.reparentTo(render) self.propSquishActor.pose('propSquish', 0) self.propJoint = self.propSquishActor.find('**/propJoint') self.spotlightActor = Actor() self.spotlightActor.loadModel( 'phase_3/models/makeatoon/roomAnim_model') self.spotlightActor.loadAnims({ 'spotlightShake': 'phase_3/models/makeatoon/roomAnim_spotlightShake' }) self.spotlightActor.reparentTo(render) self.spotlightJoint = self.spotlightActor.find('**/spotlightJoint') ee = DirectFrame(pos=(-1, 1, 1), frameSize=(-.01, 0.01, -.01, 0.01), frameColor=(0, 0, 0, 0.05), state='normal') ee.bind(DGG.B1PRESS, lambda x, ee=ee: self.toggleSlide()) self.eee = ee self.room = loader.loadModel( 'phase_3/models/makeatoon/tt_m_ara_mat_room') self.room.flattenMedium() self.genderWalls = self.room.find('**/genderWalls') self.genderWalls.flattenStrong() self.genderProps = self.room.find('**/genderProps') self.genderProps.flattenStrong() self.bodyWalls = self.room.find('**/bodyWalls') self.bodyWalls.flattenStrong() self.bodyProps = self.room.find('**/bodyProps') self.bodyProps.flattenStrong() self.colorWalls = self.room.find('**/colorWalls') self.colorWalls.flattenStrong() self.colorProps = self.room.find('**/colorProps') self.colorProps.flattenStrong() self.clothesWalls = self.room.find('**/clothWalls') self.clothesWalls.flattenMedium() self.clothesProps = self.room.find('**/clothProps') self.clothesProps.flattenMedium() self.nameWalls = self.room.find('**/nameWalls') self.nameWalls.flattenStrong() self.nameProps = self.room.find('**/nameProps') self.nameProps.flattenStrong() self.background = self.room.find('**/background') self.background.flattenStrong() self.background.reparentTo(render) self.floor = self.room.find('**/floor') self.floor.flattenStrong() self.floor.reparentTo(render) self.spotlight = self.room.find('**/spotlight') self.spotlight.reparentTo(self.spotlightJoint) self.spotlight.setColor(1, 1, 1, 0.3) self.spotlight.setPos(1.18, -1.27, 0.41) self.spotlight.setScale(2.6) self.spotlight.setHpr(0, 0, 0) smokeSeqNode = SequenceNode('smoke') smokeModel = loader.loadModel( 'phase_3/models/makeatoon/tt_m_ara_mat_smoke') smokeFrameList = list(smokeModel.findAllMatches('**/smoke_*')) smokeFrameList.reverse() for smokeFrame in smokeFrameList: smokeSeqNode.addChild(smokeFrame.node()) smokeSeqNode.setFrameRate(12) self.smoke = render.attachNewNode(smokeSeqNode) self.smoke.setScale(1, 1, 0.75) self.smoke.hide() if self.warp: self.dna = ToonDNA.ToonDNA() 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.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.ogg') self.musicVolume = base.config.GetFloat('makeatoon-music-volume', 1) self.sfxVolume = base.config.GetFloat('makeatoon-sfx-volume', 1) self.soundBack = base.loadSfx( 'phase_3/audio/sfx/GUI_create_toon_back.ogg') self.crashSounds = map(base.loadSfx, [ 'phase_3/audio/sfx/tt_s_ara_mat_crash_boing.ogg', 'phase_3/audio/sfx/tt_s_ara_mat_crash_glassBoing.ogg', 'phase_3/audio/sfx/tt_s_ara_mat_crash_wood.ogg', 'phase_3/audio/sfx/tt_s_ara_mat_crash_woodBoing.ogg', 'phase_3/audio/sfx/tt_s_ara_mat_crash_woodGlass.ogg' ])
def __handleFriendInvitation(self, avId, avName, inviterDna, context): dna = ToonDNA.ToonDNA() dna.makeFromNetString(inviterDna) if not base.localAvatar.isIgnored(avId): FriendInvitee.FriendInvitee(avId, avName, dna, context)
def setDNAString(self, dnaString): self.style = ToonDNA.ToonDNA() self.style.makeFromNetString(dnaString.decode('base64'))
def load(self): CogdoGameMovie.load(self) self.toonDNA = ToonDNA.ToonDNA() self.toonDNA.newToonFromProperties('dss', 'ss', 'm', 'm', 2, 0, 2, 2, 1, 8, 1, 8, 1, 14, 0) self.toonHead = Toon.Toon() self.toonHead.setDNA(self.toonDNA) self.makeSuit('sc') self.toonHead.getGeomNode().setDepthWrite(1) self.toonHead.getGeomNode().setDepthTest(1) self.toonHead.loop('neutral') self.toonHead.setPosHprScale(-0.73, 0, -1.27, 180, 0, 0, 0.18, 0.18, 0.18) self.toonHead.reparentTo(hidden) self.toonHead.startBlink() self.cogHead = Suit.Suit() self.cogDNA = SuitDNA.SuitDNA() self.cogDNA.newSuit('ms') self.cogHead.setDNA(self.cogDNA) self.cogHead.getGeomNode().setDepthWrite(1) self.cogHead.getGeomNode().setDepthTest(1) self.cogHead.loop('neutral') self.cogHead.setPosHprScale(-0.73, 0, -1.46, 180, 0, 0, 0.14, 0.14, 0.14) self.cogHead.reparentTo(hidden) self.cogHead.nametag3d.hide() self.clipPlane = self.toonHead.attachNewNode(PlaneNode('clip')) self.clipPlane.node().setPlane(Plane(0, 0, 1, 0)) self.clipPlane.setPos(0, 0, 2.45) audioMgr = base.cogdoGameAudioMgr self._cogDialogueSfx = audioMgr.createSfx('cogDialogue') self._toonDialogueSfx = audioMgr.createSfx('toonDialogue') suitData = Globals.SuitData[Globals.SuitTypes.Boss] bossSuit = Suit.Suit() d = SuitDNA.SuitDNA() d.newSuit(suitData['dnaName']) bossSuit.setDNA(d) bossSuit.nametag3d.stash() bossSuit.nametag.destroy() bossSuit.setScale(suitData['scale']) bossSuit.loop('neutral') bossSuit.reparentTo(render) bossSuit.setPos(self._exit, -5, -5, 0) bossSuit.lookAt(self._exit) self._suits.append(bossSuit) self._camHelperNode = NodePath('CamHelperNode') self._camHelperNode.reparentTo(render) dialogue = TTLocalizer.CogdoMazeIntroMovieDialogue introDuration = Globals.IntroDurationSeconds waitDuration = introDuration / len(dialogue) def start(): camera.wrtReparentTo(render) self._exit.open(animate=False) def showBoss(): self._setCamTarget(bossSuit, 20, offset=Point3(0, 0, 7), angle=Point3(0, 15, 0)) bossSuit.loop('victory') self._state = 1 def showExit(): self._setCamTarget(self._exit, 10, offset=Point3(0, 0, 0), angle=Point3(0, 60, 0)) self._exit.close() self._state = 2 showExitIval = Parallel( camera.posInterval(waitDuration * 0.5, (10, -25, 20), other=self._exit, blendType='easeInOut'), Sequence( Wait(waitDuration * 0.25), Func(bossSuit.play, 'effort'), camera.hprInterval(waitDuration * 0.25, (30, -30, 0), blendType='easeInOut'), Func(self._exit.close), Wait(waitDuration * 0.5))) def showWaterCooler(): wc = self._maze.getWaterCoolers()[0] self._setCamTarget(wc, 25, angle=Point3(-30, 60, 0)) camera.wrtReparentTo(self._camHelperNode) self._state = 3 def end(): self._stopUpdateTask() self._ival = Sequence( Func(start), Func(self.displayLine, 'toon', self._getRandomLine(dialogue[0])), showExitIval, Func(showWaterCooler), Func(self.displayLine, 'toon', self._getRandomLine(dialogue[1])), Wait(waitDuration), Func(showBoss), bossSuit.hprInterval(1.0, bossSuit.getHpr() + Point3(180, 0, 0), blendType='easeInOut'), Func(self.displayLine, 'toon', self._getRandomLine(dialogue[2])), Wait(waitDuration - 1.0), Func(end)) self._startUpdateTask()
def load(self): CogdoGameMovie.load(self) self.toonDNA = ToonDNA.ToonDNA() self.toonDNA.newToonFromProperties('dss', 'ss', 'm', 'm', 2, 0, 2, 2, 1, 8, 1, 8, 1, 14, 0) self.toonHead = Toon.Toon() self.toonHead.setDNA(self.toonDNA) self.makeSuit('sc') self.toonHead.getGeomNode().setDepthWrite(1) self.toonHead.getGeomNode().setDepthTest(1) self.toonHead.loop('neutral') self.toonHead.setPosHprScale(-0.73, 0, -1.27, 180, 0, 0, 0.18, 0.18, 0.18) self.toonHead.reparentTo(hidden) self.toonHead.startBlink() self.cogHead = Suit.Suit() self.cogDNA = SuitDNA.SuitDNA() self.cogDNA.newSuit('le') self.cogHead.setDNA(self.cogDNA) self.cogHead.getGeomNode().setDepthWrite(1) self.cogHead.getGeomNode().setDepthTest(1) self.cogHead.loop('neutral') self.cogHead.setPosHprScale(-0.74, 0, -1.79, 180, 0, 0, 0.12, 0.14, 0.14) self.cogHead.reparentTo(hidden) self.cogHead.nametag3d.hide() self.clipPlane = self.toonHead.attachNewNode(PlaneNode('clip')) self.clipPlane.node().setPlane(Plane(0, 0, 1, 0)) self.clipPlane.setPos(0, 0, 2.45) audioMgr = base.cogdoGameAudioMgr self._cogDialogueSfx = audioMgr.createSfx('cogDialogue') self._toonDialogueSfx = audioMgr.createSfx('toonDialogue') def start(): camera.wrtReparentTo(render) self._startUpdateTask() def end(): self._stopUpdateTask() introDuration = Globals.Gameplay.IntroDurationSeconds dialogue = TTLocalizer.CogdoFlyingIntroMovieDialogue waitDur = introDuration / len(dialogue) flyDur = introDuration - waitDur * 0.5 flyThroughIval = Parallel( camera.posInterval(flyDur, self._exit.getPos(render) + Point3(0, -22, 1), blendType='easeInOut'), camera.hprInterval(flyDur, Point3(0, 5, 0), blendType='easeInOut')) self._ival = Sequence( Func(start), Parallel( flyThroughIval, Sequence( Func(self.displayLine, 'cog', self._getRandomLine(dialogue[0])), Wait(waitDur), Func(self.displayLine, 'toon', self._getRandomLine(dialogue[1])), Wait(waitDur), Func(self.displayLine, 'cog', self._getRandomLine(dialogue[2])), Wait(waitDur))), Func(end))
def __init__(self, av=None, position=0): DirectButton.__init__(self, relief=None, text='', text_font=ToontownGlobals.getSignFont()) self.initialiseoptions(AvatarChoice) self.mode = None if not av: self.mode = AvatarChoice.MODE_CREATE self.name = '' self.dna = None else: self.mode = AvatarChoice.MODE_CHOOSE self.name = av.name self.dna = ToonDNA.ToonDNA(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.loadModel( 'phase_3/models/gui/tt_m_gui_pat_mainGui') self.buttonBgs = [] self.buttonBgs.append( self.pickAToonGui.find('**/tt_t_gui_pat_squareRed')) self.buttonBgs.append( self.pickAToonGui.find('**/tt_t_gui_pat_squareGreen')) self.buttonBgs.append( self.pickAToonGui.find('**/tt_t_gui_pat_squarePurple')) self.buttonBgs.append( self.pickAToonGui.find('**/tt_t_gui_pat_squareBlue')) self.buttonBgs.append( self.pickAToonGui.find('**/tt_t_gui_pat_squarePink')) self.buttonBgs.append( self.pickAToonGui.find('**/tt_t_gui_pat_squareYellow')) self['image'] = self.buttonBgs[position] self.setScale(1.01) if self.mode is AvatarChoice.MODE_CREATE: self['command'] = self.__handleCreate self['text'] = (TTLocalizer.AvatarChoiceMakeAToon, ) self['text_pos'] = (0, 0) self['text0_scale'] = 0.1 self['text1_scale'] = TTLocalizer.ACmakeAToon self['text2_scale'] = TTLocalizer.ACmakeAToon self['text0_fg'] = (0, 1, 0.8, 0.5) self['text1_fg'] = (0, 1, 0.8, 1) self['text2_fg'] = (0.3, 1, 0.9, 1) else: self['command'] = self.__handleChoice self['text'] = ('', TTLocalizer.AvatarChoicePlayThisToon, TTLocalizer.AvatarChoicePlayThisToon) self['text_scale'] = TTLocalizer.ACplayThisToon self['text_fg'] = (1, 0.9, 0.1, 1) self.nameText = DirectLabel( parent=self, relief=None, scale=0.08, pos=NAME_POSITIONS[position], text=self.name, hpr=(0, 0, NAME_ROTATIONS[position]), text_fg=(1, 1, 1, 1), text_shadow=(0, 0, 0, 1), text_wordwrap=8, text_font=ToontownGlobals.getToonFont(), state=DGG.DISABLED) if self.approvedName != '': self.nameText['text'] = self.approvedName guiButton = loader.loadModel('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=(TTLocalizer.AvatarChoiceNameYourToon, TTLocalizer.AvatarChoiceNameYourToon, TTLocalizer.AvatarChoiceNameYourToon), text_fg=(1, 1, 1, 1), text_shadow=(0, 0, 0, 1), text_scale=0.15, text_pos=(0, 0.03), text_font=ToontownGlobals.getInterfaceFont(), pos=(-0.2, 0, -0.3), scale=0.45, image_scale=(2, 1, 3), command=self.__handleCreate) guiButton.removeNode() self.statusText = DirectLabel( parent=self, relief=None, scale=0.09, pos=(0, 0, -0.24), text='', text_fg=(1, 1, 1, 1), text_shadow=(0, 0, 0, 1), text_wordwrap=7.5, text_scale=TTLocalizer.ACstatusText, text_font=ToontownGlobals.getToonFont(), state=DGG.DISABLED) if self.wantName != '': self.nameYourToonButton.hide() self.statusText['text'] = TTLocalizer.AvatarChoiceNameReview elif self.approvedName != '': self.nameYourToonButton.hide() self.statusText['text'] = TTLocalizer.AvatarChoiceNameApproved elif self.rejectedName != '': self.nameYourToonButton.hide() self.statusText['text'] = TTLocalizer.AvatarChoiceNameRejected elif self.allowedName == 1: self.nameYourToonButton.show() self.statusText['text'] = '' else: self.nameYourToonButton.hide() self.statusText['text'] = '' self.head = hidden.attachNewNode('head') self.head.setPosHprScale(0, 5, -0.1, 180, 0, 0, 0.24, 0.24, 0.24) 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) animalStyle = self.dna.getAnimal() bodyScale = ToontownGlobals.toonBodyScales[animalStyle] self.headModel.setScale(bodyScale / 0.75) self.headModel.startBlink() self.headModel.startLookAround() trashcanGui = loader.loadModel('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=('', TTLocalizer.AvatarChoiceDelete, TTLocalizer.AvatarChoiceDelete), text_fg=(1, 1, 1, 1), text_shadow=(0, 0, 0, 1), text_scale=0.15, text_pos=(0, -0.1), text_font=ToontownGlobals.getInterfaceFont(), relief=None, pos=DELETE_POSITIONS[position], scale=0.45, command=self.__handleDelete) trashcanGui.removeNode() self.resetFrameSize() self.avForLogging = None if av: self.avForLogging = str(av.id) else: self.avForLogging = None return