1
1
use macroquad:: prelude:: * ;
2
2
use server:: action:: Action ;
3
3
use server:: city:: { City , MoodState } ;
4
- use server:: combat:: { active_attackers, active_defenders, Combat , CombatPhase } ;
4
+ use server:: combat:: { active_attackers, active_defenders, CombatPhase } ;
5
5
use server:: content:: advances:: { NAVIGATION , ROADS , SIEGECRAFT , STEEL_WEAPONS } ;
6
- use server:: content:: custom_phase_actions:: { steel_weapons_cost , CustomPhaseState } ;
6
+ use server:: content:: custom_phase_actions:: CustomPhaseState ;
7
7
use server:: game:: { CulturalInfluenceResolution , CurrentMove , Game , GameState } ;
8
8
use server:: position:: Position ;
9
9
use server:: status_phase:: { StatusPhaseAction , StatusPhaseState } ;
@@ -12,14 +12,17 @@ use crate::assets::Assets;
12
12
use crate :: city_ui:: building_name;
13
13
use crate :: client:: { Features , GameSyncRequest } ;
14
14
use crate :: collect_ui:: CollectResources ;
15
- use crate :: combat_ui:: { RemoveCasualtiesSelection , SiegecraftPaymentDialog , SteelWeaponDialog } ;
15
+ use crate :: combat_ui:: {
16
+ steel_weapons_dialog, RemoveCasualtiesSelection , SiegecraftPaymentDialog , SteelWeaponDialog ,
17
+ } ;
16
18
use crate :: construct_ui:: ConstructionPayment ;
19
+ use crate :: custom_actions_ui:: trade_route_dialog;
17
20
use crate :: happiness_ui:: IncreaseHappinessConfig ;
18
21
use crate :: layout_ui:: FONT_SIZE ;
19
22
use crate :: log_ui:: { add_advance_help, advance_help} ;
20
23
use crate :: map_ui:: ExploreResolutionConfig ;
21
24
use crate :: move_ui:: { MoveDestination , MoveIntent , MoveSelection } ;
22
- use crate :: payment_ui:: { new_payment , Payment } ;
25
+ use crate :: payment_ui:: Payment ;
23
26
use crate :: recruit_unit_ui:: { RecruitAmount , RecruitSelection } ;
24
27
use crate :: render_context:: RenderContext ;
25
28
use crate :: status_phase_ui:: ChooseAdditionalAdvances ;
@@ -59,6 +62,7 @@ pub enum ActiveDialog {
59
62
RemoveCasualties ( RemoveCasualtiesSelection ) ,
60
63
SiegecraftPayment ( SiegecraftPaymentDialog ) ,
61
64
SteelWeaponPayment ( SteelWeaponDialog ) ,
65
+ TradeRouteSelection ( Payment ) , // it's actually a gain
62
66
}
63
67
64
68
impl ActiveDialog {
@@ -92,6 +96,7 @@ impl ActiveDialog {
92
96
ActiveDialog :: RemoveCasualties ( _) => "remove casualties" ,
93
97
ActiveDialog :: SiegecraftPayment ( _) => "siegecraft payment" ,
94
98
ActiveDialog :: SteelWeaponPayment ( _) => "steel weapon payment" ,
99
+ ActiveDialog :: TradeRouteSelection ( _) => "trade route selection" ,
95
100
}
96
101
}
97
102
@@ -185,6 +190,7 @@ impl ActiveDialog {
185
190
add_advance_help ( rc, & mut result, STEEL_WEAPONS ) ;
186
191
result
187
192
}
193
+ ActiveDialog :: TradeRouteSelection ( _) => vec ! [ "Select trade route reward" . to_string( ) ] ,
188
194
}
189
195
}
190
196
@@ -557,29 +563,16 @@ impl State {
557
563
ActiveDialog :: SiegecraftPayment ( SiegecraftPaymentDialog :: new ( game) )
558
564
}
559
565
CustomPhaseState :: SteelWeaponsAttacker ( c) => {
560
- Self :: steel_weapons_dialog ( game, c, c. attacker )
566
+ steel_weapons_dialog ( game, c, c. attacker )
561
567
}
562
568
CustomPhaseState :: SteelWeaponsDefender ( c) => {
563
- Self :: steel_weapons_dialog ( game, c, c. defender )
569
+ steel_weapons_dialog ( game, c, c. defender )
564
570
}
571
+ CustomPhaseState :: TradeRouteSelection => trade_route_dialog ( game) ,
565
572
} ,
566
573
}
567
574
}
568
575
569
- fn steel_weapons_dialog ( game : & Game , c : & Combat , player_index : usize ) -> ActiveDialog {
570
- let payment = new_payment (
571
- & steel_weapons_cost ( game, c, player_index) ,
572
- & game. get_player ( player_index) . resources ,
573
- "Use steel weapons" ,
574
- true ,
575
- ) ;
576
- ActiveDialog :: SteelWeaponPayment ( SteelWeaponDialog {
577
- attacker : player_index == c. attacker ,
578
- payment,
579
- combat : c. clone ( ) ,
580
- } )
581
- }
582
-
583
576
#[ must_use]
584
577
pub fn measure_text ( & self , text : & str ) -> TextDimensions {
585
578
measure_text ( text, Some ( & self . assets . font ) , FONT_SIZE , 1.0 )
0 commit comments