public void Initialize() { // Events Global.send_metrics_to_server += Global_SendMetricsToServer; Global.check_for_updates_from_server += Global_CheckForUpdatesFromServer; Global.set_update_uri(UpdateChecker.GameDownloadUrl); #if WINDOWS || MONOMAC Global.load_config = true; #endif #if DEBUG && !MONOGAME TactileLibrary.EventInput.Initialize(Game.Window); TactileLibrary.EventInput.CharEntered += new TactileLibrary.EventArg.CharEnteredHandler(EventInput_CharEntered); #endif // Set initial scene #if DEBUG if (!string.IsNullOrEmpty(MapEditorMap)) { Global.scene_change("Scene_Map_Unit_Editor"); } else #endif Global.scene = new SceneInitialLoad(); }
protected virtual void start_chapter(Data_Chapter chapter, Dictionary <string, string> selectedPreviousChapters) { Difficulty_Modes difficulty = Global.game_system.Difficulty_Mode; var validPreviousChapters = Global.save_file.valid_previous_chapters(chapter.Id); if (chapter.Standalone && validPreviousChapters.Count == 0) { Global.game_system.reset(); Global.game_system.reset_event_variables(); //Event_Processor.reset_variables(); //Debug int battalion_index = chapter.Battalion; Global.game_battalions.add_battalion(battalion_index); Global.game_battalions.current_battalion = battalion_index; } else { WorldmapLoadData(chapter.Id, selectedPreviousChapters); Global.game_actors.heal_battalion(); Global.battalion.refresh_deployed(); } Global.game_system.Difficulty_Mode = difficulty; //if (Global.game_system.Style != Mode_Styles.Classic) // Save file is about to be set to null //Debug // Global.save_file.Difficulty = Global.game_system.Difficulty_Mode; Global.game_system.New_Chapter_Id = chapter.Id; Global.game_system.new_chapter(chapter.Prior_Chapters, chapter.Id, selectedPreviousChapters); Global.game_temp = new Game_Temp(); Global.current_save_info.SetStartedChapter(chapter.Id); Global.save_file = null; Global.scene_change("Start_Chapter"); }
public void TitleTestBattle(int distance) { MenuManager = null; Global.game_system.Battler_1_Id = Global.test_battler_1.Actor_Id; Global.game_system.Battler_2_Id = Global.test_battler_2.Actor_Id; Global.game_system.Arena_Distance = distance; Global.game_system.In_Arena = true; Global.scene_change("Scene_Test_Battle"); }
protected virtual bool update_soft_reset() { if (Global.Input.soft_reset() && !SoftResetBlocked) { Global.Audio.stop(); Global.scene_change("Scene_Soft_Reset"); return(true); } SoftResetBlocked = false; return(false); }
public void UnitEditorMapMenuPlaytest() { string chapter_id, map_data_key, unit_data_key, event_data_key; bool valid_map_data = get_map_data( out chapter_id, out map_data_key, out unit_data_key, out event_data_key); if (valid_map_data) { Global.game_system.play_se(System_Sounds.Confirm); Difficulty_Modes difficulty = Global.game_system.Difficulty_Mode; Global.game_system = new Game_System(); Global.game_battalions = new Game_Battalions(); Global.game_actors = new Game_Actors(); Global.game_system.Difficulty_Mode = difficulty; // Switch to the best fit save file Global.game_system.New_Chapter_Id = chapter_id; Global.current_save_id = -1; if (Global.save_files_info != null) { var matching_files = Global.save_files_info .Where(x => x.Value.chapter_available( Global.game_system.New_Chapter_Id)); matching_files = matching_files.ToList(); if (matching_files.Any()) { Global.current_save_id = matching_files .OrderBy(x => x.Key) .First() .Key; } } // Failed to find a save if (Global.current_save_id < 0) { Global.current_save_id = 1; } Global.scene_change("Scene_Map_Playtest"); Global.game_temp.menuing = false; MapMenu = null; } else { Global.game_system.play_se(System_Sounds.Buzzer); } }
protected virtual void update_promotion_action_2() { switch (Level_Up_Timer) { case 40: Level_Up_Action++; Level_Up_Timer = 0; Global.scene_change("Scene_Promotion"); break; default: Level_Up_Timer++; break; } }
public override void update() { if (update_soft_reset()) return; Timer++; //Debug if (Timer < 0) BlackScreen.TintA = 255; else if (Timer <= Config.SPLASH_FADE_TIME) BlackScreen.TintA = (byte)(255 - (255 * Timer) / Config.SPLASH_FADE_TIME); //Splash.opacity = (255 * Timer) / Config.SPLASH_FADE_TIME; //Debug else if (Config.SPLASH_TIME - Timer <= Config.SPLASH_FADE_TIME) BlackScreen.TintA = (byte)(255 - (255 * (Config.SPLASH_TIME - Timer)) / Config.SPLASH_FADE_TIME); //Splash.opacity = (255 * (Config.SPLASH_TIME - Timer)) / Config.SPLASH_FADE_TIME; //Debug if (Timer >= -(Config.SPLASH_INITIAL_BLACK_TIME - 10)) { // Skip to title with start if (Global.Input.triggered(Inputs.Start)) Global.scene_change("Scene_Title"); else if (Timer >= Config.SPLASH_TIME || Global.Input.triggered(Inputs.A) || Global.Input.any_mouse_triggered || Global.Input.gesture_triggered(TouchGestures.Tap)) { Timer = 0; if (DisclaimerIndex <= DISCLAIMERS.Length) { DisclaimerIndex++; set_disclaimer_text(); } if (DisclaimerIndex >= DISCLAIMERS.Length) { Image_Index++; // Advance to title load if out of splash screens if (Image_Index >= Config.SPLASH_SCREENS.Length) Global.scene_change("Scene_Title_Load"); else set_splash_image(); } } } base.update(); }
protected override void update_promotion_action_2() { int alpha; switch (Level_Up_Timer) { case 0: Global.game_temp.boss_theme = false; // Not sure if needed but //Yeti Global.Audio.BgmFadeOut(60); Global.Audio.sfx_fade(60); Skip_Fill = new Sprite(battle_content.Load <Texture2D>(@"Graphics/White_Square")); Skip_Fill.dest_rect = new Rectangle(0, 0, Config.WINDOW_WIDTH, Config.WINDOW_HEIGHT); alpha = (Level_Up_Timer + 1) * 8; Skip_Fill.tint = new Color(alpha, alpha, alpha, alpha); Level_Up_Timer++; break; case 31: Skip_Fill.tint = new Color(255, 255, 255, 255); Level_Up_Timer++; break; case 39: Level_Up_Action++; Level_Up_Timer = 0; change_to_promotion(); Global.scene_change("Scene_Promotion"); break; default: if (Level_Up_Timer <= 30) { alpha = (Level_Up_Timer + 1) * 8; Skip_Fill.tint = new Color(alpha, alpha, alpha, alpha); } Level_Up_Timer++; break; } }
protected virtual void battle_end() { Global.scene_change("Scene_Map"); Global.game_state.battle_ending = true; Global.game_map.ShowUnits(); }
private void update_worldmap_command() { switch (Phase) { case Worldmap_Phases.Fade_In: switch (Timer) { default: // If autoselecting a chapter with no world map event if (MenuData.AutoSelectChapter && GetWorldmapEvent() == null) { // If hard mode is blocked, nevermind if (!IsBlockedHardMode(MenuData.ChapterId)) { MenuManager = null; start_chapter(); break; } } if (Fade_Timer > 0) { Fade_Timer--; } if (Fade_Timer == Constants.WorldMap.WORLDMAP_FADE_TIME / 4) { if (!MenuData.AutoSelectChapter) { Global.Audio.PlayBgm(Constants.WorldMap.WORLDMAP_THEME); } } if (Fade_Timer == 0) { Phase = Worldmap_Phases.Command_Process; } break; } break; case Worldmap_Phases.Command_Process: if (MenuData.AutoSelectChapter) { select_chapter_fade(); } break; case Worldmap_Phases.Controls_Fade: if (Hard_Mode_Blocked_Window != null) { Hard_Mode_Blocked_Window.update(); if (Hard_Mode_Blocked_Window.is_ready) { if (Hard_Mode_Blocked_Window.selected_index().IsSomething) { Global.game_system.play_se(System_Sounds.Confirm); Hard_Mode_Blocked_Window = null; } } } else { if (Fade_Timer > 0) { Fade_Timer--; MenuOffset += new Vector2(-1, 0); } if (Fade_Timer == 0 && !scrolling) { MenuManager = null; start_chapter_worldmap_event(); } } break; case Worldmap_Phases.Worldmap_Event: if (!Global.game_system.is_interpreter_running) { Phase = Worldmap_Phases.Fade_Out; Fade_Timer = Constants.WorldMap.WORLDMAP_FADE_TIME; Global.Audio.BgmFadeOut(Constants.WorldMap.WORLDMAP_FADE_TIME); } break; case Worldmap_Phases.Fade_Out: if (Fade_Timer > 0) { Fade_Timer--; } if (Fade_Timer == 0) { start_chapter(); } break; case Worldmap_Phases.Return_To_Title: if (Fade_Timer > 0) { Fade_Timer--; } if (Fade_Timer == 0) { Global.scene_change("Scene_Title_Load"); MenuManager = null; } break; } }
public void TitleClassReel() { MenuManager = null; Global.scene_change("Scene_Class_Reel"); }
protected void start_game() { Global.scene_change("Start_Game"); Global.Audio.BgmFadeOut(30); }
protected void update_class_name() { switch (Action) { // Load next class case 0: switch (Timer) { case 0: increment_index(); Timer++; break; case 60: if (Closing) { Global.scene_change("Scene_Title_Load"); } else { Timer = 0; Action++; Class_Name = "" + Unit.actor.class_name; } break; default: if (Timer >= 10 && Timer < 42) { Title_Black.TintA = (byte)(256 - (Timer - 9) * 5); Class_Banner.opacity += 8; Class_Banner.offset.Y += Timer % 4 == 0 ? 1 : 0; } Timer++; break; } break; // Create letters case 1: if (Timer == 0) { if (Class_Name.Length == 0) { Action++; } else { add_letter(); Timer++; if (Timer >= Spiral_Letter.DELAY) { Timer = 0; } } } else { Timer++; if (Timer >= Spiral_Letter.DELAY) { Timer = 0; } } break; // Pause on name case 2: if (Timer >= Spiral_Letter.FLASH_TIME && Timer < Spiral_Letter.FLASH_TIME + 8) { Class_Banner_Color.R = (byte)MathHelper.Clamp(Class_Banner_Color.R + 32, 0, 255); Class_Banner_Color.G = (byte)MathHelper.Clamp(Class_Banner_Color.G + 32, 0, 255); Class_Banner_Color.B = (byte)MathHelper.Clamp(Class_Banner_Color.B + 32, 0, 255); Class_Banner_Color.A = (byte)MathHelper.Clamp(Class_Banner_Color.A + 22, 0, 255); } else if (Timer >= Spiral_Letter.FLASH_TIME + 16 && Timer < Spiral_Letter.FLASH_TIME + 24) { Class_Banner_Color.A = (byte)MathHelper.Clamp(Class_Banner_Color.A - 32, 0, 255); } else if (Timer >= Spiral_Letter.TOTAL_WAIT && Timer < Spiral_Letter.TOTAL_WAIT + 32) { int timer = Timer - Spiral_Letter.TOTAL_WAIT; Class_Banner.scale = new Vector2(1 + 2 * ((1 + timer) / 32f), 1 - (float)Math.Sqrt(timer / 32f)); Class_Banner.opacity -= 8; } else if (Timer == Spiral_Letter.TOTAL_WAIT + 32) { Class_Banner.visible = false; Timer = 0; Action++; return; } Timer++; break; // White flash case 3: switch (Timer) { case 47: White_Screen.opacity = 255; create_battler(); Burst = null; Title_Back = null; Letters.Clear(); Timer = 0; Action++; break; default: if (Timer == 0) { Burst = new Sprite(Global.Content.Load <Texture2D>(@"Graphics/Pictures/burst")); Burst.loc = new Vector2(Config.WINDOW_WIDTH / 2, Config.WINDOW_HEIGHT / 2); Burst.offset = new Vector2(Burst.texture.Width / 2, Burst.texture.Height / 2); Burst.blend_mode = 1; Burst.opacity = 0; Burst.stereoscopic = Config.REEL_BURST_DEPTH; } Burst.opacity += 8; // Resize/rotate if (Timer % 3 == 0) { Burst.scale = Vector2.One * (Timer + 1) / 100f * ((Timer + 1) / 48f + 1); Burst.angle = -(Timer + 1) * 4 / 360f * MathHelper.Pi; } // White screen if (Timer >= 16) { White_Screen.opacity = (Timer - 15) * 8; } Timer++; break; } break; // Fade out for next phase case 4: switch (Timer) { case 47: change_phase(Class_Reel_Phases.Animation); break; default: if (Timer >= 16 && Timer <= 31) { White_Screen.opacity = (31 - Timer) * 16; } Timer++; break; } break; } }
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(""); }
public override void update() { Player.update_anim(); switch (Phase) { case Save_Phases.Load_File: Global.load_save_file = true; Global.ignore_options_load = true; Phase = Save_Phases.Cleanup; break; case Save_Phases.Cleanup: Global.game_actors.heal_battalion(); Global.game_actors.temp_clear(); Global.current_save_info.ResetStartedChapter(); if (Global.game_system.Style != Mode_Styles.Classic) { Global.save_file.Difficulty = Global.game_system.Difficulty_Mode; } Phase = Save_Phases.Save_Data; break; case Save_Phases.Save_Data: if (MenuManager != null) { MenuManager.Update(); if (MenuManager.Finished) { MenuManager = null; } } else { UpdateSaveData(); } break; case Save_Phases.Overwrite_Confirm: MenuManager.Update(); break; case Save_Phases.World_Map: // Advance after save complete if (!this.save_data_calling) { if (Timer > 0) { Timer--; } else { Global.Audio.StopBgm(); Global.scene_change("Scene_Worldmap"); if (All_Saves_Overwritten) { Global.delete_suspend = true; } Global.load_save_info = true; Global.skipUpdatingFileId = true; } } break; } }
public void update(KeyboardState key_state) { update_message(); Player.update_anim(); if (update_soft_reset()) { return; } if (!Global.load_save_info) { if (TitleTheme != TitleThemeStarts.None) { switch (TitleTheme) { case TitleThemeStarts.PlayTheme: Global.Audio.PlayBgm(Global.BgmConfig.TitleTheme); break; case TitleThemeStarts.FadeInTheme: Global.Audio.PlayBgm(Global.BgmConfig.TitleTheme, true); break; case TitleThemeStarts.Transition: Global.Audio.PlayBgm(Global.BgmConfig.ChapterTransitionTheme); break; } TitleTheme = TitleThemeStarts.None; } } if (Closing) { // If trying to load suspend and failed if (Loading_Suspend && !Global.suspend_load_successful) { Loading_Suspend = false; Closing = false; } else { Timer++; if (Timer >= Config.TITLE_GAME_START_TIME) { // If shutting down if (Quitting) { Global.quit(); } // If loading suspend else if (Loading_Suspend) { Global.scene_change("Load_Suspend"); } // Else start game else { Global.game_system.Difficulty_Mode = Global.save_file.Difficulty; start_game(); } MenuManager = null; return; } } } MenuManager.Update(!Closing); SoftResetBlocked = MenuManager != null && MenuManager.SoftResetBlocked; }
protected override void battle_end() { Global.scene_change("Scene_Title"); Global.game_system.In_Arena = false; }
public override void update() { if (Title_Back != null) { Title_Back.update(); foreach (Spiral_Letter letter in Letters) { letter.update(); } } if (Battler != null) { Battler.update(); } if (Message != null) { Message.update(); } if ((Global.Input.triggered(Inputs.A) || Global.Input.mouse_triggered(MouseButtons.Left) || Global.Input.gesture_triggered(TouchGestures.SwipeLeft)) && (Action > 0 || Timer > 0)) { switch (Phase) { case Class_Reel_Phases.Class_Name: if (Index < Data_Order.Count) { change_phase(Class_Reel_Phases.Animation); Timer = -16; } break; case Class_Reel_Phases.Animation: change_phase(Class_Reel_Phases.Force_Close); Action = 1; break; } } else { switch (Phase) { case Class_Reel_Phases.Class_Name: update_class_name(); break; case Class_Reel_Phases.Animation: update_animation(); break; case Class_Reel_Phases.Closing: case Class_Reel_Phases.Force_Close: update_closing(); break; } } if (Black_Bar_Timer >= 0) { Black_Bar_Timer++; background_clear(Black_Bar_Timer); if (Black_Bar_Timer == 20) { Black_Bar_Timer = -1; } } White_Flash.visible = false; if (Battler != null) { update_battler_animation(); Battler.update_flash(); if (Battler.flash) { White_Flash.visible = true; } } if (Global.Input.triggered(Inputs.B) || Global.Input.triggered(Inputs.Start) || Global.Input.mouse_triggered(MouseButtons.Right) || Global.Input.gesture_triggered(TouchGestures.Tap)) { Global.scene_change("Scene_Title"); Global.Audio.StopBgm(); } }