Documentation for the Unreal C++ Library
Loading...
Searching...
No Matches
PVROMultiplayerIdentity.h
Go to the documentation of this file.
1// Copyright(c) 2023 PixoVR, LLC. All Rights Reserved.
2
3#pragma once
4
5#include "CoreMinimal.h"
6#if ENGINE_MAJOR_VERSION >= 5
7#include "Online/CoreOnline.h"
8#else
9#include "UObject/CoreOnline.h"
10#endif
12#include "Interfaces/OnlineIdentityInterface.h"
13
14class FPVROSubsystem;
15
17{
18public:
19
20 // FOnlineUser
21
22 virtual TSharedRef<const FUniqueNetId> GetUserId() const override { return UserIdPtr.ToSharedRef(); }
23 virtual FString GetRealName() const override { return UserName; }
24 virtual FString GetDisplayName(const FString& Platform = FString()) const override { return UserName; }
25 virtual bool GetUserAttribute(const FString& AttrName, FString& OutAttrValue) const override;
26 virtual bool SetUserAttribute(const FString& AttrName, const FString& AttrValue) override;
27
28 // FUserOnlineAccount
29
30 virtual FString GetAccessToken() const override { return TEXT("DummyAuthTicket"); }
31 virtual bool GetAuthAttribute(const FString& AttrName, FString& OutAttrValue) const override;
32
33 // FPVROUserAccount
34
35 FPVROUserAccount(const FString& InUserId = TEXT(""))
36#if ENGINE_MAJOR_VERSION >= 5
37 : UserIdPtr(FUniqueNetIdPixoVR::Create(InUserId)),
38#else
39 : UserIdPtr(new FUniqueNetIdPixoVR(InUserId)),
40#endif
41 UserName(TEXT("PVRODisplayName"))
42 { }
43
45 {
46 }
47
50
52 TMap<FString, FString> AdditionalAuthData;
53
55 TMap<FString, FString> UserAttributes;
56
57 FString UserName;
58};
59
61{
62public:
63
64 // IOnlineIdentity
65
66 virtual bool Login(int32 LocalUserNum, const FOnlineAccountCredentials& AccountCredentials) override;
67 virtual bool Logout(int32 LocalUserNum) override;
68 virtual bool AutoLogin(int32 LocalUserNum) override;
69 virtual TSharedPtr<FUserOnlineAccount> GetUserAccount(const FUniqueNetId& UserId) const override;
70 virtual TArray<TSharedPtr<FUserOnlineAccount> > GetAllUserAccounts() const override;
71 virtual FUniqueNetIdPtr GetUniquePlayerId(int32 LocalUserNum) const override;
72 virtual FUniqueNetIdPtr CreateUniquePlayerId(uint8* Bytes, int32 Size) override;
73 virtual FUniqueNetIdPtr CreateUniquePlayerId(const FString& Str) override;
74 virtual ELoginStatus::Type GetLoginStatus(int32 LocalUserNum) const override;
75 virtual ELoginStatus::Type GetLoginStatus(const FUniqueNetId& UserId) const override;
76 virtual FString GetPlayerNickname(int32 LocalUserNum) const override;
77 virtual FString GetPlayerNickname(const FUniqueNetId& UserId) const override;
78 virtual FString GetAuthToken(int32 LocalUserNum) const override;
79 virtual void RevokeAuthToken(const FUniqueNetId& UserId, const FOnRevokeAuthTokenCompleteDelegate& Delegate) override;
80 virtual void GetUserPrivilege(const FUniqueNetId& UserId, EUserPrivileges::Type Privilege, const FOnGetUserPrivilegeCompleteDelegate& Delegate) override;
81 virtual FPlatformUserId GetPlatformUserIdFromUniqueNetId(const FUniqueNetId& UniqueNetId) const override;
82 virtual FString GetAuthType() const override;
83
84 virtual void SetPlayerNickname(int32 LocalUserNum, const FString PlayerNickname);
85 virtual void SetPlayerNickname(const FUniqueNetId& UserId, const FString PlayerNickname);
86
87 // FPVROIdentity
88
94 FPVROIdentity(FPVROSubsystem* InSubsystem);
95
99 virtual ~FPVROIdentity();
100
101private:
102
106 FPVROIdentity() = delete;
107
110
112 TMap<int32, FUniqueNetIdPtr> UserIds;
113
115 TMap<FUniqueNetIdPixoVR, TSharedRef<FPVROUserAccount>> UserAccounts;
116};
117
118typedef TSharedPtr<FPVROIdentity, ESPMode::ThreadSafe> FPVROIdentityPtr;
TSharedPtr< FPVROIdentity, ESPMode::ThreadSafe > FPVROIdentityPtr
TSharedPtr< const FUniqueNetId > FUniqueNetIdPtr
FPVROIdentity()=delete
virtual void SetPlayerNickname(int32 LocalUserNum, const FString PlayerNickname)
virtual ELoginStatus::Type GetLoginStatus(int32 LocalUserNum) const override
virtual FString GetPlayerNickname(int32 LocalUserNum) const override
virtual FUniqueNetIdPtr CreateUniquePlayerId(uint8 *Bytes, int32 Size) override
TMap< int32, FUniqueNetIdPtr > UserIds
virtual FString GetAuthToken(int32 LocalUserNum) const override
virtual bool Logout(int32 LocalUserNum) override
virtual bool AutoLogin(int32 LocalUserNum) override
virtual FPlatformUserId GetPlatformUserIdFromUniqueNetId(const FUniqueNetId &UniqueNetId) const override
virtual void GetUserPrivilege(const FUniqueNetId &UserId, EUserPrivileges::Type Privilege, const FOnGetUserPrivilegeCompleteDelegate &Delegate) override
TMap< FUniqueNetIdPixoVR, TSharedRef< FPVROUserAccount > > UserAccounts
FPVROSubsystem * Subsystem
virtual FUniqueNetIdPtr GetUniquePlayerId(int32 LocalUserNum) const override
virtual TArray< TSharedPtr< FUserOnlineAccount > > GetAllUserAccounts() const override
virtual FString GetAuthType() const override
virtual TSharedPtr< FUserOnlineAccount > GetUserAccount(const FUniqueNetId &UserId) const override
virtual bool Login(int32 LocalUserNum, const FOnlineAccountCredentials &AccountCredentials) override
virtual void RevokeAuthToken(const FUniqueNetId &UserId, const FOnRevokeAuthTokenCompleteDelegate &Delegate) override
TMap< FString, FString > UserAttributes
virtual bool GetAuthAttribute(const FString &AttrName, FString &OutAttrValue) const override
virtual FString GetAccessToken() const override
virtual TSharedRef< const FUniqueNetId > GetUserId() const override
virtual FString GetRealName() const override
virtual bool GetUserAttribute(const FString &AttrName, FString &OutAttrValue) const override
virtual FString GetDisplayName(const FString &Platform=FString()) const override
FPVROUserAccount(const FString &InUserId=TEXT(""))
TMap< FString, FString > AdditionalAuthData
virtual bool SetUserAttribute(const FString &AttrName, const FString &AttrValue) override