loby ui impl
This commit is contained in:
+10
-7
@@ -32,7 +32,7 @@ struct Selected;
|
||||
|
||||
/// Defines colors that a UI object should turn when interactions occur.
|
||||
#[derive(Component, Clone, PartialEq, Default, Debug)]
|
||||
struct InteractionColors {
|
||||
pub(crate) struct InteractionColors {
|
||||
default: Color,
|
||||
hovered: Color,
|
||||
pressed: Color,
|
||||
@@ -137,7 +137,7 @@ impl MenuLayer {
|
||||
menu_layer(layer)
|
||||
ChildOf(menu_root)
|
||||
Children [
|
||||
{entries}
|
||||
{entries},
|
||||
(
|
||||
menu_button("New Game", Some(MenuLayer::NewGame))
|
||||
InteractionColors::GOOD
|
||||
@@ -163,7 +163,7 @@ impl MenuLayer {
|
||||
full_menu_layer(layer)
|
||||
ChildOf(menu_root)
|
||||
Children [
|
||||
menu_button("Game 1", None),
|
||||
menu_button("Game 1", None)
|
||||
]
|
||||
}),
|
||||
MenuLayer::DirectConnect => Box::new(bsn! {
|
||||
@@ -320,7 +320,7 @@ fn new_game_menu() -> impl SceneList {
|
||||
font_size: FontSize::Px(66.),
|
||||
}
|
||||
TextCursorStyle {
|
||||
color: Color::BLACK
|
||||
color: Color::BLACK,
|
||||
}
|
||||
TabIndex(0)
|
||||
BackgroundColor(Color::srgb(0.48, 0.84, 0.87))
|
||||
@@ -394,7 +394,7 @@ fn game_info_menu(name: impl Into<String>) -> impl SceneList {
|
||||
font_size: FontSize::Px(66.),
|
||||
}
|
||||
TextCursorStyle {
|
||||
color: Color::BLACK
|
||||
color: Color::BLACK,
|
||||
}
|
||||
TabIndex(0)
|
||||
BackgroundColor(Color::srgb(0.48, 0.84, 0.87))
|
||||
@@ -434,7 +434,7 @@ fn game_info_menu(name: impl Into<String>) -> impl SceneList {
|
||||
|
||||
// TODO: refresh listing
|
||||
})
|
||||
)
|
||||
),
|
||||
]
|
||||
),
|
||||
]
|
||||
@@ -504,11 +504,14 @@ fn menu_button(label: impl Into<String>, next_layer: Option<MenuLayer>) -> Box<d
|
||||
fn button_activate_observer(
|
||||
event: On<Activate>,
|
||||
mut commands: Commands,
|
||||
mut menu: ResMut<CurrentMenu>,
|
||||
menu: Option<ResMut<CurrentMenu>>,
|
||||
q_next_layer: Query<(&NextLayer, &ChildOf)>,
|
||||
q_layer: Query<(&Layer, &Children)>,
|
||||
q_selected: Query<(Entity, Has<Selected>)>,
|
||||
) {
|
||||
let Some(mut menu) = menu else {
|
||||
return;
|
||||
};
|
||||
if let Ok((next_layer, parent)) = q_next_layer.get(event.entity) {
|
||||
let Ok((layer, layer_entries)) = q_layer.get(parent.parent()) else {
|
||||
warn!(
|
||||
|
||||
Reference in New Issue
Block a user