|
|
|
|
@ -1,3 +1,5 @@
|
|
|
|
|
use bevy::ecs::system::EntityCommands;
|
|
|
|
|
|
|
|
|
|
use crate::prelude::*;
|
|
|
|
|
|
|
|
|
|
pub(crate) struct MenuPlugin;
|
|
|
|
|
@ -27,34 +29,43 @@ enum MenuState {
|
|
|
|
|
Endgame,
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
fn init_menu_ui(mut commands: Commands) {
|
|
|
|
|
fn init_play_menu(mut commands: Commands) {
|
|
|
|
|
info!("Initializing Play menu");
|
|
|
|
|
|
|
|
|
|
commands
|
|
|
|
|
.spawn((NodeBundle {
|
|
|
|
|
style: Style {
|
|
|
|
|
width: Val::Percent(100.0),
|
|
|
|
|
height: Val::Percent(100.0),
|
|
|
|
|
justify_content: JustifyContent::Center,
|
|
|
|
|
align_items: AlignItems::Center,
|
|
|
|
|
flex_direction: FlexDirection::Column,
|
|
|
|
|
position_type: PositionType::Absolute,
|
|
|
|
|
.spawn((
|
|
|
|
|
MenuState::Play,
|
|
|
|
|
NodeBundle {
|
|
|
|
|
style: Style {
|
|
|
|
|
width: Val::Percent(100.0),
|
|
|
|
|
height: Val::Percent(100.0),
|
|
|
|
|
justify_content: JustifyContent::Center,
|
|
|
|
|
align_items: AlignItems::Center,
|
|
|
|
|
flex_direction: FlexDirection::Column,
|
|
|
|
|
position_type: PositionType::Absolute,
|
|
|
|
|
..default()
|
|
|
|
|
},
|
|
|
|
|
background_color: Color::NONE.into(),
|
|
|
|
|
visibility: Visibility::Hidden,
|
|
|
|
|
..default()
|
|
|
|
|
},
|
|
|
|
|
background_color: Color::NONE.into(),
|
|
|
|
|
visibility: Visibility::Hidden,
|
|
|
|
|
..default()
|
|
|
|
|
},))
|
|
|
|
|
))
|
|
|
|
|
.with_children(|parent| {
|
|
|
|
|
parent.spawn(TextBundle::from_section(
|
|
|
|
|
"M A R T I A N C H E S S",
|
|
|
|
|
TextStyle {
|
|
|
|
|
font_size: 48.0,
|
|
|
|
|
color: Color::ORANGE_RED,
|
|
|
|
|
..default()
|
|
|
|
|
},
|
|
|
|
|
parent.spawn((
|
|
|
|
|
MenuState::Play,
|
|
|
|
|
TextBundle::from_section(
|
|
|
|
|
"M A R T I A N C H E S S",
|
|
|
|
|
TextStyle {
|
|
|
|
|
font_size: 48.0,
|
|
|
|
|
color: Color::ORANGE_RED,
|
|
|
|
|
..default()
|
|
|
|
|
},
|
|
|
|
|
),
|
|
|
|
|
));
|
|
|
|
|
parent
|
|
|
|
|
.spawn((
|
|
|
|
|
GameState::Intro,
|
|
|
|
|
GameState::Play,
|
|
|
|
|
MenuState::None,
|
|
|
|
|
ButtonBundle {
|
|
|
|
|
style: Style {
|
|
|
|
|
padding: UiRect::all(Val::Px(5.0)),
|
|
|
|
|
@ -67,9 +78,10 @@ fn init_menu_ui(mut commands: Commands) {
|
|
|
|
|
))
|
|
|
|
|
.with_children(|parent| {
|
|
|
|
|
parent.spawn((
|
|
|
|
|
GameState::Intro,
|
|
|
|
|
GameState::Play,
|
|
|
|
|
MenuState::None,
|
|
|
|
|
TextBundle::from_section(
|
|
|
|
|
"Start",
|
|
|
|
|
"Continue",
|
|
|
|
|
TextStyle {
|
|
|
|
|
color: Color::BLACK,
|
|
|
|
|
font_size: 32.0,
|
|
|
|
|
@ -82,6 +94,7 @@ fn init_menu_ui(mut commands: Commands) {
|
|
|
|
|
parent
|
|
|
|
|
.spawn((
|
|
|
|
|
GameState::Credits,
|
|
|
|
|
MenuState::None,
|
|
|
|
|
ButtonBundle {
|
|
|
|
|
style: Style {
|
|
|
|
|
padding: UiRect::all(Val::Px(5.0)),
|
|
|
|
|
@ -95,6 +108,7 @@ fn init_menu_ui(mut commands: Commands) {
|
|
|
|
|
.with_children(|parent| {
|
|
|
|
|
parent.spawn((
|
|
|
|
|
GameState::Credits,
|
|
|
|
|
MenuState::None,
|
|
|
|
|
TextBundle::from_section(
|
|
|
|
|
"Credits",
|
|
|
|
|
TextStyle {
|
|
|
|
|
@ -126,17 +140,43 @@ fn init_menu_ui(mut commands: Commands) {
|
|
|
|
|
},
|
|
|
|
|
),));
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
fn init_play_menu(mut commands: Commands) {
|
|
|
|
|
todo!("Play Menu");
|
|
|
|
|
parent
|
|
|
|
|
.spawn((
|
|
|
|
|
tutorial::TutorialState::Intro, // Marks the button to start the tutorial
|
|
|
|
|
GameState::Play, // Marks the button to be ignored during tutorial step cleanup
|
|
|
|
|
MenuState::None,
|
|
|
|
|
ButtonBundle {
|
|
|
|
|
style: Style {
|
|
|
|
|
padding: UiRect::all(Val::Px(5.0)),
|
|
|
|
|
margin: UiRect::all(Val::Px(5.0)),
|
|
|
|
|
position_type: PositionType::Absolute,
|
|
|
|
|
top: Val::Px(0.0),
|
|
|
|
|
right: Val::Px(0.0),
|
|
|
|
|
..default()
|
|
|
|
|
},
|
|
|
|
|
background_color: Color::ORANGE.with_a(0.5).into(),
|
|
|
|
|
visibility: Visibility::Hidden,
|
|
|
|
|
..default()
|
|
|
|
|
},
|
|
|
|
|
))
|
|
|
|
|
.with_children(|parent| {
|
|
|
|
|
parent.spawn((TextBundle::from_section(
|
|
|
|
|
"Tutorial",
|
|
|
|
|
TextStyle {
|
|
|
|
|
color: Color::BLACK,
|
|
|
|
|
font_size: 16.0,
|
|
|
|
|
..default()
|
|
|
|
|
},
|
|
|
|
|
),));
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
fn init_tutorial_menu(mut commands: Commands) {
|
|
|
|
|
todo!("Tutorial Menu");
|
|
|
|
|
error!("Tutorial Menu");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
fn init_endgame_menu(mut commands: Commands) {
|
|
|
|
|
todo!("Endgame Menu");
|
|
|
|
|
error!("Endgame Menu");
|
|
|
|
|
}
|
|
|
|
|
|