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

r220:cae3b7aa2692 -

@@ -1,4 +1,5
1 using System.Collections.Generic;
1 using System.Collections.Generic;
2 using System.Linq;
2
3
3 using ImGuiNET;
4 using ImGuiNET;
4
5
@@ -18,6 +19,8
18 public static ContractStatus selected_status;
19 public static ContractStatus selected_status;
19 public static decimal selected_amount;
20 public static decimal selected_amount;
20
21
22 public static bool show_all;
23
21 public static void Render(ImFontPtr font, ImGuiWindowBridgeEngine engine, List<(Entity entity, string name, ContractStatus status, decimal amount)> contracts)
24 public static void Render(ImFontPtr font, ImGuiWindowBridgeEngine engine, List<(Entity entity, string name, ContractStatus status, decimal amount)> contracts)
22 {
25 {
23 bool newShow = true;
26 bool newShow = true;
@@ -54,7 +57,8
54 ImGui.SetNextWindowSize(new Num.Vector2(300, 300));
57 ImGui.SetNextWindowSize(new Num.Vector2(300, 300));
55 ImGui.Begin("Contracts", ref newShow, ImGuiWindowFlags.NoResize | ImGuiWindowFlags.NoCollapse | ImGuiWindowFlags.NoSavedSettings);
58 ImGui.Begin("Contracts", ref newShow, ImGuiWindowFlags.NoResize | ImGuiWindowFlags.NoCollapse | ImGuiWindowFlags.NoSavedSettings);
56 ImGui.ListBoxHeader("##Contracts:", new Num.Vector2(300, 150));
59 ImGui.ListBoxHeader("##Contracts:", new Num.Vector2(300, 150));
57 foreach (var contract in contracts)
60 foreach (var contract in contracts.Where((contract) => ((!(new[] {ContractStatus.Expired, ContractStatus.Broken, ContractStatus.Rejected}.Contains(contract.status))
61 || ContractsWindow.show_all ))))
58 {
62 {
59 if (ImGui.Selectable(contract.name, ContractsWindow.selected == contract.entity))
63 if (ImGui.Selectable(contract.name, ContractsWindow.selected == contract.entity))
60 {
64 {
@@ -82,6 +86,11
82 case ContractStatus.Rejected:
86 case ContractStatus.Rejected:
83 case ContractStatus.Broken:
87 case ContractStatus.Broken:
84 case ContractStatus.Expired:
88 case ContractStatus.Expired:
89 // if (ContractsWindow.show_all)
90 // {
91
92 // ImGui.TextColored(new Num.Vector4(0.95f, 0.25f, 0.25f, 1f), contract.status.ToString());
93 // }
85 ImGui.TextColored(new Num.Vector4(0.95f, 0.25f, 0.25f, 1f), contract.status.ToString());
94 ImGui.TextColored(new Num.Vector4(0.95f, 0.25f, 0.25f, 1f), contract.status.ToString());
86 break;
95 break;
87 case ContractStatus.Completed:
96 case ContractStatus.Completed:
@@ -92,6 +101,10
92 }
101 }
93 }
102 }
94 ImGui.ListBoxFooter();
103 ImGui.ListBoxFooter();
104
105 ImGui.Checkbox("Show All", ref show_all);
106
107 ImGui.Separator();
95 ImGui.Text(string.Format("Amount: ${0}/mo.", ContractsWindow.selected_amount));
108 ImGui.Text(string.Format("Amount: ${0}/mo.", ContractsWindow.selected_amount));
96 if (selected_status == ContractStatus.Proposed)
109 if (selected_status == ContractStatus.Proposed)
97 {
110 {
@@ -122,6 +135,8
122 }
135 }
123
136
124 }
137 }
138
139 ImGui.Separator();
125 if (ImGui.Button("Okay"))
140 if (ImGui.Button("Okay"))
126 {
141 {
127 newShow = false;
142 newShow = false;
You need to be logged in to leave comments. Login now