Ejemplo n.º 1
0
        private void ChangeScene(string newScene)
        {
            Global.return_to_title = false;
            if (Global.map_exists && MoveRangeUpdateThread == null)
            {
                StartMoveRangeThread();
            }
            bool   sceneChanged = true;
            string text         = Global.game_temp.message_text;

            Global.game_temp.message_text = null;
            switch (newScene)
            {
            case "Scene_Splash":
                Global.scene = new Scene_Splash();
                break;

            case "Scene_Soft_Reset":
                EndMoveRangeThread();
                MoveRangeUpdateThread = null;
                Global.scene          = new Scene_Soft_Reset();
                break;

#if DEBUG
            case "Debug_Start":
#endif
            case "Start_Game":
            case "Scene_Worldmap":

                IOHandler.RefreshSaveId();
#if DEBUG
                IOHandler.RefreshDebugFileId(newScene == "Debug_Start");

                if (newScene == "Start_Game" || newScene == "Debug_Start")
                {
                    newScene = "Start_Game";
#else
                if (newScene == "Start_Game")
                {
#endif
                    IOHandler.LoadFile(true);
                    Global.game_options.post_read();
                    Global.game_temp = new Game_Temp();
                }
                Global.change_to_new_scene(newScene);
                break;

            case "Scene_Save":
                Global.change_to_new_scene("Scene_Save");
                break;

            case "Start_Chapter":
                EndMoveRangeThread();


                Global.start_chapter();


                StartMoveRangeThread();
                break;

#if !MONOGAME && DEBUG
            case "Scene_Map_Unit_Editor":
                EndMoveRangeThread();

                Global.start_unit_editor(
                    MapEditorUnits, MapEditorMap, MapEditorUnitsSource);

                StartMoveRangeThread();
                break;

            case "Scene_Map_Playtest":
                if (!Global.scene.is_unit_editor)
                {
                    Print.message("Failed to start playtest, not currently in unit editor");
                    sceneChanged = false;
                }
                else
                {
                    IOHandler.RefreshFileId();
                    IOHandler.LoadFile(true);
                    Global.game_options.post_read();
                    Global.game_temp = new Game_Temp();



                    EndMoveRangeThread();

                    Global.start_unit_editor_playtest();

                    StartMoveRangeThread();
                }
                break;
#endif
            case "Load_Suspend":
                IOHandler.RefreshSaveId();

                // Resume Arena
                if (Global.in_arena())
                {
                    ChangeScene("Scene_Arena");
                    StartMoveRangeThread();
                    return;
                }
                else
                {
                    Global.suspend_finish_load(true);
                    StartMoveRangeThread();
                }
                break;

            case "Scene_Map":
                Global.change_to_new_scene("Scene_Map");
                Global.init_map();
                break;

            case "Scene_Dance":
            case "Scene_Staff":
            case "Scene_Arena":
            case "Scene_Battle":
            case "Scene_Promotion":
#if DEBUG
            case "Scene_Test_Battle":
                if (newScene == "Scene_Test_Battle")
                {
                    Global.change_to_new_scene("Scene_Test_Battle");
                }
                else
                {
#endif
                Global.change_to_new_scene(newScene);
                Global.initialize_action_scene(newScene == "Scene_Arena", newScene == "Scene_Promotion");
#if DEBUG
            }
#endif
                break;

            case "Scene_Title_Load":
                Global.reset_system();
                Global.change_to_new_scene("Scene_Title_Load");
                break;

            case "Scene_Title":
                Global.reset_system();
                Global.clear_events();
                Global.change_to_new_scene("Scene_Title");
                break;

            case "Scene_Class_Reel":
                Global.game_temp = new Game_Temp();
                Global.new_game_actors();
                Global.change_to_new_scene("Scene_Class_Reel");
                break;

            default:
                sceneChanged = false;
#if DEBUG
                Print.message("Non-existant scene type called: " + Global.new_scene);
#endif
                break;
            }

            if (sceneChanged)
            {
                Global.dispose_battle_textures();
                Global.dispose_face_textures();
                Global.Audio.stop_bgs(); //@Debug
                Global.Audio.stop_me();  //@Debug
            }
            else
            {
                Global.game_temp.message_text = text;
            }
            Global.scene_change("");
        }