44 lines
1.5 KiB
Rust
44 lines
1.5 KiB
Rust
use bevy::{prelude::*, text::FontSourceTemplate};
|
|
|
|
use crate::{AppState, menus::{MenuMarker, spawn_menu}};
|
|
|
|
pub fn setup_post_match_menu(
|
|
existing_menu: Option<Single<Entity, With<MenuMarker>>>,
|
|
commands: Commands,
|
|
) {
|
|
let menu = bsn! {
|
|
Node {
|
|
flex_direction: FlexDirection::Column,
|
|
width: percent(100),
|
|
height: percent(100),
|
|
justify_content: JustifyContent::Center,
|
|
align_items: AlignItems::Center
|
|
}
|
|
Children [
|
|
(
|
|
Text("[Insert beautiful post-match screen here]")
|
|
TextFont {
|
|
font: FontSourceTemplate::Handle("fonts/roboto.ttf"),
|
|
font_size: px(super::style::H1_SIZE),
|
|
}
|
|
TextColor(Color::srgb(0.9, 0.9, 0.9))
|
|
),
|
|
Text("Press any button/key to continue...")
|
|
TextFont {
|
|
font: FontSourceTemplate::Handle("fonts/roboto.ttf"),
|
|
font_size: px(super::style::H3_SIZE),
|
|
}
|
|
TextColor(Color::srgb(0.9, 0.9, 0.9))
|
|
]
|
|
};
|
|
|
|
spawn_menu(existing_menu, commands, menu);
|
|
}
|
|
|
|
pub fn check_return_to_character_select(gamepads: Query<&Gamepad>, keyboard: Res<ButtonInput<KeyCode>>, mut next_state: ResMut<NextState<AppState>>) {
|
|
let any_pressed = gamepads.iter().any(|gp| gp.get_just_pressed().count() > 0);
|
|
let any_pressed = any_pressed || keyboard.get_just_pressed().count() > 0;
|
|
if any_pressed {
|
|
next_state.set(AppState::MainMenu);
|
|
}
|
|
} |