|
|
|
@ -1,7 +1,6 @@
|
|
|
|
use crate::prelude::*;
|
|
|
|
use crate::prelude::*;
|
|
|
|
|
|
|
|
|
|
|
|
/// Menu Plugin; empty struct for Plugin impl
|
|
|
|
/// Menu Plugin; empty struct for Plugin impl
|
|
|
|
|
|
|
|
|
|
|
|
pub(crate) struct DicePlugin;
|
|
|
|
pub(crate) struct DicePlugin;
|
|
|
|
|
|
|
|
|
|
|
|
impl Plugin for DicePlugin {
|
|
|
|
impl Plugin for DicePlugin {
|
|
|
|
@ -13,10 +12,32 @@ impl Plugin for DicePlugin {
|
|
|
|
/// Create UI for the Dice game at startup
|
|
|
|
/// Create UI for the Dice game at startup
|
|
|
|
fn init_dice_ui(mut commands: Commands) {
|
|
|
|
fn init_dice_ui(mut commands: Commands) {
|
|
|
|
commands
|
|
|
|
commands
|
|
|
|
.spawn((
|
|
|
|
.spawn((GameChoice::Dice, MenuState::Closed))
|
|
|
|
GameChoice::Dice,
|
|
|
|
.add(UiContainer)
|
|
|
|
SetState(GameChoice::Dice),
|
|
|
|
.with_children(|parent| {
|
|
|
|
SetState(MenuState::Closed),
|
|
|
|
parent
|
|
|
|
))
|
|
|
|
.spawn_empty()
|
|
|
|
.add(UiTitle { text: "Dice" });
|
|
|
|
.add(UiTitle { text: "Dice" })
|
|
|
|
|
|
|
|
.add(UiStyle(Style {
|
|
|
|
|
|
|
|
position_type: PositionType::Absolute,
|
|
|
|
|
|
|
|
top: Val::Px(0.0),
|
|
|
|
|
|
|
|
left: Val::Px(0.0),
|
|
|
|
|
|
|
|
margin: UiRect::all(Val::Px(5.0)),
|
|
|
|
|
|
|
|
border: UiRect::all(Val::Px(1.0)),
|
|
|
|
|
|
|
|
..default()
|
|
|
|
|
|
|
|
}));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
parent
|
|
|
|
|
|
|
|
.spawn((SetState(GameChoice::None), SetState(MenuState::Open)))
|
|
|
|
|
|
|
|
.add(UiButton { label: "Menu" })
|
|
|
|
|
|
|
|
.add(UiStyle(Style {
|
|
|
|
|
|
|
|
position_type: PositionType::Absolute,
|
|
|
|
|
|
|
|
top: Val::Px(0.0),
|
|
|
|
|
|
|
|
right: Val::Px(0.0),
|
|
|
|
|
|
|
|
margin: UiRect::all(Val::Px(5.0)),
|
|
|
|
|
|
|
|
padding: UiRect::all(Val::Px(5.0)),
|
|
|
|
|
|
|
|
border: UiRect::all(Val::Px(1.0)),
|
|
|
|
|
|
|
|
..default()
|
|
|
|
|
|
|
|
}));
|
|
|
|
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|