fix z-index ordering of fade-in/-out, menu, death screen

This commit is contained in:
yuni 2024-11-23 02:55:26 +01:00
parent f866e9e76a
commit 8964cf47f7
2 changed files with 13 additions and 2 deletions

View file

@ -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::<DeathScreenEvent>()),
Update,
show_deathscreen
.after(visual::spawn_effects)
.run_if(on_event::<DeathScreenEvent>()),
);
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()
},
))

View file

@ -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()
},
));