|
|
|
@ -105,23 +105,44 @@ struct DialogBox;
|
|
|
|
|
|
|
|
|
|
|
|
/// Initialize the UI which consists soley of a dialog box (for now?)
|
|
|
|
/// Initialize the UI which consists soley of a dialog box (for now?)
|
|
|
|
fn init_ui(mut commands: Commands) {
|
|
|
|
fn init_ui(mut commands: Commands) {
|
|
|
|
commands.spawn((
|
|
|
|
commands
|
|
|
|
DialogBox,
|
|
|
|
.spawn((
|
|
|
|
BackgroundColor(BLACK.with_alpha(0.9).into()),
|
|
|
|
DialogBox,
|
|
|
|
Node {
|
|
|
|
BackgroundColor(BLACK.with_alpha(0.9).into()),
|
|
|
|
align_self: AlignSelf::End,
|
|
|
|
Node {
|
|
|
|
justify_self: JustifySelf::Center,
|
|
|
|
align_self: AlignSelf::End,
|
|
|
|
width: Val::Percent(98.0),
|
|
|
|
justify_self: JustifySelf::Center,
|
|
|
|
max_height: Val::Percent(25.0),
|
|
|
|
width: Val::Percent(98.0),
|
|
|
|
align_items: AlignItems::Center,
|
|
|
|
max_height: Val::Percent(25.0),
|
|
|
|
margin: UiRect::all(Val::Percent(1.0)),
|
|
|
|
align_items: AlignItems::Center,
|
|
|
|
padding: UiRect::all(Val::Percent(1.0)),
|
|
|
|
margin: UiRect::all(Val::Percent(1.0)),
|
|
|
|
flex_direction: FlexDirection::Column,
|
|
|
|
padding: UiRect::all(Val::Percent(1.0)),
|
|
|
|
// Scroll on the Y axis
|
|
|
|
flex_direction: FlexDirection::Column,
|
|
|
|
overflow: Overflow::scroll_y(),
|
|
|
|
// Scroll on the Y axis
|
|
|
|
..default()
|
|
|
|
overflow: Overflow::scroll_y(),
|
|
|
|
},
|
|
|
|
..default()
|
|
|
|
));
|
|
|
|
},
|
|
|
|
|
|
|
|
))
|
|
|
|
|
|
|
|
.observe(hover_dialog_box_over)
|
|
|
|
|
|
|
|
.observe(hover_dialog_box_out);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
fn hover_dialog_box_over(
|
|
|
|
|
|
|
|
trigger: Trigger<Pointer<Over>>,
|
|
|
|
|
|
|
|
mut query: Query<&mut BackgroundColor, With<DialogBox>>,
|
|
|
|
|
|
|
|
) {
|
|
|
|
|
|
|
|
if let Ok(mut bg) = query.get_mut(trigger.target()) {
|
|
|
|
|
|
|
|
bg.0.set_alpha(0.95);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
fn hover_dialog_box_out(
|
|
|
|
|
|
|
|
trigger: Trigger<Pointer<Out>>,
|
|
|
|
|
|
|
|
mut query: Query<&mut BackgroundColor, With<DialogBox>>,
|
|
|
|
|
|
|
|
) {
|
|
|
|
|
|
|
|
if let Ok(mut bg) = query.get_mut(trigger.target()) {
|
|
|
|
|
|
|
|
bg.0.set_alpha(0.9);
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// On startup move the camera to a suitable position
|
|
|
|
/// On startup move the camera to a suitable position
|
|
|
|
@ -226,17 +247,15 @@ 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 query: Query<(&mut TextColor, &mut BackgroundColor)>,
|
|
|
|
) {
|
|
|
|
) {
|
|
|
|
if let Ok(mut tc) = query.get_mut(trigger.target()) {
|
|
|
|
if let Ok((mut tc, mut bg)) = query.get_mut(trigger.target()) {
|
|
|
|
*tc = TextColor(DARK_ORANGE.into());
|
|
|
|
*tc = TextColor(DARK_ORANGE.into());
|
|
|
|
|
|
|
|
bg.set_alpha(1.0);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
fn hover_dialog_option_out(
|
|
|
|
fn hover_dialog_option_out(trigger: Trigger<Pointer<Out>>, mut query: Query<&mut TextColor>) {
|
|
|
|
trigger: Trigger<Pointer<Out>>,
|
|
|
|
|
|
|
|
mut query: Query<&mut TextColor>,
|
|
|
|
|
|
|
|
) {
|
|
|
|
|
|
|
|
if let Ok(mut tc) = query.get_mut(trigger.target()) {
|
|
|
|
if let Ok(mut tc) = query.get_mut(trigger.target()) {
|
|
|
|
*tc = TextColor(ORANGE.into());
|
|
|
|
*tc = TextColor(ORANGE.into());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|