本文整理汇总了Python中toontown.toonbase.ToontownGlobals类的典型用法代码示例。如果您正苦于以下问题:Python ToontownGlobals类的具体用法?Python ToontownGlobals怎么用?Python ToontownGlobals使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了ToontownGlobals类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: setupButtons
def setupButtons(self):
gui = loader.loadModel('phase_3/models/gui/tt_m_gui_mat_mainGui')
arrowImage = (gui.find('**/tt_t_gui_mat_shuffleArrowUp'), gui.find('**/tt_t_gui_mat_shuffleArrowDown'))
buttonImage = (gui.find('**/tt_t_gui_mat_shuffleUp'), gui.find('**/tt_t_gui_mat_shuffleDown'))
self.title = DirectLabel(aspect2d, relief=None, text=TTLocalizer.GloveGuiTitle,
text_fg=(0, 1, 0, 1), text_scale=0.15, text_font=ToontownGlobals.getSignFont(),
pos=(0, 0, -0.30), text_shadow=(1, 1, 1, 1))
self.notice = DirectLabel(aspect2d, relief=None, text='', text_fg=(1, 0, 0, 1), text_scale=0.11,
text_font=ToontownGlobals.getSignFont(), pos=(0, 0, -0.45), text_shadow=(1, 1, 1, 1))
self.color = DirectLabel(aspect2d, relief=None, text='', text_scale=0.11, text_font=ToontownGlobals.getSignFont(),
pos=(0, 0, -0.70), text_shadow=(1, 1, 1, 1))
self.buyButton = DirectButton(aspect2d, relief=None, image=buttonImage, text=TTLocalizer.GloveGuiBuy,
text_font=ToontownGlobals.getInterfaceFont(), text_scale=0.11, text_pos=(0, -0.02),
pos=(-0.60, 0, -0.90), text_fg=(1, 1, 1, 1), text_shadow=(0, 0, 0, 1), command=self.__exit, extraArgs=[GloveNPCGlobals.CHANGE])
self.cancelButton = DirectButton(aspect2d, relief=None, image=buttonImage, text=TTLocalizer.lCancel,
text_font=ToontownGlobals.getInterfaceFont(), text_scale=0.11, text_pos=(0, -0.02),
pos=(0.60, 0, -0.90), text_fg=(1, 1, 1, 1), text_shadow=(0, 0, 0, 1), command=self.__exit, extraArgs=[GloveNPCGlobals.USER_CANCEL])
self.downArrow = DirectButton(aspect2d, relief=None, image=arrowImage, pos=(-0.60, 0, -0.66))
self.upArrow = DirectButton(aspect2d, relief=None, image=arrowImage, pos=(0.60, 0, -0.66), scale=-1)
gui.removeNode()
示例2: __createNametag
def __createNametag(self, parent):
if self.nametagGroup == None:
self.nametagGroup = NametagGroup()
self.nametagGroup.setFont(ToontownGlobals.getToonFont())
self.nametagGroup.setSpeechFont(ToontownGlobals.getToonFont())
self.nametagGroup.setActive(0)
self.nametagGroup.setAvatar(self.partyPlannerHead)
self.nametagGroup.manage(base.marginManager)
self.nametagGroup.setColorCode(self.nametagGroup.CCNonPlayer)
self.nametagGroup.getNametag2d().setContents(0)
self.nametagNode = NametagFloat2d()
self.nametagNode.setContents(Nametag.CName)
self.nametagGroup.addNametag(self.nametagNode)
self.nametagGroup.setName(base.cr.partyManager.getPartyPlannerName())
self.nametagNP = parent.attachNewNode(self.nametagNode)
nametagPos = self.gui.find('**/step_01_partymanPeteNametag_locator').getPos()
self.nametagNP.setPosHprScale(nametagPos[0], 0, nametagPos[2], 0, 0, 0, 0.1, 1, 0.1)
self.chatNode = NametagFloat2d()
self.chatNode.setContents(Nametag.CSpeech | Nametag.CThought)
self.nametagGroup.addNametag(self.chatNode)
self.nametagGroup.setChat(TTLocalizer.PartyPlannerInstructions, CFSpeech)
self.chatNP = parent.attachNewNode(self.chatNode)
chatPos = self.gui.find('**/step_01_partymanPeteText_locator').getPos()
self.chatNP.setPosHprScale(chatPos[0], 0, chatPos[2], 0, 0, 0, 0.08, 1, 0.08)
return
示例3: __init__
def __init__(self, cr):
DistributedObject.DistributedObject.__init__(self, cr)
Level.Level.__init__(self)
self.lastToonZone = None
self.lastCamZone = 0
self.titleColor = (1, 1, 1, 1)
self.titleText = OnscreenText.OnscreenText(
"",
fg=self.titleColor,
shadow=(0, 0, 0, 1),
font=ToontownGlobals.getSuitFont(),
pos=(0, -0.5),
scale=0.16,
drawOrder=0,
mayChange=1,
)
self.smallTitleText = OnscreenText.OnscreenText(
"",
fg=self.titleColor,
font=ToontownGlobals.getSuitFont(),
pos=(0.65000000000000002, 0.90000000000000002),
scale=0.080000000000000002,
drawOrder=0,
mayChange=1,
bg=(0.5, 0.5, 0.5, 0.5),
align=TextNode.ARight,
)
self.zonesEnteredList = []
self.fColorZones = 0
self.scenarioIndex = 0
示例4: __init__
def __init__(self):
Avatar.Avatar.__init__(self)
self.setFont(ToontownGlobals.getSuitFont())
self.nametag.setSpeechFont(ToontownGlobals.getSuitFont())
self.setPlayerType(NametagGroup.CCSuit)
self.setPickable(0)
self.doorA = None
self.doorB = None
self.bubbleL = None
self.bubbleR = None
self.raised = 1
self.forward = 1
self.happy = 1
self.dizzy = 0
self.nowRaised = 1
self.nowForward = 1
self.nowHappy = 1
self.currentAnimIval = None
self.queuedAnimIvals = []
self.treadsLeftPos = 0
self.treadsRightPos = 0
self.healthBar = SuitHealthBar.SuitHealthBar()
self.animDoneEvent = 'BossCogAnimDone'
self.animIvalName = 'BossCogAnimIval'
self.warningSfx = loader.loadSfx('phase_9/audio/sfx/CHQ_GOON_tractor_beam_alarmed.ogg')
示例5: setFromAvatar
def setFromAvatar(self, av):
rewardIds = []
for q in av.quests:
questId, fromNpcId, toNpcId, rewardId, toonProgress = q
if rewardId == Quests.NA:
rewardId = Quests.getFinalRewardId(questId, fAll=1)
rewardIds.append(rewardId)
self.notify.debug('Ignoring rewards: %s' % rewardIds)
self.setRewardIndex(av.rewardTier, rewardIds, av.rewardHistory)
fishHp = int(len(av.fishCollection) / FishGlobals.FISH_PER_BONUS)
self.notify.debug('Adding %s hp for fish collection' % fishHp)
self.maxHp += fishHp
flowerHp = int(len(av.flowerCollection) / GardenGlobals.FLOWERS_PER_BONUS)
self.notify.debug('Adding %s hp for fish collection' % flowerHp)
self.maxHp += flowerHp
HQdepts = (ToontownGlobals.cogHQZoneId2deptIndex(ToontownGlobals.SellbotHQ), ToontownGlobals.cogHQZoneId2deptIndex(ToontownGlobals.LawbotHQ), ToontownGlobals.cogHQZoneId2deptIndex(ToontownGlobals.CashbotHQ))
levels = av.getCogLevels()
cogTypes = av.getCogTypes()
suitHp = 0
for dept in HQdepts:
suitHp += levels[dept]
self.notify.debug('Adding %s hp for cog suits' % suitHp)
self.maxHp += suitHp
kartingHp = int(av.kartingTrophies.count(1) / RaceGlobals.TrophiesPerCup)
self.notify.debug('Adding %s hp for karting trophies' % kartingHp)
self.maxHp += kartingHp
golfHp = int(av.golfTrophies.count(True) / GolfGlobals.TrophiesPerCup)
self.notify.debug('Adding %s hp for golf trophies' % golfHp)
self.maxHp += golfHp
示例6: load
def load(self):
gui = loader.loadModel('phase_3/models/gui/tt_m_gui_mat_mainGui')
guiBoyUp = gui.find('**/tt_t_gui_mat_boyUp')
guiBoyDown = gui.find('**/tt_t_gui_mat_boyDown')
guiGirlUp = gui.find('**/tt_t_gui_mat_girlUp')
guiGirlDown = gui.find('**/tt_t_gui_mat_girlDown')
self.boyButton = DirectButton(relief=None, image=(guiBoyUp,
guiBoyDown,
guiBoyUp,
guiBoyDown), image_scale=halfButtonScale, image1_scale=halfButtonHoverScale, image2_scale=halfButtonHoverScale, pos=(-0.4, 0, -0.8), command=self.createRandomBoy, text=('',
TTLocalizer.GenderShopBoyButtonText,
TTLocalizer.GenderShopBoyButtonText,
''), text_font=ToontownGlobals.getInterfaceFont(), text_scale=0.08, text_pos=(0, 0.19), text_fg=(1, 1, 1, 1), text_shadow=(0, 0, 0, 1))
self.boyButton.hide()
self.girlButton = DirectButton(relief=None, image=(guiGirlUp,
guiGirlDown,
guiGirlUp,
guiGirlDown), image_scale=halfButtonScale, image1_scale=halfButtonHoverScale, image2_scale=halfButtonHoverScale, pos=(0.4, 0, -0.8), command=self.createRandomGirl, text=('',
TTLocalizer.GenderShopGirlButtonText,
TTLocalizer.GenderShopGirlButtonText,
''), text_font=ToontownGlobals.getInterfaceFont(), text_scale=0.08, text_pos=(0, 0.19), text_fg=(1, 1, 1, 1), text_shadow=(0, 0, 0, 1))
self.girlButton.hide()
gui.removeNode()
del gui
self.toon = None
return
示例7: __init__
def __init__(self):
Avatar.Avatar.__init__(self)
self.setFont(ToontownGlobals.getSuitFont())
self.nametag.setSpeechFont(ToontownGlobals.getSuitFont())
self.setPlayerType(NametagGroup.CCSuit)
self.setPickable(0)
self.doorA = None
self.doorB = None
self.bubbleL = None
self.bubbleR = None
self.raised = 1
self.forward = 1
self.happy = 1
self.dizzy = 0
self.nowRaised = 1
self.nowForward = 1
self.nowHappy = 1
self.currentAnimIval = None
self.queuedAnimIvals = []
self.treadsLeftPos = 0
self.treadsRightPos = 0
self.healthBar = None
self.healthCondition = 0
self.animDoneEvent = 'BossCogAnimDone'
self.animIvalName = 'BossCogAnimIval'
self.attackSpeed = 1
return
示例8: createGui
def createGui(self):
self.title = DirectLabel(aspect2d, relief=None, text=TTLocalizer.GloveGuiTitle,
text_fg=(0, 1, 0, 1), text_scale=0.15, text_font=ToontownGlobals.getSignFont(),
pos=(0, 0, -0.30), text_shadow=(1, 1, 1, 1))
self.notice = DirectLabel(aspect2d, relief=None, text=TTLocalizer.GloveGuiNotice % ToontownGlobals.GloveCost,
text_fg=(1, 0, 0, 1), text_scale=0.11, text_font=ToontownGlobals.getSignFont(),
pos=(0, 0, -0.45), text_shadow=(1, 1, 1, 1))
self.color = DirectLabel(aspect2d, relief=None, text='',
text_scale=0.11, text_font=ToontownGlobals.getSignFont(),
pos=(0, 0, -0.70), text_shadow=(1, 1, 1, 1))
self.buyButton = DirectButton(aspect2d, relief=None, image=(self.shuffleUp, self.shuffleDown),
text=TTLocalizer.GloveGuiBuy, text_font=ToontownGlobals.getInterfaceFont(),
text_scale=0.11, text_pos=(0, -0.02), pos=(-0.60, 0, -0.90), text_fg=(1, 1, 1, 1),
text_shadow=(0, 0, 0, 1), command=self.handleBuy)
self.cancelButton = DirectButton(aspect2d, relief=None, image=(self.shuffleUp, self.shuffleDown),
text=TTLocalizer.GloveGuiCancel, text_font=ToontownGlobals.getInterfaceFont(),
text_scale=0.11, text_pos=(0, -0.02), pos=(0.60, 0, -0.90), text_fg=(1, 1, 1, 1),
text_shadow=(0, 0, 0, 1), command=self.leave)
self.leftButton = DirectButton(aspect2d, relief=None, image=(self.shuffleArrowUp, self.shuffleArrowDown),
pos=(-0.60, 0, -0.66), command=self.handleSetIndex, extraArgs=[-1])
self.rightButton = DirectButton(aspect2d, relief=None, image=(self.shuffleArrowUp, self.shuffleArrowDown),
pos=(0.60, 0, -0.66), scale=-1, command=self.handleSetIndex, extraArgs=[1])
self.updateGuiByIndex()
示例9: __init__
def __init__(self, version='n/a'):
DirectObject.__init__(self)
self.backgroundNodePath = render2d.attachNewNode('background', 0)
self.backgroundModel = loader.loadModel(
'phase_3/models/gui/loading-background.bam')
self.backgroundModel.reparentTo(self.backgroundNodePath)
self.backgroundNodePath.find('**/fg').removeNode()
self.backgroundNodePath.setScale(1, 1, 1)
self.logo = OnscreenImage(
parent=base.a2dTopCenter, image='phase_3/maps/toontown-logo.png',
scale=(1.0, 1, 0.5), pos=(0, 0, -0.85))
self.logo.setTransparency(TransparencyAttrib.MAlpha)
self.label = OnscreenText(
TTLocalizer.ClickToStartLabel, parent=base.a2dBottomCenter,
font=ToontownGlobals.getMinnieFont(), fg=Vec4(1, 1, 1, 1),
scale=0.1, align=TextNode.ACenter)
self.label.setZ(0.35)
self.versionLabel = OnscreenText(
'\x01white_shadow\x01%s\x02' % version, parent=base.a2dBottomRight,
font=ToontownGlobals.getMinnieFont(), fg=Vec4(0, 0, 0, 1),
scale=0.06, align=TextNode.ARight)
self.versionLabel.setPos(-0.025, 0.025)
self.setColorScale(Vec4(0, 0, 0, 0))
self.fadeTrack = None
self.logoPosTrack = None
self.logoScaleTrack = None
self.labelPosTrack = None
self.labelColorScaleTrack = None
示例10: loadDnaStore
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')
示例11: getPicture
def getPicture(self, avatar):
frame = self.makeFrame()
if self.nametagStyle == 100:
inFont = ToontownGlobals.getToonFont()
else:
inFont = ToontownGlobals.getNametagFont(self.nametagStyle)
nameTagDemo = DirectLabel(parent=frame, relief=None, pos=(0, 0, 0.24), scale=0.5, text=localAvatar.getName(), text_fg=(1.0, 1.0, 1.0, 1), text_shadow=(0, 0, 0, 1), text_font=inFont, text_wordwrap=9)
self.hasPicture = True
return (frame, None)
示例12: loadDnaStore
def loadDnaStore(self):
if not hasattr(self, "dnaStore"):
self.dnaStore = DNAStorage()
files = ("phase_4/dna/storage.pdna", "phase_3.5/dna/storage_interior.pdna")
dnaBulk = DNABulkLoader(self.dnaStore, files)
dnaBulk.loadDNAFiles()
self.dnaStore.storeFont("humanist", ToontownGlobals.getInterfaceFont())
self.dnaStore.storeFont("mickey", ToontownGlobals.getSignFont())
self.dnaStore.storeFont("suit", ToontownGlobals.getSuitFont())
示例13: loadGUI
def loadGUI(self):
self.gui = loader.loadModel("phase_13/models/parties/trampolineGUI")
self.gui.reparentTo(base.a2dTopLeft)
self.gui.setPos(0.115, 0, -1)
self.gui.hide()
self.toonIndicator = self.gui.find("**/trampolineGUI_MovingBar")
jumpLineLocator = self.gui.find("**/jumpLine_locator")
guiBean = self.gui.find("**/trampolineGUI_GreenJellyBean")
self.gui.find("**/trampolineGUI_GreenJellyBean").stash()
self.guiBeans = [
guiBean.instanceUnderNode(jumpLineLocator, self.uniqueName("guiBean%d" % i))
for i in range(self.numJellyBeans)
]
self.guiBeans[-1].setScale(1.5)
heightTextNode = TextNode(self.uniqueName("TrampolineActivity.heightTextNode"))
heightTextNode.setFont(ToontownGlobals.getSignFont())
heightTextNode.setAlign(TextNode.ALeft)
heightTextNode.setText("0.0")
heightTextNode.setShadow(0.05, 0.05)
heightTextNode.setShadowColor(0.0, 0.0, 0.0, 1.0)
heightTextNode.setTextColor(1.0, 1.0, 1.0, 1.0)
self.heightText = jumpLineLocator.attachNewNode(heightTextNode)
self.heightText.setX(0.15)
self.heightText.setScale(0.1)
self.heightText.setAlphaScale(0.0)
self.quitEarlyButtonModels = loader.loadModel("phase_3.5/models/gui/inventory_gui")
quitEarlyUp = self.quitEarlyButtonModels.find("**//InventoryButtonUp")
quitEarlyDown = self.quitEarlyButtonModels.find("**/InventoryButtonDown")
quitEarlyRollover = self.quitEarlyButtonModels.find("**/InventoryButtonRollover")
self.quitEarlyButton = DirectButton(
parent=base.a2dTopRight,
relief=None,
text=TTLocalizer.PartyTrampolineQuitEarlyButton,
text_fg=(1, 1, 0.65, 1),
text_pos=(0, -0.23),
text_scale=0.7,
image=(quitEarlyUp, quitEarlyDown, quitEarlyRollover),
image_color=(1, 0, 0, 1),
image_scale=(20, 1, 11),
pos=(-0.183, 0, -0.4),
scale=0.09,
command=self.leaveTrampoline,
)
self.quitEarlyButton.stash()
self.flashText = OnscreenText(
text="",
pos=(0.0, -0.45),
scale=0.2,
fg=(1.0, 1.0, 0.65, 1.0),
align=TextNode.ACenter,
font=ToontownGlobals.getSignFont(),
mayChange=True,
)
self.timer = PartyUtils.getNewToontownTimer()
self.timer.posInTopRightCorner()
return
示例14: loadNextGameTimer
def loadNextGameTimer(self):
self.nextGame = DirectLabel(parent=self, relief=None, text='', text_font=ToontownGlobals.getSignFont(), text_scale=TTLocalizer.BCGnextGame * BG.CardImageScale[2], text_fg=(1.0, 1.0, 1.0, 1), pos=(BG.GridXOffset, 0, 4 * BG.CardImageScale[2]))
self.nextGameTimer = ToontownTimer.ToontownTimer()
self.nextGameTimer.reparentTo(self.nextGame)
self.nextGameTimer.setPos(0, 0, -5 * BG.CardImageScale[2])
self.nextGameTimer.setProp('image', None)
self.nextGameTimer.setProp('text_font', ToontownGlobals.getSignFont())
self.nextGameTimer.setProp('text_scale', 0.2 * BG.CardImageScale[2])
self.nextGameTimer.setFontColor(Vec4(1.0, 1.0, 1.0, 1))
return
示例15: getFontByName
def getFontByName(self, fontname):
if fontname == "toon":
return ToontownGlobals.getToonFont()
elif fontname == "building":
return ToontownGlobals.getBuildingNametagFont()
elif fontname == "minnie":
return ToontownGlobals.getMinnieFont()
elif fontname == "suit":
return ToontownGlobals.getSuitFont()
else:
return MagicWordManager.MagicWordManager.getFontByName(self, fontname)