本文整理汇总了Python中direct.gui.DirectGui.DirectWaitBar.finish方法的典型用法代码示例。如果您正苦于以下问题:Python DirectWaitBar.finish方法的具体用法?Python DirectWaitBar.finish怎么用?Python DirectWaitBar.finish使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类direct.gui.DirectGui.DirectWaitBar
的用法示例。
在下文中一共展示了DirectWaitBar.finish方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: ProgressBar
# 需要导入模块: from direct.gui.DirectGui import DirectWaitBar [as 别名]
# 或者: from direct.gui.DirectGui.DirectWaitBar import finish [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)
示例2: __init__
# 需要导入模块: from direct.gui.DirectGui import DirectWaitBar [as 别名]
# 或者: from direct.gui.DirectGui.DirectWaitBar import finish [as 别名]
class CIProgressScreen:
def __init__(self):
self.bgm = loader.loadModel('phase_3/models/gui/progress-background.bam')
self.bgm.find('**/logo').stash()
self.bg = self.bgm.find('**/bg')
self.logo = loader.loadTexture('phase_3/maps/CogInvasion_Logo.png')
self.logoImg = OnscreenImage(image=self.logo, scale=(0.5, 0, 0.3), pos=(0, 0, 0), parent=hidden)
self.logoImg.setTransparency(True)
self.bg_img = OnscreenImage(image=self.bg, parent=hidden)
self.bg_img.setSx(1.35)
self.bg_img.hide()
self.progress_bar = DirectWaitBar(value=0, pos=(0, 0, -0.85), parent=hidden, text_pos=(0, 0, 0.2))
self.progress_bar.setSx(1.064)
self.progress_bar.setSz(0.38)
self.loading_lbl = DirectLabel(text='', relief=None, scale=0.08, pos=(-1.0725, 0, -0.79), text_align=TextNode.ALeft, sortOrder=100, text_fg=(0.343, 0.343, 0.343, 1.0), text_font=CIGlobals.getMinnieFont(), parent=hidden, text_shadow=(0, 0, 0, 1))
return
def begin(self, hood, range, wantGui):
render.hide()
self.renderFrames()
base.setBackgroundColor(0, 0, 0)
if hood == 'localAvatarEnterGame':
self.loading_lbl['text'] = 'Entering...'
elif hood == 'init':
self.loading_lbl['text'] = 'Loading...'
else:
self.loading_lbl['text'] = 'Heading to %s...' % hood
self.progress_bar['barColor'] = (0.343, 0.343, 0.343, 1.0)
self.progress_bar['range'] = range
self.bgm.reparentTo(aspect2d)
self.bg.reparentTo(render2d)
self.bg_img.reparentTo(hidden)
self.loading_lbl.reparentTo(aspect2d)
self.logoImg.reparentTo(aspect2d)
self.progress_bar.reparentTo(aspect2d)
self.__count = 0
self.__expectedCount = range
self.progress_bar.update(self.__count)
def renderFramesTask(self, task):
self.renderFrames()
return task.cont
def end(self):
base.setBackgroundColor(CIGlobals.DefaultBackgroundColor)
taskMgr.remove('renderFrames')
render.show()
self.progress_bar.finish()
self.bg_img.reparentTo(hidden)
self.logoImg.reparentTo(hidden)
self.bg.reparentTo(hidden)
self.bgm.reparentTo(hidden)
self.loading_lbl.reparentTo(hidden)
self.progress_bar.reparentTo(hidden)
self.renderFrames()
def destroy(self):
self.bg.removeNode()
del self.bg
self.bgm.removeNode()
del self.bgm
self.bg_img.destroy()
self.loading_lbl.destroy()
self.progress_bar.destroy()
self.bgm.destroy()
del self.bg_img
del self.loading_lbl
del self.progress_bar
del self.bgm
def renderFrames(self):
base.graphicsEngine.renderFrame()
base.graphicsEngine.renderFrame()
def tick(self):
self.__count += 1
self.progress_bar.update(self.__count)