aboutsummaryrefslogtreecommitdiff
path: root/Minecraft.Client/Durango/Network/DQRNetworkPlayer.h
diff options
context:
space:
mode:
authordaoge_cmd <3523206925@qq.com>2026-03-01 12:16:08 +0800
committerdaoge_cmd <3523206925@qq.com>2026-03-01 12:16:08 +0800
commitb691c43c44ff180d10e7d4a9afc83b98551ff586 (patch)
tree3e9849222cbc6ba49f2f1fc6e5fe7179632c7390 /Minecraft.Client/Durango/Network/DQRNetworkPlayer.h
parentdef8cb415354ac390b7e89052a50605285f1aca9 (diff)
Initial commit
Diffstat (limited to 'Minecraft.Client/Durango/Network/DQRNetworkPlayer.h')
-rw-r--r--Minecraft.Client/Durango/Network/DQRNetworkPlayer.h65
1 files changed, 65 insertions, 0 deletions
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 <queue>
+
+// 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