|
|
|
@ -566,14 +566,6 @@ fn init_ui(mut commands: Commands, server: Res<AssetServer>) {
|
|
|
|
..default()
|
|
|
|
..default()
|
|
|
|
},))
|
|
|
|
},))
|
|
|
|
.with_children(|parent| {
|
|
|
|
.with_children(|parent| {
|
|
|
|
fn quit_game(
|
|
|
|
|
|
|
|
_trigger: Trigger<Pointer<Click>>,
|
|
|
|
|
|
|
|
mut exit: EventWriter<AppExit>,
|
|
|
|
|
|
|
|
) {
|
|
|
|
|
|
|
|
warn!("Quitting game");
|
|
|
|
|
|
|
|
exit.write(AppExit::Success);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
fn show_credits(
|
|
|
|
fn show_credits(
|
|
|
|
_trigger: Trigger<Pointer<Click>>,
|
|
|
|
_trigger: Trigger<Pointer<Click>>,
|
|
|
|
mut state: ResMut<NextState<PlayerState>>,
|
|
|
|
mut state: ResMut<NextState<PlayerState>>,
|
|
|
|
@ -590,6 +582,17 @@ fn init_ui(mut commands: Commands, server: Res<AssetServer>) {
|
|
|
|
children![(TextColor(BLACK.into()), Text::new("Credits")),],
|
|
|
|
children![(TextColor(BLACK.into()), Text::new("Credits")),],
|
|
|
|
))
|
|
|
|
))
|
|
|
|
.observe(show_credits);
|
|
|
|
.observe(show_credits);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#[cfg(not(target_arch = "wasm32"))]
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
fn quit_game(
|
|
|
|
|
|
|
|
_trigger: Trigger<Pointer<Click>>,
|
|
|
|
|
|
|
|
mut exit: EventWriter<AppExit>,
|
|
|
|
|
|
|
|
) {
|
|
|
|
|
|
|
|
warn!("Quitting game");
|
|
|
|
|
|
|
|
exit.write(AppExit::Success);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
parent
|
|
|
|
parent
|
|
|
|
.spawn((
|
|
|
|
.spawn((
|
|
|
|
BorderRadius::all(Val::Px(5.0)),
|
|
|
|
BorderRadius::all(Val::Px(5.0)),
|
|
|
|
@ -599,6 +602,7 @@ fn init_ui(mut commands: Commands, server: Res<AssetServer>) {
|
|
|
|
children![(Text::new("Quit"), TextColor(BLACK.into()))],
|
|
|
|
children![(Text::new("Quit"), TextColor(BLACK.into()))],
|
|
|
|
))
|
|
|
|
))
|
|
|
|
.observe(quit_game);
|
|
|
|
.observe(quit_game);
|
|
|
|
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|