本文整理汇总了Python中panda3d.core.CardMaker.setName方法的典型用法代码示例。如果您正苦于以下问题:Python CardMaker.setName方法的具体用法?Python CardMaker.setName怎么用?Python CardMaker.setName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类panda3d.core.CardMaker
的用法示例。
在下文中一共展示了CardMaker.setName方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: ToonBlitzAssetMgr
# 需要导入模块: from panda3d.core import CardMaker [as 别名]
# 或者: from panda3d.core.CardMaker import setName [as 别名]
class ToonBlitzAssetMgr(DirectObject):
notify = DirectNotifyGlobal.directNotify.newCategory('DistributedToonBlitzAssets')
def __init__(self, game):
self.__defineConstants()
self.game = game
self.load()
def __defineConstants(self):
pass
def load(self):
self.world = NodePath('ToonBlitzWorld')
self.background = loader.loadModel('phase_4/models/minigames/toonblitz_game')
self.background.reparentTo(self.world)
self.startingWall = loader.loadModel('phase_4/models/minigames/toonblitz_game_wall')
self.startingPipe = loader.loadModel('phase_4/models/minigames/toonblitz_game_start')
self.exitElevator = loader.loadModel('phase_4/models/minigames/toonblitz_game_elevator')
self.arrow = loader.loadModel('phase_4/models/minigames/toonblitz_game_arrow')
self.sprayProp = loader.loadModel('phase_4/models/minigames/prop_waterspray')
self.treasureModelList = []
salesIcon = loader.loadModel('phase_4/models/minigames/salesIcon')
self.treasureModelList.append(salesIcon)
moneyIcon = loader.loadModel('phase_4/models/minigames/moneyIcon')
self.treasureModelList.append(moneyIcon)
legalIcon = loader.loadModel('phase_4/models/minigames/legalIcon')
self.treasureModelList.append(legalIcon)
corpIcon = loader.loadModel('phase_4/models/minigames/corpIcon')
self.treasureModelList.append(corpIcon)
self.particleGlow = loader.loadModel('phase_4/models/minigames/particleGlow')
self.blockTypes = []
for i in xrange(4):
blockType = loader.loadModel('phase_4/models/minigames/toonblitz_game_block0' + str(i))
self.blockTypes.append(blockType)
self.stomper = loader.loadModel('phase_4/models/minigames/toonblitz_game_stomper')
plane = CollisionPlane(Plane(Vec3(0, 0, 1), Point3(0, 0, -50)))
dropPlane = CollisionNode('dropPlane')
dropPlane.addSolid(plane)
dropPlane.setCollideMask(ToontownGlobals.FloorBitmask)
self.world.attachNewNode(dropPlane)
self.gameMusic = base.loader.loadMusic('phase_4/audio/bgm/MG_TwoDGame.ogg')
self.treasureGrabSound = loader.loadSfx('phase_4/audio/sfx/SZ_DD_treasure.ogg')
self.sndOof = base.loader.loadSfx('phase_4/audio/sfx/MG_cannon_hit_dirt.ogg')
self.soundJump = base.loader.loadSfx('phase_4/audio/sfx/MG_sfx_vine_game_jump.ogg')
self.fallSound = base.loader.loadSfx('phase_4/audio/sfx/MG_sfx_vine_game_fall.ogg')
self.watergunSound = base.loader.loadSfx('phase_4/audio/sfx/AA_squirt_seltzer_miss.ogg')
self.splashSound = base.loader.loadSfx('phase_4/audio/sfx/Seltzer_squirt_2dgame_hit.ogg')
self.threeSparkles = loader.loadSfx('phase_4/audio/sfx/threeSparkles.ogg')
self.sparkleSound = loader.loadSfx('phase_4/audio/sfx/sparkly.ogg')
self.headCollideSound = loader.loadSfx('phase_3.5/audio/sfx/AV_collision.ogg')
self.faceStartPos = Vec3(-0.8, 0, -0.87)
self.faceEndPos = Vec3(0.8, 0, -0.87)
self.aspect2dRoot = aspect2d.attachNewNode('TwoDGuiAspect2dRoot')
self.aspect2dRoot.setDepthWrite(1)
self.cardMaker = CardMaker('card')
self.cardMaker.reset()
self.cardMaker.setName('ProgressLine')
self.cardMaker.setFrame(-0.5, 0.5, -0.5, 0.5)
self.progressLine = self.aspect2dRoot.attachNewNode(self.cardMaker.generate())
self.progressLine.setScale(self.faceEndPos[0] - self.faceStartPos[0], 1, 0.01)
self.progressLine.setPos(0, 0, self.faceStartPos[2])
self.cardMaker.setName('RaceProgressLineHash')
for n in xrange(ToonBlitzGlobals.NumSections[self.game.getSafezoneId()] + 1):
hash = self.aspect2dRoot.attachNewNode(self.cardMaker.generate())
hash.setScale(self.progressLine.getScale()[2], 1, self.progressLine.getScale()[2] * 5)
t = float(n) / ToonBlitzGlobals.NumSections[self.game.getSafezoneId()]
hash.setPos(self.faceStartPos[0] * (1 - t) + self.faceEndPos[0] * t, self.faceStartPos[1], self.faceStartPos[2])
def destroy(self):
while len(self.blockTypes):
blockType = self.blockTypes[0]
self.blockTypes.remove(blockType)
del blockType
self.blockTypes = None
while len(self.treasureModelList):
treasureModel = self.treasureModelList[0]
self.treasureModelList.remove(treasureModel)
del treasureModel
self.treasureModelList = None
self.startingWall.removeNode()
del self.startingWall
self.startingPipe.removeNode()
del self.startingPipe
self.exitElevator.removeNode()
del self.exitElevator
self.stomper.removeNode()
del self.stomper
self.arrow.removeNode()
del self.arrow
self.sprayProp.removeNode()
del self.sprayProp
self.aspect2dRoot.removeNode()
del self.aspect2dRoot
self.world.removeNode()
del self.world
del self.gameMusic
del self.treasureGrabSound
#.........这里部分代码省略.........
示例2: __init__
# 需要导入模块: from panda3d.core import CardMaker [as 别名]
# 或者: from panda3d.core.CardMaker import setName [as 别名]
#.........这里部分代码省略.........
self.faceEndPos = Vec3(0.8, 0, 0.93)
self.placeLabelNum = DirectLabel(relief=None, pos=TTLocalizer.RGUIplaceLabelNumPos, text='1', text_scale=0.35, text_fg=(0.95, 0.95, 0, 1), text_font=ToontownGlobals.getSignFont())
self.placeLabelNum.reparentTo(base.a2dBottomLeft)
self.directObjList.append(self.placeLabelNum)
self.placeLabelStr = DirectLabel(relief=None, pos=TTLocalizer.RGUIplaceLabelStrPos, text=TTLocalizer.KartRace_FirstSuffix, text_scale=0.1, text_fg=(0.95, 0.95, 0, 1), text_font=ToontownGlobals.getSignFont())
self.placeLabelStr.reparentTo(base.a2dBottomLeft)
self.directObjList.append(self.placeLabelStr)
self.lapLabel = DirectLabel(relief=None, pos=(-0.22, 0, -0.5), text='1/' + str(self.race.lapCount), text_scale=0.1, text_fg=(0.95, 0.95, 0, 1), text_font=ToontownGlobals.getSignFont())
self.lapLabel.reparentTo(base.a2dTopRight)
self.directObjList.append(self.lapLabel)
self.photoFinishLabel = DirectLabel(relief=None, pos=(0, 0, -0.1), text=TTLocalizer.KartRace_PhotoFinish, text_scale=TTLocalizer.RGUIphotoFinish, text_fg=(0.95, 0.95, 0, 1), text_font=ToontownGlobals.getSignFont())
self.photoFinishLabel.hide()
self.directObjList.append(self.photoFinishLabel)
self.wrongWayLabel = DirectLabel(relief=None, pos=(-0.22, 0, -0.2), text=TTLocalizer.KartRace_WrongWay, text_scale=0.1, text_fg=(0.95, 0, 0, 1), text_font=ToontownGlobals.getSignFont())
self.wrongWayLabel.reparentTo(base.a2dTopRight)
self.directObjList.append(self.wrongWayLabel)
self.wrongWayLabel.setColorScale(Vec4(1, 1, 1, 0))
self.wrongWaySeq = Sequence(self.wrongWayLabel.colorScaleInterval(0.25, colorScale=Vec4(1, 1, 1, 1), startColorScale=Vec4(1, 1, 1, 0)), self.wrongWayLabel.colorScaleInterval(0.25, colorScale=Vec4(1, 1, 1, 0), startColorScale=Vec4(1, 1, 1, 1)))
interpolateFacePos = lambda x: self.faceStartPos * (1.0 - x) + self.faceEndPos * x
self.timeLabels = []
for x in xrange(self.race.lapCount):
minLabel = DirectLabel(relief=None, pos=(interpolateFacePos((2.0 * x + 1) / (self.race.lapCount * 2))[0] - 0.06, 0, 0.84), text="0'", text_scale=0.06, text_fg=(0.95, 0.95, 0, 1), text_font=ToontownGlobals.getSignFont(), text_align=TextNode.ARight)
minLabel.reparentTo(self.raceModeRoot)
self.directObjList.append(minLabel)
secLabel = DirectLabel(relief=None, pos=(interpolateFacePos((2.0 * x + 1) / (self.race.lapCount * 2))[0] + 0.06, 0, 0.84), text="00''", text_scale=0.06, text_fg=(0.95, 0.95, 0, 1), text_font=ToontownGlobals.getSignFont(), text_align=TextNode.ARight)
secLabel.reparentTo(self.raceModeRoot)
self.directObjList.append(secLabel)
fractionLabel = DirectLabel(relief=None, pos=(interpolateFacePos((2.0 * x + 1) / (self.race.lapCount * 2))[0] + 0.14, 0, 0.84), text='00', text_scale=0.06, text_fg=(0.95, 0.95, 0, 1), text_font=ToontownGlobals.getSignFont(), text_align=TextNode.ARight)
fractionLabel.reparentTo(self.raceModeRoot)
self.directObjList.append(fractionLabel)
self.timeLabels.append((minLabel, secLabel, fractionLabel))
self.cardMaker.reset()
self.cardMaker.setName('GagIndicator')
self.cardMaker.setFrame(-0.5, 0.5, -0.5, 0.5)
self.cardMaker.setColor(1, 1, 1, 1)
self.gagPanel = DirectFrame(parent=base.a2dBottomLeft, relief=None, image=loader.loadModel('phase_6/models/karting/gag_panel'), image_scale=0.25, pos=(0.2, 0, 0.55))
self.directObjList.append(self.gagPanel)
self.gag = self.gagPanel.attachNewNode('gag')
self.gag.setScale(0.2)
for gag in self.gagTextures:
gag.reparentTo(self.gag)
gag.hide()
self.cardMaker.reset()
self.cardMaker.setName('RaceProgressLine')
self.cardMaker.setFrame(-0.5, 0.5, -0.5, 0.5)
line = self.raceModeRoot.attachNewNode(self.cardMaker.generate())
line.setScale(self.faceEndPos[0] - self.faceStartPos[0], 1, 0.01)
line.setPos(0, 0, self.faceStartPos[2])
self.cardMaker.setName('RaceProgressLineHash')
for n in xrange(self.race.lapCount + 1):
hash = self.raceModeRoot.attachNewNode(self.cardMaker.generate())
hash.setScale(line.getScale()[2], 1, line.getScale()[2] * 5)
t = float(n) / self.race.lapCount
hash.setPos(self.faceStartPos[0] * (1 - t) + self.faceEndPos[0] * t, self.faceStartPos[1], self.faceStartPos[2])
self.raceModeReady = True
self.disable()
return
def initResultMode(self):
self.endPanel = RaceEndPanel(len(self.race.avIds), self.race)
self.endPanel.reparentTo(self.aspect2dRoot)
self.directObjList.append(self.endPanel)
self.resultModeReady = True