Exemplo n.º 1
0
    def __on_old_game_teardown_end(self, event):
        assert isinstance(event[0], map.Map)
        del globals.active_objects_list[:]

        globals.active_map = event[0]
        pf.new_game_string(globals.active_map.pfmap_str(),
                           update_navgrid=False)
        minimap_pos = pf.get_minimap_position()
        pf.set_minimap_position(UI_LEFT_PANE_WIDTH + minimap_pos[0],
                                minimap_pos[1])
        self.view.hide()

        if event[1] is not None:
            assert len(globals.active_objects_list) == 0
            try:
                globals.active_objects_list = pf.load_scene(
                    event[1], update_navgrid=False)
                globals.scene_filename = event[1]
                for obj in globals.active_objects_list:
                    obj.selectable = True
                faction_descs = pf.get_factions_list()
            except:
                print("Failed to load scene! [{0}]".format(event[1]))

        if len(pf.get_factions_list()) == 0:
            pf.add_faction(DEFAULT_FACTION_NAME, DEFAULT_FACTION_COLOR)
Exemplo n.º 2
0
import views.terrain_tab_window as ttw
import views.objects_tab_window as otw
import views.diplomacy_tab_window as dtw
import views.menu_window as mw

############################################################
# Global settings                                          #
############################################################

pf.set_ambient_light_color((1.0, 1.0, 1.0))
pf.set_emit_light_color((1.0, 1.0, 1.0))
pf.set_emit_light_pos((1664.0, 1024.0, 384.0))
pf.set_active_font("OptimusPrinceps.ttf")

pf.new_game_string(globals.active_map.pfmap_str(), update_navgrid=False)
minimap_pos = pf.get_minimap_position()
pf.set_minimap_position(UI_LEFT_PANE_WIDTH + minimap_pos[0], minimap_pos[1])

pf.disable_unit_selection()
pf.disable_fog_of_war()

pf.add_faction(DEFAULT_FACTION_NAME, DEFAULT_FACTION_COLOR)
mouse_events.install()

############################################################
# Setup UI                                                 #
############################################################

terrain_tab_vc = ttvc.TerrainTabVC(ttw.TerrainTabWindow())
objects_tab_vc = otvc.ObjectsVC(otw.ObjectsTabWindow())
diplo_tab_vc = dtvc.DiplomacyVC(dtw.DiplomacyTabWindow())