本文整理汇总了Python中panda3d.core.TextNode.generate方法的典型用法代码示例。如果您正苦于以下问题:Python TextNode.generate方法的具体用法?Python TextNode.generate怎么用?Python TextNode.generate使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类panda3d.core.TextNode
的用法示例。
在下文中一共展示了TextNode.generate方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: displayText
# 需要导入模块: from panda3d.core import TextNode [as 别名]
# 或者: from panda3d.core.TextNode import generate [as 别名]
def displayText(self,text):
newTextNode = TextNode('text')
newTextNode.setText(text)
newTextNode.setAlign(TextNode.ACenter)
newTextNode.setWordwrap(16.0)
text_generate = newTextNode.generate()
newTextNodePath = render.attachNewNode(text_generate)
newTextNodePath.setPos(0,1000,190)
newTextNodePath.setScale(30,30,30)
self.textEffects(newTextNodePath)
return newTextNodePath
示例2: loadWitch
# 需要导入模块: from panda3d.core import TextNode [as 别名]
# 或者: from panda3d.core.TextNode import generate [as 别名]
def loadWitch(self):
self.airplane = loader.loadModel('phase_4/models/props/tt_m_prp_ext_flyingWitch.bam')
self.airplane.setScale(2)
self.airplane.setPos(0, 0, 1)
self.airplane.find('**/').setH(180)
bannerText = TextNode('bannerText')
bannerText.setTextColor(1, 0, 0, 1)
bannerText.setAlign(bannerText.ACenter)
bannerText.setFont(ToontownGlobals.getSignFont())
bannerText.setText(TTLocalizer.EstatePlaneHoliday)
self.bn = self.airplane.attachNewNode(bannerText.generate())
self.bn.setPos(-20.0, -.1, 0)
self.bn.setH(180)
self.bn.setScale(2.35)
self.bn.setDepthTest(1)
self.bn.setDepthWrite(1)
self.bn.setDepthOffset(500)
base.airplane = self.airplane
示例3: loadAirplane
# 需要导入模块: from panda3d.core import TextNode [as 别名]
# 或者: from panda3d.core.TextNode import generate [as 别名]
def loadAirplane(self):
self.airplane = loader.loadModel('phase_4/models/props/airplane.bam')
self.airplane.setScale(4)
self.airplane.setPos(0, 0, 1)
self.banner = self.airplane.find('**/*banner')
bannerText = TextNode('bannerText')
bannerText.setTextColor(1, 0, 0, 1)
bannerText.setAlign(bannerText.ACenter)
bannerText.setFont(ToontownGlobals.getSignFont())
bannerText.setText(TTLocalizer.EstatePlaneReturn)
self.bn = self.banner.attachNewNode(bannerText.generate())
self.bn.setHpr(180, 0, 0)
self.bn.setPos(-5.8, 0.1, -0.25)
self.bn.setScale(0.95)
self.bn.setDepthTest(1)
self.bn.setDepthWrite(1)
self.bn.setDepthOffset(500)
base.airplane = self.airplane
示例4: DistributedCogThiefGame
# 需要导入模块: from panda3d.core import TextNode [as 别名]
# 或者: from panda3d.core.TextNode import generate [as 别名]
#.........这里部分代码省略.........
self.jarIval = Parallel(Sequence(self.rewardPanel.scaleInterval(0.15, s * 3.0 / 4.0, blendType='easeOut'), self.rewardPanel.scaleInterval(0.15, s, blendType='easeIn')), SoundInterval(self.sndRewardTick), name='cogThiefGameRewardJarThrob')
self.jarIval.start()
task.curScore = score
else:
result = Task.done
return result
def startGameWalk(self):
if self.useOrthoWalk:
self.gameWalk.start()
else:
self.gameWalk.enter()
self.gameWalk.fsm.request('walking')
def stopGameWalk(self):
if self.useOrthoWalk:
self.gameWalk.stop()
else:
self.gameWalk.exit()
def getCogThief(self, cogIndex):
return self.cogInfo[cogIndex]['suit']
def isToonPlayingHitTrack(self, avId):
if avId in self.toonHitTracks:
track = self.toonHitTracks[avId]
if track.isPlaying():
return True
return False
def getNumCogs(self):
result = base.config.GetInt('cog-thief-num-cogs', 0)
if not result:
safezone = self.getSafezoneId()
result = CTGG.calculateCogs(self.numPlayers, safezone)
return result
def getCogSpeed(self):
result = 6.0
safezone = self.getSafezoneId()
result = CTGG.calculateCogSpeed(self.numPlayers, safezone)
return result
def showResults(self):
if not self.gameIsEnding:
self.gameIsEnding = True
for barrel in self.barrels:
barrel.wrtReparentTo(render)
for key in self.cogInfo:
thief = self.cogInfo[key]['suit']
thief.suit.setPos(100, 0, 0)
thief.suit.hide()
self.__killRewardCountdown()
self.stopGameWalk()
numBarrelsSaved = len(self.barrels) - len(self.stolenBarrels)
resultStr = ''
if numBarrelsSaved == len(self.barrels):
resultStr = TTLocalizer.CogThiefPerfect
elif numBarrelsSaved > 1:
resultStr = TTLocalizer.CogThiefBarrelsSaved % {'num': numBarrelsSaved}
elif numBarrelsSaved == 1:
resultStr = TTLocalizer.CogThiefBarrelSaved % {'num': numBarrelsSaved}
else:
resultStr = TTLocalizer.CogThiefNoBarrelsSaved
perfectTextSubnode = hidden.attachNewNode(self.__genText(resultStr))
perfectText = hidden.attachNewNode('perfectText')
perfectTextSubnode.reparentTo(perfectText)
frame = self.__textGen.getCardActual()
offsetY = -abs(frame[2] + frame[3]) / 2.0
perfectTextSubnode.setPos(0, 0, offsetY)
perfectText.setColor(1, 0.1, 0.1, 1)
def fadeFunc(t, text = perfectText):
text.setColorScale(1, 1, 1, t)
def destroyText(text = perfectText):
text.removeNode()
def safeGameOver(self = self):
if not self.frameworkFSM.isInternalStateInFlux():
self.gameOver()
textTrack = Sequence(Func(perfectText.reparentTo, aspect2d), Parallel(LerpScaleInterval(perfectText, duration=0.5, scale=0.3, startScale=0.0), LerpFunctionInterval(fadeFunc, fromData=0.0, toData=1.0, duration=0.5)), Wait(2.0), Parallel(LerpScaleInterval(perfectText, duration=0.5, scale=1.0), LerpFunctionInterval(fadeFunc, fromData=1.0, toData=0.0, duration=0.5, blendType='easeIn')), Func(destroyText), WaitInterval(0.5), Func(safeGameOver))
if numBarrelsSaved == len(self.barrels):
soundTrack = SoundInterval(self.sndPerfect)
else:
soundTrack = Sequence()
self.resultIval = Parallel(textTrack, soundTrack)
self.resultIval.start()
def __genText(self, text):
self.__textGen.setText(text)
return self.__textGen.generate()
def getIntroTrack(self):
base.camera.setPosHpr(0, -13.66, 13.59, 0, -51.6, 0)
result = Sequence(Wait(2), LerpPosHprInterval(base.camera, 13, Point3(self.cameraTopView[0], self.cameraTopView[1], self.cameraTopView[2]), Point3(self.cameraTopView[3], self.cameraTopView[4], self.cameraTopView[5]), blendType='easeIn'))
return result