Beispiel #1
0
        public static void start_unit_editor(string chapterId, string mapDataKey, string unitDataKey)
        {
            UnitEditorActive = true;

            Global.game_temp       = new Game_Temp();
            Global.game_battalions = new Game_Battalions();
            Global.game_actors     = new Game_Actors();
            Global.change_to_new_scene("Scene_Map_Unit_Editor");

            Global.game_system.reset();
            Global.game_system.new_chapter(new List <string>(), Global.game_system.chapter_id, new Dictionary <string, string>());

            Global.reset_game_state();
            var old_map = Global.game_map;

            Global.game_map = new Game_Map();
            Global.player   = new Player();

            // Trying to start this after everything else, instead of in the middle
            //move_range_update_thread(); //Debug
            Global.clear_events();

            //Global.Audio.clear_map_theme(); //@Debug

            Global.set_unit_editor_data(chapterId, mapDataKey, unitDataKey);
            Global.change_game_state_turn();

            if (old_map != null)
            {
                Global.game_map.set_scroll_loc(old_map.display_loc, true, true);
                Global.player.center_cursor(true);
            }
        }
Beispiel #2
0
        public static void start_chapter()
        {
            Global.change_to_new_scene("Scene_Map");

            Global.reset_game_state();
            Global.game_map = new Game_Map();
            Global.player   = new Player();

            // Trying to start this after everything else, instead of in the middle
            //move_range_update_thread(); //Debug
            Global.clear_events();

            //Global.Audio.clear_map_theme(); //@Debug

            Global.set_map_data();
            Global.game_state.reset_support_data();
            Global.change_game_state_turn();
        }
Beispiel #3
0
        public static void start_unit_editor_playtest()
        {
            var old_scene = Global.scene;

            if (!(old_scene is Scene_Map_Unit_Editor))
            {
                return;
            }

            Difficulty_Modes difficulty = Global.game_system.Difficulty_Mode;
            var chapter = Global.data_chapters[Global.game_system.New_Chapter_Id];

            var previous_chapters    = Global.save_file.valid_previous_chapters(chapter.Id);
            var previous_chapter_ids = previous_chapters
                                       .ToDictionary(p => p.Key, p => p.Value.Count == 0 ? "" : p.Value.Last());

            if (previous_chapters.Count == 0 || previous_chapters.Any(x => x.Value.Count == 0))
            {
                if (previous_chapters.Count > 0)
                {
                    Print.message(string.Format(
                                      "Could not load any save data\nfor \"{0}\", tried to use save file {1}",
                                      Global.game_system.New_Chapter_Id, Global.current_save_id));
                }
                previous_chapter_ids = previous_chapter_ids
                                       .ToDictionary(p => p.Key, p => "");
                Global.game_system.reset();
                Global.game_system.reset_event_variables();
                int battalion_index = chapter.Battalion;
                Global.game_battalions.add_battalion(battalion_index);
                Global.game_battalions.current_battalion = battalion_index;
            }
            else
            {
                Global.save_file.load_data(chapter.Id, previous_chapter_ids, "");

                Global.game_actors.heal_battalion();
                Global.battalion.refresh_deployed();
            }
            Global.game_system.Difficulty_Mode = difficulty;

            if (Global.game_system.Style != Mode_Styles.Classic)
            {
                Global.save_file.Difficulty = Global.game_system.Difficulty_Mode;
            }
            Global.game_system.new_chapter(chapter.Prior_Chapters, chapter.Id,
                                           previous_chapter_ids);

            // these weren't copied in like the rest of the Scene_Worldmap.start_chapter() stuff? //Debug
            Global.game_temp = new Game_Temp();
            Global.save_file = null;


            Global.change_to_new_scene("Scene_Map");

            Global.reset_game_state();
            var old_map = Global.game_map;

            Global.game_map = new Game_Map();
            Global.player   = new Player();

            // Trying to start this after everything else, instead of in the middle
            //move_range_update_thread(); //Debug
            Global.clear_events();

            //Global.Audio.clear_map_theme(); //@Debug

            (Scene as Scene_Map).set_map(old_scene as Scene_Map_Unit_Editor);
            Global.game_state.reset_support_data();
            Global.change_game_state_turn();

            if (old_map != null)
            {
                Global.game_map.set_scroll_loc(old_map.display_loc, true, true);
                Global.player.center_cursor(true);
            }
        }