Remove background color from dialog options

main
Elijah Voigt 4 months ago
parent 6c12943cd4
commit f7dfb346ae

@ -188,7 +188,7 @@ fn dialog_engine(
vec!["L"], vec!["L"],
]; ];
info!("Show options: {:?}", dialog.get(*idx)); debug!("Show options: {:?}", dialog.get(*idx));
commands.entity(*dialog_box).with_children(|parent| { commands.entity(*dialog_box).with_children(|parent| {
if let Some(options) = dialog.get(*idx) { if let Some(options) = dialog.get(*idx) {
@ -209,14 +209,14 @@ fn choose_dialog_option(
options: Query<Entity, With<DialogOption>>, options: Query<Entity, With<DialogOption>>,
dialog_box: Single<Entity, With<DialogBox>>, dialog_box: Single<Entity, With<DialogBox>>,
) { ) {
info!("Choosing dialog {:?}", trigger.target()); debug!("Choosing dialog {:?}", trigger.target());
info!("Despawning dialog options"); debug!("Despawning dialog options");
options.iter().for_each(|e| { options.iter().for_each(|e| {
commands.entity(e).despawn(); commands.entity(e).despawn();
}); });
info!("Inserting dialog line"); debug!("Inserting dialog line");
if let Ok(t) = texts.get(trigger.target()) { if let Ok(t) = texts.get(trigger.target()) {
commands.entity(*dialog_box).with_children(|parent| { commands.entity(*dialog_box).with_children(|parent| {
parent.spawn((t.clone(), DialogLine)); parent.spawn((t.clone(), DialogLine));
@ -226,21 +226,19 @@ fn choose_dialog_option(
fn hover_dialog_option_over( fn hover_dialog_option_over(
trigger: Trigger<Pointer<Over>>, trigger: Trigger<Pointer<Over>>,
mut query: Query<(&mut TextColor, &mut BackgroundColor)>, mut query: Query<&mut TextColor>,
) { ) {
if let Ok((mut tc, mut bg)) = query.get_mut(trigger.target()) { if let Ok(mut tc) = query.get_mut(trigger.target()) {
*tc = TextColor(DARK_ORANGE.into()); *tc = TextColor(DARK_ORANGE.into());
bg.0.set_alpha(0.9);
} }
} }
fn hover_dialog_option_out( fn hover_dialog_option_out(
trigger: Trigger<Pointer<Out>>, trigger: Trigger<Pointer<Out>>,
mut query: Query<(&mut TextColor, &mut BackgroundColor)>, mut query: Query<&mut TextColor>,
) { ) {
if let Ok((mut tc, mut bg)) = query.get_mut(trigger.target()) { if let Ok(mut tc) = query.get_mut(trigger.target()) {
*tc = TextColor(ORANGE.into()); *tc = TextColor(ORANGE.into());
bg.0.set_alpha(0.0);
} }
} }
@ -258,7 +256,6 @@ fn add_dialog_option(trigger: Trigger<OnAdd, DialogOption>, mut commands: Comman
}) })
.insert(TextLayout::new_with_justify(JustifyText::Center)) .insert(TextLayout::new_with_justify(JustifyText::Center))
.insert(TextColor(ORANGE.into())) .insert(TextColor(ORANGE.into()))
.insert(BackgroundColor(BLACK.with_alpha(0.0).into()))
.observe(choose_dialog_option) .observe(choose_dialog_option)
.observe(hover_dialog_option_over) .observe(hover_dialog_option_over)
.observe(hover_dialog_option_out); .observe(hover_dialog_option_out);

Loading…
Cancel
Save