本文整理汇总了Python中dialog.Dialog.show_exit_menu方法的典型用法代码示例。如果您正苦于以下问题:Python Dialog.show_exit_menu方法的具体用法?Python Dialog.show_exit_menu怎么用?Python Dialog.show_exit_menu使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类dialog.Dialog
的用法示例。
在下文中一共展示了Dialog.show_exit_menu方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: Game
# 需要导入模块: from dialog import Dialog [as 别名]
# 或者: from dialog.Dialog import show_exit_menu [as 别名]
#.........这里部分代码省略.........
def quest1(self):
self.dialog.hide()
self._quest = 1
self.setState(STATE_PLAY)
def quest2(self):
self.dialog.hide()
self._quest = 2
self.setState(STATE_PLAY)
self._secState = STATE_BEE2
def quest3(self):
self.dialog.hide()
self._quest = 3
self.setState(STATE_PLAY)
self._secState = STATE_WIZARD2
def game_over(self):
self.exit()
def end(self):
self.deleteStatus()
self.exit()
"""
The following functions allow the user to save, load and delete the game status.
"""
def show_save_dialog(self):
if self._state == STATE_PLAY:
self._old_state = self._state
self.setState(STATE_PAUSE)
self.dialog.hide_instancemenu()
self.dialog.show_exit_menu(self.saveStatus, self.loadButtonPress, self.exit)
else:
if self.dialog.exit_load_visible():
self.dialog.hide_exit_menu()
self.dialog.hide_load_menu()
self.setState(STATE_PLAY)
def exit(self):
self.agentManager.destroy()
cmd = fife.Command()
cmd.setSource(None)
cmd.setCommandType(fife.CMD_QUIT_GAME)
self.engine.getEventManager().dispatchCommand(cmd)
def saveStatus(self):
name_tmp = "./saves/{:s}".format(datetime.datetime.now().strftime("%Y-%m-%d_%H:%M"))
name = name_tmp
i = 1
while os.path.exists(name):
name = "{:s}_{:d}".format(name_tmp, i)
i += 1
Config = SafeConfigParser()
Config.add_section("GAME")
Config.set("GAME", "quest", str(self._quest))
Config.set("GAME", "state", str(self._old_state))
Config.set("GAME", "secState", str(self._secState))
Config.add_section("PLAYABLE_AGENTS")
for a in self.agentManager.playableAgent:
c = a.agent.getLocation().getMapCoordinates()
Config.set("PLAYABLE_AGENTS", a.agentName.replace(':', '_'),
"{:d};{:d};{:f};{:f};{:d}".format(int(a.health), int(a.magic), c.x*2, c.y*2, int(a._mode)))