# HG changeset patch # User Alys Brooks # Date 2021-10-23 21:08:37 # Node ID 4833f85973a530eb1554fec0e233bddb3abf8aba # Parent a819423abe8f24c3d3e9017855ed7845c3cd15fa Add low budget indicators. diff --git a/isometric-park-fna/Engines/ImGuiWindowBridgeEngine.cs b/isometric-park-fna/Engines/ImGuiWindowBridgeEngine.cs --- a/isometric-park-fna/Engines/ImGuiWindowBridgeEngine.cs +++ b/isometric-park-fna/Engines/ImGuiWindowBridgeEngine.cs @@ -63,6 +63,9 @@ public bool showContractIndicator; public List contracts; + public bool showBudgetLow; + public bool showBudgetNegative; + public ImFontPtr font; public ImFontPtr italicFont; private DebugWindow debugWindow; @@ -98,6 +101,8 @@ this.windowStatuses = new Dictionary(); this.showContractIndicator = false; + this.showBudgetLow = false; + this.showBudgetNegative = false; this.font = font; this.italicFont = italicFont; @@ -237,6 +242,10 @@ } } + this.showBudgetLow = (this.Simulation .latestBudget.money < 10_000M); + this.showBudgetNegative = (this.Simulation .latestBudget.money < 0M); + + this.messages.Clear(); this.typeMessages.Clear(); this.contractStatusMessages.Clear(); diff --git a/isometric-park-fna/UI/Menu.cs b/isometric-park-fna/UI/Menu.cs --- a/isometric-park-fna/UI/Menu.cs +++ b/isometric-park-fna/UI/Menu.cs @@ -68,6 +68,22 @@ } } + private static bool budgetButton(ImGuiWindowBridgeEngine bridgeEngine) + { + if (bridgeEngine.showBudgetNegative) + { + return Menu.activeButtonIndicator("$ Budget", bridgeEngine.windowStatuses[Window.Budget], StyleSets.selected, StyleSets.white, "(!!)", StyleSets.red, "Funds are negative!"); + } + else if (bridgeEngine.showBudgetLow) + { + return Menu.activeButtonIndicator("$ Budget", bridgeEngine.windowStatuses[Window.Budget], StyleSets.selected, StyleSets.white, "(!)", StyleSets.red, "Funds are low."); + } + else + { + return Menu.activeButton("$ Budget", bridgeEngine.windowStatuses[Window.Budget], StyleSets.selected, StyleSets.white); + } + } + public static void Render(ImFontPtr font, int width, ImGuiWindowBridgeEngine bridgeEngine, ref bool quit, ref bool paused, ref int rate, ref bool showBudget, string header) { ImGui.PushFont(font); @@ -95,7 +111,7 @@ bridgeEngine.typeMessages.Add(new ToggleWindowTypeMessage{Window = Window.Contracts}); } //Budget isn't connected to an entity yet: - if (Menu.activeButton("$ Budget", showBudget, StyleSets.selected, StyleSets.white)) //" \ue0b2 ", StyleSets.red, "New budget" + if (budgetButton(bridgeEngine)) //" \ue0b2 ", StyleSets.red, "New budget" { bridgeEngine.typeMessages.Add(new ToggleWindowTypeMessage{Window = Window.Budget});