public static void HandleInput(InputHelper helper, KeyManager keys) { CurrentState?.HandleInput(helper, keys); EconomyGrid economyGrid = ((EconomyState)GetState("economy")).EconomyGrid; SaveGame sg = new SaveGame(economyGrid); int f1 = (int)Keys.F1; int f12 = (int)Keys.F12; for (int i = f1; i <= f12; ++i) { if (helper.KeyPressed((Keys)i) && (helper.IsKeyDown(Keys.LeftShift) || helper.IsKeyDown(Keys.RightShift))) { FileManager.SaveGame("savegametest-" + i, new byte[] { 0x42, 0x10, 0x28, 0x64, 0xFF, 0xEB }, sg); } else if (helper.KeyPressed((Keys)i)) { FileManager.LoadGame("savegametest-" + i, new byte[] { 0x42, 0x10, 0x28, 0x64, 0xFF, 0xEB }, sg); EconomyState ecoState = (EconomyState)GetState("economy"); ecoState.EconomyGrid = sg.EcoGrid; ecoState.Players = sg.EcoGrid.players; } } }
/// <summary> /// Called when a player wins a battle from the battle state. /// </summary> /// <param name="remainingArmy">The remaining Army on the battle field.</param> public static void OnPlayerWinBattle(Army remainingArmy) { CurrentState.FadeOut = true; EconomyState state = GetState("economy") as EconomyState; state.OnPlayerWinBattle(remainingArmy); state.FadeIn = true; SwitchState("economy", false); AssetManager.Instance.PlayMusic("Music/Village of Emerdale"); }