|
|
|
@ -1,5 +1,5 @@
|
|
|
|
use bevy::{
|
|
|
|
use bevy::{
|
|
|
|
color::palettes::css::{BLACK, BLUE, GREEN, ORANGE, PURPLE, RED, TEAL},
|
|
|
|
color::palettes::css::{BLACK, INDIGO, ORANGE, PURPLE, RED, TEAL},
|
|
|
|
prelude::*,
|
|
|
|
prelude::*,
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
@ -10,7 +10,16 @@ pub struct MenuPlugin;
|
|
|
|
|
|
|
|
|
|
|
|
impl Plugin for MenuPlugin {
|
|
|
|
impl Plugin for MenuPlugin {
|
|
|
|
fn build(&self, app: &mut App) {
|
|
|
|
fn build(&self, app: &mut App) {
|
|
|
|
app.add_systems(Startup, (setup, setup_about, setup_how_to_play));
|
|
|
|
app.add_systems(
|
|
|
|
|
|
|
|
Startup,
|
|
|
|
|
|
|
|
(
|
|
|
|
|
|
|
|
setup,
|
|
|
|
|
|
|
|
setup_about,
|
|
|
|
|
|
|
|
setup_how_to_play,
|
|
|
|
|
|
|
|
setup_deck,
|
|
|
|
|
|
|
|
setup_sets,
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@ -54,13 +63,13 @@ fn setup(mut commands: Commands) {
|
|
|
|
})
|
|
|
|
})
|
|
|
|
.observe(button_set_state(ViewState::Menu));
|
|
|
|
.observe(button_set_state(ViewState::Menu));
|
|
|
|
parent
|
|
|
|
parent
|
|
|
|
.spawn((Button, BackgroundColor(GREEN.into()), GlobalZIndex(1)))
|
|
|
|
.spawn((Button, BackgroundColor(INDIGO.into()), GlobalZIndex(1)))
|
|
|
|
.with_children(|parent| {
|
|
|
|
.with_children(|parent| {
|
|
|
|
parent.spawn(Text("Deck".to_string()));
|
|
|
|
parent.spawn(Text("Deck".to_string()));
|
|
|
|
})
|
|
|
|
})
|
|
|
|
.observe(button_set_state(ViewState::Deck));
|
|
|
|
.observe(button_set_state(ViewState::Deck));
|
|
|
|
parent
|
|
|
|
parent
|
|
|
|
.spawn((Button, BackgroundColor(BLUE.into()), GlobalZIndex(1)))
|
|
|
|
.spawn((Button, BackgroundColor(ORANGE.into()), GlobalZIndex(1)))
|
|
|
|
.with_children(|parent| {
|
|
|
|
.with_children(|parent| {
|
|
|
|
parent.spawn(Text("Sets".to_string()));
|
|
|
|
parent.spawn(Text("Sets".to_string()));
|
|
|
|
})
|
|
|
|
})
|
|
|
|
@ -102,6 +111,32 @@ fn setup_how_to_play(mut commands: Commands) {
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
fn setup_deck(mut commands: Commands) {
|
|
|
|
|
|
|
|
commands
|
|
|
|
|
|
|
|
.spawn((ViewState::Deck, Node::default()))
|
|
|
|
|
|
|
|
.with_children(|parent| {
|
|
|
|
|
|
|
|
parent
|
|
|
|
|
|
|
|
.spawn((Button, BackgroundColor(TEAL.into())))
|
|
|
|
|
|
|
|
.with_children(|parent| {
|
|
|
|
|
|
|
|
parent.spawn(Text("Back".to_string()));
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
.observe(button_set_state(ViewState::Play));
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
fn setup_sets(mut commands: Commands) {
|
|
|
|
|
|
|
|
commands
|
|
|
|
|
|
|
|
.spawn((ViewState::Sets, Node::default()))
|
|
|
|
|
|
|
|
.with_children(|parent| {
|
|
|
|
|
|
|
|
parent
|
|
|
|
|
|
|
|
.spawn((Button, BackgroundColor(TEAL.into())))
|
|
|
|
|
|
|
|
.with_children(|parent| {
|
|
|
|
|
|
|
|
parent.spawn(Text("Back".to_string()));
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
.observe(button_set_state(ViewState::Play));
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
fn quit_button(_trigger: Trigger<Pointer<Click>>, mut exit_event: EventWriter<AppExit>) {
|
|
|
|
fn quit_button(_trigger: Trigger<Pointer<Click>>, mut exit_event: EventWriter<AppExit>) {
|
|
|
|
exit_event.send(AppExit::Success);
|
|
|
|
exit_event.send(AppExit::Success);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|