Пример #1
0
 def save( self, sfpat = 'egg_{}.sav' ):
     # Save a record of all the containers.
     self._con_rec.clear()
     self._remove_container_for(self.pc)
     self._remove_container_for(self.mecha)
     for npc in self.dramatis_personae:
         self._remove_container_for(npc)
     with open( util.user_dir( sfpat.format( self.pc.name ) ) , "wb" ) as f:
         pickle.dump( self , f, -1 )
     self._reset_container_for(self.pc)
     self._reset_container_for(self.mecha)
     for npc in self.dramatis_personae:
         self._reset_container_for(npc)
Пример #2
0
 def save( self, sfpat = 'egg_{}.sav' ):
     # Save a record of all the containers.
     con_rec = dict()
     self._remove_container_for(self.pc, con_rec)
     self._remove_container_for(self.mecha, con_rec)
     for npc in list(self.dramatis_personae):
         self._remove_container_for(npc, con_rec)
         if npc.is_destroyed():
             self.dramatis_personae.remove(npc)
     with open( util.user_dir( sfpat.format( self.pc.name ) ) , "wb" ) as f:
         pickle.dump( self , f, -1 )
     self._reset_container_for(self.pc, con_rec)
     self._reset_container_for(self.mecha, con_rec)
     for npc in self.dramatis_personae:
         self._reset_container_for(npc, con_rec)
Пример #3
0
    def __call__(self):
        action = True
        while action:
            # rebuild the menu.
            mymenu = pbge.rpgmenu.Menu(-250,
                                       self.dy,
                                       500,
                                       200,
                                       predraw=self.predraw,
                                       font=pbge.my_state.big_font)
            mymenu.add_item(
                "Fullscreen: {}".format(
                    util.config.getboolean("GENERAL", "fullscreen")),
                self.toggle_fullscreen)
            mymenu.add_item(
                "Music On: {}".format(
                    util.config.getboolean("GENERAL", "music_on")),
                self.toggle_music)
            mymenu.add_item(
                "Names Above Heads: {}".format(
                    util.config.getboolean("GENERAL", "names_above_heads")),
                self.toggle_names)
            mymenu.add_item(
                "Auto Save on Scene Change: {}".format(
                    util.config.getboolean("GENERAL", "auto_save")),
                self.toggle_autosave)
            mymenu.add_item(
                "Can Replay Adventures: {}".format(
                    util.config.getboolean("GENERAL",
                                           "can_replay_adventures")),
                self.toggle_replay)

            for op in util.config.options("DIFFICULTY"):
                mymenu.add_item(
                    "{}: {}".format(op,
                                    util.config.getboolean("DIFFICULTY", op)),
                    OptionToggler(op, "DIFFICULTY"))

            mymenu.add_item("Save and Exit", False)
            if action is not True:
                mymenu.set_item_by_value(action)
            action = mymenu.query()
            if action and action is not True:
                action()

        # Export the new config options.
        with open(util.user_dir("config.cfg"), "wt") as f:
            util.config.write(f)
Пример #4
0
    def __call__(self):
        action = True
        while action:
            # rebuild the menu.
            mymenu = pbge.rpgmenu.Menu(-250,self.dy,500,200,
                predraw=self.predraw,font=pbge.my_state.huge_font)
            mymenu.add_item("Fullscreen: {}".format(util.config.getboolean( "DEFAULT", "fullscreen" )),self.toggle_fullscreen)
            mymenu.add_item("Music On: {}".format(util.config.getboolean( "DEFAULT", "music_on" )),self.toggle_music)
            mymenu.add_item("Names Above Heads: {}".format(util.config.getboolean( "DEFAULT", "names_above_heads" )),self.toggle_names)
            mymenu.add_item("Save and Exit",False)
            if action is not True:
                mymenu.set_item_by_value(action)
            action = mymenu.query()
            if action:
                action()

        # Export the new config options.
        with open( util.user_dir( "config.cfg" ) , "wb" ) as f:
            util.config.write( f )
