/* * This file is part of laurelin/client * Copyright (C) 2023 Jonni Liljamo * * Licensed under GPL-3.0-only. * See LICENSE for licensing information. */ use bevy::prelude::*; use iyes_loopless::prelude::*; use crate::{remove_ui, GameState}; //mod mainmenuscreen; //use mainmenuscreen::*; //mod settingsscreen; //use settingsscreen::*; //mod accountscreenloggedout; //use accountscreenloggedout::*; //mod accountscreenloggedin; //use accountscreenloggedin::*; //mod accountlogin; //mod accountregister; //mod play; pub struct MenuPlugin; impl Plugin for MenuPlugin { fn build(&self, app: &mut App) { /* app. // Start with no menu. The menu is loaded when the GameState::MainMenu is entered. add_loopless_state(MenuState::None) .add_enter_system(GameState::MainMenu, menu_setup) // Systems for main menu screen .add_enter_system(MenuState::Main, remove_ui.label("msm_enter_first")) .add_enter_system(MenuState::Main, main_menu_setup.before("msm_enter_first")) .add_exit_system(MenuState::Main, remove_ui) .add_event::() .add_event::() .add_system_set( ConditionSet::new() .run_in_state(MenuState::Main) .with_system(handle_to_account_event.run_on_event::()) .with_system(handle_exit_event.run_on_event::()) .into() ); */ // Systems for the settings screen //.add_enter_system(MenuState::Settings, settings_setup) //.add_exit_system(MenuState::Settings, remove_ui) // Systems for account loggedout screen //.add_enter_system(MenuState::AccountLoggedOut, account_loggedout_setup) //.add_exit_system(MenuState::AccountLoggedOut, remove_ui) // Systems for account loggedin screen //.add_enter_system(MenuState::AccountLoggedIn, account_loggedin_setup) //.add_exit_system(MenuState::AccountLoggedIn, remove_ui) //.add_event::() //.add_system_set( // ConditionSet::new() // .run_in_state(MenuState::AccountLoggedIn) // .with_system(handle_logout_event.run_on_event::()) // .into() //); //app.add_plugin(accountregister::AccountRegisterPlugin) // .add_plugin(accountlogin::AccountLoginPlugin); //app.add_plugin(play::PlayMenuPlugin); } } /// Menu State #[derive(Clone, Eq, PartialEq, Debug, Hash)] pub enum MenuState { None, Main, Play, Settings, AccountLoggedIn, AccountLoggedOut, AccountLogin, AccountRegister, } fn menu_setup(mut commands: Commands) { commands.insert_resource(NextState(MenuState::Main)) }