|
|
|
@ -1,10 +1,12 @@
|
|
|
|
use bevy::{
|
|
|
|
use bevy::{
|
|
|
|
color::palettes::css::{BLACK, GREEN, INDIGO, ORANGE, PURPLE, RED, TEAL},
|
|
|
|
color::palettes::css::{BLACK, WHITE},
|
|
|
|
prelude::*,
|
|
|
|
prelude::*,
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
use crate::{
|
|
|
|
use crate::{
|
|
|
|
play::check_for_sets,
|
|
|
|
boot,
|
|
|
|
|
|
|
|
deck::{Card, Deck, ItemColor, ItemNumber, ItemPattern, ItemShape},
|
|
|
|
|
|
|
|
play::{check_for_sets, check_set},
|
|
|
|
view::{button_set_state, ViewState},
|
|
|
|
view::{button_set_state, ViewState},
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
@ -18,70 +20,126 @@ impl Plugin for MenuPlugin {
|
|
|
|
(
|
|
|
|
(
|
|
|
|
setup,
|
|
|
|
setup,
|
|
|
|
setup_about,
|
|
|
|
setup_about,
|
|
|
|
setup_how_to_play,
|
|
|
|
setup_how_to_play.after(boot::load),
|
|
|
|
setup_deck,
|
|
|
|
setup_deck,
|
|
|
|
setup_sets,
|
|
|
|
setup_sets,
|
|
|
|
|
|
|
|
setup_set_check_button,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
);
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
fn button_builder(node: Node) -> (Button, BackgroundColor, Node, BorderColor) {
|
|
|
|
|
|
|
|
(
|
|
|
|
|
|
|
|
Button,
|
|
|
|
|
|
|
|
BackgroundColor(BLACK.with_alpha(0.9).into()),
|
|
|
|
|
|
|
|
Node {
|
|
|
|
|
|
|
|
padding: UiRect::all(Val::Px(10.)),
|
|
|
|
|
|
|
|
margin: UiRect::top(Val::Px(25.)),
|
|
|
|
|
|
|
|
border: UiRect::all(Val::Px(1.0)),
|
|
|
|
|
|
|
|
..node
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
BorderColor(WHITE.into()),
|
|
|
|
|
|
|
|
)
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
fn setup(mut commands: Commands) {
|
|
|
|
fn setup(mut commands: Commands) {
|
|
|
|
commands
|
|
|
|
commands
|
|
|
|
.spawn((ViewState::Menu, Node::default()))
|
|
|
|
.spawn((
|
|
|
|
|
|
|
|
ViewState::Menu,
|
|
|
|
|
|
|
|
Node {
|
|
|
|
|
|
|
|
position_type: PositionType::Absolute,
|
|
|
|
|
|
|
|
justify_content: JustifyContent::Center,
|
|
|
|
|
|
|
|
align_items: AlignItems::Center,
|
|
|
|
|
|
|
|
width: Val::Percent(100.0),
|
|
|
|
|
|
|
|
height: Val::Percent(100.0),
|
|
|
|
|
|
|
|
..default()
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
))
|
|
|
|
|
|
|
|
.with_children(|parent| {
|
|
|
|
|
|
|
|
parent
|
|
|
|
|
|
|
|
.spawn(Node {
|
|
|
|
|
|
|
|
flex_direction: FlexDirection::Column,
|
|
|
|
|
|
|
|
align_items: AlignItems::Center,
|
|
|
|
|
|
|
|
justify_content: JustifyContent::Center,
|
|
|
|
|
|
|
|
..default()
|
|
|
|
|
|
|
|
})
|
|
|
|
.with_children(|parent| {
|
|
|
|
.with_children(|parent| {
|
|
|
|
parent
|
|
|
|
parent
|
|
|
|
.spawn((Button, BackgroundColor(TEAL.into())))
|
|
|
|
.spawn(button_builder(Node::default()))
|
|
|
|
.with_children(|parent| {
|
|
|
|
.with_children(|parent| {
|
|
|
|
parent.spawn(Text("Play".to_string()));
|
|
|
|
parent.spawn(Text("Play".to_string()));
|
|
|
|
})
|
|
|
|
})
|
|
|
|
|
|
|
|
.observe(button_hover_on)
|
|
|
|
|
|
|
|
.observe(button_hover_off)
|
|
|
|
.observe(button_set_state(ViewState::Play));
|
|
|
|
.observe(button_set_state(ViewState::Play));
|
|
|
|
parent
|
|
|
|
parent
|
|
|
|
.spawn((Button, BackgroundColor(ORANGE.into())))
|
|
|
|
.spawn(button_builder(Node::default()))
|
|
|
|
.with_children(|parent| {
|
|
|
|
.with_children(|parent| {
|
|
|
|
parent.spawn(Text("About".to_string()));
|
|
|
|
parent.spawn(Text("About".to_string()));
|
|
|
|
})
|
|
|
|
})
|
|
|
|
|
|
|
|
.observe(button_hover_on)
|
|
|
|
|
|
|
|
.observe(button_hover_off)
|
|
|
|
.observe(button_set_state(ViewState::About));
|
|
|
|
.observe(button_set_state(ViewState::About));
|
|
|
|
parent
|
|
|
|
parent
|
|
|
|
.spawn((Button, BackgroundColor(PURPLE.into())))
|
|
|
|
.spawn(button_builder(Node::default()))
|
|
|
|
.with_children(|parent| {
|
|
|
|
.with_children(|parent| {
|
|
|
|
parent.spawn(Text("How to Play".to_string()));
|
|
|
|
parent.spawn(Text("How to Play".to_string()));
|
|
|
|
})
|
|
|
|
})
|
|
|
|
|
|
|
|
.observe(button_hover_on)
|
|
|
|
|
|
|
|
.observe(button_hover_off)
|
|
|
|
.observe(button_set_state(ViewState::HowToPlay));
|
|
|
|
.observe(button_set_state(ViewState::HowToPlay));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#[cfg(not(target_arch = "wasm32"))]
|
|
|
|
parent
|
|
|
|
parent
|
|
|
|
.spawn((Button, BackgroundColor(RED.into())))
|
|
|
|
.spawn(button_builder(Node::default()))
|
|
|
|
.with_children(|parent| {
|
|
|
|
.with_children(|parent| {
|
|
|
|
parent.spawn(Text("Quit".to_string()));
|
|
|
|
parent.spawn(Text("Quit".to_string()));
|
|
|
|
})
|
|
|
|
})
|
|
|
|
|
|
|
|
.observe(button_hover_on)
|
|
|
|
|
|
|
|
.observe(button_hover_off)
|
|
|
|
.observe(quit_button);
|
|
|
|
.observe(quit_button);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
commands
|
|
|
|
commands
|
|
|
|
.spawn((ViewState::Play, Node::default()))
|
|
|
|
.spawn((ViewState::Play, Node::default()))
|
|
|
|
.with_children(|parent| {
|
|
|
|
.with_children(|parent| {
|
|
|
|
parent
|
|
|
|
parent
|
|
|
|
.spawn((Button, BackgroundColor(TEAL.into()), GlobalZIndex(1)))
|
|
|
|
.spawn((button_builder(Node::default()), GlobalZIndex(1)))
|
|
|
|
.with_children(|parent| {
|
|
|
|
.with_children(|parent| {
|
|
|
|
parent.spawn(Text("Menu".to_string()));
|
|
|
|
parent.spawn(Text("Menu".to_string()));
|
|
|
|
})
|
|
|
|
})
|
|
|
|
|
|
|
|
.observe(button_hover_on)
|
|
|
|
|
|
|
|
.observe(button_hover_off)
|
|
|
|
.observe(button_set_state(ViewState::Menu));
|
|
|
|
.observe(button_set_state(ViewState::Menu));
|
|
|
|
|
|
|
|
/*
|
|
|
|
parent
|
|
|
|
parent
|
|
|
|
.spawn((Button, BackgroundColor(INDIGO.into()), GlobalZIndex(1)))
|
|
|
|
.spawn((button_builder(Node::default()), GlobalZIndex(1)))
|
|
|
|
.with_children(|parent| {
|
|
|
|
.with_children(|parent| {
|
|
|
|
parent.spawn(Text("Deck".to_string()));
|
|
|
|
parent.spawn(Text("Deck".to_string()));
|
|
|
|
})
|
|
|
|
})
|
|
|
|
|
|
|
|
.observe(button_hover_on)
|
|
|
|
|
|
|
|
.observe(button_hover_off)
|
|
|
|
.observe(button_set_state(ViewState::Deck));
|
|
|
|
.observe(button_set_state(ViewState::Deck));
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
/*
|
|
|
|
parent
|
|
|
|
parent
|
|
|
|
.spawn((Button, BackgroundColor(ORANGE.into()), GlobalZIndex(1)))
|
|
|
|
.spawn((button_builder(Node::default()), GlobalZIndex(1)))
|
|
|
|
.with_children(|parent| {
|
|
|
|
.with_children(|parent| {
|
|
|
|
parent.spawn(Text("Sets".to_string()));
|
|
|
|
parent.spawn(Text("Sets".to_string()));
|
|
|
|
})
|
|
|
|
})
|
|
|
|
|
|
|
|
.observe(button_hover_on)
|
|
|
|
|
|
|
|
.observe(button_hover_off)
|
|
|
|
.observe(button_set_state(ViewState::Sets));
|
|
|
|
.observe(button_set_state(ViewState::Sets));
|
|
|
|
|
|
|
|
*/
|
|
|
|
parent
|
|
|
|
parent
|
|
|
|
.spawn((Button, BackgroundColor(GREEN.into()), GlobalZIndex(1)))
|
|
|
|
.spawn((button_builder(Node::default()), GlobalZIndex(1)))
|
|
|
|
.with_children(|parent| {
|
|
|
|
.with_children(|parent| {
|
|
|
|
parent.spawn(Text("Help!".to_string()));
|
|
|
|
parent.spawn(Text("Help!".to_string()));
|
|
|
|
})
|
|
|
|
})
|
|
|
|
|
|
|
|
.observe(button_hover_on)
|
|
|
|
|
|
|
|
.observe(button_hover_off)
|
|
|
|
.observe(check_for_sets);
|
|
|
|
.observe(check_for_sets);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
@ -91,32 +149,150 @@ fn setup_about(mut commands: Commands) {
|
|
|
|
.spawn((ViewState::About, Node::default()))
|
|
|
|
.spawn((ViewState::About, Node::default()))
|
|
|
|
.with_children(|parent| {
|
|
|
|
.with_children(|parent| {
|
|
|
|
parent
|
|
|
|
parent
|
|
|
|
.spawn((Button, BackgroundColor(TEAL.into())))
|
|
|
|
.spawn(button_builder(Node::default()))
|
|
|
|
.with_children(|parent| {
|
|
|
|
.with_children(|parent| {
|
|
|
|
parent.spawn(Text("Menu".to_string()));
|
|
|
|
parent.spawn(Text("Menu".to_string()));
|
|
|
|
})
|
|
|
|
})
|
|
|
|
.observe(button_set_state(ViewState::Menu));
|
|
|
|
.observe(button_set_state(ViewState::Menu));
|
|
|
|
parent.spawn((
|
|
|
|
|
|
|
|
Text("This is the about page".to_string()),
|
|
|
|
|
|
|
|
BackgroundColor(BLACK.into()),
|
|
|
|
|
|
|
|
));
|
|
|
|
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
fn setup_how_to_play(mut commands: Commands) {
|
|
|
|
fn setup_how_to_play(mut commands: Commands, deck: Res<Deck>) {
|
|
|
|
commands
|
|
|
|
commands
|
|
|
|
.spawn((ViewState::HowToPlay, Node::default()))
|
|
|
|
.spawn((
|
|
|
|
|
|
|
|
ViewState::HowToPlay,
|
|
|
|
|
|
|
|
Node {
|
|
|
|
|
|
|
|
position_type: PositionType::Absolute,
|
|
|
|
|
|
|
|
width: Val::Percent(100.0),
|
|
|
|
|
|
|
|
height: Val::Percent(100.0),
|
|
|
|
|
|
|
|
..default()
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
))
|
|
|
|
.with_children(|parent| {
|
|
|
|
.with_children(|parent| {
|
|
|
|
parent
|
|
|
|
parent
|
|
|
|
.spawn((Button, BackgroundColor(TEAL.into())))
|
|
|
|
.spawn(button_builder(Node {
|
|
|
|
|
|
|
|
position_type: PositionType::Absolute,
|
|
|
|
|
|
|
|
top: Val::Px(0.0),
|
|
|
|
|
|
|
|
left: Val::Px(0.0),
|
|
|
|
|
|
|
|
..default()
|
|
|
|
|
|
|
|
}))
|
|
|
|
.with_children(|parent| {
|
|
|
|
.with_children(|parent| {
|
|
|
|
parent.spawn(Text("Menu".to_string()));
|
|
|
|
parent.spawn(Text("Menu".to_string()));
|
|
|
|
})
|
|
|
|
})
|
|
|
|
.observe(button_set_state(ViewState::Menu));
|
|
|
|
.observe(button_set_state(ViewState::Menu));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
parent.spawn((Node {
|
|
|
|
|
|
|
|
align_items: AlignItems::Center,
|
|
|
|
|
|
|
|
justify_content: JustifyContent::Center,
|
|
|
|
|
|
|
|
flex_direction: FlexDirection::Column,
|
|
|
|
|
|
|
|
..default()
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
BackgroundColor(BLACK.with_alpha(0.9).into()),
|
|
|
|
|
|
|
|
)).with_children(|parent| {
|
|
|
|
|
|
|
|
let most_matching = (
|
|
|
|
|
|
|
|
Card {
|
|
|
|
|
|
|
|
color: ItemColor::Red,
|
|
|
|
|
|
|
|
shape: ItemShape::Squiggle,
|
|
|
|
|
|
|
|
number: ItemNumber::One,
|
|
|
|
|
|
|
|
pattern: ItemPattern::Solid,
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
Card {
|
|
|
|
|
|
|
|
color: ItemColor::Red,
|
|
|
|
|
|
|
|
shape: ItemShape::Squiggle,
|
|
|
|
|
|
|
|
number: ItemNumber::Two,
|
|
|
|
|
|
|
|
pattern: ItemPattern::Solid,
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
Card {
|
|
|
|
|
|
|
|
color: ItemColor::Red,
|
|
|
|
|
|
|
|
shape: ItemShape::Squiggle,
|
|
|
|
|
|
|
|
number: ItemNumber::Three,
|
|
|
|
|
|
|
|
pattern: ItemPattern::Solid,
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
);
|
|
|
|
|
|
|
|
let most_not_matching = (
|
|
|
|
|
|
|
|
Card {
|
|
|
|
|
|
|
|
color: ItemColor::Green,
|
|
|
|
|
|
|
|
shape: ItemShape::Oval,
|
|
|
|
|
|
|
|
number: ItemNumber::Three,
|
|
|
|
|
|
|
|
pattern: ItemPattern::Solid,
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
Card {
|
|
|
|
|
|
|
|
color: ItemColor::Purple,
|
|
|
|
|
|
|
|
shape: ItemShape::Squiggle,
|
|
|
|
|
|
|
|
number: ItemNumber::Three,
|
|
|
|
|
|
|
|
pattern: ItemPattern::Striped,
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
Card {
|
|
|
|
|
|
|
|
color: ItemColor::Red,
|
|
|
|
|
|
|
|
shape: ItemShape::Diamond,
|
|
|
|
|
|
|
|
number: ItemNumber::Three,
|
|
|
|
|
|
|
|
pattern: ItemPattern::Open,
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
);
|
|
|
|
|
|
|
|
let not_valid = (
|
|
|
|
|
|
|
|
Card {
|
|
|
|
|
|
|
|
color: ItemColor::Purple,
|
|
|
|
|
|
|
|
shape: ItemShape::Oval,
|
|
|
|
|
|
|
|
number: ItemNumber::Three,
|
|
|
|
|
|
|
|
pattern: ItemPattern::Striped,
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
Card {
|
|
|
|
|
|
|
|
color: ItemColor::Purple,
|
|
|
|
|
|
|
|
shape: ItemShape::Oval,
|
|
|
|
|
|
|
|
number: ItemNumber::Two,
|
|
|
|
|
|
|
|
pattern: ItemPattern::Striped,
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
Card {
|
|
|
|
|
|
|
|
color: ItemColor::Purple,
|
|
|
|
|
|
|
|
shape: ItemShape::Oval,
|
|
|
|
|
|
|
|
number: ItemNumber::Three,
|
|
|
|
|
|
|
|
pattern: ItemPattern::Open,
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
);
|
|
|
|
|
|
|
|
[
|
|
|
|
|
|
|
|
("Find groups of 3 cards", None),
|
|
|
|
|
|
|
|
("All cards in a set must match or differ in their traits: Color, Number, Shading, and Shape.", None),
|
|
|
|
|
|
|
|
("For example all agree on Color, Shading, and Shape but not Number...", Some(most_matching)),
|
|
|
|
|
|
|
|
("...or all agree on Number but not Color, Number, Shading, and Shape...", Some(most_not_matching)),
|
|
|
|
|
|
|
|
("...but never partial agreement on a trait...", Some(not_valid)),
|
|
|
|
|
|
|
|
("When in doubt, click the 'Help!' button to get an assist", None),
|
|
|
|
|
|
|
|
]
|
|
|
|
|
|
|
|
.iter()
|
|
|
|
|
|
|
|
.for_each(|(t, example)| {
|
|
|
|
parent.spawn((
|
|
|
|
parent.spawn((
|
|
|
|
Text("This is the how to play page".to_string()),
|
|
|
|
Node {
|
|
|
|
BackgroundColor(BLACK.into()),
|
|
|
|
flex_direction: FlexDirection::Row,
|
|
|
|
|
|
|
|
align_items: AlignItems::Center,
|
|
|
|
|
|
|
|
..default()
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
)).with_children(|parent| {
|
|
|
|
|
|
|
|
parent.spawn((
|
|
|
|
|
|
|
|
Node {
|
|
|
|
|
|
|
|
margin: UiRect::all(Val::Px(5.0)),
|
|
|
|
|
|
|
|
padding: UiRect::all(Val::Px(5.0)),
|
|
|
|
|
|
|
|
..default()
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
Text(t.to_string()),
|
|
|
|
));
|
|
|
|
));
|
|
|
|
|
|
|
|
if let Some((a, b, c)) = example {
|
|
|
|
|
|
|
|
[a, b, c].iter().for_each(|x| {
|
|
|
|
|
|
|
|
let sprite = deck.cards.get(*x).unwrap();
|
|
|
|
|
|
|
|
parent.spawn((
|
|
|
|
|
|
|
|
Node {
|
|
|
|
|
|
|
|
height: Val::Px(100.0),
|
|
|
|
|
|
|
|
..default()
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
ImageNode {
|
|
|
|
|
|
|
|
image: sprite.image.clone(),
|
|
|
|
|
|
|
|
texture_atlas: sprite.texture_atlas.clone(),
|
|
|
|
|
|
|
|
..default()
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
));
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@ -125,7 +301,7 @@ fn setup_deck(mut commands: Commands) {
|
|
|
|
.spawn((ViewState::Deck, Node::default()))
|
|
|
|
.spawn((ViewState::Deck, Node::default()))
|
|
|
|
.with_children(|parent| {
|
|
|
|
.with_children(|parent| {
|
|
|
|
parent
|
|
|
|
parent
|
|
|
|
.spawn((Button, BackgroundColor(TEAL.into())))
|
|
|
|
.spawn(button_builder(Node::default()))
|
|
|
|
.with_children(|parent| {
|
|
|
|
.with_children(|parent| {
|
|
|
|
parent.spawn(Text("Back".to_string()));
|
|
|
|
parent.spawn(Text("Back".to_string()));
|
|
|
|
})
|
|
|
|
})
|
|
|
|
@ -138,7 +314,7 @@ fn setup_sets(mut commands: Commands) {
|
|
|
|
.spawn((ViewState::Sets, Node::default()))
|
|
|
|
.spawn((ViewState::Sets, Node::default()))
|
|
|
|
.with_children(|parent| {
|
|
|
|
.with_children(|parent| {
|
|
|
|
parent
|
|
|
|
parent
|
|
|
|
.spawn((Button, BackgroundColor(TEAL.into())))
|
|
|
|
.spawn(button_builder(Node::default()))
|
|
|
|
.with_children(|parent| {
|
|
|
|
.with_children(|parent| {
|
|
|
|
parent.spawn(Text("Back".to_string()));
|
|
|
|
parent.spawn(Text("Back".to_string()));
|
|
|
|
})
|
|
|
|
})
|
|
|
|
@ -146,6 +322,40 @@ fn setup_sets(mut commands: Commands) {
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
pub(crate) fn setup_set_check_button(mut commands: Commands) {
|
|
|
|
|
|
|
|
commands
|
|
|
|
|
|
|
|
.spawn((
|
|
|
|
|
|
|
|
Node {
|
|
|
|
|
|
|
|
width: Val::Percent(100.0),
|
|
|
|
|
|
|
|
position_type: PositionType::Absolute,
|
|
|
|
|
|
|
|
top: Val::Px(0.0),
|
|
|
|
|
|
|
|
flex_direction: FlexDirection::Column,
|
|
|
|
|
|
|
|
align_items: AlignItems::Center,
|
|
|
|
|
|
|
|
..default()
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
Visibility::default(),
|
|
|
|
|
|
|
|
ViewState::Play,
|
|
|
|
|
|
|
|
))
|
|
|
|
|
|
|
|
.with_children(|parent| {
|
|
|
|
|
|
|
|
parent
|
|
|
|
|
|
|
|
.spawn(button_builder(Node::default()))
|
|
|
|
|
|
|
|
.with_children(|parent| {
|
|
|
|
|
|
|
|
parent.spawn(Text("Set!".to_string()));
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
.observe(check_set);
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
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);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
fn button_hover_on(trigger: Trigger<Pointer<Over>>, mut query: Query<&mut BackgroundColor>) {
|
|
|
|
|
|
|
|
let mut background_color = query.get_mut(trigger.entity()).unwrap();
|
|
|
|
|
|
|
|
background_color.0.set_alpha(1.0);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
fn button_hover_off(trigger: Trigger<Pointer<Out>>, mut query: Query<&mut BackgroundColor>) {
|
|
|
|
|
|
|
|
let mut background_color = query.get_mut(trigger.entity()).unwrap();
|
|
|
|
|
|
|
|
background_color.0.set_alpha(0.9);
|
|
|
|
|
|
|
|
}
|
|
|
|
|