2014-01-28 09:00:02 +01:00
|
|
|
/////////////////////////////////////////////////////////////////////
|
|
|
|
// Created by [Dennis Andersen] [2013]
|
|
|
|
/////////////////////////////////////////////////////////////////////
|
|
|
|
#ifndef DANBIASSERVER_MAINLOBBY_H
|
|
|
|
#define DANBIASSERVER_MAINLOBBY_H
|
|
|
|
|
|
|
|
#include <NetworkSession.h>
|
|
|
|
#include <Protocols.h>
|
|
|
|
#include <PostBox\IPostBox.h>
|
|
|
|
#include <WinTimer.h>
|
2014-01-29 10:18:01 +01:00
|
|
|
#include "GameSession.h"
|
2014-01-28 09:00:02 +01:00
|
|
|
|
|
|
|
namespace DanBias
|
|
|
|
{
|
2014-01-30 11:11:04 +01:00
|
|
|
struct LobbyLevelData
|
|
|
|
{
|
|
|
|
int mapNumber;
|
|
|
|
int maxClients;
|
|
|
|
int gameMode;
|
|
|
|
int gameTime;
|
|
|
|
std::string gameName;
|
|
|
|
};
|
2014-01-28 09:00:02 +01:00
|
|
|
class GameLobby :public Oyster::Network::NetworkSession
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
GameLobby();
|
|
|
|
virtual~GameLobby();
|
|
|
|
void Release();
|
2014-01-29 10:18:01 +01:00
|
|
|
void Update();
|
2014-01-28 09:00:02 +01:00
|
|
|
|
2014-01-30 11:11:04 +01:00
|
|
|
void SetGameDesc(const LobbyLevelData& desc);
|
|
|
|
void GetGameDesc(LobbyLevelData& desc);
|
2014-01-30 00:19:00 +01:00
|
|
|
bool StartGameSession();
|
2014-01-28 09:00:02 +01:00
|
|
|
|
|
|
|
private:
|
2014-01-29 10:18:01 +01:00
|
|
|
void ParseProtocol(Oyster::Network::CustomNetProtocol& p, Oyster::Network::NetworkClient* c);
|
|
|
|
|
|
|
|
void GeneralStatus(GameLogic::Protocol_General_Status& p, Oyster::Network::NetworkClient* c); //id = protocol_General_Status:
|
|
|
|
void GeneralText(GameLogic::Protocol_General_Text& p, Oyster::Network::NetworkClient* c); //id = protocol_General_Text:
|
2014-01-30 00:19:00 +01:00
|
|
|
//void LobbyCreateGame(GameLogic::Protocol_LobbyCreateGame& p, Oyster::Network::NetworkClient* c); //id = protocol_Lobby_Create:
|
2014-01-29 10:18:01 +01:00
|
|
|
void LobbyStartGame(GameLogic::Protocol_LobbyStartGame& p, Oyster::Network::NetworkClient* c); //id = protocol_Lobby_Start:
|
2014-01-30 11:11:04 +01:00
|
|
|
//void LobbyJoin(GameLogic::Protocol_LobbyJoin& p, Oyster::Network::NetworkClient* c); //id = protocol_Lobby_Join:
|
2014-01-29 15:01:14 +01:00
|
|
|
void LobbyLogin(GameLogic::Protocol_LobbyLogin& p, Oyster::Network::NetworkClient* c); //id = protocol_Lobby_Login:
|
2014-01-29 10:18:01 +01:00
|
|
|
void LobbyRefresh(GameLogic::Protocol_LobbyRefresh& p, Oyster::Network::NetworkClient* c); //id = protocol_Lobby_Refresh:
|
2014-01-30 14:15:25 +01:00
|
|
|
void LobbyGameData(GameLogic::Protocol_LobbyGameData& p, Oyster::Network::NetworkClient* c); //id = protocol_Lobby_GameData:
|
2014-01-30 11:11:04 +01:00
|
|
|
void LobbyMainData(GameLogic::Protocol_LobbyClientData& p, Oyster::Network::NetworkClient* c); //id = protocol_Lobby_MainData:
|
2014-01-28 09:00:02 +01:00
|
|
|
|
|
|
|
private:
|
|
|
|
void ClientEventCallback(Oyster::Network::NetEvent<Oyster::Network::NetworkClient*, Oyster::Network::NetworkClient::ClientEventArgs> e) override;
|
2014-01-29 10:18:01 +01:00
|
|
|
void ClientConnectedEvent(Utility::DynamicMemory::SmartPointer<Oyster::Network::NetworkClient> client) override;
|
2014-01-28 09:00:02 +01:00
|
|
|
|
|
|
|
private:
|
|
|
|
Utility::WinTimer timer;
|
|
|
|
float refreshFrequency;
|
2014-01-31 22:52:52 +01:00
|
|
|
|
2014-01-30 00:19:00 +01:00
|
|
|
GameSession gameSession;
|
2014-01-30 11:11:04 +01:00
|
|
|
LobbyLevelData description;
|
2014-02-04 16:07:10 +01:00
|
|
|
Utility::DynamicMemory::SmartPointer<DanBias::GameClient> sessionOwner;
|
2014-01-28 09:00:02 +01:00
|
|
|
};
|
|
|
|
}//End namespace DanBias
|
|
|
|
#endif // !DANBIASGAME_GAMELOBBY_H
|