From b691c43c44ff180d10e7d4a9afc83b98551ff586 Mon Sep 17 00:00:00 2001 From: daoge_cmd <3523206925@qq.com> Date: Sun, 1 Mar 2026 12:16:08 +0800 Subject: Initial commit --- .../Durango/Network/DQRNetworkPlayer.h | 65 ++++++++++++++++++++++ 1 file changed, 65 insertions(+) create mode 100644 Minecraft.Client/Durango/Network/DQRNetworkPlayer.h (limited to 'Minecraft.Client/Durango/Network/DQRNetworkPlayer.h') diff --git a/Minecraft.Client/Durango/Network/DQRNetworkPlayer.h b/Minecraft.Client/Durango/Network/DQRNetworkPlayer.h new file mode 100644 index 00000000..fd140722 --- /dev/null +++ b/Minecraft.Client/Durango/Network/DQRNetworkPlayer.h @@ -0,0 +1,65 @@ +#pragma once +#include "DQRNetworkManager.h" +#include + +// This is the lowest level class for handling the concept of a player on Durango. This is managed by DQRNetworkManager. The game shouldn't directly communicate +// with this class, as it is wrapped by NetworkPlayerDurango which is an implementation of a platform-independent interface INetworkPlayer. + +class DQRNetworkPlayer +{ +public: + friend class DQRNetworkManager; + + typedef enum + { + DNP_TYPE_HOST, // This player represents the host + DNP_TYPE_LOCAL, // On host - this player is a local player that needs communicated with specially not using rudp. On clients - this is a local player, where network communications can be used to communicate with the host + DNP_TYPE_REMOTE, // On host - this player can be used to communicate from between the host and this player. On clients - this is a remote player that cannot be communicated with + } eDQRNetworkPlayerType; + + DQRNetworkPlayer(); + DQRNetworkPlayer(DQRNetworkManager *manager, eDQRNetworkPlayerType playerType, bool onHost, int localPlayerIdx, unsigned int sessionAddress); + ~DQRNetworkPlayer(); + + PlayerUID GetUID(); + void SetUID(PlayerUID UID); + int GetLocalPlayerIndex(); + uintptr_t GetCustomDataValue(); + void SetCustomDataValue(uintptr_t data); + bool IsRemote(); + bool IsHost(); + bool IsLocal(); + bool IsSameSystem(DQRNetworkPlayer *other); + bool HasVoice(); + bool IsTalking(); + bool HasCamera(); + LPCWSTR GetGamertag(); + int GetSmallId(); + void SetSmallId(unsigned char smallId); + int GetSessionIndex(); + void SendData( DQRNetworkPlayer *pPlayerTarget, const void *data, unsigned int dataSize ); + + int GetSendQueueSizeBytes(); + int GetSendQueueSizeMessages(); + + wchar_t *GetName(); + void SetName(const wchar_t *name); + + std::wstring GetDisplayName(); + void SetDisplayName(std::wstring displayName); +private: + void SendInternal(const void *data, unsigned int dataSize); + + eDQRNetworkPlayerType m_type; // The player type + bool m_host; // Whether this actual player class is stored on a host (not whether it represents the host, or a player on the host machine) + int m_localPlayerIdx; // Index of this player on the machine to which it belongs + DQRNetworkManager *m_manager; // Pointer back to the manager that is managing this player + + PlayerUID m_UID; + uintptr_t m_customData; + unsigned char m_smallId; + unsigned int m_sessionAddress; + + wchar_t m_name[21]; + std::wstring m_displayName; +}; \ No newline at end of file -- cgit v1.2.3