Description:
Display preserve on status bar.
Commit status:
[Not Reviewed]
References:
Diff options:
Comments:
0 Commit comments
0 Inline Comments
Unresolved TODOs:
There are no unresolved TODOs
@@ -20,7 +20,8 | |||||
|
20 | typeof(QuitGameMessage))] |
|
20 | typeof(QuitGameMessage))] |
|
21 | [Reads(typeof(AreaComponent), |
|
21 | [Reads(typeof(AreaComponent), |
|
22 | typeof(ContractStatusComponent), |
|
22 | typeof(ContractStatusComponent), |
|
23 |
typeof(OptionsComponent) |
|
23 | typeof(OptionsComponent), |
|
|
24 | typeof(PreserveComponent))] | ||
|
24 | class GameBridgeEngine : Engine |
|
25 | class GameBridgeEngine : Engine |
|
25 | { |
|
26 | { |
|
26 |
|
27 | ||
@@ -88,6 +89,7 | |||||
|
88 |
|
89 | ||
|
89 | game.in_zone = false; |
|
90 | game.in_zone = false; |
|
90 | game.in_active_zone = false; |
|
91 | game.in_active_zone = false; |
|
|
92 | game.in_preserve = false; | ||
|
91 | foreach (ref readonly var entity in ReadEntities<AreaComponent>()) |
|
93 | foreach (ref readonly var entity in ReadEntities<AreaComponent>()) |
|
92 | { |
|
94 | { |
|
93 | var areaComponent = GetComponent<AreaComponent>(entity); |
|
95 | var areaComponent = GetComponent<AreaComponent>(entity); |
@@ -108,8 +110,19 | |||||
|
108 | } |
|
110 | } |
|
109 | } |
|
111 | } |
|
110 | } |
|
112 | } |
|
|
113 | else if (HasComponent<PreserveComponent>(entity)) { | ||
|
|
114 | foreach (var square in areaComponent.squares) { | ||
|
|
115 | if (game.mouseGrid == square) | ||
|
|
116 | { | ||
|
|
117 | |||
|
|
118 | game.in_preserve = true; | ||
|
|
119 | } | ||
|
|
120 | |||
|
|
121 | } | ||
|
|
122 | } | ||
|
111 | } |
|
123 | } |
|
112 |
|
124 | ||
|
|
125 | |||
|
113 | foreach (ref readonly var message in ReadMessages<QuitGameMessage>()) |
|
126 | foreach (ref readonly var message in ReadMessages<QuitGameMessage>()) |
|
114 | { |
|
127 | { |
|
115 | this.game.quit = true; |
|
128 | this.game.quit = true; |
@@ -82,6 +82,7 | |||||
|
82 | //for now |
|
82 | //for now |
|
83 | public bool in_zone; |
|
83 | public bool in_zone; |
|
84 | public bool in_active_zone; |
|
84 | public bool in_active_zone; |
|
|
85 | public bool in_preserve; | ||
|
85 |
|
86 | ||
|
86 | public bool isPlaying = false; |
|
87 | public bool isPlaying = false; |
|
87 |
|
88 | ||
@@ -442,6 +443,23 | |||||
|
442 | } |
|
443 | } |
|
443 |
|
444 | ||
|
444 |
|
445 | ||
|
|
446 | private String CurrentStatus() { | ||
|
|
447 | |||
|
|
448 | if (this.in_active_zone) { | ||
|
|
449 | return "Contracted"; | ||
|
|
450 | } | ||
|
|
451 | else if (this.in_zone) { | ||
|
|
452 | return "Proposed Contract"; | ||
|
|
453 | } | ||
|
|
454 | else if (this.in_preserve) { | ||
|
|
455 | return "Preserve"; | ||
|
|
456 | } | ||
|
|
457 | else { | ||
|
|
458 | return "Unused"; | ||
|
|
459 | } | ||
|
|
460 | } | ||
|
|
461 | |||
|
|
462 | |||
|
445 |
|
463 | ||
|
446 | protected override void Update(GameTime gameTime) |
|
464 | protected override void Update(GameTime gameTime) |
|
447 | { |
|
465 | { |
@@ -804,17 +822,18 | |||||
|
804 | var treeStatus = this.simulation.map.cells[(int)this.mouseGrid.X][(int)this.mouseGrid.Y].Status; |
|
822 | var treeStatus = this.simulation.map.cells[(int)this.mouseGrid.X][(int)this.mouseGrid.Y].Status; |
|
805 | var treeStatusAdjective = this.simulation.map.cells[(int)this.mouseGrid.X][(int)this.mouseGrid.Y].StatusAdjective; |
|
823 | var treeStatusAdjective = this.simulation.map.cells[(int)this.mouseGrid.X][(int)this.mouseGrid.Y].StatusAdjective; |
|
806 | var treeType = this.simulation.map.cells[(int)this.mouseGrid.X][(int)this.mouseGrid.Y].TypeName; |
|
824 | var treeType = this.simulation.map.cells[(int)this.mouseGrid.X][(int)this.mouseGrid.Y].TypeName; |
|
|
825 | var useStatus = this.CurrentStatus(); | ||
|
807 | if (treeStatus != CellStatus.Clear) |
|
826 | if (treeStatus != CellStatus.Clear) |
|
808 | { |
|
827 | { |
|
809 | status_left = String.Format("{0:},{1:} {2} {3} ({4})", this.mouseGrid.X, this.mouseGrid.Y, |
|
828 | status_left = String.Format("{0:},{1:} {2} {3} ({4})", this.mouseGrid.X, this.mouseGrid.Y, |
|
810 | treeStatusAdjective, |
|
829 | treeStatusAdjective, |
|
811 | treeType, |
|
830 | treeType, |
|
812 | this.in_active_zone ? "Contracted" : (this.in_zone ? "Proposed Contract": "Unused")); |
|
831 | useStatus); |
|
813 | } |
|
832 | } |
|
814 | else { |
|
833 | else { |
|
815 | status_left = String.Format("{0:},{1:} {2} ({3})", this.mouseGrid.X, this.mouseGrid.Y, |
|
834 | status_left = String.Format("{0:},{1:} {2} ({3})", this.mouseGrid.X, this.mouseGrid.Y, |
|
816 | treeStatusAdjective, |
|
835 | treeStatusAdjective, |
|
817 | this.in_active_zone ? "Contracted" : (this.in_zone ? "Proposed Contract": "Unused")); |
|
836 | useStatus); |
|
818 | } |
|
837 | } |
|
819 | } |
|
838 | } |
|
820 |
|
839 |
You need to be logged in to leave comments.
Login now