本文整理汇总了Python中direct.gui.DirectGui.DirectWaitBar.setZ方法的典型用法代码示例。如果您正苦于以下问题:Python DirectWaitBar.setZ方法的具体用法?Python DirectWaitBar.setZ怎么用?Python DirectWaitBar.setZ使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类direct.gui.DirectGui.DirectWaitBar
的用法示例。
在下文中一共展示了DirectWaitBar.setZ方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from direct.gui.DirectGui import DirectWaitBar [as 别名]
# 或者: from direct.gui.DirectGui.DirectWaitBar import setZ [as 别名]
def __init__(self):
#create Queue to hold the incoming chat
#request the heartbeat so that the caht interface is being refreshed in order to get the message from other player
self.keyMap = {"left":0, "right":0, "forward":0, "cam-left":0, "cam-right":0, "charge":0}
base.win.setClearColor(Vec4(0,0,0,1))
self.cManager = ConnectionManager()
self.cManager.startConnection()
#------------------------------
#Chat
Chat(self.cManager)
#send dummy login info of the particular client
#send first chat info
#---------------------------------------
self.userName = username
dummy_login ={'user_id' : self.userName, 'factionId': faction, 'password': '1234'}
self.cManager.sendRequest(Constants.RAND_STRING, dummy_login)
chat = { 'userName' : self.userName, #username
'message' : '-------Login------' }
self.cManager.sendRequest(Constants.CMSG_CHAT, chat)
#--------------------------------------
#self.minimap = OnscreenImage(image="images/minimap.png", scale=(0.2,1,0.2), pos=(-1.1,0,0.8))
#frame = DirectFrame(text="Resource Bar", scale=0.001)
resource_bar = DirectWaitBar(text="",
value=35, range=100, pos=(0,0,0.9), barColor=(255,255,0,1),
frameSize=(-0.3,0.3,0,0.03))
cp_bar = DirectWaitBar(text="",
value=70, range=100, pos=(1.0,0,0.9), barColor=(0,0,255,1),
frameSize=(-0.3,0.3,0,0.03), frameColor=(255,0,0,1))
# Set up the environment
#
# This environment model contains collision meshes. If you look
# in the egg file, you will see the following:
#
# <Collide> { Polyset keep descend }
#
# This tag causes the following mesh to be converted to a collision
# mesh -- a mesh which is optimized for collision, not rendering.
# It also keeps the original mesh, so there are now two copies ---
# one optimized for rendering, one for collisions.
self.environ = loader.loadModel("models/world")
self.environ.reparentTo(render)
self.environ.setPos(0,0,0)
# Create the main character, Ralph
ralphStartPos = self.environ.find("**/start_point").getPos()
self.ralph = Actor("models/ralph",
{"run":"models/ralph-run",
"walk":"models/ralph-walk"})
self.ralph.reparentTo(render)
self.ralph.setScale(.2)
self.ralph.setPos(ralphStartPos)
nameplate = TextNode('textNode username_' + str(self.userName))
nameplate.setText(self.userName)
npNodePath = self.ralph.attachNewNode(nameplate)
npNodePath.setScale(0.8)
npNodePath.setBillboardPointEye()
#npNodePath.setPos(1.0,0,6.0)
npNodePath.setZ(6.5)
bar = DirectWaitBar(value=100, scale=1.0)
bar.setColor(255,0,0)
#bar.setBarRelief()
bar.setZ(6.0)
bar.setBillboardPointEye()
bar.reparentTo(self.ralph)
# Create a floater object. We use the "floater" as a temporary
# variable in a variety of calculations.
self.floater = NodePath(PandaNode("floater"))
self.floater.reparentTo(render)
# Accept the control keys for movement and rotation
self.accept("escape", sys.exit)
self.accept("arrow_left", self.setKey, ["left",1])
self.accept("arrow_right", self.setKey, ["right",1])
self.accept("arrow_up", self.setKey, ["forward",1])
self.accept("a", self.setKey, ["cam-left",1])
self.accept("s", self.setKey, ["cam-right",1])
self.accept("arrow_left-up", self.setKey, ["left",0])
self.accept("arrow_right-up", self.setKey, ["right",0])
self.accept("arrow_up-up", self.setKey, ["forward",0])
self.accept("a-up", self.setKey, ["cam-left",0])
self.accept("s-up", self.setKey, ["cam-right",0])
#.........这里部分代码省略.........