Description:
Add low budget indicators.
Commit status:
[Not Reviewed]
References:
Comments:
0 Commit comments 0 Inline Comments
Unresolved TODOs:
There are no unresolved TODOs
Add another comment

r436:4833f85973a5 -

@@ -63,6 +63,9
63 63 public bool showContractIndicator;
64 64 public List<string> contracts;
65 65
66 public bool showBudgetLow;
67 public bool showBudgetNegative;
68
66 69 public ImFontPtr font;
67 70 public ImFontPtr italicFont;
68 71 private DebugWindow debugWindow;
@@ -98,6 +101,8
98 101 this.windowStatuses = new Dictionary<Window, bool>();
99 102
100 103 this.showContractIndicator = false;
104 this.showBudgetLow = false;
105 this.showBudgetNegative = false;
101 106
102 107 this.font = font;
103 108 this.italicFont = italicFont;
@@ -237,6 +242,10
237 242 }
238 243 }
239 244
245 this.showBudgetLow = (this.Simulation .latestBudget.money < 10_000M);
246 this.showBudgetNegative = (this.Simulation .latestBudget.money < 0M);
247
248
240 249 this.messages.Clear();
241 250 this.typeMessages.Clear();
242 251 this.contractStatusMessages.Clear();
@@ -68,6 +68,22
68 68 }
69 69 }
70 70
71 private static bool budgetButton(ImGuiWindowBridgeEngine bridgeEngine)
72 {
73 if (bridgeEngine.showBudgetNegative)
74 {
75 return Menu.activeButtonIndicator("$ Budget", bridgeEngine.windowStatuses[Window.Budget], StyleSets.selected, StyleSets.white, "(!!)", StyleSets.red, "Funds are negative!");
76 }
77 else if (bridgeEngine.showBudgetLow)
78 {
79 return Menu.activeButtonIndicator("$ Budget", bridgeEngine.windowStatuses[Window.Budget], StyleSets.selected, StyleSets.white, "(!)", StyleSets.red, "Funds are low.");
80 }
81 else
82 {
83 return Menu.activeButton("$ Budget", bridgeEngine.windowStatuses[Window.Budget], StyleSets.selected, StyleSets.white);
84 }
85 }
86
71 87 public static void Render(ImFontPtr font, int width, ImGuiWindowBridgeEngine bridgeEngine, ref bool quit, ref bool paused, ref int rate, ref bool showBudget, string header)
72 88 {
73 89 ImGui.PushFont(font);
@@ -95,7 +111,7
95 111 bridgeEngine.typeMessages.Add(new ToggleWindowTypeMessage{Window = Window.Contracts});
96 112 }
97 113 //Budget isn't connected to an entity yet:
98 if (Menu.activeButton("$ Budget", showBudget, StyleSets.selected, StyleSets.white)) //" \ue0b2 ", StyleSets.red, "New budget"
114 if (budgetButton(bridgeEngine)) //" \ue0b2 ", StyleSets.red, "New budget"
99 115 {
100 116 bridgeEngine.typeMessages.Add(new ToggleWindowTypeMessage{Window = Window.Budget});
101 117
You need to be logged in to leave comments. Login now