Description:
Actually warn about expiring contracts.
Commit status:
[Not Reviewed]
References:
Diff options:
Comments:
0 Commit comments
0 Inline Comments
Unresolved TODOs:
There are no unresolved TODOs
@@ -27,7 +27,9 | |||
|
27 | 27 | [Reads(typeof(VisibilityComponent), |
|
28 | 28 | typeof(WindowTypeComponent), |
|
29 | 29 | typeof(TrespassingPolicyComponent), |
|
30 |
typeof(ContractStatusComponent) |
|
|
30 | typeof(ContractStatusComponent), | |
|
31 | typeof(RelatedOrganizationComponent), | |
|
32 | typeof(NameAndDescriptionComponent))] | |
|
31 | 33 | public class ImGuiWindowBridgeEngine : Engine |
|
32 | 34 | { |
|
33 | 35 | |
@@ -53,13 +55,17 | |||
|
53 | 55 | public Dictionary<Window, bool> windowStatuses {get;} |
|
54 | 56 | |
|
55 | 57 | public bool showContractIndicator; |
|
58 | public List<string> contracts; | |
|
56 | 59 | |
|
57 | 60 | public ImFontPtr font; |
|
58 | 61 | public ImFontPtr italicFont; |
|
59 | 62 | private DebugWindow debugWindow; |
|
60 | 63 | |
|
64 | private Simulation Simulation; | |
|
65 | ||
|
61 | 66 | public ImGuiWindowBridgeEngine(DebugWindow debugWindow, |
|
62 |
ImFontPtr font, ImFontPtr italicFont |
|
|
67 | ImFontPtr font, ImFontPtr italicFont, | |
|
68 | Simulation simulation) | |
|
63 | 69 | { |
|
64 | 70 | this.messages = new List<ToggleWindowMessage>(); |
|
65 | 71 | this.typeMessages = new List<ToggleWindowTypeMessage>(); |
@@ -80,6 +86,10 | |||
|
80 | 86 | this.font = font; |
|
81 | 87 | this.italicFont = italicFont; |
|
82 | 88 | this.debugWindow = debugWindow; |
|
89 | this.Simulation = simulation; | |
|
90 | ||
|
91 | ||
|
92 | this.contracts = new List<string>(); | |
|
83 | 93 | |
|
84 | 94 | |
|
85 | 95 | //Prepopulate: |
@@ -172,14 +182,25 | |||
|
172 | 182 | |
|
173 | 183 | //reset |
|
174 | 184 | this.showContractIndicator = false; |
|
185 | this.contracts.Clear(); | |
|
175 | 186 | foreach(var entity in ReadEntities<ContractStatusComponent>()) |
|
176 | 187 | { |
|
177 | 188 | var contractStatus = GetComponent<ContractStatusComponent>(entity); |
|
178 | if(contractStatus.date > new DateTime(2021, 4, 1)) | |
|
189 | var age = this.Simulation.DateTime - contractStatus.date; | |
|
190 | if((age.TotalDays > (5*30) ) | |
|
191 | && (contractStatus.status == ContractStatus.Proposed)) | |
|
179 | 192 | { |
|
180 | this.showContractIndicator = true; | |
|
193 | try { | |
|
194 | this.showContractIndicator = true; | |
|
195 | var organizationEntity = GetComponent<RelatedOrganizationComponent>(entity).Entity; | |
|
196 | var name = GetComponent<NameAndDescriptionComponent>(organizationEntity).DisplayName; | |
|
197 | this.contracts.Add(name); | |
|
198 | } | |
|
199 | catch (Exception e) | |
|
200 | { | |
|
201 | Logging.Error(string.Format("Exception: {0}", e.ToString())); | |
|
202 | } | |
|
181 | 203 | } |
|
182 | ||
|
183 | 204 | } |
|
184 | 205 | |
|
185 | 206 |
@@ -248,7 +248,7 | |||
|
248 | 248 | WorldBuilder.AddEngine(new GameStateEngine()); |
|
249 | 249 | WorldBuilder.AddEngine(this.simulation.BridgeEngine); |
|
250 | 250 | WorldBuilder.AddEngine(new CameraBridgeEngine(this.camera)); |
|
251 | this.imGuiWindowBridgeEngine = new ImGuiWindowBridgeEngine(this.debugWindow, debugWindow.monoFont, debugWindow.italicFont); | |
|
251 | this.imGuiWindowBridgeEngine = new ImGuiWindowBridgeEngine(this.debugWindow, debugWindow.monoFont, debugWindow.italicFont, this.simulation); | |
|
252 | 252 | WorldBuilder.AddEngine(this.imGuiWindowBridgeEngine); |
|
253 | 253 | WorldBuilder.AddEngine(new ContractStatusEngine(this.simulation)); |
|
254 | 254 |
@@ -72,7 +72,7 | |||
|
72 | 72 | { |
|
73 | 73 | if (bridgeEngine.showContractIndicator) |
|
74 | 74 | { |
|
75 |
return Menu.activeButtonIndicator("\ue0c2 Contracts", bridgeEngine.windowStatuses[Window.Contracts], StyleSets.selected, StyleSets.white, "(!)", StyleSets.red, "Contract |
|
|
75 | return Menu.activeButtonIndicator("\ue0c2 Contracts", bridgeEngine.windowStatuses[Window.Contracts], StyleSets.selected, StyleSets.white, "(!)", StyleSets.red, "Contracts about to expire:\n" + string.Join("\n", bridgeEngine.contracts)); | |
|
76 | 76 | } |
|
77 | 77 | else |
|
78 | 78 | { |
@@ -103,7 +103,7 | |||
|
103 | 103 | if (contractsButton(bridgeEngine)) |
|
104 | 104 | { |
|
105 | 105 | Logging.Trace("Contracts toggled."); |
|
106 | Logging.Spy(bridgeEngine.windowStatuses, "statuses"); | |
|
106 | // Logging.Spy(bridgeEngine.windowStatuses, "statuses"); | |
|
107 | 107 | bridgeEngine.typeMessages.Add(new ToggleWindowTypeMessage{Window = Window.Contracts}); |
|
108 | 108 | } |
|
109 | 109 | //Budget isn't connected to an entity yet: |
You need to be logged in to leave comments.
Login now