2022-06-16 21:33:18 +00:00
# pragma once
# include "game/Input/InputSeparator.h"
# include "game/Layouts/CommonVerticalList.h"
# include "game/Layouts/SimpleLayoutMenu.h"
# include "al/message/MessageSystem.h"
# include "al/nerve/HostStateBase.h"
# include "al/message/IUseMessageSystem.h"
# include "al/layout/LayoutInitInfo.h"
# include "al/scene/Scene.h"
# include "al/util/NerveUtil.h"
# include "rs/util/InputUtil.h"
# include "al/util.hpp"
# include "game/GameData/GameDataHolder.h"
# include "logger.hpp"
# include "server/gamemode/GameModeConfigMenu.hpp"
2022-08-07 21:42:56 +00:00
# include "server/gamemode/GameModeConfigMenuFactory.hpp"
2022-06-16 21:33:18 +00:00
class FooterParts ;
class StageSceneStateServerConfig : public al : : HostStateBase < al : : Scene > , public al : : IUseMessageSystem {
public :
StageSceneStateServerConfig ( const char * , al : : Scene * , const al : : LayoutInitInfo & ,
FooterParts * , GameDataHolder * , bool ) ;
enum ServerConfigOption {
GAMEMODECONFIG ,
GAMEMODESWITCH ,
RECONNECT ,
2022-06-19 00:48:37 +00:00
SETIP ,
SETPORT
2022-06-16 21:33:18 +00:00
} ;
virtual al : : MessageSystem * getMessageSystem ( void ) const override ;
virtual void init ( void ) override ;
virtual void appear ( void ) override ;
virtual void kill ( void ) override ;
void exeMainMenu ( ) ;
2022-06-19 00:48:37 +00:00
void exeOpenKeyboardIP ( ) ;
void exeOpenKeyboardPort ( ) ;
2022-06-16 21:33:18 +00:00
void exeRestartServer ( ) ;
void exeGamemodeConfig ( ) ;
void exeGamemodeSelect ( ) ;
2022-07-05 19:45:22 +00:00
void exeSaveData ( ) ;
2022-07-10 01:24:00 +00:00
void exeConnectError ( ) ;
2022-06-16 21:33:18 +00:00
void endSubMenu ( ) ;
private :
inline void subMenuStart ( ) ;
inline void subMenuUpdate ( ) ;
al : : MessageSystem * mMsgSystem = nullptr ;
FooterParts * mFooterParts = nullptr ;
GameDataHolder * mGameDataHolder = nullptr ;
InputSeparator * mInput = nullptr ;
SimpleLayoutMenu * mCurrentMenu = nullptr ;
CommonVerticalList * mCurrentList = nullptr ;
// Root Page, contains buttons for gamemode config, server reconnecting, and server ip address changing
SimpleLayoutMenu * mMainOptions = nullptr ;
CommonVerticalList * mMainOptionsList = nullptr ;
// Sub-Page of Mode config, used to select a gamemode for the client to use
SimpleLayoutMenu * mModeSelect = nullptr ;
CommonVerticalList * mModeSelectList = nullptr ;
2022-08-07 21:42:56 +00:00
// Sub-Pages for Mode configuration, has buttons for selecting current gamemode and configuring currently selected mode (if no mode is chosen, button will not do anything)
struct GameModeEntry {
GameModeConfigMenu * mMenu ;
SimpleLayoutMenu * mLayout = nullptr ;
CommonVerticalList * mList = nullptr ;
} ;
sead : : SafeArray < GameModeEntry , GameModeConfigMenuFactory : : getMenuCount ( ) > mGamemodeConfigMenus ;
GameModeEntry * mGamemodeConfigMenu = nullptr ;
2022-06-16 21:33:18 +00:00
bool mIsDecideConfig = false ;
} ;
namespace {
NERVE_HEADER ( StageSceneStateServerConfig , MainMenu )
2022-06-19 00:48:37 +00:00
NERVE_HEADER ( StageSceneStateServerConfig , OpenKeyboardIP )
NERVE_HEADER ( StageSceneStateServerConfig , OpenKeyboardPort )
2022-06-16 21:33:18 +00:00
NERVE_HEADER ( StageSceneStateServerConfig , RestartServer )
NERVE_HEADER ( StageSceneStateServerConfig , GamemodeConfig )
NERVE_HEADER ( StageSceneStateServerConfig , GamemodeSelect )
2022-07-05 19:45:22 +00:00
NERVE_HEADER ( StageSceneStateServerConfig , SaveData )
2022-07-10 01:24:00 +00:00
NERVE_HEADER ( StageSceneStateServerConfig , ConnectError )
2022-06-16 21:33:18 +00:00
}