Skip to content

Commit

Permalink
fix!: Remove help menu entirely
Browse files Browse the repository at this point in the history
  • Loading branch information
PraxTube committed Jan 17, 2024
1 parent 5e542ab commit 3360f7e
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 86 deletions.
39 changes: 1 addition & 38 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 1 addition & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "ace-of-the-heavens"
version = "0.2.5"
version = "0.2.6"
edition = "2021"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
Expand Down Expand Up @@ -29,7 +29,6 @@ bevy_ggrs = { version = "0.13" }
bevy_matchbox = { version = "0.7", features = ["ggrs"] }
bevy_roll_safe = { git = "https://github.com/johanhelsing/bevy_roll_safe" }

open = "5.0.0"
clap = "4.1.10"
bincode = "1.3.3"
serde = "1.0.189"
Expand Down
39 changes: 4 additions & 35 deletions src/ui/main_menu_screen.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
use bevy::prelude::*;

use super::MainMenuState;
use crate::{GameAssets, GameState};

#[derive(Component)]
Expand Down Expand Up @@ -29,17 +28,6 @@ fn spawn_play_text(commands: &mut Commands, font: Handle<Font>) -> Entity {
commands.spawn(text_bundle).id()
}

fn spawn_help_text(commands: &mut Commands, font: Handle<Font>) -> Entity {
let text_style = TextStyle {
font,
font_size: 35.0,
color: Color::WHITE,
};
let text_bundle =
TextBundle::from_sections([TextSection::new("PRESS H FOR HELP".to_string(), text_style)]);
commands.spawn(text_bundle).id()
}

fn spawn_quit_text(commands: &mut Commands, font: Handle<Font>) -> Entity {
let text_style = TextStyle {
font,
Expand Down Expand Up @@ -73,11 +61,10 @@ fn spawn_text(commands: &mut Commands, font: Handle<Font>) {
.id();
let title_text = spawn_title_text(commands, font.clone());
let play_text = spawn_play_text(commands, font.clone());
let help_text = spawn_help_text(commands, font.clone());
let quit_text = spawn_quit_text(commands, font.clone());
commands
.entity(text_root_node)
.push_children(&[title_text, play_text, help_text, quit_text]);
.push_children(&[title_text, play_text, quit_text]);
}

fn spawn_main_menu_screen(mut commands: Commands, assets: Res<GameAssets>) {
Expand Down Expand Up @@ -112,30 +99,12 @@ fn play_game(
}
}

fn help_menu(keys: Res<Input<KeyCode>>, mut next_state: ResMut<NextState<MainMenuState>>) {
if keys.pressed(KeyCode::H) {
next_state.set(MainMenuState::HelpMenu);
}
}

pub struct MainMenuUiPlugin;

impl Plugin for MainMenuUiPlugin {
fn build(&self, app: &mut App) {
app.add_systems(
Update,
(
play_game.run_if(
in_state(GameState::MainMenu).and_then(in_state(MainMenuState::MainMenu)),
),
help_menu.run_if(
in_state(GameState::MainMenu).and_then(in_state(MainMenuState::MainMenu)),
),
),
)
.add_systems(OnEnter(GameState::MainMenu), spawn_main_menu_screen)
.add_systems(OnExit(GameState::MainMenu), despawn_main_menu_screen)
.add_systems(OnExit(MainMenuState::HelpMenu), spawn_main_menu_screen)
.add_systems(OnEnter(MainMenuState::HelpMenu), despawn_main_menu_screen);
app.add_systems(Update, (play_game.run_if(in_state(GameState::MainMenu)),))
.add_systems(OnEnter(GameState::MainMenu), spawn_main_menu_screen)
.add_systems(OnExit(GameState::MainMenu), despawn_main_menu_screen);
}
}
12 changes: 1 addition & 11 deletions src/ui/mod.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
pub mod round_start_screen;

mod game_over_screen;
mod help_menu_screen;
mod main_menu_screen;
mod matchmaking_screen;
mod round_over_screen;
Expand All @@ -11,28 +10,19 @@ mod session_stats_screen;

use bevy::prelude::*;

#[derive(States, Clone, Eq, PartialEq, Debug, Hash, Default)]
pub enum MainMenuState {
#[default]
MainMenu,
HelpMenu,
}

pub struct AceUiPlugin;

impl Plugin for AceUiPlugin {
fn build(&self, app: &mut App) {
app.add_plugins((
main_menu_screen::MainMenuUiPlugin,
help_menu_screen::HelpMenuUiPlugin,
matchmaking_screen::MatchmakingUiPlugin,
scoreboard::ScoreboardUiPlugin,
session_stats_screen::SessionStatsPlugin,
seed_screen::SeedUiPlugin,
round_start_screen::RoundStartUiPlugin,
round_over_screen::RoundOverUiPlugin,
game_over_screen::GameOverUiPlugin,
))
.add_state::<MainMenuState>();
));
}
}

0 comments on commit 3360f7e

Please sign in to comment.