本文整理汇总了Python中hud.Hud.soft_show方法的典型用法代码示例。如果您正苦于以下问题:Python Hud.soft_show方法的具体用法?Python Hud.soft_show怎么用?Python Hud.soft_show使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类hud.Hud
的用法示例。
在下文中一共展示了Hud.soft_show方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: Game
# 需要导入模块: from hud import Hud [as 别名]
# 或者: from hud.Hud import soft_show [as 别名]
#.........这里部分代码省略.........
self.glow_filter = shader.GlowFilter ()
panda = self.manager.panda
if GlobalConf ().path ('game.shader').value:
self.glow_filter.enable (panda)
panda.relative_mouse ()
panda.loop_music (self.level.music)
def setup_input (self):
self.player_input = GameInput ()
self.camera_input = GameInput (CAMERA_INPUT_MAP)
self.events.connect (self.player_input)
self.events.connect (self.camera_input)
self.tasks.add (self.player_input)
self.tasks.add (self.camera_input)
self.player_input.assoc ('on_steer', 'panda-mouse-move')
cfg = GlobalConf ().path ('game.player0.keys')
for c in cfg.childs ():
if c.value:
self.player_input.assoc (c.name, c.value)
c.on_conf_change += self.on_control_change
GlobalConf ().path ('game.shader').on_conf_change += \
self.on_shader_change
def setup_controllers (self):
self.camera_ctl = CameraController (
entities = self.entities,
camera = base.camera)
self.player_ctl = PlayerController (
entities = self.entities,
delegate = self.level.boy)
self.level.boy.connect (self.camera_ctl)
self.camera_input.connect (self.camera_ctl)
self.player_input.connect (self.player_ctl)
def setup_hud (self):
self.hud = Hud (entities = self.entities)
self.hud.add_counter ('clock', 'hud/clock.png')
self.hud.add_counter ('pigeons', 'hud/pigeon.png')
self.hud.add_counter ('sticks', 'hud/stick.png')
self.hud.hide ()
def setup_logic (self):
total_pigeons = 0
for f in self.level.flocks:
total_pigeons += len (f.boids)
for b in f.boids:
b.on_death += self.on_kill_pigeon
self.total_pigeons = total_pigeons
self.dead_pigeons = 0
self.level.boy.on_death += self.on_kill_boy
self.num_sticks = self.level.max_sticks
self.player_ctl.on_place_stick_down += self.on_place_stick
self.hud.set_counter ('sticks', self.num_sticks)
self.timer = self.tasks.add (
task.TimerTask (duration = self.level.max_time))
self.timer.on_tick = lambda: self.hud.set_counter (
'clock', int (self.timer.remaining))
self.timer.on_finish = self.on_finish_time
self.tasks.add (self.highlight_stick_task)
self._curr_best_stick = None
self.pigeon_food = []
def do_sink (self):
super (Game, self).do_sink ()
if self.manager.current.state_name == 'menu-noload':
for x in self.entities.entities:
if isinstance (x, task.Task):
x.pause ()
self.events.quiet = True
self.hud.soft_hide ()
self.timer.pause ()
def do_unsink (self, action = 'continue'):
super (Game, self).do_unsink ()
self.manager.panda.relative_mouse ()
self.tasks.resume ()
for x in self.entities.entities:
if isinstance (x, task.Task):
x.resume ()
if action == 'continue':
self.events.quiet = False
self.hud.soft_show ()
self.timer.resume ()
elif action == 'quit':
self.leave_transition ()
elif action == 'retry':
self.leave_transition ('game')
def do_release (self):
self.level.dispose () # TODO: To entity!
self.glow_filter.disable ()
super (Game, self).do_release ()