@@ -3,11 +3,10 @@ use macroquad::prelude::clear_background;
3
3
use macroquad:: prelude:: * ;
4
4
5
5
use server:: action:: Action ;
6
- use server:: content:: custom_phase_actions:: CurrentEventResponse ;
7
6
use server:: game:: Game ;
8
7
use server:: position:: Position ;
9
8
10
- use crate :: advance_ui:: { pay_advance_dialog, show_free_advance_menu , show_paid_advance_menu} ;
9
+ use crate :: advance_ui:: { pay_advance_dialog, show_paid_advance_menu} ;
11
10
use crate :: client_state:: {
12
11
ActiveDialog , CameraMode , DialogChooser , State , StateUpdate , StateUpdates ,
13
12
} ;
@@ -22,7 +21,6 @@ use crate::log_ui::show_log;
22
21
use crate :: map_ui:: { draw_map, explore_dialog, show_tile_menu} ;
23
22
use crate :: player_ui:: { player_select, show_global_controls, show_top_center, show_top_left} ;
24
23
use crate :: render_context:: RenderContext ;
25
- use crate :: status_phase_ui:: raze_city_confirm_dialog;
26
24
use crate :: unit_ui:: unit_selection_click;
27
25
use crate :: {
28
26
custom_actions_ui, custom_phase_ui, dialog_ui, influence_ui, map_ui, move_ui, recruit_unit_ui,
@@ -97,7 +95,7 @@ fn render(rc: &RenderContext, features: &Features) -> StateUpdate {
97
95
updates. add ( show_tile_menu ( rc, pos) ) ;
98
96
}
99
97
}
100
- updates. add ( try_click ( rc ) ) ;
98
+ updates. add ( rc . with_camera ( CameraMode :: World , try_click ) ) ;
101
99
updates. result ( )
102
100
}
103
101
@@ -130,8 +128,7 @@ fn render_active_dialog(rc: &RenderContext) -> StateUpdate {
130
128
match & state. active_dialog {
131
129
ActiveDialog :: None
132
130
| ActiveDialog :: WaitingForUpdate
133
- | ActiveDialog :: CulturalInfluence ( _)
134
- | ActiveDialog :: PositionRequest ( _) => StateUpdate :: None ,
131
+ | ActiveDialog :: CulturalInfluence ( _) => StateUpdate :: None ,
135
132
ActiveDialog :: DialogChooser ( d) => dialog_chooser ( rc, d) ,
136
133
ActiveDialog :: Log => show_log ( rc) ,
137
134
@@ -143,23 +140,17 @@ fn render_active_dialog(rc: &RenderContext) -> StateUpdate {
143
140
ActiveDialog :: CollectResources ( c) => collect_dialog ( rc, c) ,
144
141
ActiveDialog :: RecruitUnitSelection ( s) => recruit_unit_ui:: select_dialog ( rc, s) ,
145
142
ActiveDialog :: ReplaceUnits ( r) => recruit_unit_ui:: replace_dialog ( rc, r) ,
146
- ActiveDialog :: CulturalInfluenceResolution ( r) => {
147
- influence_ui:: cultural_influence_resolution_dialog ( rc, r)
148
- }
149
143
ActiveDialog :: ExploreResolution ( r) => explore_dialog ( rc, r) ,
150
144
ActiveDialog :: MoveUnits ( _) => move_ui:: move_units_dialog ( rc) ,
151
145
ActiveDialog :: MovePayment ( p) => move_ui:: move_payment_dialog ( rc, p) ,
152
146
153
147
//status phase
154
- ActiveDialog :: FreeAdvance => show_free_advance_menu ( rc) ,
155
- ActiveDialog :: RazeSize1City => status_phase_ui:: raze_city_dialog ( rc) ,
156
- ActiveDialog :: CompleteObjectives => status_phase_ui:: complete_objectives_dialog ( rc) ,
157
- ActiveDialog :: ChangeGovernmentType => status_phase_ui:: change_government_type_dialog ( rc) ,
148
+ ActiveDialog :: ChangeGovernmentType ( r) => {
149
+ status_phase_ui:: change_government_type_dialog ( rc, r)
150
+ }
158
151
ActiveDialog :: ChooseAdditionalAdvances ( a) => {
159
152
status_phase_ui:: choose_additional_advances_dialog ( rc, a)
160
153
}
161
- ActiveDialog :: DetermineFirstPlayer => status_phase_ui:: determine_first_player_dialog ( rc) ,
162
-
163
154
ActiveDialog :: Sports ( ( p, pos) ) => custom_actions_ui:: sports ( rc, p, * pos) ,
164
155
ActiveDialog :: Taxes ( p) => custom_actions_ui:: taxes ( rc, p) ,
165
156
ActiveDialog :: Theaters ( p) => custom_actions_ui:: theaters ( rc, p) ,
@@ -174,6 +165,7 @@ fn render_active_dialog(rc: &RenderContext) -> StateUpdate {
174
165
ActiveDialog :: UnitsRequest ( r) => custom_phase_ui:: select_units_dialog ( rc, r) ,
175
166
ActiveDialog :: StructuresRequest ( r) => custom_phase_ui:: select_structures_dialog ( rc, r) ,
176
167
ActiveDialog :: BoolRequest => custom_phase_ui:: bool_request_dialog ( rc) ,
168
+ ActiveDialog :: PositionRequest ( r) => custom_phase_ui:: position_request_dialog ( rc, r) ,
177
169
}
178
170
}
179
171
@@ -223,15 +215,8 @@ fn controlling_player_click(rc: &RenderContext, mouse_pos: Vec2, pos: Position)
223
215
ActiveDialog :: ReplaceUnits ( s) => unit_selection_click ( rc, pos, mouse_pos, s, |new| {
224
216
StateUpdate :: OpenDialog ( ActiveDialog :: ReplaceUnits ( new. clone ( ) ) )
225
217
} ) ,
226
- ActiveDialog :: RazeSize1City => raze_city_confirm_dialog ( rc, pos) ,
227
218
ActiveDialog :: PositionRequest ( r) => {
228
- if r. choices . contains ( & pos) {
229
- StateUpdate :: Execute ( Action :: CustomPhaseEvent (
230
- CurrentEventResponse :: SelectPosition ( pos) ,
231
- ) )
232
- } else {
233
- StateUpdate :: None
234
- }
219
+ StateUpdate :: OpenDialog ( ActiveDialog :: PositionRequest ( r. clone ( ) . toggle ( pos) ) )
235
220
}
236
221
ActiveDialog :: UnitsRequest ( s) => unit_selection_click ( rc, pos, mouse_pos, s, |new| {
237
222
StateUpdate :: OpenDialog ( ActiveDialog :: UnitsRequest ( new. clone ( ) ) )
0 commit comments