Temp
This commit is contained in:
parent
2bc7c9f65f
commit
830b448690
|
@ -546,14 +546,14 @@ namespace GameLogic
|
|||
//#define protocol_Gameplay_ObjectCreatePlayer 359
|
||||
struct Protocol_ObjectCreatePlayer :public Oyster::Network::CustomProtocolObject
|
||||
{
|
||||
//ObjectType type; //ie player, box or whatever
|
||||
int object_ID;
|
||||
int teamId;
|
||||
std::string name;
|
||||
std::string meshName;
|
||||
float position[3];
|
||||
float rotationQ[4];
|
||||
float scale[3];
|
||||
/*1*/ int object_ID;
|
||||
/*2*/ int teamId;
|
||||
/*3*/ bool owner;
|
||||
/*4*/ std::string name;
|
||||
/*5*/ std::string meshName;
|
||||
/*6 - 8*/ float position[3];
|
||||
/*9 - 11*/ float rotationQ[4];
|
||||
/*12 - 14*/ float scale[3];
|
||||
|
||||
Protocol_ObjectCreatePlayer()
|
||||
{
|
||||
|
@ -564,44 +564,47 @@ namespace GameLogic
|
|||
this->protocol[1].type = Oyster::Network::NetAttributeType_Int;
|
||||
//TEAM_ID
|
||||
this->protocol[2].type = Oyster::Network::NetAttributeType_Int;
|
||||
//OWNER
|
||||
this->protocol[3].type = Oyster::Network::NetAttributeType_Bool;
|
||||
//PLAYER-NAME
|
||||
this->protocol[3].type = Oyster::Network::NetAttributeType_CharArray;
|
||||
//MESH-NAME
|
||||
this->protocol[4].type = Oyster::Network::NetAttributeType_CharArray;
|
||||
//MESH-NAME
|
||||
this->protocol[5].type = Oyster::Network::NetAttributeType_CharArray;
|
||||
//POSITION
|
||||
this->protocol[5].type = Oyster::Network::NetAttributeType_Float;
|
||||
this->protocol[6].type = Oyster::Network::NetAttributeType_Float;
|
||||
this->protocol[7].type = Oyster::Network::NetAttributeType_Float;
|
||||
//ROTATION
|
||||
this->protocol[8].type = Oyster::Network::NetAttributeType_Float;
|
||||
//ROTATION
|
||||
this->protocol[9].type = Oyster::Network::NetAttributeType_Float;
|
||||
this->protocol[10].type = Oyster::Network::NetAttributeType_Float;
|
||||
//SCALE
|
||||
this->protocol[11].type = Oyster::Network::NetAttributeType_Float;
|
||||
//SCALE
|
||||
this->protocol[12].type = Oyster::Network::NetAttributeType_Float;
|
||||
this->protocol[13].type = Oyster::Network::NetAttributeType_Float;
|
||||
this->protocol[14].type = Oyster::Network::NetAttributeType_Float;
|
||||
}
|
||||
Protocol_ObjectCreatePlayer(Oyster::Network::CustomNetProtocol& p)
|
||||
{
|
||||
this->object_ID = p[1].value.netInt;
|
||||
this->teamId = this->protocol[2].value.netInt;
|
||||
this->name.assign(p[3].value.netCharPtr);
|
||||
this->meshName.assign(p[4].value.netCharPtr);
|
||||
this->owner = this->protocol[3].value.netBool;
|
||||
this->name.assign(p[4].value.netCharPtr);
|
||||
this->meshName.assign(p[5].value.netCharPtr);
|
||||
|
||||
this->position[0] = p[5].value.netFloat;
|
||||
this->position[1] = p[6].value.netFloat;
|
||||
this->position[2] = p[7].value.netFloat;
|
||||
this->position[0] = p[6].value.netFloat;
|
||||
this->position[1] = p[7].value.netFloat;
|
||||
this->position[2] = p[8].value.netFloat;
|
||||
|
||||
this->rotationQ[0] = p[8].value.netFloat;
|
||||
this->rotationQ[1] = p[9].value.netFloat;
|
||||
this->rotationQ[2] = p[10].value.netFloat;
|
||||
this->rotationQ[3] = p[11].value.netFloat;
|
||||
this->rotationQ[0] = p[9].value.netFloat;
|
||||
this->rotationQ[1] = p[10].value.netFloat;
|
||||
this->rotationQ[2] = p[11].value.netFloat;
|
||||
this->rotationQ[3] = p[12].value.netFloat;
|
||||
|
||||
this->scale[0] = p[12].value.netFloat;
|
||||
this->scale[1] = p[13].value.netFloat;
|
||||
this->scale[2] = p[14].value.netFloat;
|
||||
this->scale[0] = p[13].value.netFloat;
|
||||
this->scale[1] = p[14].value.netFloat;
|
||||
this->scale[2] = p[15].value.netFloat;
|
||||
}
|
||||
Protocol_ObjectCreatePlayer(float position[3], float rotation[4], float scale[3], int ObjectID, int teamID, std::string name, std::string meshName)
|
||||
Protocol_ObjectCreatePlayer(float position[3], float rotation[4], float scale[3], int ObjectID, bool owner, int teamID, std::string name, std::string meshName)
|
||||
{
|
||||
this->protocol[0].value = protocol_Gameplay_ObjectCreatePlayer;
|
||||
this->protocol[0].type = Oyster::Network::NetAttributeType_Short;
|
||||
|
@ -610,26 +613,29 @@ namespace GameLogic
|
|||
this->protocol[1].type = Oyster::Network::NetAttributeType_Int;
|
||||
//TEAM_ID
|
||||
this->protocol[2].type = Oyster::Network::NetAttributeType_Int;
|
||||
//OWNER
|
||||
this->protocol[3].type = Oyster::Network::NetAttributeType_Bool;
|
||||
//PLAYER-NAME
|
||||
this->protocol[3].type = Oyster::Network::NetAttributeType_CharArray;
|
||||
//MESH-NAME
|
||||
this->protocol[4].type = Oyster::Network::NetAttributeType_CharArray;
|
||||
//MESH-NAME
|
||||
this->protocol[5].type = Oyster::Network::NetAttributeType_CharArray;
|
||||
//POSITION
|
||||
this->protocol[5].type = Oyster::Network::NetAttributeType_Float;
|
||||
this->protocol[6].type = Oyster::Network::NetAttributeType_Float;
|
||||
this->protocol[7].type = Oyster::Network::NetAttributeType_Float;
|
||||
//ROTATION
|
||||
this->protocol[8].type = Oyster::Network::NetAttributeType_Float;
|
||||
//ROTATION
|
||||
this->protocol[9].type = Oyster::Network::NetAttributeType_Float;
|
||||
this->protocol[10].type = Oyster::Network::NetAttributeType_Float;
|
||||
this->protocol[11].type = Oyster::Network::NetAttributeType_Float;
|
||||
//SCALE
|
||||
this->protocol[12].type = Oyster::Network::NetAttributeType_Float;
|
||||
//SCALE
|
||||
this->protocol[13].type = Oyster::Network::NetAttributeType_Float;
|
||||
this->protocol[14].type = Oyster::Network::NetAttributeType_Float;
|
||||
this->protocol[15].type = Oyster::Network::NetAttributeType_Float;
|
||||
|
||||
this->object_ID = ObjectID;
|
||||
this->teamId = teamID;
|
||||
this->owner = owner;
|
||||
this->name = name;
|
||||
this->meshName = meshName;
|
||||
memcpy(&this->position[0], &position[0], sizeof(float)*3);
|
||||
|
@ -641,22 +647,23 @@ namespace GameLogic
|
|||
|
||||
this->protocol[1].value = this->object_ID;
|
||||
this->protocol[2].value = this->teamId;
|
||||
this->protocol.Set(3, this->name);
|
||||
this->protocol.Set(4, this->meshName);
|
||||
this->protocol[3].value = this->owner;
|
||||
this->protocol.Set(4, this->name);
|
||||
this->protocol.Set(5, this->meshName);
|
||||
|
||||
//POSITION
|
||||
this->protocol[5].value = this->position[0];
|
||||
this->protocol[6].value = this->position[1];
|
||||
this->protocol[7].value = this->position[2];
|
||||
this->protocol[6].value = this->position[0];
|
||||
this->protocol[7].value = this->position[1];
|
||||
this->protocol[8].value = this->position[2];
|
||||
//ROTATION
|
||||
this->protocol[8].value = this->rotationQ[0];
|
||||
this->protocol[9].value = this->rotationQ[1];
|
||||
this->protocol[10].value = this->rotationQ[2];
|
||||
this->protocol[11].value = this->rotationQ[3];
|
||||
this->protocol[9].value = this->rotationQ[0];
|
||||
this->protocol[10].value = this->rotationQ[1];
|
||||
this->protocol[11].value = this->rotationQ[2];
|
||||
this->protocol[12].value = this->rotationQ[3];
|
||||
//SCALE
|
||||
this->protocol[12].value = this->scale[0];
|
||||
this->protocol[13].value = this->scale[1];
|
||||
this->protocol[14].value = this->scale[2];
|
||||
this->protocol[13].value = this->scale[0];
|
||||
this->protocol[14].value = this->scale[1];
|
||||
this->protocol[15].value = this->scale[2];
|
||||
|
||||
return protocol;
|
||||
}
|
||||
|
|
|
@ -46,6 +46,7 @@ namespace DanBias
|
|||
void LobbyGameData(GameLogic::Protocol_LobbyGameData& p, Oyster::Network::NetworkClient* c); //id = protocol_Lobby_GameData:
|
||||
void LobbyMainData(GameLogic::Protocol_LobbyClientData& p, Oyster::Network::NetworkClient* c); //id = protocol_Lobby_MainData:
|
||||
void LobbyReady(GameLogic::Protocol_LobbyClientReadyState& p, Oyster::Network::NetworkClient* c); //id = protocol_Lobby_ClientReadyState:
|
||||
void LobbyQuerryGameData(GameLogic::Protocol_QuerryGameType& p, Oyster::Network::NetworkClient* c); //id = protocol_Lobby_QuerryGameType:
|
||||
|
||||
private:
|
||||
void ClientEventCallback(Oyster::Network::NetEvent<Oyster::Network::NetworkClient*, Oyster::Network::NetworkClient::ClientEventArgs> e) override;
|
||||
|
|
|
@ -11,8 +11,8 @@ using namespace Oyster::Network;
|
|||
using namespace Oyster;
|
||||
using namespace GameLogic;
|
||||
|
||||
namespace DanBias
|
||||
{
|
||||
using namespace DanBias;
|
||||
|
||||
GameLobby::GameLobby()
|
||||
{ }
|
||||
GameLobby::~GameLobby()
|
||||
|
@ -26,7 +26,13 @@ namespace DanBias
|
|||
}
|
||||
void GameLobby::Update()
|
||||
{
|
||||
this->ProcessClients();
|
||||
for (unsigned int i = 0; i < this->clients.Size(); i++)
|
||||
{
|
||||
if(this->clients[i])
|
||||
{
|
||||
this->clients[i]->Update();
|
||||
}
|
||||
}
|
||||
}
|
||||
void GameLobby::SetGameDesc(const LobbyLevelData& desc)
|
||||
{
|
||||
|
@ -105,7 +111,7 @@ namespace DanBias
|
|||
|
||||
if(this->gameSession)
|
||||
{
|
||||
this->gameSession.Attach(client);
|
||||
Attach(client);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -134,4 +140,3 @@ namespace DanBias
|
|||
}
|
||||
}
|
||||
|
||||
}//End namespace DanBias
|
|
@ -32,6 +32,8 @@ void GameLobby::ParseProtocol(Oyster::Network::CustomNetProtocol& p, NetworkClie
|
|||
break;
|
||||
case protocol_Lobby_ClientReadyState: this->LobbyReady (Protocol_LobbyClientReadyState (p), c);
|
||||
break;
|
||||
case protocol_Lobby_QuerryGameType: this->LobbyReady (Protocol_LobbyClientReadyState (p), c);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -112,4 +114,29 @@ void GameLobby::LobbyReady(GameLogic::Protocol_LobbyClientReadyState& p, Oyster:
|
|||
this->readyList.Remove(c);
|
||||
}
|
||||
}
|
||||
void GameLobby::LobbyQuerryGameData(GameLogic::Protocol_QuerryGameType& p, Oyster::Network::NetworkClient* c)
|
||||
{
|
||||
NetClient temp;
|
||||
bool found = false;
|
||||
|
||||
//find client in waiting list
|
||||
for (unsigned int i = 0; !found && i < this->clients.Size(); i++)
|
||||
{
|
||||
if(this->clients[i]->GetID() == c->GetID())
|
||||
{
|
||||
temp = this->clients[i];
|
||||
found = true;
|
||||
}
|
||||
}
|
||||
|
||||
//Something is wrong
|
||||
if(!found)
|
||||
{
|
||||
c->Disconnect();
|
||||
}
|
||||
else
|
||||
{
|
||||
//Send game data
|
||||
this->gameSession.Attach(temp);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -209,6 +209,7 @@ namespace DanBias
|
|||
{
|
||||
IPlayerData* p = this->clients[i]->GetPlayer();
|
||||
Protocol_ObjectCreate oc(p->GetPosition(), p->GetRotation(), p->GetScale(), p->GetID(), "char_white.dan");
|
||||
//Protocol_ObjectCreatePlayer oc(p->GetPosition(), p->GetRotation(), p->GetScale(), p->GetID(), "char_white.dan");
|
||||
this->clients[i]->GetClient()->Send(oc);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue