|
|
|
@ -16,7 +16,7 @@ impl Plugin for MenuPlugin {
|
|
|
|
|
|
|
|
|
|
|
|
/// State tracking if the menu is open or closed
|
|
|
|
/// State tracking if the menu is open or closed
|
|
|
|
#[derive(States, Debug, Clone, PartialEq, Eq, Hash, Default, Component)]
|
|
|
|
#[derive(States, Debug, Clone, PartialEq, Eq, Hash, Default, Component)]
|
|
|
|
enum MenuState {
|
|
|
|
pub(crate) enum MenuState {
|
|
|
|
#[default]
|
|
|
|
#[default]
|
|
|
|
Open,
|
|
|
|
Open,
|
|
|
|
Closed,
|
|
|
|
Closed,
|
|
|
|
@ -25,36 +25,11 @@ enum MenuState {
|
|
|
|
/// Initialize menu UI nodes at startup
|
|
|
|
/// Initialize menu UI nodes at startup
|
|
|
|
fn init_menu_ui(mut commands: Commands) {
|
|
|
|
fn init_menu_ui(mut commands: Commands) {
|
|
|
|
commands
|
|
|
|
commands
|
|
|
|
.spawn((
|
|
|
|
.spawn(MenuState::Open)
|
|
|
|
MenuState::Open,
|
|
|
|
.add(UiContainer)
|
|
|
|
NodeBundle {
|
|
|
|
|
|
|
|
style: Style {
|
|
|
|
|
|
|
|
width: Val::Percent(100.0),
|
|
|
|
|
|
|
|
height: Val::Percent(100.0),
|
|
|
|
|
|
|
|
align_items: AlignItems::Center,
|
|
|
|
|
|
|
|
align_content: AlignContent::Center,
|
|
|
|
|
|
|
|
justify_items: JustifyItems::Center,
|
|
|
|
|
|
|
|
justify_content: JustifyContent::Center,
|
|
|
|
|
|
|
|
flex_direction: FlexDirection::Column,
|
|
|
|
|
|
|
|
..default()
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
..default()
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
))
|
|
|
|
|
|
|
|
.with_children(|parent| {
|
|
|
|
.with_children(|parent| {
|
|
|
|
let title_text_style = TextStyle {
|
|
|
|
parent.spawn_empty().add(UiTitle {
|
|
|
|
color: Color::BLACK,
|
|
|
|
text: "Game Jam Casino",
|
|
|
|
font_size: 24.0,
|
|
|
|
|
|
|
|
..default()
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
parent.spawn(TextBundle {
|
|
|
|
|
|
|
|
text: Text::from_section("Game Jam Casino", title_text_style),
|
|
|
|
|
|
|
|
style: Style {
|
|
|
|
|
|
|
|
margin: UiRect::all(Val::Px(5.0)),
|
|
|
|
|
|
|
|
..default()
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
..default()
|
|
|
|
|
|
|
|
});
|
|
|
|
});
|
|
|
|
parent.spawn_empty().add(UiButton { label: "Dice" });
|
|
|
|
parent.spawn_empty().add(UiButton { label: "Dice" });
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|