Documentation for the Unreal C++ Library
Loading...
Searching...
No Matches
PVROSubsystem.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#include "OnlineSubsystemImpl.h"
7#include "HAL/ThreadSafeCounter.h"
8#include "PVROnlineSession.h"
10#include "PVROPackage.h"
11
12#ifndef PVR_MP_SUBSYSTEM
13#define PVR_MP_SUBSYSTEM FName(TEXT("PIXOVR"))
14#endif
15
16class FPVROIdentity;
18class FOnlineVoiceImpl;
19
20typedef TSharedPtr<class FPVROnlineSession, ESPMode::ThreadSafe> FPVROnlineSessionPtr;
21typedef TSharedPtr<class FOnlineVoiceImpl, ESPMode::ThreadSafe> FOnlineVoiceImplPtr;
22typedef TSharedPtr<class FPVROIdentity, ESPMode::ThreadSafe> FPVROIdentityPtr;
23
24class PIXOVRMULTIPLAYER_API FPVROSubsystem : public FOnlineSubsystemImpl
25{
26public:
27
28 virtual ~FPVROSubsystem() {}
29
30 // IOnlineSubsystem
31
32 virtual IOnlineSessionPtr GetSessionInterface() const override;
33 virtual IOnlineFriendsPtr GetFriendsInterface() const override;
34 virtual IOnlinePartyPtr GetPartyInterface() const override;
35 virtual IOnlineGroupsPtr GetGroupsInterface() const override;
36 virtual IOnlineSharedCloudPtr GetSharedCloudInterface() const override;
37 virtual IOnlineUserCloudPtr GetUserCloudInterface() const override;
38 virtual IOnlineEntitlementsPtr GetEntitlementsInterface() const override;
39 virtual IOnlineLeaderboardsPtr GetLeaderboardsInterface() const override;
40 virtual IOnlineVoicePtr GetVoiceInterface() const override;
41 virtual IOnlineExternalUIPtr GetExternalUIInterface() const override;
42 virtual IOnlineTimePtr GetTimeInterface() const override;
43 virtual IOnlineIdentityPtr GetIdentityInterface() const override;
44 virtual IOnlineTitleFilePtr GetTitleFileInterface() const override;
45#if ENGINE_MAJOR_VERSION == 4
46 virtual IOnlineStorePtr GetStoreInterface() const override { return nullptr; }
47#endif
48 virtual IOnlineStoreV2Ptr GetStoreV2Interface() const override { return nullptr; }
49 virtual IOnlinePurchasePtr GetPurchaseInterface() const override { return nullptr; }
50 virtual IOnlineEventsPtr GetEventsInterface() const override;
51 virtual IOnlineAchievementsPtr GetAchievementsInterface() const override;
52 virtual IOnlineSharingPtr GetSharingInterface() const override;
53 virtual IOnlineUserPtr GetUserInterface() const override;
54 virtual IOnlineMessagePtr GetMessageInterface() const override;
55 virtual IOnlinePresencePtr GetPresenceInterface() const override;
56 virtual IOnlineChatPtr GetChatInterface() const override;
57 virtual IOnlineTurnBasedPtr GetTurnBasedInterface() const override;
58 virtual IOnlineTournamentPtr GetTournamentInterface() const override;
59 virtual IOnlineStatsPtr GetStatsInterface() const override;
60
61 virtual bool Init() override;
62 virtual bool Shutdown() override;
63 virtual FString GetAppId() const override;
64 virtual bool Exec(class UWorld* InWorld, const TCHAR* Cmd, FOutputDevice& Ar) override;
65 virtual FText GetOnlineServiceName() const override;
66
67 // FTickerObjectBase
68
69 virtual bool Tick(float DeltaTime) override;
70
72
74 FPVROSubsystem() = delete;
75 explicit FPVROSubsystem(FName InInstanceName) :
77 MultiplayerURL(TEXT("127.0.0.1")),
78 UserName(TEXT("PixoVR_Player")),
79 UserOrgId(-1),
80 ModuleId(-1),
81 ModuleVersion("1.23.45"),
82 SessionInterface(nullptr),
83 IdentityInterface(nullptr),
84 VoiceInterface(nullptr),
85 bVoiceInterfaceInitialized(false),
86 TaskThreadManager(nullptr),
87 TaskThread(nullptr)
88 {}
89
90 // server information
92
93 // user information
94 FString UserName;
95
97
98 // module information
100
102
104
105private:
106
108
110
112
114
116
117 class FRunnableThread* TaskThread;
118
119 static FThreadSafeCounter TaskCounter;
120
121public:
122
123 void QueueAsyncTask(class FOnlineAsyncTask* AsyncTask);
124
125 void SetUserInfo(FString InUserName, int InUserOrgId);
126
127 void SetModuleInfo(int InModuleId, FString InModuleVersion);
128
129 bool ConnectWebsocket();
130
131 bool FindSessions(int InOrgId = -1, int InModuleId = -1, FString InUserName = "", FString InModuleVersion = "");
132
133private:
134
135 bool TryLoadConfig();
136
137 bool ParseConfig(FString ConfigContent, TMap<FString, FString>& ConfigValues);
138
139 bool SaveConfig();
140};
141
142typedef TSharedPtr<FPVROSubsystem, ESPMode::ThreadSafe> FPVROSubsystemPtr;
143
#define PVR_MP_SUBSYSTEM
#define PACKAGE_SCOPE
Definition PVROPackage.h:12
TSharedPtr< FPVROSubsystem, ESPMode::ThreadSafe > FPVROSubsystemPtr
TSharedPtr< class FOnlineVoiceImpl, ESPMode::ThreadSafe > FOnlineVoiceImplPtr
TSharedPtr< class FPVROnlineSession, ESPMode::ThreadSafe > FPVROnlineSessionPtr
TSharedPtr< class FPVROIdentity, ESPMode::ThreadSafe > FPVROIdentityPtr
class FRunnableThread * TaskThread
virtual IOnlineStoreV2Ptr GetStoreV2Interface() const override
FPVROnlineSessionPtr SessionInterface
FPVROSubsystem(FName InInstanceName)
virtual IOnlinePurchasePtr GetPurchaseInterface() const override
FString ModuleVersion
bool bVoiceInterfaceInitialized
FString MultiplayerURL
FPVROSubsystem()=delete
MultiplayerWebSocket WebSocket
virtual ~FPVROSubsystem()
FOnlineVoiceImplPtr VoiceInterface
class FPVROAsyncTaskManager * TaskThreadManager
static FThreadSafeCounter TaskCounter
FPVROIdentityPtr IdentityInterface