本文整理汇总了Python中direct.gui.DirectGui.DirectWaitBar.show方法的典型用法代码示例。如果您正苦于以下问题:Python DirectWaitBar.show方法的具体用法?Python DirectWaitBar.show怎么用?Python DirectWaitBar.show使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类direct.gui.DirectGui.DirectWaitBar
的用法示例。
在下文中一共展示了DirectWaitBar.show方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: Hud
# 需要导入模块: from direct.gui.DirectGui import DirectWaitBar [as 别名]
# 或者: from direct.gui.DirectGui.DirectWaitBar import show [as 别名]
class Hud(DirectObject):
def __init__(self):
self.lifeBar1 = DirectWaitBar(
text = "Player1",
text_fg = (1,1,1,1),
text_pos = (-1.2, -0.18, 0),
text_align = TextNode.ALeft,
value = 100,
barColor = (0, 1, 0.25, 1),
barRelief = DGG.RAISED,
barBorderWidth = (0.03, 0.03),
borderWidth = (0.01, 0.01),
relief = DGG.RIDGE,
frameColor = (0.8,0.05,0.10,1),
frameSize = (-1.2, 0, -0.1, 0),
pos = (-0.2,0,base.a2dTop-0.15))
self.lifeBar1.setTransparency(1)
self.lifeBar2 = DirectWaitBar(
text = "Player2",
text_fg = (1,1,1,1),
text_pos = (1.2, -0.18, 0),
text_align = TextNode.ARight,
value = 100,
barColor = (0, 1, 0.25, 1),
barRelief = DGG.RAISED,
barBorderWidth = (0.03, 0.03),
borderWidth = (0.01, 0.01),
relief = DGG.RIDGE,
frameColor = (0.8,0.05,0.10,1),
frameSize = (0, 1.2, -0.1, 0),
pos = (0.2,0,base.a2dTop-0.15))
self.lifeBar2.setTransparency(1)
self.accept("hud_setLifeBarValue", self.setLifeBarValue)
self.hide()
def show(self):
self.lifeBar1["value"] = 100
self.lifeBar2["value"] = 100
self.lifeBar1.show()
self.lifeBar2.show()
def hide(self):
self.lifeBar1.hide()
self.lifeBar2.hide()
def setLifeBarValue(self, barNr, newValue):
if barNr == 0:
self.lifeBar1["value"] = newValue
elif barNr == 1:
self.lifeBar2["value"] = newValue
示例2: ControlPointBar
# 需要导入模块: from direct.gui.DirectGui import DirectWaitBar [as 别名]
# 或者: from direct.gui.DirectGui.DirectWaitBar import show [as 别名]
class ControlPointBar(DirectWaitBar):
def __init__(self, barColor=(255,0,0,1), pos=(1.0,0,0.9)):
self.bar = DirectWaitBar(pos = pos, barColor = barColor, text="",
value=0, range=30, frameSize=(-0.3,0.3,0,0.03), frameColor=(0,0,255,1))
def setValue(self, value):
self.bar['value'] = float(value)
def hide(self):
self.bar.hide()
def show(self):
self.bar.show()
示例3: ResourceBar
# 需要导入模块: from direct.gui.DirectGui import DirectWaitBar [as 别名]
# 或者: from direct.gui.DirectGui.DirectWaitBar import show [as 别名]
class ResourceBar(DirectWaitBar):
def __init__(self, barColor=(200,180,0,1), pos=(0,0,0.9)):
self.bar = DirectWaitBar(pos = pos, barColor = barColor, text="",
value=70, range=100, frameSize=(-0.3,0.3,0,0.03), frameColor=(0,0,0,1))
def setValue(self, value):
self.bar['value'] = float(value)
def hide(self):
self.bar.hide()
def show(self):
self.bar.show()
示例4: Bar
# 需要导入模块: from direct.gui.DirectGui import DirectWaitBar [as 别名]
# 或者: from direct.gui.DirectGui.DirectWaitBar import show [as 别名]
class Bar(DirectObject.DirectObject):
def __init__( self):
self.bar = DirectWaitBar(text = "Loading...", value = 0, pos = (0,.4,.4))
self.bar.hide()
def incBar(self, arg):
self.bar['value'] += arg
#text = str(bar['value'])
#textObject.setText(text)
def show(self):
self.bar.show()
def hide(self):
self.bar.hide()
示例5: ProgressBar
# 需要导入模块: from direct.gui.DirectGui import DirectWaitBar [as 别名]
# 或者: from direct.gui.DirectGui.DirectWaitBar import show [as 别名]
class ProgressBar(object):
'''
'''
def __init__(self):
'''
'''
self.__wait_bar = DirectWaitBar( text = "Carregando...",
value = 0,
pos = (0, 0, -.95),
text_scale = 0.05,
text_pos = (0, 0.025),
frameSize = (-1.3, 1.3, 0, 0.08) )
self.hide()
def finish(self):
self.__wait_bar['barColor'] = (0, 1, 0, 1)
self.__wait_bar.setBarColor()
self.__wait_bar.finish()
self.hide()
def hide(self):
self.__wait_bar.hide()
def show(self):
self.__wait_bar.show()
def update(self, value):
if value < 25:
self.__wait_bar['barColor'] = (1, 0, 0, 1)
elif value > 25 and value < 75:
self.__wait_bar['barColor'] = (1, 1, 0, 1)
elif value > 75:
self.__wait_bar['barColor'] = (0, 1, 0, 1)
self.__wait_bar.setBarColor()
self.__wait_bar.update(value)
示例6: ControlPointBar
# 需要导入模块: from direct.gui.DirectGui import DirectWaitBar [as 别名]
# 或者: from direct.gui.DirectGui.DirectWaitBar import show [as 别名]
class ControlPointBar(DirectWaitBar):
def __init__(self, barColor=(255,0,0,1), pos=(1.0,0,0.9)):
self.bar = DirectWaitBar(pos = pos, barColor = barColor, text="",
value=70, range=100, frameSize=(-0.3,0.3,0,0.03), frameColor=(0,0,255,1))
def setValue(self, value):
self.bar['value'] = float(value)
self.setPos((0,0,0))
def hide(self):
self.bar.hide()
# to make inherited setPos available for this object
def show(self):
self.bar.show()
# to make inherited setPos available for this object
def setPos(self, pos):
self.bar.setPos(pos)
示例7: PartyCogActivityGui
# 需要导入模块: from direct.gui.DirectGui import DirectWaitBar [as 别名]
# 或者: from direct.gui.DirectGui.DirectWaitBar import show [as 别名]
#.........这里部分代码省略.........
self._moveKeys.setScale(0.15)
self._attackKeys.reparentTo(aspect2d)
self._attackKeys.setPos(0.85, 0.0, -0.45)
self._attackKeys.setScale(0.15)
self._moveKeys.hide()
self._attackKeys.hide()
def _initPiePowerMeter(self):
h = PartyGlobals.CogActivityPowerMeterHeight / 2.0
w = PartyGlobals.CogActivityPowerMeterWidth / 2.0
self._piePowerMeter = DirectWaitBar(frameSize=(-h,
h,
-w,
w), relief=DGG.GROOVE, frameColor=(0.9, 0.9, 0.9, 1.0), borderWidth=(0.01, 0.01), barColor=PartyGlobals.CogActivityColors[0], pos=PartyGlobals.CogActivityPowerMeterPos, hpr=(0.0, 0.0, -90.0))
self._piePowerMeter.setBin('fixed', 0)
self._piePowerTitle = OnscreenText(text=TTLocalizer.PartyCogGuiPowerLabel, pos=PartyGlobals.CogActivityPowerMeterTextPos, scale=0.05, fg=(1.0, 1.0, 1.0, 1.0), align=TextNode.ACenter)
self._piePowerTitle.setBin('fixed', 0)
self._piePowerMeter.hide()
self._piePowerTitle.hide()
def _initScore(self):
self._scoreLabel = OnscreenText(text='0', pos=PartyGlobals.CogActivityScorePos, scale=PartyGlobals.TugOfWarTextWordScale, fg=(1.0, 1.0, 0.0, 1.0), align=TextNode.ARight, font=ToontownGlobals.getSignFont(), mayChange=True)
self._scoreTitle = OnscreenText(text=TTLocalizer.PartyCogGuiScoreLabel, pos=PartyGlobals.CogActivityScoreTitle, scale=0.05, fg=(1.0, 1.0, 1.0, 1.0), align=TextNode.ARight)
self._scoreLabel.hide()
self._scoreTitle.hide()
def _initCogTracker(self):
self._cogTracker = PartyCogTrackerGui()
def _initSpamWarning(self):
self._spamWarning = OnscreenText(text=TTLocalizer.PartyCogGuiSpamWarning, scale=0.15, fg=(1.0, 1.0, 0, 1.0), shadow=(0, 0, 0, 0.62), mayChange=False, pos=(0, 0.33))
self._spamWarning.hide()
def showScore(self):
self._scoreLabel.show()
self._scoreTitle.show()
def hideScore(self):
self._scoreLabel.hide()
self._scoreTitle.hide()
def setScore(self, score = 0):
self._scoreLabel['text'] = str(score)
def resetPiePowerMeter(self):
self._piePowerMeter['value'] = 0
def showPiePowerMeter(self):
self._piePowerMeter.show()
self._piePowerTitle.show()
def hidePiePowerMeter(self):
self._piePowerMeter.hide()
self._piePowerTitle.hide()
def updatePiePowerMeter(self, value):
self._piePowerMeter['value'] = value
def getPiePowerMeterValue(self):
return self._piePowerMeter['value']
def hideSpamWarning(self):
taskMgr.remove(self._spamWarningIvalName)
if self._spamWarning:
self._spamWarning.hide()
示例8: DistributedMazeGame
# 需要导入模块: from direct.gui.DirectGui import DirectWaitBar [as 别名]
# 或者: from direct.gui.DirectGui.DirectWaitBar import show [as 别名]
class DistributedMazeGame(DistributedMinigame):
notify = directNotify.newCategory('DistributedMazeGame')
CAMERA_TASK = 'MazeGameCameraTask'
UPDATE_SUITS_TASK = 'MazeGameUpdateSuitsTask'
TREASURE_GRAB_EVENT_NAME = 'MazeTreasureGrabbed'
def __init__(self, cr):
DistributedMinigame.__init__(self, cr)
self.gameFSM = ClassicFSM.ClassicFSM('DistributedMazeGame', [State.State('off', self.enterOff, self.exitOff, ['play']),
State.State('play', self.enterPlay, self.exitPlay, ['cleanup', 'showScores']),
State.State('showScores', self.enterShowScores, self.exitShowScores, ['cleanup']),
State.State('cleanup', self.enterCleanup, self.exitCleanup, [])], 'off', 'cleanup')
self.addChildGameFSM(self.gameFSM)
self.usesLookAround = 1
def getTitle(self):
return TTLocalizer.MazeGameTitle
def getInstructions(self):
return TTLocalizer.MazeGameInstructions
def getMaxDuration(self):
return MazeGameGlobals.GAME_DURATION
def __defineConstants(self):
self.TOON_SPEED = 8.0
self.TOON_Z = 0
self.MinSuitSpeedRange = [0.8 * self.TOON_SPEED, 0.6 * self.TOON_SPEED]
self.MaxSuitSpeedRange = [1.1 * self.TOON_SPEED, 2.0 * self.TOON_SPEED]
self.FASTER_SUIT_CURVE = 1
self.SLOWER_SUIT_CURVE = self.getDifficulty() < 0.5
self.slowerSuitPeriods = {2000: {4: [128, 76],
8: [128,
99,
81,
68],
12: [128,
108,
93,
82,
74,
67],
16: [128,
112,
101,
91,
83,
76,
71,
66]},
1000: {4: [110, 69],
8: [110,
88,
73,
62],
12: [110,
95,
83,
74,
67,
61],
16: [110,
98,
89,
81,
75,
69,
64,
60]},
5000: {4: [96, 63],
8: [96,
79,
66,
57],
12: [96,
84,
75,
67,
61,
56],
16: [96,
87,
80,
73,
68,
63,
59,
55]},
4000: {4: [86, 58],
8: [86,
71,
61,
53],
12: [86,
76,
68,
62,
56,
52],
16: [86,
#.........这里部分代码省略.........