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

r644:e7a48b4cb262 -

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