The Endscreen now works over the network.
This commit is contained in:
@@ -36,6 +36,7 @@
|
|||||||
#include "Network/ESearchForServers.h"
|
#include "Network/ESearchForServers.h"
|
||||||
#include "Network/EInterpolate.h"
|
#include "Network/EInterpolate.h"
|
||||||
#include "Network/SnapshotFilter.h"
|
#include "Network/SnapshotFilter.h"
|
||||||
|
#include "Core/EWin.h"
|
||||||
|
|
||||||
class Client : public Network
|
class Client : public Network
|
||||||
{
|
{
|
||||||
@@ -107,6 +108,7 @@ private:
|
|||||||
void parseAmmoPickup(Packet& packet);
|
void parseAmmoPickup(Packet& packet);
|
||||||
void parseRemoveWorld(Packet& packet);
|
void parseRemoveWorld(Packet& packet);
|
||||||
void parseKDEvent(Packet& packet);
|
void parseKDEvent(Packet& packet);
|
||||||
|
void parseWin(Packet& packet);
|
||||||
void InterpolateFields(Packet& packet, const ComponentInfo & componentInfo, const EntityID & entityID, const std::string & componentType);
|
void InterpolateFields(Packet& packet, const ComponentInfo & componentInfo, const EntityID & entityID, const std::string & componentType);
|
||||||
void parseSnapshot(Packet& packet);
|
void parseSnapshot(Packet& packet);
|
||||||
void identifyPacketLoss();
|
void identifyPacketLoss();
|
||||||
|
|||||||
@@ -25,6 +25,7 @@ enum class MessageType
|
|||||||
AmmoPickup,
|
AmmoPickup,
|
||||||
RemoveWorld,
|
RemoveWorld,
|
||||||
KD,
|
KD,
|
||||||
|
Win,
|
||||||
Invalid
|
Invalid
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -176,6 +176,9 @@ void Client::parseMessageType(Packet& packet)
|
|||||||
case MessageType::KD:
|
case MessageType::KD:
|
||||||
parseKDEvent(packet);
|
parseKDEvent(packet);
|
||||||
break;
|
break;
|
||||||
|
case MessageType::Win:
|
||||||
|
parseWin(packet);
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -376,6 +379,13 @@ void Client::parseKDEvent(Packet & packet)
|
|||||||
m_EventBroker->Publish(e);
|
m_EventBroker->Publish(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Client::parseWin(Packet& packet)
|
||||||
|
{
|
||||||
|
Events::Win e;
|
||||||
|
e.TeamThatWon = packet.ReadPrimitive<int>();
|
||||||
|
m_EventBroker->Publish(e);
|
||||||
|
}
|
||||||
|
|
||||||
void Client::updateFields(Packet& packet, const ComponentInfo& componentInfo, const EntityID& entityID)
|
void Client::updateFields(Packet& packet, const ComponentInfo& componentInfo, const EntityID& entityID)
|
||||||
{
|
{
|
||||||
for (auto field : componentInfo.FieldsInOrder) {
|
for (auto field : componentInfo.FieldsInOrder) {
|
||||||
|
|||||||
@@ -609,6 +609,9 @@ bool Server::OnWin(const Events::Win & e)
|
|||||||
{
|
{
|
||||||
// Postpone the gameover reset
|
// Postpone the gameover reset
|
||||||
m_GameIsOver = true;
|
m_GameIsOver = true;
|
||||||
|
Packet winPacket = Packet(MessageType::Win);
|
||||||
|
winPacket.WritePrimitive(e.TeamThatWon);
|
||||||
|
reliableBroadcast(winPacket);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user