@@ -42,6 +42,8 @@ fn spawn_map_selection(
4242 mut commands : Commands ,
4343 selected_map_state : Res < State < SelectedMapState > > ,
4444) {
45+ let selected_map_state = selected_map_state. get ( ) ;
46+
4547 commands
4648 . spawn ( (
4749 Node {
@@ -56,7 +58,7 @@ fn spawn_map_selection(
5658 DespawnOnExit ( MainMenuState :: MapSelection ) ,
5759 ) )
5860 . with_children ( |parent| {
59- let selected_map_preview_image = match * selected_map_state. get ( ) {
61+ let selected_map_preview_image = match selected_map_state {
6062 SelectedMapState :: TinyTown => "maps/tiny_town/preview.png" ,
6163 SelectedMapState :: MediumPlastic => {
6264 "maps/medium_plastic/preview.png"
@@ -124,6 +126,10 @@ fn spawn_map_selection(
124126 font_size : DEFAULT_FONT_SIZE ,
125127 ..default ( )
126128 } ,
129+ TextColor ( get_text_button_color_for_map_selection_button (
130+ & selected_map_state,
131+ MapSelectionButton ( SelectedMapState :: TinyTown ) ,
132+ ) ) ,
127133 ) ) ;
128134 parent
129135 . spawn ( (
@@ -139,6 +145,10 @@ fn spawn_map_selection(
139145 font_size : DEFAULT_FONT_SIZE ,
140146 ..default ( )
141147 } ,
148+ TextColor ( get_text_button_color_for_map_selection_button (
149+ & selected_map_state,
150+ MapSelectionButton ( SelectedMapState :: MediumPlastic ) ,
151+ ) ) ,
142152 ) ) ;
143153 parent
144154 . spawn ( (
@@ -185,6 +195,17 @@ fn spawn_map_selection(
185195 } ) ;
186196}
187197
198+ fn get_text_button_color_for_map_selection_button (
199+ selected_map_state : & SelectedMapState ,
200+ button : MapSelectionButton ,
201+ ) -> Color {
202+ if button. 0 == * selected_map_state {
203+ ORANGE_400 . into ( )
204+ } else {
205+ WHITE . into ( )
206+ }
207+ }
208+
188209fn update_selected_map_preview_image (
189210 asset_server : Res < AssetServer > ,
190211 mut image_node : Single < & mut ImageNode , With < SelectedMapPreviewImage > > ,
0 commit comments