Overhaul of LobbyState

This commit is contained in:
Dander7BD 2014-02-12 09:15:41 +01:00
parent 4d78e30fb8
commit 8dc22c854c
2 changed files with 54 additions and 46 deletions

View File

@ -18,17 +18,11 @@ struct LobbyState::myData
int modelCount; int modelCount;
// UI object // UI object
// game client* // game client*
}privData; } privData;
LobbyState::LobbyState(void) LobbyState::LobbyState(void) {}
{
}
LobbyState::~LobbyState(void) LobbyState::~LobbyState(void) {}
{
}
bool LobbyState::Init(Oyster::Network::NetworkClient* nwClient) bool LobbyState::Init(Oyster::Network::NetworkClient* nwClient)
{ {
@ -39,6 +33,7 @@ bool LobbyState::Init(Oyster::Network::NetworkClient* nwClient)
InitCamera(Oyster::Math::Float3(0,0,5.4f)); InitCamera(Oyster::Math::Float3(0,0,5.4f));
return true; return true;
} }
bool LobbyState::LoadModels(std::wstring file) bool LobbyState::LoadModels(std::wstring file)
{ {
Oyster::Graphics::Definitions::Pointlight plight; Oyster::Graphics::Definitions::Pointlight plight;
@ -137,13 +132,27 @@ bool LobbyState::Release()
privData = NULL; privData = NULL;
return true; return true;
} }
void LobbyState::Protocol(ProtocolStruct* protocol)
{
if((PlayerName*)protocol)
PlayerJoinProtocol((PlayerName*)protocol);
}
void LobbyState::PlayerJoinProtocol(PlayerName* name)
{
using namespace ::Oyster::Network;
void LobbyState::DataRecieved( NetEvent<NetworkClient*, ClientEventArgs> e )
{
CustomNetProtocol data = e.args.data.protocol;
short ID = data[0].value.netShort; // fetching the id data.
// Block irrelevant messages.
if( !ProtocolIsLobby(ID) )
return;
switch(ID)
{
case protocol_Lobby_Create: break; /** @todo TODO: implement */
case protocol_Lobby_Start: break; /** @todo TODO: implement */
case protocol_Lobby_Join: break; /** @todo TODO: implement */
case protocol_Lobby_Login: break; /** @todo TODO: implement */
case protocol_Lobby_Refresh: break; /** @todo TODO: implement */
case protocol_Lobby_ClientData: break; /** @todo TODO: implement */
case protocol_Lobby_GameData: break; /** @todo TODO: implement */
default: break;
}
} }

View File

@ -8,35 +8,34 @@
namespace DanBias namespace DanBias
{ {
namespace Client namespace Client
{ {
class LobbyState : public GameClientState
class LobbyState : public GameClientState {
{ private:
private: Oyster::Network::NetworkClient* nwClient;
Oyster::Network::NetworkClient* nwClient; struct myData;
struct myData; myData* privData;
myData* privData; public:
public: LobbyState(void);
LobbyState(void); ~LobbyState(void);
~LobbyState(void); bool Init(Oyster::Network::NetworkClient* nwClient);
bool Init(Oyster::Network::NetworkClient* nwClient); bool LoadModels(std::wstring file);
bool LoadModels(std::wstring file); bool InitCamera(Oyster::Math::Float3 startPos);
bool InitCamera(Oyster::Math::Float3 startPos); ClientState Update(float deltaTime, InputClass* KeyInput);
ClientState Update(float deltaTime, InputClass* KeyInput); // create session lobby
// create session lobby // join session lobby
// join session lobby // set name
// set name // set rules
// set rules // set map
// set map // ready
// ready // chat
// chat // kick
// kick
bool Render(); bool Render();
bool Release(); bool Release();
void Protocol(ProtocolStruct* protocol)override;
void PlayerJoinProtocol(PlayerName* name);
void GameStarted();
};};}; void DataRecieved( ::Oyster::Network::NetEvent<NetworkClient*, ClientEventArgs> e );
};
}
}
#endif // ! DANBIAS_CLIENT_GAMECLIENTSTATE_H #endif // ! DANBIAS_CLIENT_GAMECLIENTSTATE_H