diff --git a/assets/martian.tweak.toml b/assets/martian.tweak.toml index f01513e..ffea183 100644 --- a/assets/martian.tweak.toml +++ b/assets/martian.tweak.toml @@ -45,17 +45,21 @@ Will you be a part of the universal rhyme, and if so, which side are you on? [tutorial] intro = [ - "Greetings general, and welcome to 'Martian Advanced Rules for Generals: Long-Term engagement strategies'. As a part of your assignment to operation Red Rocks, it is in your best interest to thoroughly utilize this simulation to best prepare you for engagement with, and strategic domination of, Martian forces.", - "…", - "But first things first! How do you play the dang game?", +""" +Greetings general, and welcome to 'Martian Advanced Rules for Generals: Long-Term engagement strategies'. As a part of your assignment to operation Red Rocks, it is in your best interest to thoroughly utilize this simulation to best prepare you for engagement with, and strategic domination of, Martian forces. +""", +""" +... +""", +""" +But first things first! How do you play the dang game? +""", ] - objective = [ "The Goal of Martian Chess is to have more points than your opponent when the game ends.", "You get points by capturing your opponent's pieces.", "The game ends when one player has no more pieces in their zone.", ] - ownership = [ """ > When player or AI moves a piece across the canal, @@ -63,23 +67,25 @@ This here line is called the canal. And blow me down if she aint a beaut! See he """, "Keep playing and try to score some points!", ] - -promotions = """ +promotions = [ +""" > When player has either no drones or no Queens -Oh and one last thing: real nerds occasionally employ the field promotions strategy. Here’s how it works: If you control no drones, you may combine two pawns to make a drone. Similarly, if you control no Queens, you may combine two drones to make a queen. +Oh and one last thing: real nerds occasionally employ the field promotions strategy. Here's how it works: If you control no drones, you may combine two pawns to make a drone. Similarly, if you control no Queens, you may combine two drones to make a queen. +""", +] +outro = [ """ - -outro = """ Ok I gotta go now, but You now know enough to prevent human extinction. Do you want to finish this practice round? -""" +""", +] [tutorial.pieces] -prompt = "Try picking up a piece" -pawn = "Pawn. The Pawn is worth 1 point, and moves 1 space diagonally. This thing ain’t worth your time. Put it down." -drone = "Drone. The Drone is worth 2 points, and moves 1 or 2 spaces horizontally or vertically. Neat. Back on the board." -queen = "Queen. The Queen is worth 3 Points, and moves any distance in a straight line. Woah, watch where you point that thing. Best put it back down." -jumping = "Note that jumping is not allowed. Martians banned any and all jumping in their society long ago." -end = "Ok, now move some pieces somewheres!" +prompt = ["Try picking up a piece"] +pawn = ["Pawn. The Pawn is worth 1 point, and moves 1 space diagonally. This thing ain't worth your time. Put it down."] +drone = ["Drone. The Drone is worth 2 points, and moves 1 or 2 spaces horizontally or vertically. Neat. Back on the board."] +queen = ["Queen. The Queen is worth 3 Points, and moves any distance in a straight line. Woah, watch where you point that thing. Best put it back down."] +jumping = ["Note that jumping is not allowed. Martians banned any and all jumping in their society long ago."] +end = ["Ok, now move some pieces somewheres!"] [resolution] diff --git a/src/credits.rs b/src/credits.rs index df8c662..8f2f643 100644 --- a/src/credits.rs +++ b/src/credits.rs @@ -73,6 +73,6 @@ fn update_credits( }) .collect() }; - info!("Text sections: {:?}", text.sections); + debug!("Text sections: {:?}", text.sections); }); } diff --git a/src/intro.rs b/src/intro.rs index 6e2bbcf..ba85624 100644 --- a/src/intro.rs +++ b/src/intro.rs @@ -8,7 +8,9 @@ impl Plugin for IntroPlugin { fn build(&self, app: &mut App) { app.add_systems( OnExit(GameState::Loading), - init_intro_text.run_if(resource_exists::()), + init_intro_text + .run_if(resource_exists::()) + .run_if(run_once()), ) .init_resource::() .add_systems(OnEnter(GameState::Intro), activate::) @@ -75,18 +77,32 @@ fn init_intro_text( }, )) .with_children(|parent| { - parent.spawn(( - Intro, - TextBundle::from_sections(text.chars().into_iter().map(|c| TextSection { - value: c.to_string(), - style: TextStyle { - font_size: 16.0, - color: Color::WHITE.with_a(0.0), + parent + .spawn(( + Intro, + NodeBundle { + style: Style { + padding: UiRect::all(Val::Px(25.0)), + ..default() + }, + background_color: Color::BLACK.with_a(0.9).into(), ..default() }, - })) - .with_text_alignment(TextAlignment::Center), - )); + )) + .with_children(|parent| { + parent.spawn(( + Intro, + TextBundle::from_sections(text.chars().into_iter().map(|c| TextSection { + value: c.to_string(), + style: TextStyle { + font_size: 16.0, + color: Color::WHITE.with_a(0.0), + ..default() + }, + })) + .with_text_alignment(TextAlignment::Center), + )); + }); }); } diff --git a/src/main.rs b/src/main.rs index 080f874..d699300 100644 --- a/src/main.rs +++ b/src/main.rs @@ -35,6 +35,8 @@ fn main() { ( debug_state::.run_if(resource_changed::>()), debug_state::.run_if(resource_changed::>()), + debug_state:: + .run_if(resource_changed::>()), ), ); app.add_systems( @@ -119,7 +121,10 @@ fn activate( } fn deactivate( - mut entities: Query<&mut Visibility, (With, Without)>, + mut entities: Query< + &mut Visibility, + (With, Without, Without), + >, ) { entities.iter_mut().for_each(|mut visibility| { *visibility = Visibility::Hidden; diff --git a/src/menu.rs b/src/menu.rs index 8de026a..e2efcee 100644 --- a/src/menu.rs +++ b/src/menu.rs @@ -13,7 +13,7 @@ impl Plugin for MenuPlugin { .add_systems( Update, ( - handle_menu_button, + handle_menu_button::, handle_menu_quit, bevy::window::close_on_esc, ) @@ -85,6 +85,35 @@ fn init_menu_ui(mut commands: Commands) { )); }); + parent + .spawn(( + GameState::Play, + tutorial::TutorialState::Intro, + ButtonBundle { + style: Style { + padding: UiRect::all(Val::Px(5.0)), + margin: UiRect::all(Val::Px(5.0)), + ..default() + }, + background_color: Color::ORANGE.with_a(0.5).into(), + ..default() + }, + )) + .with_children(|parent| { + parent.spawn(( + GameState::Play, + tutorial::TutorialState::Intro, + TextBundle::from_section( + "Tutorial", + TextStyle { + color: Color::BLACK, + font_size: 32.0, + ..default() + }, + ), + )); + }); + parent .spawn(( GameState::Credits, @@ -141,9 +170,9 @@ fn init_menu_ui(mut commands: Commands) { }); } -fn handle_menu_button( - events: Query<(&Interaction, &GameState), (With