|
|
|
|
@ -69,8 +69,10 @@ fn manage_cursor(
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
fn interactive_button(
|
|
|
|
|
mut events: Query<(&mut UiImage, &Interaction), (With<Button>, Changed<Interaction>)>,
|
|
|
|
|
mut events: Query<(Entity, &mut UiImage, &Interaction), (With<Button>, Changed<Interaction>)>,
|
|
|
|
|
mut writer: EventWriter<audio::AudioEvent>,
|
|
|
|
|
mut children: Query<&Children>,
|
|
|
|
|
mut texts: Query<(&mut Text, &mut Style)>,
|
|
|
|
|
tweaks_file: Res<tweak::GameTweaks>,
|
|
|
|
|
tweaks: Res<Assets<tweak::Tweaks>>,
|
|
|
|
|
) {
|
|
|
|
|
@ -82,23 +84,38 @@ fn interactive_button(
|
|
|
|
|
|
|
|
|
|
events
|
|
|
|
|
.iter_mut()
|
|
|
|
|
.for_each(|(mut ui_image, interaction)| match interaction {
|
|
|
|
|
.for_each(|(entity, mut ui_image, interaction)| match interaction {
|
|
|
|
|
Interaction::None => {
|
|
|
|
|
ui_image.texture = resting_handle.clone();
|
|
|
|
|
texts
|
|
|
|
|
.iter_many_mut(children.iter_descendants(entity))
|
|
|
|
|
.for_each(|(mut t, mut s)| {
|
|
|
|
|
s.right = Val::Auto;
|
|
|
|
|
info!("TODO: Change text color");
|
|
|
|
|
info!("TODO: Change position");
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
Interaction::Hovered => {
|
|
|
|
|
ui_image.texture = depressed_handle.clone();
|
|
|
|
|
writer.send(audio::AudioEvent::MenuHover);
|
|
|
|
|
texts
|
|
|
|
|
.iter_many_mut(children.iter_descendants(entity))
|
|
|
|
|
.for_each(|(mut t, mut s)| {
|
|
|
|
|
s.right = Val::Px(0.0);
|
|
|
|
|
info!("TODO: Change text color");
|
|
|
|
|
info!("TODO: Change position");
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
Interaction::Pressed => {
|
|
|
|
|
ui_image.texture = depressed_handle.clone();
|
|
|
|
|
writer.send(audio::AudioEvent::MenuSelect);
|
|
|
|
|
texts
|
|
|
|
|
.iter_many_mut(children.iter_descendants(entity))
|
|
|
|
|
.for_each(|(mut t, mut s)| {
|
|
|
|
|
s.right = Val::Px(0.0);
|
|
|
|
|
info!("TODO: Change text color");
|
|
|
|
|
info!("TODO: Change position");
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|