当前位置: 首页>>代码示例>>Python>>正文


Python Dialog.show_load_menu方法代码示例

本文整理汇总了Python中dialog.Dialog.show_load_menu方法的典型用法代码示例。如果您正苦于以下问题:Python Dialog.show_load_menu方法的具体用法?Python Dialog.show_load_menu怎么用?Python Dialog.show_load_menu使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在dialog.Dialog的用法示例。


在下文中一共展示了Dialog.show_load_menu方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: Game

# 需要导入模块: from dialog import Dialog [as 别名]
# 或者: from dialog.Dialog import show_load_menu [as 别名]

#.........这里部分代码省略.........
                        "{:d};{:d};{:f};{:f};{:d}".format(int(a.health), int(a.magic), c.x*2, c.y*2, int(a._mode)))
        Config.add_section("BEES")
        for b in self.agentManager.bees:
            c = b.agent.getLocation().getMapCoordinates()
            Config.set("BEES", b.agentName.replace(':','_'), "{:f};{:f};{:d};{:d}".format(c.x*2, c.y*2, int(b.state), int(b.mode)))
        cfg = open(name, "w")
        Config.write(cfg)
        cfg.close()
        cfg = open("./conf", "w")
        Config.write(cfg)
        cfg.close()
        self.setState(STATE_PLAY)
        self.dialog.hide_exit_menu()

    def deleteStatus(self):
        Config = SafeConfigParser()
        cfg = open("./conf", "w")
        cfg.close()

    def loadButtonPress(self):
        list = []
        tmp_list = []
        for fn in os.listdir("./saves/"):
            tmp_list.append(fn)
        tmp_list.sort(reverse=True)
        i = 1
        for fn in tmp_list:
            obj = LoadObject(self, fn)
            list.append(obj)
            i += 1
            if i > 8:
                break
        self.dialog.hide_exit_menu()
        self.dialog.show_load_menu(list)

    def loadStatus(self, name="./conf"):
        config = SafeConfigParser()
        config.read(name)
        try:
            if config.sections() != []:
                if config.has_section("GAME"):
                    self._quest = config.getint("GAME", "quest")
                    self.setState(config.getint("GAME", "state"))
                    self._secState = config.get("GAME", "secState")
                    if self._secState != "None":
                        self._secState = int(self._secState)
                if config.has_section("PLAYABLE_AGENTS"):
                    self.agentManager.reset()
                    for l in config.options("PLAYABLE_AGENTS"):
                        name = "{:s}:{:s}".format(l.split('_')[0].upper(), l.split('_')[1])
                        a = self.agentManager.getAgentByName(name)
                        params = config.get("PLAYABLE_AGENTS", l).split(';')
                        if a != None:
                            a.health = int(params[0])
                            a.magic = int(params[1])
                            l = a.agent.getLocation()
                            l.setLayerCoordinates(fife.ModelCoordinate(*(int(float(params[2])), int(float(params[3])))))
                            a.agent.setLocation(l)
                            a._mode = int(params[4])
                        self.agentManager.addNewPlayableAgent(name)
                if config.has_section("BEES"):
                    for l in config.options("BEES"):
                        name = "{:s}:{:s}:{:s}".format(l.split('_')[0].upper(), l.split('_')[1], l.split('_')[2])
                        b = self.agentManager.getAgentByName(name)
                        params = config.get("BEES", l).split(';')
                        if b != None:
开发者ID:drolando,项目名称:SoftDev,代码行数:70,代码来源:game.py


注:本文中的dialog.Dialog.show_load_menu方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。