diff --git a/src/menu.rs b/src/menu.rs index f0c605a..faeca53 100644 --- a/src/menu.rs +++ b/src/menu.rs @@ -106,7 +106,7 @@ fn init_play_menu( parent.spawn(TextBundle { text: Text { sections: vec![TextSection { - value: "C o n t i n u e".into(), + value: "Continue".into(), style: TextStyle { color: Color::WHITE, font_size: 12.0, @@ -145,7 +145,7 @@ fn init_play_menu( parent.spawn(TextBundle { text: Text { sections: vec![TextSection { - value: "R e s t a r t".into(), + value: "New Game".into(), style: TextStyle { color: Color::WHITE, font_size: 12.0, @@ -184,7 +184,7 @@ fn init_play_menu( parent.spawn(TextBundle { text: Text { sections: vec![TextSection { - value: "T u t o r i a l".into(), + value: "Tutorial".into(), style: TextStyle { color: Color::WHITE, font_size: 12.0, @@ -223,7 +223,7 @@ fn init_play_menu( parent.spawn(TextBundle { text: Text { sections: vec![TextSection { - value: "C r e d i t s".into(), + value: "Credits".into(), style: TextStyle { color: Color::WHITE, font_size: 12.0, @@ -262,7 +262,7 @@ fn init_play_menu( parent.spawn(TextBundle { text: Text { sections: vec![TextSection { - value: "Q u i t".into(), + value: "Quit".into(), style: TextStyle { color: Color::WHITE, font_size: 12.0, diff --git a/src/tutorial.rs b/src/tutorial.rs index 595e7b7..bd46f6f 100644 --- a/src/tutorial.rs +++ b/src/tutorial.rs @@ -221,7 +221,7 @@ fn initialize_tutorial( ..default() }, style: Style { - margin: UiRect::all(Val::Px(20.0)), + margin: UiRect::all(Val::Px(10.0)), ..default() }, ..default() @@ -304,7 +304,7 @@ fn initialize_tutorial( parent.spawn(TextBundle { text: Text { sections: vec![TextSection { - value: "Reset".into(), + value: "New Game".into(), style: TextStyle { color: Color::WHITE, font_size: 10.0, @@ -314,7 +314,7 @@ fn initialize_tutorial( ..default() }, style: Style { - margin: UiRect::all(Val::Px(20.0)), + margin: UiRect::all(Val::Px(10.0)), ..default() }, ..default() @@ -354,7 +354,7 @@ fn initialize_tutorial( ..default() }, style: Style { - margin: UiRect::all(Val::Px(20.0)), + margin: UiRect::all(Val::Px(10.0)), ..default() }, ..default() diff --git a/src/ui.rs b/src/ui.rs index 8926797..9d694af 100644 --- a/src/ui.rs +++ b/src/ui.rs @@ -8,7 +8,7 @@ impl Plugin for UiPlugin { fn build(&self, app: &mut App) { app.add_systems(Startup, load_assets) .init_state::() - .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, + tweaks: Res>, + mut commands: Commands, +) { + let tweak = tweaks.get(tweaks_file.handle.clone()).expect("Load tweaks"); + let button_handle = tweak.get_handle::("buttons_image_resting").unwrap(); + let font_handle = tweak.get_handle::("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() + }); + }); }); }