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)
def __on_fac_new(self, event): if len(pf.get_factions_list()) == DiplomacyVC.MAX_NUM_FACTIONS: print("Maximum number of factions reached!") return new_name = event[0] new_clr = event[1] pf.add_faction(new_name, new_clr) self.view.selected_fac_idx = len(pf.get_factions_list()) - 1
def setup_scene(): 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.new_game("assets/maps", "plain.pfmap") pf.add_faction("RED", (255, 0, 0, 255)) pf.add_faction("BLUE", (0, 0, 255, 255)) pf.set_diplomacy_state(0, 1, pf.DIPLOMACY_STATE_PEACE) pf.set_faction_controllable(0, False) pf.set_faction_controllable(1, False)
def setup_scene(): 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.settings_set("pf.game.fog_of_war_enabled", False, persist=False) pf.new_game("assets/maps", "plain.pfmap") pf.add_faction("RED", (255, 0, 0, 255)) pf.add_faction("BLUE", (0, 0, 255, 255)) pf.set_diplomacy_state(0, 1, pf.DIPLOMACY_STATE_WAR) pf.set_faction_controllable(0, False) pf.set_faction_controllable(1, False)
# 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()) tab_bar_vc = tbvc.TabBarVC(tbw.TabBarWindow(), EVENT_TOP_TAB_SELECTION_CHANGED) tab_bar_vc.push_child("Terrain", terrain_tab_vc) tab_bar_vc.push_child("Objects", objects_tab_vc) tab_bar_vc.push_child("Diplomacy", diplo_tab_vc) tab_bar_vc.activate()