Пример #5
0
    def __call__(self):
        action = True
        while action:
            # rebuild the menu.
            mymenu = pbge.rpgmenu.Menu(-250,self.dy,500,200,
                predraw=self.predraw,font=pbge.my_state.big_font)
            mymenu.add_item("Fullscreen: {}".format(util.config.getboolean( "GENERAL", "fullscreen" )),self.toggle_fullscreen)
            mymenu.add_item("Music On: {}".format(util.config.getboolean( "GENERAL", "music_on" )),self.toggle_music)
            mymenu.add_item("Names Above Heads: {}".format(util.config.getboolean( "GENERAL", "names_above_heads" )),self.toggle_names)

            for op in util.config.options("DIFFICULTY"):
                mymenu.add_item("{}: {}".format(op,util.config.getboolean("DIFFICULTY",op)),OptionToggler(op,"DIFFICULTY"))

            mymenu.add_item("Save and Exit",False)
            if action is not True:
                mymenu.set_item_by_value(action)
            action = mymenu.query()
            if action and action is not True:
                action()

        # Export the new config options.
        with open( util.user_dir( "config.cfg" ) , "wb" ) as f:
            util.config.write( f )
Пример #6
0
 def save(self, sfpat='egg_{}.sav'):
     with open(util.user_dir(sfpat.format(self.pc.name)), "wb") as f:
         self.write(f)
Пример #7
0
    def __call__(self):
        action = True
        pos = 0
        while action:
            # rebuild the menu.
            mymenu = pbge.rpgmenu.Menu(-250,
                                       self.dy,
                                       500,
                                       200,
                                       predraw=self.predraw,
                                       font=pbge.my_state.big_font)
            OptionToggler.add_menu_toggle(mymenu,
                                          "Fullscreen",
                                          "fullscreen",
                                          extra_fun=self.toggle_fullscreen)
            OptionToggler.add_menu_toggle(mymenu,
                                          "Stretch Screen",
                                          "stretchy_screen",
                                          extra_fun=self.toggle_stretchyscreen)
            OptionToggler.add_menu_toggle(mymenu,
                                          "Music On",
                                          "music_on",
                                          extra_fun=self.toggle_music)
            OptionToggler.add_menu_toggle(mymenu, "Names Above Heads",
                                          "names_above_heads")
            OptionToggler.add_menu_toggle(mymenu, "Auto Save on Scene Change",
                                          "auto_save")
            OptionToggler.add_menu_toggle(mymenu, "Can Replay Adventures",
                                          "can_replay_adventures")
            OptionToggler.add_menu_toggle(mymenu, "No Escape From Main Menu",
                                          "no_escape_from_title_screen")

            OptionToggler.add_menu_toggle(mymenu,
                                          "Lancemates repaint their mecha",
                                          "lancemates_repaint_mecha")
            OptionToggler.add_menu_toggle(mymenu,
                                          "Announce start of player turns",
                                          "announce_pc_turn_start")
            OptionToggler.add_menu_toggle(mymenu,
                                          "Scroll to start of action library",
                                          "scroll_to_start_of_action_library")
            OptionToggler.add_menu_toggle(mymenu, "Auto-center map cursor",
                                          "auto_center_map_cursor")
            OptionToggler.add_menu_toggle(mymenu, "Mouse scroll at map edges",
                                          "mouse_scroll_at_map_edges")

            for op in util.config.options("DIFFICULTY"):
                OptionToggler.add_menu_toggle(mymenu,
                                              op,
                                              op,
                                              section="DIFFICULTY")

            mymenu.add_item("Save and Exit", False)
            mymenu.set_item_by_position(pos)
            action = mymenu.query()
            if action and action is not True:
                pos = mymenu.selected_item
                action()

        # Export the new config options.
        with open(util.user_dir("config.cfg"), "wt") as f:
            util.config.write(f)