diff --git a/isometric-park-fna/FNAGame.cs b/isometric-park-fna/FNAGame.cs --- a/isometric-park-fna/FNAGame.cs +++ b/isometric-park-fna/FNAGame.cs @@ -815,7 +815,7 @@ if (this.showForest) { - ForestWindow.Render(ref this.showForest, debugWindow.monoFont, this.simulation); + ForestWindow.Render(this.showForest, debugWindow.monoFont, this.simulation, this.imGuiWindowBridgeEngine); } if (this.showNews) diff --git a/isometric-park-fna/UI/ForestWindow.cs b/isometric-park-fna/UI/ForestWindow.cs --- a/isometric-park-fna/UI/ForestWindow.cs +++ b/isometric-park-fna/UI/ForestWindow.cs @@ -2,13 +2,17 @@ using Num = System.Numerics; +using isometricparkfna.Messages; +using isometricparkfna.Engines; + namespace isometricparkfna.UI { public static class ForestWindow { - public static void Render(ref bool show, ImFontPtr font, Simulation sim) + public static void Render(bool show, ImFontPtr font, Simulation sim, ImGuiWindowBridgeEngine engine) { + bool newShow = show; if (show) { ImGui.PushFont(font); @@ -58,6 +62,10 @@ ImGui.PopStyleColor(8); ImGui.PopFont(); } + if (show != newShow) + { + engine.messages.Add(new ToggleWindowMessage {Window = Window.Forest }); + } } } -} \ No newline at end of file +} diff --git a/isometric-park-fna/UI/NewsWindow.cs b/isometric-park-fna/UI/NewsWindow.cs --- a/isometric-park-fna/UI/NewsWindow.cs +++ b/isometric-park-fna/UI/NewsWindow.cs @@ -148,7 +148,6 @@ if (show != newShow) { engine.messages.Add(new ToggleWindowMessage {Window = Window.News }); - // SendMessage(new ToggleWindowMessage {Window = Window.News }); } } }