本文整理汇总了Python中src.toontown.hood.ZoneUtil类的典型用法代码示例。如果您正苦于以下问题:Python ZoneUtil类的具体用法?Python ZoneUtil怎么用?Python ZoneUtil使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了ZoneUtil类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: updateMap
def updateMap(self):
if self.av:
hoodId = ZoneUtil.getCanonicalHoodId(self.av.getLocation()[1])
zoneId = ZoneUtil.getCanonicalBranchZone(self.av.getLocation()[1])
try:
mapsGeom = loader.loadModel('phase_4/models/questmap/%s_maps' % ToontownGlobals.dnaMap[hoodId])
except:
self.stop()
return
mapImage = mapsGeom.find('**/%s_%s_english' % (ToontownGlobals.dnaMap[hoodId], zoneId))
if not mapImage.isEmpty():
self.container['image'] = mapImage
self.resetFrameSize()
self.cornerPosInfo = QuestMapGlobals.CornerPosTable.get('%s_%s_english' % (ToontownGlobals.dnaMap[hoodId], zoneId))
self.hqPosInfo = QuestMapGlobals.HQPosTable.get('%s_%s_english' % (ToontownGlobals.dnaMap[hoodId], zoneId))
self.fishingSpotInfo = QuestMapGlobals.FishingSpotPosTable.get('%s_%s_english' % (ToontownGlobals.dnaMap[hoodId], zoneId))
self.cogInfoPos = QuestMapGlobals.CogInfoPosTable.get('%s_%s_english' % (ToontownGlobals.dnaMap[hoodId], zoneId))
self.cogInfoFrame.setPos(self.cogInfoPos)
self.hide()
self.hoodId = hoodId
self.zoneId = zoneId
self.updateQuestInfo()
self.updateCogInfo()
taskMgr.add(self.update, 'questMapUpdate')
else:
self.stop()
mapsGeom.removeNode()
示例2: enteringARace
def enteringARace(self, status):
if not status['where'] == 'racetrack':
return 0
if ZoneUtil.isDynamicZone(status['zoneId']):
return status['hoodId'] == self.hood.hoodId
else:
return ZoneUtil.getHoodId(status['zoneId']) == self.hood.hoodId
示例3: enter
def enter(self):
ShtikerPage.ShtikerPage.enter(self)
try:
zone = base.cr.playGame.getPlace().getZoneId()
except:
zone = 0
if base.localAvatar.lastHood >= ToontownGlobals.BossbotHQ:
self.safeZoneButton['text'] = TTLocalizer.MapPageBackToCogHQ
else:
self.safeZoneButton['text'] = TTLocalizer.MapPageBackToPlayground
if zone and ZoneUtil.isPlayground(zone) or self.book.safeMode:
self.safeZoneButton.hide()
else:
self.safeZoneButton.show()
if base.cr.playGame.getPlaceId() == ToontownGlobals.MyEstate and base.cr.playGame.hood.loader.atMyEstate() or self.book.safeMode:
self.goHomeButton.hide()
elif base.housingEnabled:
self.goHomeButton.show()
if base.cr.playGame.getPlaceId() == ToontownGlobals.MyEstate:
if base.cr.playGame.hood.loader.atMyEstate():
self.hoodLabel['text'] = TTLocalizer.MapPageYouAreAtHome
self.hoodLabel.show()
else:
avatar = base.cr.identifyAvatar(base.cr.playGame.hood.loader.estateOwnerId)
if avatar:
avName = avatar.getName()
self.hoodLabel['text'] = TTLocalizer.MapPageYouAreAtSomeonesHome % TTLocalizer.GetPossesive(avName)
self.hoodLabel.show()
elif zone:
hoodName = ToontownGlobals.hoodNameMap.get(ZoneUtil.getCanonicalHoodId(zone), ('',))[-1]
streetName = ToontownGlobals.StreetNames.get(ZoneUtil.getCanonicalBranchZone(zone), ('',))[-1]
if hoodName:
self.hoodLabel['text'] = TTLocalizer.MapPageYouAreHere % (hoodName, streetName)
self.hoodLabel.show()
else:
self.hoodLabel.hide()
else:
self.hoodLabel.hide()
hoodsVisited = base.localAvatar.hoodsVisited
hoodTeleportList = base.localAvatar.getTeleportAccess()
for hood in self.allZones:
label = self.labels[self.allZones.index(hood)]
clouds = self.clouds[self.allZones.index(hood)]
if not self.book.safeMode and hood in hoodsVisited:
label['text_fg'] = (0, 0, 0, 1)
label.show()
for cloud in clouds:
cloud.hide()
fullname = base.cr.hoodMgr.getFullnameFromId(hood)
if hood in hoodTeleportList:
text = TTLocalizer.MapPageGoTo % fullname
label['text'] = ('', text, text)
else:
label['text'] = ('', fullname, fullname)
else:
label.hide()
for cloud in clouds:
cloud.show()
示例4: enteringAGolfCourse
def enteringAGolfCourse(self, status):
if not status["where"] == "golfcourse":
return 0
if ZoneUtil.isDynamicZone(status["zoneId"]):
return status["hoodId"] == self.hood.hoodId
else:
return ZoneUtil.getHoodId(status["zoneId"]) == self.hood.hoodId
示例5: kickToPlayground
def kickToPlayground(self, retCode):
if retCode == 0:
msg = TTLocalizer.EstateOwnerLeftMessage % HouseGlobals.BOOT_GRACE_PERIOD
self.__popupKickoutMessage(msg)
elif retCode == 1:
zoneId = base.localAvatar.lastHood
self.doneStatus = {'loader': ZoneUtil.getBranchLoaderName(zoneId),
'where': ZoneUtil.getToonWhereName(zoneId),
'how': 'teleportIn',
'hoodId': zoneId,
'zoneId': zoneId,
'shardId': None,
'avId': -1}
messenger.send(self.doneEvent)
elif retCode == 2:
zoneId = base.localAvatar.lastHood
self.doneStatus = {'loader': ZoneUtil.getBranchLoaderName(zoneId),
'where': ZoneUtil.getToonWhereName(zoneId),
'how': 'teleportIn',
'hoodId': zoneId,
'zoneId': zoneId,
'shardId': None,
'avId': -1}
messenger.send(self.doneEvent)
else:
self.notify.error('unknown reason for exiting estate')
示例6: genDNAFileName
def genDNAFileName(self):
zoneId = ZoneUtil.getCanonicalZoneId(self.getZoneId())
hoodId = ZoneUtil.getCanonicalHoodId(zoneId)
hood = ToontownGlobals.dnaMap[hoodId]
phase = ToontownGlobals.streetPhaseMap[hoodId]
if hoodId == zoneId:
zoneId = 'sz'
return 'phase_%s/dna/%s_%s.pdna' % (phase, hood, zoneId)
示例7: forcedExit
def forcedExit(self, avId):
target_sz = base.localAvatar.defaultZone
base.cr.playGame.getPlace().fsm.request('teleportOut', [{'loader': ZoneUtil.getLoaderName(target_sz),
'where': ZoneUtil.getWhereName(target_sz, 1),
'how': 'teleportIn',
'hoodId': target_sz,
'zoneId': target_sz,
'shardId': None,
'avId': -1}], force=1)
return
示例8: lookupDNAFileName
def lookupDNAFileName(self, zoneId):
zoneId = ZoneUtil.getCanonicalZoneId(zoneId)
hoodId = ZoneUtil.getCanonicalHoodId(zoneId)
hood = ToontownGlobals.dnaMap[hoodId]
if hoodId == zoneId:
zoneId = 'sz'
phaseNum = ToontownGlobals.phaseMap[hoodId]
else:
phaseNum = ToontownGlobals.streetPhaseMap[hoodId]
return 'phase_%s/dna/%s_%s.pdna' % (phaseNum, hood, zoneId)
示例9: handleWaitForSetZoneResponse
def handleWaitForSetZoneResponse(self, requestStatus):
hoodId = requestStatus['hoodId']
canonicalHoodId = ZoneUtil.getCanonicalZoneId(hoodId)
toHoodPhrase = ToontownGlobals.hoodNameMap[canonicalHoodId][0]
hoodName = ToontownGlobals.hoodNameMap[canonicalHoodId][-1]
zoneId = requestStatus['zoneId']
requestStatus['loader'] = 'cogHQLoader' if ZoneUtil.isCogHQZone(hoodId) else requestStatus['loader']
loaderName = requestStatus['loader']
avId = requestStatus.get('avId', -1)
ownerId = requestStatus.get('ownerId', avId)
if base.config.GetBool('want-qa-regression', 0):
self.notify.info('QA-REGRESSION: NEIGHBORHOODS: Visit %s' % hoodName)
count = ToontownGlobals.hoodCountMap[canonicalHoodId]
if loaderName == 'safeZoneLoader':
count += ToontownGlobals.safeZoneCountMap[canonicalHoodId]
elif loaderName == 'townLoader':
count += ToontownGlobals.townCountMap[canonicalHoodId]
if not loader.inBulkBlock:
if hoodId == ToontownGlobals.MyEstate:
if avId == -1:
loader.beginBulkLoad('hood', TTLocalizer.HeadingToYourEstate, count, 1, TTLocalizer.TIP_ESTATE, zoneId)
else:
owner = base.cr.identifyAvatar(ownerId)
if owner == None:
friend = base.cr.identifyAvatar(avId)
if friend != None:
avName = friend.getName()
loader.beginBulkLoad('hood', TTLocalizer.HeadingToFriend % avName, count, 1, TTLocalizer.TIP_ESTATE, zoneId)
else:
self.notify.warning("we can't perform this teleport")
return
else:
avName = owner.getName()
loader.beginBulkLoad('hood', TTLocalizer.HeadingToEstate % avName, count, 1, TTLocalizer.TIP_ESTATE, zoneId)
elif ZoneUtil.isCogHQZone(zoneId):
loader.beginBulkLoad('hood', TTLocalizer.HeadingToHood % {'to': toHoodPhrase,
'hood': hoodName}, count, 1, TTLocalizer.TIP_COGHQ, zoneId)
elif ZoneUtil.isGoofySpeedwayZone(zoneId):
loader.beginBulkLoad('hood', TTLocalizer.HeadingToHood % {'to': toHoodPhrase,
'hood': hoodName}, count, 1, TTLocalizer.TIP_KARTING, zoneId)
else:
loader.beginBulkLoad('hood', TTLocalizer.HeadingToHood % {'to': toHoodPhrase,
'hood': hoodName}, count, 1, TTLocalizer.TIP_GENERAL, zoneId)
if hoodId == ToontownGlobals.Tutorial:
self.loadDnaStoreTutorial()
else:
if not hasattr(self, 'dnaStore'):
self.loadDnaStore()
hoodClass = self.getHoodClassByNumber(canonicalHoodId)
self.hood = hoodClass(self.fsm, self.hoodDoneEvent, self.dnaStore, hoodId)
self.hood.load()
self.hood.loadLoader(requestStatus)
if not base.placeBeforeObjects:
loader.endBulkLoad('hood')
return
示例10: load
def load(self, zoneId):
self.zoneId = zoneId
self.parentFSMState.addChild(self.fsm)
self.loadBattleAnims()
self.branchZone = ZoneUtil.getBranchZone(zoneId)
self.canonicalBranchZone = ZoneUtil.getCanonicalBranchZone(zoneId)
self.music = base.loadMusic(self.musicFile)
self.activityMusic = base.loadMusic(self.activityMusicFile)
self.battleMusic = base.loadMusic('phase_3.5/audio/bgm/encntr_general_bg.ogg')
self.townBattle = TownBattle.TownBattle(self.townBattleDoneEvent)
self.townBattle.load()
示例11: kickToonsOut
def kickToonsOut(self):
if not self.localToonOnBoard:
zoneId = self.cr.playGame.hood.hoodId
self.cr.playGame.getPlace().fsm.request('teleportOut', [{'loader': ZoneUtil.getLoaderName(zoneId),
'where': ZoneUtil.getToonWhereName(zoneId),
'how': 'teleportIn',
'hoodId': zoneId,
'zoneId': zoneId,
'shardId': None,
'avId': -1}])
return
示例12: enterReward
def enterReward(self, ts = 0):
base.localAvatar.b_setParent(ToontownGlobals.SPHidden)
request = {'loader': ZoneUtil.getBranchLoaderName(self.extZoneId),
'where': ZoneUtil.getToonWhereName(self.extZoneId),
'how': 'elevatorIn',
'hoodId': ZoneUtil.getHoodId(self.extZoneId),
'zoneId': self.extZoneId,
'shardId': None,
'avId': base.localAvatar.doId,
'bldgDoId': self.distBldgDoId}
messenger.send('DSIDoneEvent', [request])
return
示例13: getRequestStatus
def getRequestStatus(self):
zoneId = self.otherZoneId
request = {'loader': ZoneUtil.getBranchLoaderName(zoneId),
'where': ZoneUtil.getToonWhereName(zoneId),
'how': 'doorIn',
'hoodId': ZoneUtil.getHoodId(zoneId),
'zoneId': zoneId,
'shardId': None,
'avId': -1,
'allowRedirect': 0,
'doorDoId': self.otherDoId}
return request
示例14: localToonDied
def localToonDied(self):
target_sz = ZoneUtil.getSafeZoneId(localAvatar.defaultZone)
place = self.cr.playGame.getPlace()
place.fsm.request('died', [{'loader': ZoneUtil.getLoaderName(target_sz),
'where': ZoneUtil.getWhereName(target_sz, 1),
'how': 'teleportIn',
'hoodId': target_sz,
'zoneId': target_sz,
'shardId': None,
'avId': -1,
'battle': 1}])
return
示例15: exitCogdoBuilding
def exitCogdoBuilding(self):
if base.localAvatar.hp < 0:
return
base.localAvatar.b_setParent(ToontownGlobals.SPHidden)
request = {'loader': ZoneUtil.getBranchLoaderName(self.extZoneId),
'where': ZoneUtil.getToonWhereName(self.extZoneId),
'how': 'elevatorIn',
'hoodId': ZoneUtil.getHoodId(self.extZoneId),
'zoneId': self.extZoneId,
'shardId': None,
'avId': -1,
'bldgDoId': self.distBldgDoId}
messenger.send('DSIDoneEvent', [request])
return