Description:
Style fixes.
Commit status:
[Not Reviewed]
References:
Diff options:
Comments:
0 Commit comments
0 Inline Comments
Unresolved TODOs:
There are no unresolved TODOs
@@ -17,7 +17,6 | |||
|
17 | 17 | namespace isometricparkfna.UI |
|
18 | 18 | { |
|
19 | 19 | |
|
20 | ||
|
21 | 20 | public static class GraphWindow |
|
22 | 21 | { |
|
23 | 22 | public static bool hadFocus = false; |
@@ -29,10 +28,9 | |||
|
29 | 28 | |
|
30 | 29 | public static bool always_show_zero = false; |
|
31 | 30 | |
|
32 |
private static string[] money_series = { |
|
|
33 |
|
|
|
34 | }; | |
|
35 | private static string[] tree_series = { "Total trees", "Dead trees", "Crowded trees"}; | |
|
31 | private static string[] money_series = {"Total Funds", | |
|
32 | "Subsidies", "Upkeep", "Contracts", "Cashflow", "Misc"}; | |
|
33 | private static string[] tree_series = {"Total trees", "Dead trees", "Crowded trees"}; | |
|
36 | 34 | |
|
37 | 35 | public static Dictionary<string, IEnumerable<double>> data_sets = new Dictionary<string, IEnumerable<double>>(); |
|
38 | 36 | |
@@ -42,9 +40,7 | |||
|
42 | 40 | .Select(e => (e, false)) |
|
43 | 41 | .ToDictionary(t => t.Item1, t=> t.Item2); |
|
44 | 42 | |
|
45 | ||
|
46 | ||
|
47 | public static ImGuiColor[] colors = { ImGuiColor.BLACK, ImGuiColor.RED, ImGuiColor.GREEN, | |
|
43 | public static ImGuiColor[] colors = {ImGuiColor.BLACK, ImGuiColor.RED, ImGuiColor.GREEN, | |
|
48 | 44 | ImGuiColor.BLUE, ImGuiColor.DARKGREY, ImGuiColor.LIGHTRED, ImGuiColor.LIGHTGREEN, |
|
49 | 45 | ImGuiColor.LIGHTBLUE, ImGuiColor.BLACK }; |
|
50 | 46 | |
@@ -54,7 +50,6 | |||
|
54 | 50 | .Zip(colors, (first, second) => (first, second)) |
|
55 | 51 | .ToDictionary(t => t.Item1, t => t.Item2); |
|
56 | 52 | |
|
57 | ||
|
58 | 53 | public static void DrawLinearAxis(ImDrawListPtr draw_list, Num.Vector2 range, bool vertical, int points, Num.Vector2 position) { |
|
59 | 54 | //See DrawLinearLabels for explanation |
|
60 | 55 | var tick_spacing = (int)Math.Abs((range.Y - range.X) / (points - 1)); |
@@ -106,10 +101,8 | |||
|
106 | 101 | |
|
107 | 102 | tick_absolute_position = Num.Vector2.Add(starting_position, tick_position); |
|
108 | 103 | } |
|
109 | ||
|
110 | 104 | } |
|
111 | 105 | |
|
112 | ||
|
113 | 106 | public static void DrawLine(ImDrawListPtr draw_list, Num.Vector2 c, Num.Vector2[] points, ImGuiColor col) { |
|
114 | 107 | var p = Num.Vector2.Zero; |
|
115 | 108 | |
@@ -118,7 +111,7 | |||
|
118 | 111 | points[i] = Num.Vector2.Add(points[i], c); |
|
119 | 112 | } |
|
120 | 113 | |
|
121 |
draw_list.AddPolyline(ref points[0], points.Length, (uint)col, 0 |
|
|
114 | draw_list.AddPolyline(ref points[0], points.Length, (uint)col, 0, 1.0f); | |
|
122 | 115 | } |
|
123 | 116 | |
|
124 | 117 | public static int Scale(Num.Vector2 domain, Num.Vector2 range, int num) { |
@@ -155,16 +148,16 | |||
|
155 | 148 | } |
|
156 | 149 | GraphWindow.hadFocus = ImGui.IsWindowFocused(); |
|
157 | 150 | |
|
158 |
data_sets["Total Funds"] = |
|
|
159 |
data_sets["Subsidies"] = |
|
|
160 |
data_sets["Upkeep"] = |
|
|
161 |
data_sets["Contracts"] = |
|
|
162 |
data_sets["Misc"] = |
|
|
163 |
data_sets["Cashflow"] = |
|
|
151 | data_sets["Total Funds"] = sim.allBudgets().Select(b => (double)b.money); | |
|
152 | data_sets["Subsidies"] = sim.allBudgets().Select(b => (double)b.subsidy); | |
|
153 | data_sets["Upkeep"] = sim.allBudgets().Select(b => (double)b.upkeep); | |
|
154 | data_sets["Contracts"] = sim.allBudgets().Select(b => (double)b.contracts); | |
|
155 | data_sets["Misc"] = sim.allBudgets().Select(b => (double)b.misc); | |
|
156 | data_sets["Cashflow"] = sim.allBudgets().Select(b => (double)b.cashflow); | |
|
164 | 157 | |
|
165 |
data_sets["Total trees"] = |
|
|
166 |
data_sets["Dead trees"] = |
|
|
167 |
data_sets["Crowded trees"] = |
|
|
158 | data_sets["Total trees"] = sim.allBudgets().Select(b => (double)b.trees); | |
|
159 | data_sets["Dead trees"] = sim.allBudgets().Select(b => (double)b.dead_trees); | |
|
160 | data_sets["Crowded trees"] = sim.allBudgets().Select(b => (double)b.crowded_trees); | |
|
168 | 161 | |
|
169 | 162 | var periods = 12.0d * GraphWindow.year; |
|
170 | 163 | var keys = data_sets_show.Keys.ToList(); |
@@ -184,7 +177,7 | |||
|
184 | 177 | foreach (var key in keys) { |
|
185 | 178 | if (data_sets_show[key] && totals.Count() > 0) { |
|
186 | 179 | var series_min = data_sets[key].Min(); |
|
187 |
series_min = |
|
|
180 | series_min = series_min >= 0? series_min * 0.90f : series_min *1.10f; | |
|
188 | 181 | min = Math.Min(series_min, min); |
|
189 | 182 | } |
|
190 | 183 | } |
@@ -266,7 +259,7 | |||
|
266 | 259 | var key = tree_series[i]; |
|
267 | 260 | if (Menu.activeButton(key, data_sets_show[key], StyleSets.selected, StyleSets.white)) |
|
268 | 261 | { |
|
269 |
data_sets_show[key] = |
|
|
262 | data_sets_show[key] = !data_sets_show[key]; | |
|
270 | 263 | } |
|
271 | 264 | |
|
272 | 265 | if (i != tree_series.Length-1) |
@@ -281,7 +274,7 | |||
|
281 | 274 | var key = money_series[i]; |
|
282 | 275 | if (Menu.activeButton(key, data_sets_show[key], StyleSets.selected, StyleSets.white)) |
|
283 | 276 | { |
|
284 |
data_sets_show[key] = |
|
|
277 | data_sets_show[key] = !data_sets_show[key]; | |
|
285 | 278 | } |
|
286 | 279 | if ((i % 4 != 3) && (i != money_series.Length-1)) { |
|
287 | 280 | ImGui.SameLine(); |
You need to be logged in to leave comments.
Login now