|
|
|
@ -1,5 +1,5 @@
|
|
|
|
use crate::{deck::*, *};
|
|
|
|
use crate::{deck::*, *};
|
|
|
|
use bevy::prelude::*;
|
|
|
|
use bevy::{color::palettes::css::TEAL, prelude::*};
|
|
|
|
|
|
|
|
|
|
|
|
pub struct SetupPlugin;
|
|
|
|
pub struct SetupPlugin;
|
|
|
|
|
|
|
|
|
|
|
|
@ -7,7 +7,13 @@ impl Plugin for SetupPlugin {
|
|
|
|
fn build(&self, app: &mut App) {
|
|
|
|
fn build(&self, app: &mut App) {
|
|
|
|
app.add_systems(
|
|
|
|
app.add_systems(
|
|
|
|
OnEnter(GameState::Setup),
|
|
|
|
OnEnter(GameState::Setup),
|
|
|
|
(setup::setup_cards, setup::setup_camera, setup::start_play).chain(),
|
|
|
|
(
|
|
|
|
|
|
|
|
setup_cards,
|
|
|
|
|
|
|
|
setup_camera,
|
|
|
|
|
|
|
|
setup_set_check_button,
|
|
|
|
|
|
|
|
start_play,
|
|
|
|
|
|
|
|
)
|
|
|
|
|
|
|
|
.chain(),
|
|
|
|
);
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
@ -52,6 +58,20 @@ pub(crate) fn setup_camera(mut commands: Commands) {
|
|
|
|
));
|
|
|
|
));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#[derive(Component)]
|
|
|
|
|
|
|
|
pub(crate) struct CheckSet;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
pub(crate) fn setup_set_check_button(mut commands: Commands) {
|
|
|
|
|
|
|
|
commands.spawn(Node::default()).with_children(|parent| {
|
|
|
|
|
|
|
|
parent
|
|
|
|
|
|
|
|
.spawn((Button, CheckSet, BackgroundColor(TEAL.into())))
|
|
|
|
|
|
|
|
.with_children(|parent| {
|
|
|
|
|
|
|
|
parent.spawn(Text("Set!?".to_string()));
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
.observe(play::check_set);
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// Finish the setup state by progressing to the play state
|
|
|
|
/// Finish the setup state by progressing to the play state
|
|
|
|
pub(crate) fn start_play(mut game_state: ResMut<NextState<GameState>>) {
|
|
|
|
pub(crate) fn start_play(mut game_state: ResMut<NextState<GameState>>) {
|
|
|
|
game_state.set(GameState::Play);
|
|
|
|
game_state.set(GameState::Play);
|
|
|
|
|