|
|
|
|
@ -8,7 +8,7 @@ impl Plugin for UiPlugin {
|
|
|
|
|
fn build(&self, app: &mut App) {
|
|
|
|
|
app.add_systems(Startup, load_assets)
|
|
|
|
|
.init_state::<Prompt>()
|
|
|
|
|
.add_systems(Startup, init_prompts)
|
|
|
|
|
.add_systems(OnExit(GameState::Loading), init_prompts)
|
|
|
|
|
.add_systems(
|
|
|
|
|
Update,
|
|
|
|
|
(
|
|
|
|
|
@ -151,7 +151,15 @@ fn scale_ui(
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
fn init_prompts(mut commands: Commands) {
|
|
|
|
|
fn init_prompts(
|
|
|
|
|
tweaks_file: Res<tweak::GameTweaks>,
|
|
|
|
|
tweaks: Res<Assets<tweak::Tweaks>>,
|
|
|
|
|
mut commands: Commands,
|
|
|
|
|
) {
|
|
|
|
|
let tweak = tweaks.get(tweaks_file.handle.clone()).expect("Load tweaks");
|
|
|
|
|
let button_handle = tweak.get_handle::<Image>("buttons_image_resting").unwrap();
|
|
|
|
|
let font_handle = tweak.get_handle::<Font>("buttons_font").unwrap();
|
|
|
|
|
|
|
|
|
|
// ClickToContinue
|
|
|
|
|
commands
|
|
|
|
|
.spawn((
|
|
|
|
|
@ -178,6 +186,90 @@ fn init_prompts(mut commands: Commands) {
|
|
|
|
|
visibility: Visibility::Inherited,
|
|
|
|
|
..default()
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
// Skip Intro button
|
|
|
|
|
parent
|
|
|
|
|
.spawn((
|
|
|
|
|
GameState::Intro,
|
|
|
|
|
menu::ButtonAction(GameState::Title),
|
|
|
|
|
ButtonBundle {
|
|
|
|
|
style: Style {
|
|
|
|
|
margin: UiRect::all(Val::Px(5.0)),
|
|
|
|
|
position_type: PositionType::Absolute,
|
|
|
|
|
bottom: Val::Px(0.0),
|
|
|
|
|
right: Val::Px(0.0),
|
|
|
|
|
..default()
|
|
|
|
|
},
|
|
|
|
|
background_color: Color::WHITE.with_a(0.3).into(),
|
|
|
|
|
image: UiImage {
|
|
|
|
|
texture: button_handle.clone(),
|
|
|
|
|
..default()
|
|
|
|
|
},
|
|
|
|
|
..default()
|
|
|
|
|
},
|
|
|
|
|
))
|
|
|
|
|
.with_children(|parent| {
|
|
|
|
|
parent.spawn(TextBundle {
|
|
|
|
|
text: Text {
|
|
|
|
|
sections: vec![TextSection {
|
|
|
|
|
value: "Skip".into(),
|
|
|
|
|
style: TextStyle {
|
|
|
|
|
color: Color::WHITE.with_a(0.3),
|
|
|
|
|
font_size: 8.0,
|
|
|
|
|
font: font_handle.clone(),
|
|
|
|
|
},
|
|
|
|
|
}],
|
|
|
|
|
..default()
|
|
|
|
|
},
|
|
|
|
|
style: Style {
|
|
|
|
|
margin: UiRect::all(Val::Px(10.0)),
|
|
|
|
|
..default()
|
|
|
|
|
},
|
|
|
|
|
..default()
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
// Skip Title button
|
|
|
|
|
parent
|
|
|
|
|
.spawn((
|
|
|
|
|
GameState::Title,
|
|
|
|
|
menu::ButtonAction(GameState::Play),
|
|
|
|
|
ButtonBundle {
|
|
|
|
|
style: Style {
|
|
|
|
|
margin: UiRect::all(Val::Px(5.0)),
|
|
|
|
|
position_type: PositionType::Absolute,
|
|
|
|
|
bottom: Val::Px(0.0),
|
|
|
|
|
right: Val::Px(0.0),
|
|
|
|
|
..default()
|
|
|
|
|
},
|
|
|
|
|
background_color: Color::WHITE.with_a(0.3).into(),
|
|
|
|
|
image: UiImage {
|
|
|
|
|
texture: button_handle.clone(),
|
|
|
|
|
..default()
|
|
|
|
|
},
|
|
|
|
|
..default()
|
|
|
|
|
},
|
|
|
|
|
))
|
|
|
|
|
.with_children(|parent| {
|
|
|
|
|
parent.spawn(TextBundle {
|
|
|
|
|
text: Text {
|
|
|
|
|
sections: vec![TextSection {
|
|
|
|
|
value: "Skip".into(),
|
|
|
|
|
style: TextStyle {
|
|
|
|
|
color: Color::WHITE.with_a(0.3),
|
|
|
|
|
font_size: 8.0,
|
|
|
|
|
font: font_handle.clone(),
|
|
|
|
|
},
|
|
|
|
|
}],
|
|
|
|
|
..default()
|
|
|
|
|
},
|
|
|
|
|
style: Style {
|
|
|
|
|
margin: UiRect::all(Val::Px(10.0)),
|
|
|
|
|
..default()
|
|
|
|
|
},
|
|
|
|
|
..default()
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|