diff --git a/crates/thetawave_interface/src/states.rs b/crates/thetawave_interface/src/states.rs index e7037e60..5e54de91 100644 --- a/crates/thetawave_interface/src/states.rs +++ b/crates/thetawave_interface/src/states.rs @@ -6,7 +6,6 @@ pub enum AppStates { #[default] LoadingAssets, MainMenu, - Instructions, CharacterSelection, InitializeRun, Game, @@ -36,8 +35,5 @@ pub struct VictoryCleanup; #[derive(Component)] pub struct PauseCleanup; -#[derive(Component)] -pub struct InstructionsCleanup; - #[derive(Component)] pub struct CharacterSelectionCleanup; diff --git a/crates/thetawave_storage/src/plugin.rs b/crates/thetawave_storage/src/plugin.rs index 1fa1b70f..ee6f0948 100644 --- a/crates/thetawave_storage/src/plugin.rs +++ b/crates/thetawave_storage/src/plugin.rs @@ -171,7 +171,7 @@ mod test { } fn set_dummy_terminal_game_state(mut s: ResMut>) { - (*s).set(AppStates::Instructions); + (*s).set(AppStates::CharacterSelection); } fn clear_completed_games_metrics( diff --git a/src/states/game.rs b/src/states/game.rs index 7693b27a..c1408b7b 100644 --- a/src/states/game.rs +++ b/src/states/game.rs @@ -32,23 +32,3 @@ pub(super) fn start_game_system( }); } } - -pub(super) fn start_character_selection_system( - menu_input_query: Query<&ActionState, With>, - mut next_app_state: ResMut>, - mut sound_effect_pub: EventWriter, -) { - // read menu input action - let action_state = menu_input_query.single(); - - // if input read enter the game state - if action_state.just_released(&MenuAction::Confirm) { - // set the state to game - next_app_state.set(AppStates::CharacterSelection); - - // play sound effect - sound_effect_pub.send(PlaySoundEffectEvent { - sound_effect_type: SoundEffectType::MenuInputSuccess, - }); - } -} diff --git a/src/states/mod.rs b/src/states/mod.rs index 87659737..492536a7 100644 --- a/src/states/mod.rs +++ b/src/states/mod.rs @@ -14,7 +14,6 @@ use thetawave_interface::input::MenuExplorer; use thetawave_interface::states::CharacterSelectionCleanup; use thetawave_interface::states::GameCleanup; use thetawave_interface::states::GameOverCleanup; -use thetawave_interface::states::InstructionsCleanup; use thetawave_interface::states::MainMenuCleanup; use thetawave_interface::states::PauseCleanup; use thetawave_interface::states::VictoryCleanup; @@ -34,7 +33,7 @@ use crate::assets::UiAssets; use crate::GameEnterSet; use crate::GameUpdateSet; -use self::game::{start_character_selection_system, start_game_system}; +use self::game::start_game_system; use self::pause_menu::{close_pause_menu_system, open_pause_menu_system}; /// Includes systems that handle state transitions for `AppStates` and `GameStates`. Also includes /// an asset loading state. @@ -115,11 +114,6 @@ impl Plugin for StatesPlugin { .run_if(in_state(GameStates::Playing)), ); - app.add_systems( - Update, - start_character_selection_system.run_if(in_state(AppStates::Instructions)), - ); - app.add_systems( Update, start_game_system.run_if(in_state(AppStates::CharacterSelection)), @@ -152,11 +146,6 @@ impl Plugin for StatesPlugin { clear_state_system::, ); - app.add_systems( - OnExit(AppStates::Instructions), - clear_state_system::, - ); - app.add_systems( Update, close_pause_menu_system.run_if(in_state(GameStates::Paused)), diff --git a/src/ui/instructions.rs b/src/ui/instructions.rs deleted file mode 100644 index 5fb16565..00000000 --- a/src/ui/instructions.rs +++ /dev/null @@ -1,85 +0,0 @@ -use super::BouncingPromptComponent; -use crate::options::PlayingOnArcadeResource; -use bevy::{ - asset::AssetServer, - ecs::{ - component::Component, - system::{Commands, Res}, - }, - hierarchy::BuildChildren, - time::{Timer, TimerMode}, - ui::{ - node_bundles::{ImageBundle, NodeBundle}, - AlignItems, Style, UiRect, Val, - }, - utils::default, -}; -use thetawave_interface::states::InstructionsCleanup; - -#[derive(Component)] -pub struct InstructionsUI; - -pub fn setup_instructions_system( - mut commands: Commands, - asset_server: Res, - playing_on_arcade: Res, -) { - commands - .spawn(NodeBundle { - style: Style { - width: Val::Percent(100.0), - height: Val::Percent(100.0), - ..Default::default() - }, - ..Default::default() - }) - .insert(InstructionsCleanup) - .insert(InstructionsUI) - .with_children(|parent| { - parent - .spawn(ImageBundle { - image: asset_server - .load(if **playing_on_arcade { - "texture/instructions_54_arcade.png" - } else { - "texture/instructions_54.png" - }) - .into(), - style: Style { - width: Val::Percent(100.0), - height: Val::Percent(100.0), - align_items: AlignItems::Center, - ..Default::default() - }, - ..default() - }) - .with_children(|parent| { - parent - .spawn(ImageBundle { - image: asset_server - .load(if **playing_on_arcade { - "texture/start_game_prompt_arcade.png" - } else { - "texture/start_game_prompt_keyboard.png" - }) - .into(), - style: Style { - width: Val::Px(350.0), - height: Val::Px(87.5), - margin: UiRect { - left: Val::Auto, - right: Val::Percent(18.0), - top: Val::Percent(70.0), - ..Default::default() - }, - ..Default::default() - }, - ..Default::default() - }) - .insert(BouncingPromptComponent { - flash_timer: Timer::from_seconds(2.0, TimerMode::Repeating), - is_active: true, - }); - }); - }); -} diff --git a/src/ui/main_menu/button.rs b/src/ui/main_menu/button.rs index c5cb0b85..cb500786 100644 --- a/src/ui/main_menu/button.rs +++ b/src/ui/main_menu/button.rs @@ -1,7 +1,7 @@ //! Provides the layout (trait on `bevy::hierarchy::ChildBUilder`) and behavior (systems) to put 4 //! vertically layed out on the main menu, and change the state from //! `thetawave_interface::states::AppStates::MainMenu` to -//! `thetawave_interface::states::AppStates::Instructions` +//! `thetawave_interface::states::AppStates::CharacterSelection` use crate::assets::UiAssets; use bevy::{ app::AppExit, @@ -44,11 +44,11 @@ const BUTTON_TEXTURE_PADDING_HOVERED: UiRect = UiRect::new(Val::ZERO, Val::ZERO, Val::Percent(10.5), Val::ZERO); /// Event and Component for giving and sending menu buttons actions to move the user from -/// `AppStates::MainMenu` to `AppStates::Instructions`, plus possibly a few digressions and +/// `AppStates::MainMenu` to `AppStates::CharacterSelection`, plus possibly a few digressions and /// sprinkles. #[derive(Component, Event, Clone, PartialEq, Eq, Copy, Debug)] pub(super) enum MainMenuButtonActionComponent { - EnterInstructions, + EnterCharacterSelection, EnterOptions, EnterCompendium, QuitGame, @@ -59,7 +59,7 @@ impl MainMenuButtonActionComponent { /// option/action fn in_game_text(&self) -> &'static str { match self { - Self::EnterInstructions => "Start Game", + Self::EnterCharacterSelection => "Start Game", Self::EnterOptions => "Options", Self::EnterCompendium => "Compendium", Self::QuitGame => "Exit Game", @@ -68,7 +68,7 @@ impl MainMenuButtonActionComponent { } /// This is the order (vertical, going down) of the buttons shown on the main menu UI. const MAIN_MENU_BUTTON_ORDER: [MainMenuButtonActionComponent; 4] = [ - MainMenuButtonActionComponent::EnterInstructions, + MainMenuButtonActionComponent::EnterCharacterSelection, MainMenuButtonActionComponent::EnterOptions, MainMenuButtonActionComponent::EnterCompendium, MainMenuButtonActionComponent::QuitGame, @@ -368,8 +368,8 @@ pub(super) fn main_menu_button_on_click_system( ) { for event in button_event_reader.read() { match event { - MainMenuButtonActionComponent::EnterInstructions => { - next_app_state.set(AppStates::Instructions); + MainMenuButtonActionComponent::EnterCharacterSelection => { + next_app_state.set(AppStates::CharacterSelection); } MainMenuButtonActionComponent::EnterOptions => info!("Enter options menu."), MainMenuButtonActionComponent::EnterCompendium => info!("Enter compendium."), diff --git a/src/ui/main_menu/mod.rs b/src/ui/main_menu/mod.rs index 8f938a24..932a8324 100644 --- a/src/ui/main_menu/mod.rs +++ b/src/ui/main_menu/mod.rs @@ -1,5 +1,5 @@ //! Exposes a plugin to handle the layout and behavior of a button-based main menu that mainly -//! guides the user into the `thetawave_interface::states::AppStates::Instructions` state. +//! guides the user into the `thetawave_interface::states::AppStates::CharacterSelection` state. use crate::{ animation::{AnimationComponent, AnimationDirection}, assets::UiAssets, @@ -30,7 +30,7 @@ use self::button::main_menu_button_selection_and_click_system; use self::button::MainMenuButtonActionEvent; use self::button::UiChildBuilderExt; /// Renders a button-based UI to transition the app from `AppStates::MainMenu` to -/// `AppStates::Instructions`, possibly with some digressions. Without this plugin, the game will +/// `AppStates::CharacterSelection`, possibly with some digressions. Without this plugin, the game will /// never progress past a blank main menu screen and the user cannot start the run. pub(super) struct MainMenuUIPlugin; impl Plugin for MainMenuUIPlugin { diff --git a/src/ui/mod.rs b/src/ui/mod.rs index 505e9922..bdc31ea3 100644 --- a/src/ui/mod.rs +++ b/src/ui/mod.rs @@ -12,7 +12,6 @@ use thetawave_interface::states; mod character_selection; mod game; mod game_over; -mod instructions; mod main_menu; mod pause_menu; mod victory; @@ -24,7 +23,6 @@ use self::{ }, game::GameUiPlugin, game_over::setup_game_over_system, - instructions::setup_instructions_system, main_menu::MainMenuUIPlugin, pause_menu::setup_pause_system, victory::setup_victory_system, @@ -41,11 +39,6 @@ impl Plugin for UiPlugin { app.add_plugins(MainMenuUIPlugin); app.add_systems(Update, bouncing_prompt_system); - app.add_systems( - OnEnter(states::AppStates::Instructions), - setup_instructions_system, - ); - app.add_systems( OnEnter(states::AppStates::CharacterSelection), setup_character_selection_system,