2013-12-12 09:33:59 +01:00
|
|
|
#include "ClientObject.h"
|
|
|
|
|
|
|
|
using namespace DanBias;
|
|
|
|
|
2013-12-17 10:25:34 +01:00
|
|
|
ClientObject::ClientObject(Oyster::Network::NetworkClient* client)
|
2013-12-12 09:33:59 +01:00
|
|
|
{
|
2013-12-13 23:47:16 +01:00
|
|
|
this->client = client;
|
2013-12-17 10:25:34 +01:00
|
|
|
this->client->SetRecieverObject(this, Oyster::Network::NetworkProtocolCallbackType_Object);
|
2013-12-13 23:47:16 +01:00
|
|
|
this->box = 0;
|
2013-12-12 09:33:59 +01:00
|
|
|
}
|
|
|
|
ClientObject::~ClientObject()
|
|
|
|
{
|
2013-12-17 10:25:34 +01:00
|
|
|
this->client->Disconnect();
|
2013-12-12 09:33:59 +01:00
|
|
|
}
|
2013-12-19 12:32:23 +01:00
|
|
|
void ClientObject::SetProtocolCallback(Oyster::Network::ProtocolRecieverObject* object)
|
|
|
|
{
|
|
|
|
this->NetClient_Object()->SetRecieverObject(object, Oyster::Network::NetworkProtocolCallbackType_Object);
|
|
|
|
}
|
2013-12-18 08:44:10 +01:00
|
|
|
void ClientObject::SetPostbox(Oyster::IPostBox<NetworkSession::NetEvent>* box)
|
2013-12-13 23:47:16 +01:00
|
|
|
{
|
|
|
|
this->box = box;
|
|
|
|
}
|
2013-12-14 22:04:42 +01:00
|
|
|
GameLogic::Player* ClientObject::Logic_Object()
|
|
|
|
{
|
|
|
|
return &this->logicPlayer;
|
|
|
|
}
|
|
|
|
Oyster::Network::NetworkClient* ClientObject::NetClient_Object()
|
|
|
|
{
|
2013-12-17 10:25:34 +01:00
|
|
|
return this->client;
|
2013-12-14 22:04:42 +01:00
|
|
|
}
|
|
|
|
|
2013-12-13 23:47:16 +01:00
|
|
|
void ClientObject::ProtocolRecievedCallback(Oyster::Network::CustomNetProtocol& protocol)
|
|
|
|
{
|
2013-12-17 14:15:20 +01:00
|
|
|
//this->client->Send(&protocol);
|
2013-12-13 23:47:16 +01:00
|
|
|
if(!this->box) return;
|
|
|
|
|
2013-12-16 09:09:54 +01:00
|
|
|
NetworkSession::NetEvent _event;
|
2013-12-13 23:47:16 +01:00
|
|
|
_event.protocol = protocol;
|
|
|
|
_event.reciever = this;
|
|
|
|
|
|
|
|
this->box->Post(_event);
|
|
|
|
}
|
2013-12-12 09:33:59 +01:00
|
|
|
|