51 lines
1.1 KiB
C++
51 lines
1.1 KiB
C++
#include "ClientObject.h"
|
|
|
|
using namespace DanBias;
|
|
|
|
ClientObject::ClientObject(Oyster::Network::NetworkClient* client)
|
|
{
|
|
this->client = client;
|
|
this->client->SetRecieverObject(this, Oyster::Network::NetworkProtocolCallbackType_Object);
|
|
this->box = 0;
|
|
}
|
|
ClientObject::~ClientObject()
|
|
{
|
|
this->client->Disconnect();
|
|
}
|
|
void ClientObject::SetProtocolCallback(Oyster::Network::ProtocolRecieverObject* object)
|
|
{
|
|
this->NetClient_Object()->SetRecieverObject(object, Oyster::Network::NetworkProtocolCallbackType_Object);
|
|
}
|
|
void ClientObject::SetPostbox(Oyster::IPostBox<NetworkSession::NetEvent>* box)
|
|
{
|
|
this->box = box;
|
|
}
|
|
GameLogic::Player* ClientObject::Logic_Object()
|
|
{
|
|
return this->logicPlayer;
|
|
}
|
|
Oyster::Network::NetworkClient* ClientObject::NetClient_Object()
|
|
{
|
|
return this->client;
|
|
}
|
|
|
|
void ClientObject::CreatePlayer()
|
|
{
|
|
if(this->logicPlayer) return;
|
|
|
|
this->logicPlayer = new GameLogic::Player();
|
|
}
|
|
|
|
void ClientObject::ProtocolRecievedCallback(Oyster::Network::CustomNetProtocol& protocol)
|
|
{
|
|
//this->client->Send(&protocol);
|
|
if(!this->box) return;
|
|
|
|
NetworkSession::NetEvent _event;
|
|
_event.protocol = protocol;
|
|
_event.reciever = this;
|
|
|
|
this->box->Post(_event);
|
|
}
|
|
|