@@ 87,6 87,9 @@ pub enum MenuState {
None,
Main,
Play,
Lobby,
CreateGame,
JoinGame,
Settings,
SettingsDisplay,
SettingsAudio,
@@ 114,6 117,8 @@ struct SelectedSettingsTab;
#[derive(Component)]
enum MenuButtonAction {
Play,
CreateGame,
JoinGame,
Settings,
SettingsDisplay,
SettingsAudio,
@@ 145,6 150,8 @@ fn menu_action(
match menu_button_action {
MenuButtonAction::Exit => app_exit_events.send(AppExit),
MenuButtonAction::Play => menu_state.set(MenuState::Play).unwrap(),
MenuButtonAction::CreateGame => menu_state.set(MenuState::CreateGame).unwrap(),
MenuButtonAction::JoinGame => menu_state.set(MenuState::JoinGame).unwrap(),
MenuButtonAction::Settings => menu_state.set(MenuState::Settings).unwrap(),
MenuButtonAction::SettingsDisplay => {
menu_state.set(MenuState::SettingsDisplay).unwrap()
@@ 76,7 76,11 @@ pub fn play_setup(mut commands: Commands, asset_server: Res<AssetServer>) {
..default()
})
.with_children(|parent| {
for (action, text) in [(MenuButtonAction::BackToMainMenu, "Back")] {
for (action, text) in [
(MenuButtonAction::CreateGame, "Create"),
(MenuButtonAction::JoinGame, "Join"),
(MenuButtonAction::BackToMainMenu, "Back"),
] {
parent
.spawn((
ButtonBundle {