Danbias/Code/Game/GameServer/GameClient.h

56 lines
2.0 KiB
C
Raw Normal View History

2014-01-28 09:00:02 +01:00
/////////////////////////////////////////////////////////////////////
// Created by [Dennis Andersen] [2013]
/////////////////////////////////////////////////////////////////////
#ifndef DANBIASSERVER_CLIENT_OBJECT_H
#define DANBIASSERVER_CLIENT_OBJECT_H
#include <NetworkClient.h>
#include <PostBox\PostBox.h>
#include <GameAPI.h>
2014-01-29 10:18:01 +01:00
#include <Utilities.h>
2014-01-28 09:00:02 +01:00
namespace DanBias
{
2014-01-29 10:18:01 +01:00
/**
* Container to keep logic player and network client together as a unit.
*/
2014-01-28 09:00:02 +01:00
class GameClient
{
public:
2014-01-29 10:18:01 +01:00
GameClient(Utility::DynamicMemory::SmartPointer<Oyster::Network::NetworkClient> client, GameLogic::IPlayerData* player);
2014-01-28 09:00:02 +01:00
virtual~GameClient();
GameLogic::IPlayerData* GetPlayer();
GameLogic::IPlayerData* ReleasePlayer();
2014-01-29 10:18:01 +01:00
Utility::DynamicMemory::SmartPointer<Oyster::Network::NetworkClient> GetClient();
Utility::DynamicMemory::SmartPointer<Oyster::Network::NetworkClient> ReleaseClient();
2014-02-18 08:55:38 +01:00
inline bool operator==(const GameLogic::IPlayerData* c) { return (this->player) ? (c->GetID() == this->player->GetID()) : false ; }
inline bool operator==(const Oyster::Network::NetworkClient* c) { return (c->GetID() == this->GetID()); }
2014-02-18 08:55:38 +01:00
inline float GetSinceLastResponse() const { return this->secondsSinceLastResponse; }
inline std::wstring GetAlias() const { return this->alias; }
inline std::wstring GetCharacter() const { return this->character; }
inline bool IsReady() const { return this->isReady; }
inline GameLogic::IPlayerData* GetPlayer() const { return this->player; }
void SetPlayer(GameLogic::IPlayerData* player);
void SetReadyState(bool isReady);
2014-02-18 08:55:38 +01:00
void SetAlias(std::wstring alias);
void SetCharacter(std::wstring character);
void SetSinceLastResponse(float seconds);
2014-01-28 09:00:02 +01:00
private:
GameLogic::IPlayerData* player;
2014-01-29 10:18:01 +01:00
Utility::DynamicMemory::SmartPointer<Oyster::Network::NetworkClient> client;
2014-02-18 08:55:38 +01:00
bool isReady;
float secondsSinceLastResponse;
2014-01-28 09:00:02 +01:00
2014-02-18 08:55:38 +01:00
std::wstring alias;
std::wstring character;
};
2014-01-28 09:00:02 +01:00
}//End namespace DanBias
#endif // !DANBIASSERVER_CLIENT_OBJECT_H