Description:
Show tree delta on Contract.
Commit status:
[Not Reviewed]
References:
Diff options:
Comments:
0 Commit comments
0 Inline Comments
Unresolved TODOs:
There are no unresolved TODOs
|
1 | NO CONTENT: modified file, binary diff hidden |
@@ -106,12 +106,14 | |||
|
106 | 106 | |
|
107 | 107 | int contract_amount = random_generator.Next(CONTRACT_MINIMUM, CONTRACT_MAXIMUM); |
|
108 | 108 | |
|
109 | var deltaTrees = random_generator.Next(-12, 0); | |
|
110 | ||
|
109 | 111 | // AddComponent |
|
110 | 112 | AddComponent(contract, new AreaComponent { squares = squares }); |
|
111 | 113 | AddComponent(contract, new NameComponent { DisplayName = message.name }); |
|
112 | 114 | AddComponent(contract, new SelectedComponent { selected = false }); |
|
113 | 115 | AddComponent(contract, new ContractStatusComponent { status = ContractStatus.Proposed, date = this.simulation.DateTime }); |
|
114 |
AddComponent(contract, new TreeDeltaComponent { deltaTrees = |
|
|
116 | AddComponent(contract, new TreeDeltaComponent { deltaTrees = deltaTrees }); | |
|
115 | 117 | AddComponent(contract, new BudgetLineComponent |
|
116 | 118 | { |
|
117 | 119 | category = "Contracts", |
@@ -39,7 +39,7 | |||
|
39 | 39 | case Window.Contracts: |
|
40 | 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 | 44 | // var names = contracts.Select(entity => GetComponent<NameComponent>(entity).DisplayName) |
|
45 | 45 | foreach(var e in contracts) |
@@ -47,7 +47,8 | |||
|
47 | 47 | var name = GetComponent<NameComponent>(e).DisplayName; |
|
48 | 48 | var status = GetComponent<ContractStatusComponent>(e).status; |
|
49 | 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 | 20 | public static decimal selected_amount; |
|
21 | 21 | |
|
22 | 22 | public static bool show_all; |
|
23 | private static int selected_tree_delta; | |
|
23 | 24 | |
|
24 |
public static void Render(ImFontPtr font, ImGuiWindowBridgeEngine engine, |
|
|
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 | 28 | bool newShow = true; |
|
27 | 29 | |
@@ -70,6 +72,7 | |||
|
70 | 72 | { |
|
71 | 73 | ContractsWindow.selected_status = contract.status; |
|
72 | 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 | 110 | ImGui.Separator(); |
|
108 | 111 | ImGui.Text(string.Format("Amount: ${0}/mo.", ContractsWindow.selected_amount)); |
|
112 | ImGui.Text(string.Format("Trees: {0}", ContractsWindow.selected_tree_delta)); | |
|
109 | 113 | if (selected_status == ContractStatus.Proposed) |
|
110 | 114 | { |
|
111 | 115 | if (ImGui.Button("Select")) |
You need to be logged in to leave comments.
Login now