Description:
Show tree delta on Contract.
Commit status:
[Not Reviewed]
References:
Comments:
0 Commit comments 0 Inline Comments
Unresolved TODOs:
There are no unresolved TODOs
Add another comment

r225:bf701a9eecea -

1 NO CONTENT: modified file, binary diff hidden
NO CONTENT: modified file, binary diff hidden
@@ -106,12 +106,14
106
106
107 int contract_amount = random_generator.Next(CONTRACT_MINIMUM, CONTRACT_MAXIMUM);
107 int contract_amount = random_generator.Next(CONTRACT_MINIMUM, CONTRACT_MAXIMUM);
108
108
109 var deltaTrees = random_generator.Next(-12, 0);
110
109 // AddComponent
111 // AddComponent
110 AddComponent(contract, new AreaComponent { squares = squares });
112 AddComponent(contract, new AreaComponent { squares = squares });
111 AddComponent(contract, new NameComponent { DisplayName = message.name });
113 AddComponent(contract, new NameComponent { DisplayName = message.name });
112 AddComponent(contract, new SelectedComponent { selected = false });
114 AddComponent(contract, new SelectedComponent { selected = false });
113 AddComponent(contract, new ContractStatusComponent { status = ContractStatus.Proposed, date = this.simulation.DateTime });
115 AddComponent(contract, new ContractStatusComponent { status = ContractStatus.Proposed, date = this.simulation.DateTime });
114 AddComponent(contract, new TreeDeltaComponent { deltaTrees = -1 });
116 AddComponent(contract, new TreeDeltaComponent { deltaTrees = deltaTrees });
115 AddComponent(contract, new BudgetLineComponent
117 AddComponent(contract, new BudgetLineComponent
116 {
118 {
117 category = "Contracts",
119 category = "Contracts",
@@ -39,7 +39,7
39 case Window.Contracts:
39 case Window.Contracts:
40 var contracts = ReadEntities<AreaComponent>();
40 var contracts = ReadEntities<AreaComponent>();
41
41
42 var contract_data = new List<(Entity, string, ContractStatus, decimal)>();
42 var contract_data = new List<(Entity, string, ContractStatus, decimal, int)>();
43
43
44 // var names = contracts.Select(entity => GetComponent<NameComponent>(entity).DisplayName)
44 // var names = contracts.Select(entity => GetComponent<NameComponent>(entity).DisplayName)
45 foreach(var e in contracts)
45 foreach(var e in contracts)
@@ -47,7 +47,8
47 var name = GetComponent<NameComponent>(e).DisplayName;
47 var name = GetComponent<NameComponent>(e).DisplayName;
48 var status = GetComponent<ContractStatusComponent>(e).status;
48 var status = GetComponent<ContractStatusComponent>(e).status;
49 var amount = GetComponent<BudgetLineComponent>(e).amount;
49 var amount = GetComponent<BudgetLineComponent>(e).amount;
50 contract_data.Add((e, name, status, amount));
50 var tree_delta = GetComponent<TreeDeltaComponent>(e).deltaTrees;
51 contract_data.Add((e, name, status, amount, tree_delta));
51
52
52 }
53 }
53
54
@@ -20,8 +20,10
20 public static decimal selected_amount;
20 public static decimal selected_amount;
21
21
22 public static bool show_all;
22 public static bool show_all;
23 private static int selected_tree_delta;
23
24
24 public static void Render(ImFontPtr font, ImGuiWindowBridgeEngine engine, List<(Entity entity, string name, ContractStatus status, decimal amount)> contracts)
25 public static void Render(ImFontPtr font, ImGuiWindowBridgeEngine engine,
26 List<(Entity entity, string name, ContractStatus status, decimal amount, int delta_trees)> contracts)
25 {
27 {
26 bool newShow = true;
28 bool newShow = true;
27
29
@@ -70,6 +72,7
70 {
72 {
71 ContractsWindow.selected_status = contract.status;
73 ContractsWindow.selected_status = contract.status;
72 ContractsWindow.selected_amount = contract.amount;
74 ContractsWindow.selected_amount = contract.amount;
75 ContractsWindow.selected_tree_delta = contract.delta_trees;
73 }
76 }
74
77
75
78
@@ -106,6 +109,7
106
109
107 ImGui.Separator();
110 ImGui.Separator();
108 ImGui.Text(string.Format("Amount: ${0}/mo.", ContractsWindow.selected_amount));
111 ImGui.Text(string.Format("Amount: ${0}/mo.", ContractsWindow.selected_amount));
112 ImGui.Text(string.Format("Trees: {0}", ContractsWindow.selected_tree_delta));
109 if (selected_status == ContractStatus.Proposed)
113 if (selected_status == ContractStatus.Proposed)
110 {
114 {
111 if (ImGui.Button("Select"))
115 if (ImGui.Button("Select"))
You need to be logged in to leave comments. Login now