From 8964cf47f78132477697a78a5044f67bfeffed3b Mon Sep 17 00:00:00 2001 From: yuni Date: Sat, 23 Nov 2024 02:55:26 +0100 Subject: [PATCH] fix z-index ordering of fade-in/-out, menu, death screen --- src/menu.rs | 13 +++++++++++-- src/visual.rs | 2 ++ 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/src/menu.rs b/src/menu.rs index c15781b..b1459af 100644 --- a/src/menu.rs +++ b/src/menu.rs @@ -21,8 +21,10 @@ impl Plugin for MenuPlugin { fn build(&self, app: &mut App) { app.add_systems(Startup, setup.after(hud::setup)); app.add_systems( - PreUpdate, - show_deathscreen.run_if(on_event::()), + Update, + show_deathscreen + .after(visual::spawn_effects) + .run_if(on_event::()), ); app.add_systems(Update, handle_deathscreen_input); app.add_systems( @@ -129,6 +131,7 @@ pub fn setup( style: style_fullscreen(), background_color: Color::BLACK.into(), visibility: Visibility::Hidden, + z_index: ZIndex::Global(4000), ..default() }, )); @@ -170,6 +173,7 @@ pub fn setup( NodeBundle { style: style_centered(), visibility: Visibility::Hidden, + z_index: ZIndex::Global(4000), ..default() }, )) @@ -216,6 +220,7 @@ pub fn setup( style: style_fullscreen(), background_color: Color::srgba(0.0, 0.0, 0.0, 0.8).into(), visibility: Visibility::Hidden, + z_index: ZIndex::Global(9999), ..default() }, )); @@ -232,6 +237,7 @@ pub fn setup( ..default() }, visibility: Visibility::Hidden, + z_index: ZIndex::Global(9999), ..default() }, )) @@ -277,6 +283,7 @@ pub fn setup( ..default() }, visibility: Visibility::Hidden, + z_index: ZIndex::Global(9999), ..default() }, )) @@ -323,6 +330,7 @@ pub fn setup( ..default() }, visibility: Visibility::Hidden, + z_index: ZIndex::Global(9999), ..default() }, )) @@ -361,6 +369,7 @@ pub fn setup( ..default() }, visibility: Visibility::Hidden, + z_index: ZIndex::Global(9999), ..default() }, )) diff --git a/src/visual.rs b/src/visual.rs index ce13396..0099a0b 100644 --- a/src/visual.rs +++ b/src/visual.rs @@ -153,6 +153,7 @@ pub fn spawn_effects( NodeBundle { style: style_fullscreen(), background_color: color.into(), + z_index: ZIndex::Global(5000), ..default() }, )); @@ -169,6 +170,7 @@ pub fn spawn_effects( NodeBundle { style: style_fullscreen(), background_color: color.with_alpha(0.0).into(), + z_index: ZIndex::Global(5000), ..default() }, ));