client PlayerManager

This commit is contained in:
2025-08-21 20:51:13 +02:00
parent fd08833f3f
commit 4fe2e25029
11 changed files with 100 additions and 7 deletions

View File

@@ -0,0 +1,31 @@
#pragma once
#include <td/protocol/packet/Packets.h>
#include <td/misc/Signal.h>
namespace td {
namespace client {
class IClientSocket;
class PlayerManager : public protocol::PacketHandler {
private:
std::map<PlayerID, PlayerInfo> m_Players;
std::shared_ptr<IClientSocket> m_Socket;
public:
utils::Signal<const PlayerInfo&> OnPlayerJoin;
utils::Signal<PlayerID> OnPlayerLeave;
PlayerManager(const std::shared_ptr<IClientSocket>& a_Socket);
~PlayerManager();
PlayerInfo GetPlayer(PlayerID a_Player);
virtual void Handle(const protocol::packets::PlayerJoinPacket&) override;
virtual void Handle(const protocol::packets::PlayerListPacket&) override;
virtual void Handle(const protocol::packets::PlayerLeavePacket&) override;
};
} // namespace client
} // namespace td