diff --git a/isometric-park-fna/Engines/Spawners/GameSpawner.cs b/isometric-park-fna/Engines/Spawners/GameSpawner.cs --- a/isometric-park-fna/Engines/Spawners/GameSpawner.cs +++ b/isometric-park-fna/Engines/Spawners/GameSpawner.cs @@ -108,6 +108,12 @@ this.game.enqueueDialog(DialogTrees.flatten(DialogTrees.testTree, this.grammar)); #endregion + this.simulation.Subsidy = message.Difficulty switch { + DifficultyLevel.Hard => 0M, + DifficultyLevel.Medium => 750M, + DifficultyLevel.Easy => 1000M, + }; + Logging.Success("Spawned new game."); } diff --git a/isometric-park-fna/Messages/SpawnGameMessage.cs b/isometric-park-fna/Messages/SpawnGameMessage.cs --- a/isometric-park-fna/Messages/SpawnGameMessage.cs +++ b/isometric-park-fna/Messages/SpawnGameMessage.cs @@ -2,5 +2,15 @@ namespace isometricparkfna.Messages { - public struct SpawnGameMessage : IMessage { } + public enum DifficultyLevel + { + Easy, + Medium, + Hard + } + + + public struct SpawnGameMessage : IMessage { + public DifficultyLevel Difficulty; + } } diff --git a/isometric-park-fna/Simulation.cs b/isometric-park-fna/Simulation.cs --- a/isometric-park-fna/Simulation.cs +++ b/isometric-park-fna/Simulation.cs @@ -61,6 +61,8 @@ public const int MAX_TREES_TO_PLANT = 25; public const int MAX_TREES_TO_CLEAR = 25; + public decimal Subsidy { get; set; } + public int Tick { get; @@ -297,7 +299,7 @@ DateTime = this.DateTime, money = this.money, trees = this.map.tree_count, - subsidy = 1000, + subsidy = this.Subsidy, contracts = this.contracts, enforcement = this.enforcement, upkeep = (int)(this.map.tree_count * 1.5), diff --git a/isometric-park-fna/UI/InGameMenu.cs b/isometric-park-fna/UI/InGameMenu.cs --- a/isometric-park-fna/UI/InGameMenu.cs +++ b/isometric-park-fna/UI/InGameMenu.cs @@ -49,6 +49,7 @@ bridgeEngine.gameStateMessages.Add(new GameStateMessage{isPlaying = false}); bridgeEngine.typeMessages.Add(new ToggleWindowTypeMessage{Window = Window.InGameMenu}); + bridgeEngine.typeMessages.Add(new ToggleWindowTypeMessage{Window = Window.MainMenu}); } if (ImGui.Button("Quit", button_size)) { diff --git a/isometric-park-fna/UI/NewGameWindow.cs b/isometric-park-fna/UI/NewGameWindow.cs --- a/isometric-park-fna/UI/NewGameWindow.cs +++ b/isometric-park-fna/UI/NewGameWindow.cs @@ -12,13 +12,6 @@ namespace isometricparkfna.UI { - enum DifficultyLevel - { - Easy, - Medium, - Hard - } - public static class NewGameWindow { @@ -47,6 +40,13 @@ public static void Initialize() { + NewGameWindow.Reset(); + + showModal = true; + + } + + public static void Reset() { parkNameBuffer = new byte[BUFFER_SIZE]; pos = 0; @@ -60,9 +60,6 @@ customTitleBuffer = new byte[BUFFER_SIZE]; customTitlePos = 0; - - showModal = true; - } public static void Render(ImFontPtr font, ImFontPtr italicFont, ImGuiWindowBridgeEngine bridgeEngine) @@ -197,9 +194,10 @@ bridgeEngine.setTextVariableMessages.Add(new SetTextVariableMessage { variable = "playerCasual", value = playerName2Buffer }); bridgeEngine.setTextVariableMessages.Add(new SetTextVariableMessage { variable = "playerTitle", value = selectedTitle}); - bridgeEngine.spawnGameMessages.Add(new SpawnGameMessage{}); + bridgeEngine.spawnGameMessages.Add(new SpawnGameMessage{ Difficulty = (DifficultyLevel)choice }); bridgeEngine.typeMessages.Add(new ToggleWindowTypeMessage {Window = Window.NewGame}); bridgeEngine.gameStateMessages.Add(new GameStateMessage { isPlaying = true}); + NewGameWindow.Reset(); } ImGui.SameLine(); @@ -208,6 +206,7 @@ bridgeEngine.typeMessages.Add(new ToggleWindowTypeMessage {Window = Window.NewGame}); bridgeEngine.typeMessages.Add(new ToggleWindowTypeMessage { Window = Window.MainMenu }); + NewGameWindow.Reset(); }