diff --git a/src/audio.rs b/src/audio.rs index 46ad466..c04fca9 100644 --- a/src/audio.rs +++ b/src/audio.rs @@ -124,7 +124,7 @@ fn audio_trigger( .for_each(|source| source.stop()); // we are playing a sound } else { - info!("Playing audoi {}", event_str); + info!("Playing audio {}", event_str); commands.spawn(audio_source); } } else { diff --git a/src/ui.rs b/src/ui.rs index 1851bc0..82e525e 100644 --- a/src/ui.rs +++ b/src/ui.rs @@ -5,12 +5,17 @@ pub(crate) struct UiPlugin; impl Plugin for UiPlugin { fn build(&self, app: &mut App) { app.add_systems(Startup, initialize); - app.add_systems(OnExit(GameState::Loading), sync_display_mode); + app.add_systems(OnEnter(GameState::Menu), sync_display_mode); app.add_systems( Update, ( toggle_display_mode.run_if(any_component_changed::), - sync_display_mode.run_if(state_changed::()), + sync_display_mode + .run_if(state_changed::()) + .run_if(in_state(GameState::Menu)), + sync_display_mode + .run_if(state_changed::()) + .run_if(in_state(GameState::Play)), ), ); } @@ -30,7 +35,8 @@ fn initialize(mut commands: Commands) { bottom: Val::Px(5.0), ..default() }, - background_color: Color::WHITE.with_a(0.5).into(), + background_color: Color::WHITE.into(), + visibility: Visibility::Hidden, ..default() }, UiRoot, @@ -42,7 +48,7 @@ fn initialize(mut commands: Commands) { padding: UiRect::all(Val::Px(10.0)), ..default() }, - visibility: Visibility::Visible, + background_color: Color::WHITE.into(), ..default() }, DisplayState::Display2d, @@ -71,6 +77,7 @@ fn toggle_display_mode( /// Runs every time the DisplayState changes fn sync_display_mode( mut query: Query<(&mut UiImage, &mut DisplayState), With