Description:
Fix style and ensure preserve renders in red.
Commit status:
[Not Reviewed]
References:
Diff options:
Comments:
0 Commit comments
0 Inline Comments
Unresolved TODOs:
There are no unresolved TODOs
@@ -19,7 +19,7 | |||
|
19 | 19 | // typeof(SelectedComponent), |
|
20 | 20 | typeof(PreserveComponent))] |
|
21 | 21 | [Reads(typeof(SelectedComponent), |
|
22 |
|
|
|
22 | typeof(ContractStatusComponent), | |
|
23 | 23 | typeof(AreaComponent), |
|
24 | 24 | typeof(PreserveComponent))] |
|
25 | 25 | public class BuildToolEngine : Engine { |
@@ -48,19 +48,19 | |||
|
48 | 48 | public override void Update(double dt) { |
|
49 | 49 | var occupied = new List<Vector2>(); |
|
50 | 50 | foreach (var (entity, status) in ReadEntities<AreaComponent>() |
|
51 | .WhereF((e) => HasComponent<ContractStatusComponent>(e)) | |
|
52 | .SelectWhereF((e) => (e, GetComponent<ContractStatusComponent>(e)), | |
|
53 |
(e) => ((e.Item2.status != ContractStatus.Broken) |
|
|
54 |
&& (e.Item2.status != ContractStatus.Rejected) |
|
|
55 | && (e.Item2.status != ContractStatus.Expired) | |
|
56 | && (e.Item2.status != ContractStatus.Completed) | |
|
57 | && (e.Item2.status != ContractStatus.Proposed)) | |
|
58 | )) { | |
|
51 | .WhereF((e) => HasComponent<ContractStatusComponent>(e)) | |
|
52 | .SelectWhereF((e) => (e, GetComponent<ContractStatusComponent>(e)), | |
|
53 | (e) => ((e.Item2.status != ContractStatus.Broken) | |
|
54 | && (e.Item2.status != ContractStatus.Rejected) | |
|
55 | && (e.Item2.status != ContractStatus.Expired) | |
|
56 | && (e.Item2.status != ContractStatus.Completed) | |
|
57 | && (e.Item2.status != ContractStatus.Proposed)) | |
|
58 | )) { | |
|
59 | 59 | var entitySquares = GetComponent<AreaComponent>(entity).squares; |
|
60 | 60 | occupied.AddRange(entitySquares); |
|
61 | 61 | } |
|
62 | 62 | foreach (var entity in ReadEntities<AreaComponent>() |
|
63 | .WhereF((e) => HasComponent<PreserveComponent>(e))) { | |
|
63 | .WhereF((e) => HasComponent<PreserveComponent>(e))) { | |
|
64 | 64 | var entitySquares = GetComponent<AreaComponent>(entity).squares; |
|
65 | 65 | occupied.AddRange(entitySquares); |
|
66 | 66 | } |
@@ -71,10 +71,10 | |||
|
71 | 71 | { |
|
72 | 72 | if (message.Start.X >= 0 && message.Start.X < this.Map.MapWidth |
|
73 | 73 | && message.Start.Y >= 0 && message.Start.Y < this.Map.MapHeight) { |
|
74 | var entity = CreateEntity(); | |
|
74 | var entity = CreateEntity(); | |
|
75 | 75 | |
|
76 | AddComponent(entity, new AreaComponent { squares = new[] {message.Start} }); | |
|
77 | AddComponent(entity, new SelectedComponent { selected = true, Type= SelectionType.ActiveTool}); | |
|
76 | AddComponent(entity, new AreaComponent { squares = new[] {message.Start} }); | |
|
77 | AddComponent(entity, new SelectedComponent { selected = true, Type= SelectionType.ActiveTool}); | |
|
78 | 78 | } |
|
79 | 79 | } |
|
80 | 80 |
@@ -21,7 +21,7 | |||
|
21 | 21 | [Reads(typeof(AreaComponent), |
|
22 | 22 | typeof(ContractStatusComponent), |
|
23 | 23 | typeof(OptionsComponent), |
|
24 |
|
|
|
24 | typeof(PreserveComponent))] | |
|
25 | 25 | class GameBridgeEngine : Engine |
|
26 | 26 | { |
|
27 | 27 | |
@@ -89,7 +89,7 | |||
|
89 | 89 | |
|
90 | 90 | game.in_zone = false; |
|
91 | 91 | game.in_active_zone = false; |
|
92 |
|
|
|
92 | game.in_preserve = false; | |
|
93 | 93 | foreach (ref readonly var entity in ReadEntities<AreaComponent>()) |
|
94 | 94 | { |
|
95 | 95 | var areaComponent = GetComponent<AreaComponent>(entity); |
@@ -110,16 +110,16 | |||
|
110 | 110 | } |
|
111 | 111 | } |
|
112 | 112 | } |
|
113 |
|
|
|
113 | else if (HasComponent<PreserveComponent>(entity)) { | |
|
114 | 114 | foreach (var square in areaComponent.squares) { |
|
115 | 115 | if (game.mouseGrid == square) |
|
116 | 116 | { |
|
117 | ||
|
118 | game.in_preserve = true; | |
|
119 | } | |
|
120 | 117 | |
|
121 | } | |
|
122 | } | |
|
118 | game.in_preserve = true; | |
|
119 | } | |
|
120 | ||
|
121 | } | |
|
122 | } | |
|
123 | 123 | } |
|
124 | 124 | |
|
125 | 125 |
@@ -188,7 +188,7 | |||
|
188 | 188 | { |
|
189 | 189 | SendMessage(new ToggleWindowTypeMessage {Window = Window.InGameMenu}); |
|
190 | 190 | SendMessage(new GameRateMessage { paused = true, rate = null }); |
|
191 |
|
|
|
191 | SendMessage(new AdjustSelection {Type = AdjustmentType.Complete }); | |
|
192 | 192 | } |
|
193 | 193 | } |
|
194 | 194 |
@@ -21,7 +21,7 | |||
|
21 | 21 | typeof(SelectMessage), |
|
22 | 22 | typeof(SetDialogMessage), |
|
23 | 23 | typeof(DialogChoiceMessage), |
|
24 |
|
|
|
24 | typeof(AdjustSelection))] | |
|
25 | 25 | [Reads(typeof(DialogComponent), |
|
26 | 26 | typeof(WindowTypeComponent), |
|
27 | 27 | typeof(VisibilityComponent), |
@@ -103,19 +103,20 | |||
|
103 | 103 | } |
|
104 | 104 | |
|
105 | 105 | foreach (ref readonly var message in ReadMessages<AdjustSelection>()) { |
|
106 |
|
|
|
107 |
|
|
|
108 |
|
|
|
109 |
|
|
|
110 | && selection.selected) { | |
|
111 |
|
|
|
112 | selected = false }); | |
|
113 | } | |
|
114 | } | |
|
115 | } | |
|
116 | } | |
|
106 | if(message.Type == AdjustmentType.Complete) { | |
|
107 | foreach (ref readonly var entity in ReadEntities<SelectedComponent>()) { | |
|
108 | var selection = GetComponent<SelectedComponent>(entity); | |
|
109 | if(selection.Type == SelectionType.ActiveTool | |
|
110 | && selection.selected) { | |
|
111 | SetComponent(entity, new SelectedComponent {Type = SelectionType.ActiveTool, | |
|
112 | selected = false | |
|
113 | }); | |
|
114 | } | |
|
115 | } | |
|
116 | } | |
|
117 | } | |
|
117 | 118 | |
|
118 | 119 | |
|
119 | } | |
|
120 | } | |
|
120 | } | |
|
121 | } | |
|
121 | 122 | } |
@@ -34,27 +34,24 | |||
|
34 | 34 | // var SelectedComponent = GetComponent<SelectedComponent>(entity); |
|
35 | 35 | var selected = GetComponent<SelectedComponent>(entity).selected; |
|
36 | 36 | |
|
37 |
if |
|
|
38 | || GetComponent<ContractStatusComponent>(entity).status == ContractStatus.Accepted) | |
|
39 | && !selected) | |
|
37 | if (!HasComponent<ContractStatusComponent>(entity) ) | |
|
38 | { | |
|
39 | Quad.FillSquares(batch, areaComponent.squares, Color.Red, 0.5f, 0.79f); | |
|
40 | Tile.DrawOutlinedSquares(batch, areaComponent.squares, Color.Red); | |
|
41 | } | |
|
42 | else if ((!HasComponent<ContractStatusComponent>(entity) | |
|
43 | || GetComponent<ContractStatusComponent>(entity).status == ContractStatus.Accepted) | |
|
44 | && !selected) | |
|
40 | 45 | { |
|
41 | 46 | Tile.DrawOutlinedSquares(batch, areaComponent.squares, Color.Teal); |
|
42 | 47 | Quad.FillSquares(batch, areaComponent.squares, Color.Teal, 0.5f, 0.78f); |
|
43 | 48 | } |
|
44 | ||
|
45 | 49 | else if (HasComponent<ContractStatusComponent>(entity) |
|
46 | && selected | |
|
47 | // && GetComponent<SelectedComponent>(entity).selected | |
|
48 | ) | |
|
50 | && selected) | |
|
49 | 51 | { |
|
50 | 52 | Tile.DrawOutlinedSquares(batch, areaComponent.squares, Color.Teal); |
|
51 | 53 | Quad.FillSquares(batch, areaComponent.squares, Color.Gray, 0.5f, 0.78f); |
|
52 | 54 | } |
|
53 | else if (!HasComponent<ContractStatusComponent>(entity) ) | |
|
54 | { | |
|
55 | Quad.FillSquares(batch, areaComponent.squares, Color.Red, 0.5f, 0.79f); | |
|
56 | Tile.DrawOutlinedSquares(batch, areaComponent.squares, Color.Red); | |
|
57 | } | |
|
58 | 55 | } |
|
59 | 56 | } |
|
60 | 57 | } |
@@ -68,8 +68,8 | |||
|
68 | 68 | } |
|
69 | 69 | } |
|
70 | 70 | |
|
71 |
|
|
|
72 | { | |
|
71 | public static float Clamp(float val, float min, float max) | |
|
72 | { | |
|
73 | 73 | if (val > max) |
|
74 | 74 | { |
|
75 | 75 | return max; |
@@ -82,7 +82,7 | |||
|
82 | 82 | { |
|
83 | 83 | return val; |
|
84 | 84 | } |
|
85 | } | |
|
85 | } | |
|
86 | 86 | |
|
87 | 87 | protected float Decrement(float value, float delta) |
|
88 | 88 | { |
You need to be logged in to leave comments.
Login now