本文整理汇总了Python中pandac.PandaModules.TextNode.setAlign方法的典型用法代码示例。如果您正苦于以下问题:Python TextNode.setAlign方法的具体用法?Python TextNode.setAlign怎么用?Python TextNode.setAlign使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pandac.PandaModules.TextNode
的用法示例。
在下文中一共展示了TextNode.setAlign方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: addball
# 需要导入模块: from pandac.PandaModules import TextNode [as 别名]
# 或者: from pandac.PandaModules.TextNode import setAlign [as 别名]
def addball(self, NUM):
# pos = Vec3(random.uniform(-7, 7), random.uniform(-7, 7), random.uniform(-7, 7))
if self.model == True and self.text == True:
self.f.remove()
self.newTextNodePath2.remove()
a = random.uniform(-7, 7)
b = random.uniform(-7, 7)
c = random.uniform(-7, 7)
pos = Vec3(a, b, c)
tex = loader.loadTexture("cra/textures/e.jpeg")
self.f = loader.loadModel("cra/models/ball1.egg")
self.f.setTexGen(TextureStage.getDefault(), TexGenAttrib.MEyeSphereMap)
self.f.setTexture(tex, 1)
self.f.setPos(pos)
self.f.setScale(1.5)
self.f.reparentTo(render)
self.f.setCollideMask(0)
text = NUM
newTextNode = TextNode("text") # Create a new TextNode
newTextNode.setText(text) # Set the TextNode text
newTextNode.setAlign(TextNode.ACenter) # Set the text align
newTextNode.setWordwrap(6.0) # Set the word wrap
text_generate = newTextNode.generate() # Generate a NodePath
self.newTextNodePath2 = render.attachNewNode(text_generate) # Attach the NodePath to the render tree
self.newTextNodePath2.setPos(a, b, (c + 0.3))
self.newTextNodePath2.setColor(255, 0, 0, 1)
self.newTextNodePath2.setScale(0.6)
return pos
示例2: addball
# 需要导入模块: from pandac.PandaModules import TextNode [as 别名]
# 或者: from pandac.PandaModules.TextNode import setAlign [as 别名]
def addball(self, NUM):
X = "Person_pics/" + NUM + '.jpeg'
tex = loader.loadTexture(X)
f = loader.loadModel("models/ball1.egg")
f.setTexGen(TextureStage.getDefault(), TexGenAttrib.MEyeSphereMap)
a = random.uniform((-8 + (self.addx)), (8 + self.addx))
b = random.uniform((-8 + (self.addy)), (8 + self.addy))
c = random.uniform((-8 + (self.addz)), (8 + self.addz))
pos = Vec3(a,b,c)
f.setTexture(tex, 1)
f.setPos(pos)
f.setScale(.8)
f.reparentTo(render)
f.setCollideMask(0)
text = NUM
newTextNode = TextNode('text') # Create a new TextNode
newTextNode.setText(text) # Set the TextNode text
newTextNode.setAlign(TextNode.ACenter) # Set the text align
newTextNode.setWordwrap(6.0) # Set the word wrap
text_generate = newTextNode.generate() # Generate a NodePath
newTextNodePath = render.attachNewNode(text_generate) # Attach the NodePath to the render tree
newTextNodePath.setPos(a,b,(c + 0.6))
newTextNodePath.setColor(255, 0, 0,1)
newTextNodePath.setScale(.5)
return pos
示例3: __init__
# 需要导入模块: from pandac.PandaModules import TextNode [as 别名]
# 或者: from pandac.PandaModules.TextNode import setAlign [as 别名]
def __init__(self,bat_np,t,x,y,col):
rate = 2
z = 20
scale = 12
scale_up = 15
text_node = TextNode("battle_text")
text_node.setText(t)
text_node_path = bat_np.attachNewNode(text_node)
text_node_path.reparentTo(render)
text_node_path.setPos(x,y,0)
text_node_path.setHpr(0,-90,0)
text_node_path.setScale(scale)
text_node_path.setTransparency(TransparencyAttrib.MAlpha)
text_node.setTextColor(col)
text_node.setAlign(TextNode.ACenter)
node_scl_up = text_node_path.scaleInterval(rate, Point3(scale_up, scale_up, scale_up))
node_z_up = text_node_path.posInterval(rate, Point3(x, y, z*2))
node_z_up2 = text_node_path.posInterval(rate, Point3(x, y, z*2))
node_fade_down = text_node_path.colorScaleInterval(rate, (col[0],col[1],col[2],0))
node_func_death = Func(self.destroy)
t_para = Parallel(node_scl_up,node_z_up,node_fade_down)
t_seq = Sequence(t_para,node_func_death)
t_seq.start()
self.tnp = text_node_path
示例4: loadSign
# 需要导入模块: from pandac.PandaModules import TextNode [as 别名]
# 或者: from pandac.PandaModules.TextNode import setAlign [as 别名]
def loadSign(self):
actNameForSign = self.activityName
if self.activityId == PartyGlobals.ActivityIds.PartyJukebox40:
actNameForSign = PartyGlobals.ActivityIds.getString(PartyGlobals.ActivityIds.PartyJukebox)
elif self.activityId == PartyGlobals.ActivityIds.PartyDance20:
actNameForSign = PartyGlobals.ActivityIds.getString(PartyGlobals.ActivityIds.PartyDance)
self.sign = self.root.attachNewNode('%sSign' % self.activityName)
self.signModel = self.party.defaultSignModel.copyTo(self.sign)
self.signFlat = self.signModel.find('**/sign_flat')
self.signFlatWithNote = self.signModel.find('**/sign_withNote')
self.signTextLocator = self.signModel.find('**/signText_locator')
textureNodePath = getPartyActivityIcon(self.party.activityIconsModel, actNameForSign)
textureNodePath.setPos(0.0, -0.02, 2.2)
textureNodePath.setScale(2.35)
textureNodePath.copyTo(self.signFlat)
textureNodePath.copyTo(self.signFlatWithNote)
text = TextNode('noteText')
text.setTextColor(0.2, 0.1, 0.7, 1.0)
text.setAlign(TextNode.ACenter)
text.setFont(OTPGlobals.getInterfaceFont())
text.setWordwrap(10.0)
text.setText('')
self.noteText = self.signFlatWithNote.attachNewNode(text)
self.noteText.setPosHpr(self.signTextLocator, 0.0, 0.0, 0.2, 0.0, 0.0, 0.0)
self.noteText.setScale(0.2)
self.signFlatWithNote.stash()
self.signTextLocator.stash()
示例5: loadGUI
# 需要导入模块: from pandac.PandaModules import TextNode [as 别名]
# 或者: from pandac.PandaModules.TextNode import setAlign [as 别名]
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 xrange(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
示例6: attachHostNameToSign
# 需要导入模块: from pandac.PandaModules import TextNode [as 别名]
# 或者: from pandac.PandaModules.TextNode import setAlign [as 别名]
def attachHostNameToSign(self, locator):
if self.hostName == "":
return
nameText = TextNode("nameText")
nameText.setCardAsMargin(0.1, 0.1, 0.1, 0.1)
nameText.setCardDecal(True)
nameText.setCardColor(1.0, 1.0, 1.0, 0.0)
r = 232.0 / 255.0
g = 169.0 / 255.0
b = 23.0 / 255.0
nameText.setTextColor(r, g, b, 1)
nameText.setAlign(nameText.ACenter)
nameText.setFont(ToontownGlobals.getBuildingNametagFont())
nameText.setShadowColor(0, 0, 0, 1)
nameText.setBin("fixed")
if TTLocalizer.BuildingNametagShadow:
nameText.setShadow(*TTLocalizer.BuildingNametagShadow)
nameWordWrap = 11.0
nameText.setWordwrap(nameWordWrap)
scaleMult = 0.48
houseName = self.hostName
nameText.setText(houseName)
textWidth = nameText.getWidth()
xScale = 1.0 * scaleMult
if textWidth > nameWordWrap:
xScale = nameWordWrap / textWidth * scaleMult
sign_origin = locator
namePlate = sign_origin.attachNewNode(nameText)
namePlate.setDepthWrite(0)
namePlate.setPos(0, 0, 0)
namePlate.setScale(xScale)
示例7: addball
# 需要导入模块: from pandac.PandaModules import TextNode [as 别名]
# 或者: from pandac.PandaModules.TextNode import setAlign [as 别名]
def addball(self, NUM):
#pos = Vec3(random.uniform(-7, 7), random.uniform(-7, 7), random.uniform(-7, 7))
a = random.uniform((-8 + (self.addx)), (8 + self.addx))
b = random.uniform((-8 + (self.addy)), (8 + self.addy))
c = random.uniform((-8 + (self.addz)), (8 + self.addz))
pos = Vec3(a,b,c)
f = loader.loadModel("models/ball")
f.setPos(pos)
f.setScale(.8)
f.reparentTo(render)
f.setCollideMask(0)
text = NUM
newTextNode = TextNode('text') # Create a new TextNode
newTextNode.setText(text) # Set the TextNode text
newTextNode.setAlign(TextNode.ACenter) # Set the text align
newTextNode.setWordwrap(6.0) # Set the word wrap
text_generate = newTextNode.generate() # Generate a NodePath
newTextNodePath = render.attachNewNode(text_generate) # Attach the NodePath to the render tree
newTextNodePath.setPos(a,b,(c + 0.6))
newTextNodePath.setColor(255, 0, 0,1)
newTextNodePath.setScale(2)
#self.V = self.V + 1
#self.negy = (10%(self.V))*(-7)
#self.posy = (10%(self.V)+3)*(-7)
return pos
示例8: place_markers
# 需要导入模块: from pandac.PandaModules import TextNode [as 别名]
# 或者: from pandac.PandaModules.TextNode import setAlign [as 别名]
def place_markers(self,nodes):
for n in range(len(nodes)):
town_node = NodePath("town")
town = loader.loadModel("models/infantry_counter.egg")
x = (nodes[n+1]["x"]-map_center[0])*amplification
y = (nodes[n+1]["y"]-map_center[1])*amplification
town.setPos(x,y,0)
if nodes[n+1]["type"] == "city":
scale = 12
elif nodes[n+1]["type"] == "town":
scale = 7
elif nodes[n+1]["type"] == "village":
scale = 4
town.setScale(scale,scale,scale)
town.reparentTo(town_node)
town_node.reparentTo(render)
text_node = TextNode("town_text_node")
text_node.setText(nodes[n+1]["name"])
text_node_path = town.attachNewNode(text_node)
text_node_path.setPos(1,0,0)
text_node_path.setHpr(0,-90,0)
text_node_path.setScale(scale/2)
text_node_path.setTransparency(TransparencyAttrib.MAlpha)
text_node.setTextColor(0.8, 0.1, 0.1, 1)
text_node.setAlign(TextNode.ALeft)
示例9: center
# 需要导入模块: from pandac.PandaModules import TextNode [as 别名]
# 或者: from pandac.PandaModules.TextNode import setAlign [as 别名]
def center(self, prsn_name , m):
if (m < 5):
self.i = self.i + 1
X = 'Person_pics/' + prsn_name + '.jpeg'
tex = loader.loadTexture(X)
self.sphere = loader.loadModel("models/ball1")
self.sphere.setTexGen(TextureStage.getDefault(), TexGenAttrib.MEyeSphereMap)
self.sphere.setTexture(tex, 1)
self.sphere.reparentTo(render)
gx = self.sx
y = self.sy
z = self.sz
pos = (gx,y,z)
self.addx =gx
self.addy =y
self.addz =z
self.sphere.setPos(1, self.sy, 1)
self.sphere.setScale(.9)
self.sy = -14*(self.i)
else :
x = m/5
j = m%5
if ( j == 0):
self.sy = 1
self.i = 1
else :
self.sy = -14*(self.i)
self.sx = 40*(x)
self.sphere = loader.loadModel("models/ball1")
self.sphere.reparentTo(render)
gx = self.sx
y = self.sy
z = self.sz
self.addx =gx
self.addy =y
self.addz =z
pos = (gx, y, 1)
self.sphere.setPos(pos)
#self.sphere.setScale(.9)
self.i = self.i + 1
self.sphere.setScale(.9)
text = prsn_name
newTextNode = TextNode('text') # Create a new TextNode
newTextNode.setText(text) # Set the TextNode text
newTextNode.setAlign(TextNode.ACenter) # Set the text align
newTextNode.setWordwrap(6.0) # Set the word wrap
text_generate = newTextNode.generate() # Generate a NodePath
newTextNodePath = render.attachNewNode(text_generate) # Attach the NodePath to the render tree
newTextNodePath.setPos(gx, y, (z + 2))
newTextNodePath.setColor(0, 0, 255,1)
newTextNodePath.setScale(.5)
return pos
示例10: createDistanceLabel
# 需要导入模块: from pandac.PandaModules import TextNode [as 别名]
# 或者: from pandac.PandaModules.TextNode import setAlign [as 别名]
def createDistanceLabel(self, number, color):
text = TextNode('distanceText-%d' % number)
text.setAlign(TextNode.ACenter)
text.setTextColor(color)
text.setFont(ToontownGlobals.getSignFont())
text.setText('10 ft')
node = self.root.attachNewNode(text)
node.setBillboardPointEye()
node.setScale(2.5)
node.setZ(5.0)
return (node, text)
示例11: createText
# 需要导入模块: from pandac.PandaModules import TextNode [as 别名]
# 或者: from pandac.PandaModules.TextNode import setAlign [as 别名]
def createText(self, number, position, color):
text = TextNode('winText%d' % number)
text.setAlign(TextNode.ACenter)
text.setTextColor(color)
text.setFont(ToontownGlobals.getSignFont())
text.setText('')
noteText = aspect2d.attachNewNode(text)
noteText.setScale(0.2)
noteText.setPos(position)
noteText.stash()
return (text, noteText)
示例12: load
# 需要导入模块: from pandac.PandaModules import TextNode [as 别名]
# 或者: from pandac.PandaModules.TextNode import setAlign [as 别名]
def load(self):
from toontown.toonbase import ToontownGlobals
from pandac.PandaModules import TextNode
textNode = TextNode('moviedialogue')
textNode.setTextColor(0, 0, 0, 1)
textNode.setCardColor(1, 1, 1, 1)
textNode.setCardAsMargin(0, 0, 0, 0)
textNode.setCardDecal(True)
textNode.setWordwrap(27.0)
textNode.setAlign(TextNode.ACenter)
textNode.setFont(ToontownGlobals.getToonFont())
self._dialogueLabel = aspect2d.attachNewNode(textNode)
self._dialogueLabel.setScale(0.06, 0.06, 0.06)
self._dialogueLabel.setPos(0.32, 0, -0.75)
self._dialogueLabel.reparentTo(hidden)
示例13: center
# 需要导入模块: from pandac.PandaModules import TextNode [as 别名]
# 或者: from pandac.PandaModules.TextNode import setAlign [as 别名]
def center(self, prsn_name):
self.sphere = loader.loadModel("models/ball")
self.sphere.reparentTo(render)
self.sphere.setPos(1, 1, 1)
self.sphere.setScale(.9)
text = prsn_name
newTextNode = TextNode('text') # Create a new TextNode
newTextNode.setText(text) # Set the TextNode text
newTextNode.setAlign(TextNode.ACenter) # Set the text align
newTextNode.setWordwrap(6.0) # Set the word wrap
text_generate = newTextNode.generate() # Generate a NodePath
newTextNodePath = render.attachNewNode(text_generate) # Attach the NodePath to the render tree
newTextNodePath.setPos(1, 1, 2)
newTextNodePath.setColor(255, 0, 0,1)
newTextNodePath.setScale(.8)
示例14: load
# 需要导入模块: from pandac.PandaModules import TextNode [as 别名]
# 或者: from pandac.PandaModules.TextNode import setAlign [as 别名]
def load(self, loadModels = 1, arenaModel = 'partyCatchTree'):
self.notify.info('load()')
DistributedPartyCatchActivity.notify.debug('PartyCatch: load')
self.activityFSM = CatchActivityFSM(self)
self.defineConstants()
self.treesAndFence = loader.loadModel('phase_13/models/parties/%s' % arenaModel)
self.treesAndFence.setScale(0.9)
self.treesAndFence.find('**/fence_floor').setPos(0.0, 0.0, 0.1)
self.treesAndFence.reparentTo(self.root)
ground = self.treesAndFence.find('**/groundPlane')
ground.setBin('ground', 1)
DistributedPartyActivity.load(self)
exitText = TextNode('PartyCatchExitText')
exitText.setCardAsMargin(0.1, 0.1, 0.1, 0.1)
exitText.setCardDecal(True)
exitText.setCardColor(1.0, 1.0, 1.0, 0.0)
exitText.setText(TTLocalizer.PartyCatchActivityExit)
exitText.setTextColor(0.0, 8.0, 0.0, 0.9)
exitText.setAlign(exitText.ACenter)
exitText.setFont(ToontownGlobals.getBuildingNametagFont())
exitText.setShadowColor(0, 0, 0, 1)
exitText.setBin('fixed')
if TTLocalizer.BuildingNametagShadow:
exitText.setShadow(*TTLocalizer.BuildingNametagShadow)
exitTextLoc = self.treesAndFence.find('**/loc_exitSignText')
exitTextNp = exitTextLoc.attachNewNode(exitText)
exitTextNp.setDepthWrite(0)
exitTextNp.setScale(4)
exitTextNp.setZ(-.5)
self.sign.reparentTo(self.treesAndFence.find('**/loc_eventSign'))
self.sign.wrtReparentTo(self.root)
self.avatarNodePath = NodePath('PartyCatchAvatarNodePath')
self.avatarNodePath.reparentTo(self.root)
self._avatarNodePathParentToken = 3
base.cr.parentMgr.registerParent(self._avatarNodePathParentToken, self.avatarNodePath)
self.toonSDs = {}
self.dropShadow = loader.loadModelOnce('phase_3/models/props/drop_shadow')
self.dropObjModels = {}
if loadModels:
self.__loadDropModels()
self.sndGoodCatch = base.loadSfx('phase_4/audio/sfx/SZ_DD_treasure.ogg')
self.sndOof = base.loadSfx('phase_4/audio/sfx/MG_cannon_hit_dirt.ogg')
self.sndAnvilLand = base.loadSfx('phase_4/audio/sfx/AA_drop_anvil_miss.ogg')
self.sndPerfect = base.loadSfx('phase_4/audio/sfx/ring_perfect.ogg')
self.__textGen = TextNode('partyCatchActivity')
self.__textGen.setFont(ToontownGlobals.getSignFont())
self.__textGen.setAlign(TextNode.ACenter)
self.activityFSM.request('Idle')
示例15: __init__
# 需要导入模块: from pandac.PandaModules import TextNode [as 别名]
# 或者: from pandac.PandaModules.TextNode import setAlign [as 别名]
def __init__(self, name, parent, pos = (0.0, 0.0, -0.5), scale = 0.09, color = (1.0, 1.0, 0, 1), sfx = None):
self.color = color
self._displaySfx = sfx
textNode = TextNode('messageLabel.' + name)
textNode.setTextColor(self.color)
textNode.setAlign(TextNode.ACenter)
textNode.setFont(ToontownGlobals.getSignFont())
textNode.setShadow(0.06, 0.06)
textNode.setShadowColor(0.5, 0.5, 0.5, 1.0)
self.pos = pos
self.scale = scale
self.messageLabel = parent.attachNewNode(textNode)
self.messageLabel.setPos(self.pos)
self.messageLabel.setScale(self.scale)
self.messageLabel.stash()
self.transitionInterval = Sequence(name='%s.transitionInterval' % self.__class__.__name__)