Pico Unreal Platform SDK
PicoPresenceInterface.h
1// Copyright 2022 Pico Technology Co., Ltd.All rights reserved.
2// This plugin incorporates portions of the Unreal® Engine. Unreal® is a trademark or registered trademark of Epic Games, Inc.In the United States of America and elsewhere.
3// Unreal® Engine, Copyright 1998 – 2022, Epic Games, Inc.All rights reserved.
4
5#pragma once
6
7#include "CoreMinimal.h"
8#include "OnlineSubsystemPico.h"
9#include "OnlineSubsystemPicoPackage.h"
10#include "OnlineSubsystemPicoNames.h"
11#include "OnlineFriendsInterfacePico.h"
12
14
25DECLARE_LOG_CATEGORY_EXTERN(PresenceInterface, Log, All);
26
27// Request
28DECLARE_DELEGATE_TwoParams(FOnPresenceClearComplete, bool /*IsSuccessed*/, const FString& /*Error Message*/);
29DECLARE_DELEGATE_TwoParams(FOnReadInvitableUserComplete, bool /*IsSuccessed*/, const FString& /*Error Message*/);
30DECLARE_DELEGATE_TwoParams(FOnPresenceSetComplete, bool /*IsSuccessed*/, const FString& /*Error Message*/);
31DECLARE_DELEGATE_TwoParams(FOnPresenceSetDestinationComplete, bool /*IsSuccessed*/, const FString& /*Error Message*/);
32DECLARE_DELEGATE_TwoParams(FOnPresenceSetIsJoinableComplete, bool /*IsSuccessed*/, const FString& /*Error Message*/);
33DECLARE_DELEGATE_TwoParams(FOnPresenceSetLobbySessionComplete, bool /*IsSuccessed*/, const FString& /*Error Message*/);
34DECLARE_DELEGATE_TwoParams(FOnPresenceSetMatchSessionComplete, bool /*IsSuccessed*/, const FString& /*Error Message*/);
35DECLARE_DELEGATE_TwoParams(FOnPresenceSetPresenceExtraComplete, bool /*IsSuccessed*/, const FString& /*Error Message*/);
36DECLARE_DELEGATE_TwoParams(FOnReadSentInvitesComplete, bool /*IsSuccessed*/, const FString& /*Error Message*/);
37DECLARE_DELEGATE_TwoParams(FOnSentInvitesComplete, bool /*IsSuccessed*/, const FString& /*Error Message*/);
38DECLARE_DELEGATE_TwoParams(FOnGetDestinationsComplete, bool /*IsSuccessed*/, const FString& /*Error Message*/);
39
40DECLARE_MULTICAST_DELEGATE_FourParams(FJoinIntentReceived, const FString& /*DeeplinkMessage*/, const FString& /*DestinationApiName*/, const FString&/*LobbySessionId*/, const FString& /*MatchSessionId*/);
41DECLARE_MULTICAST_DELEGATE_ThreeParams(FLeaveIntentReceived, const FString& /*DestinationApiName*/, const FString&/*LobbySessionId*/, const FString& /*MatchSessionId*/);
42
44class ONLINESUBSYSTEMPICO_API FPicoPresenceInterface
45{
46
47private:
48
49 FOnlineSubsystemPico& PicoSubsystem;
50
51 TMap<FString, TSharedRef<FOnlinePicoFriend>> InvitableUsers;
52
53 TArray<FPicoApplicationInvite> InvitesArray;
54
55 TArray<FPicoDestination> DestinationArray;
56
57public:
60
69 bool PresenceClear(const FOnPresenceClearComplete& Delegate = FOnPresenceClearComplete());
70 void OnQueryPresenceClearComplete(ppfMessageHandle Message, bool bIsError, const FOnPresenceClearComplete& Delegate);
71
83 bool ReadInvitableUser(TArray<FString> SuggestedUserList, const FOnReadInvitableUserComplete& Delegate = FOnReadInvitableUserComplete());
84 void OnQueryReadInvitableUserComplete(ppfMessageHandle Message, bool bIsError, TMap<FString, TSharedRef<FOnlinePicoFriend>>& OutList, bool bAppendToExistingMap, const FOnReadInvitableUserComplete& Delegate);
85
94 bool GetInvitableFriendList(TArray<TSharedRef<FOnlinePicoFriend>>& OutFriends);
95
114 bool PresenceSet(const FString& ApiName, const FString& LobbySessionId, const FString& MatchSessionId, bool bIsJoinable, const FString& Extra, const FOnPresenceSetComplete& Delegate = FOnPresenceSetComplete());
115 void OnQueryPresenceSetComplete(ppfMessageHandle Message, bool bIsError, const FOnPresenceSetComplete& Delegate);
116
128 bool PresenceSetDestination(const FString& ApiName, const FOnPresenceSetDestinationComplete& Delegate = FOnPresenceSetDestinationComplete());
129 void OnQueryPresenceSetDestinationComplete(ppfMessageHandle Message, bool bIsError, const FOnPresenceSetDestinationComplete& Delegate);
130
146 bool PresenceSetSetIsJoinable(bool bIsJoinable, const FOnPresenceSetIsJoinableComplete& Delegate = FOnPresenceSetIsJoinableComplete());
147 void OnQueryPresenceSetSetIsJoinableComplete(ppfMessageHandle Message, bool bIsError, const FOnPresenceSetIsJoinableComplete& Delegate);
148
160 bool PresenceSetLobbySession(const FString& LobbySession, const FOnPresenceSetLobbySessionComplete& Delegate = FOnPresenceSetLobbySessionComplete());
161 void OnQueryPresenceSetLobbySessionComplete(ppfMessageHandle Message, bool bIsError, const FOnPresenceSetLobbySessionComplete& Delegate);
162
174 bool PresenceSetMatchSession(const FString& MatchSession, const FOnPresenceSetMatchSessionComplete& Delegate = FOnPresenceSetMatchSessionComplete());
175 void OnQueryPresenceSetMatchSessionComplete(ppfMessageHandle Message, bool bIsError, const FOnPresenceSetMatchSessionComplete& Delegate);
176
188 bool PresenceSetExtra(const FString& Extra, const FOnPresenceSetPresenceExtraComplete& Delegate = FOnPresenceSetPresenceExtraComplete());
189 void OnQueryPresenceSetExtraComplete(ppfMessageHandle Message, bool bIsError, const FOnPresenceSetPresenceExtraComplete& Delegate);
190
200 bool PresenceReadSendInvites(const FOnReadSentInvitesComplete& Delegate = FOnReadSentInvitesComplete());
201 void OnQueryPresenceReadSendInvitesComplete(ppfMessageHandle Message, bool bIsError, TArray<FPicoApplicationInvite>& OutList, bool bAppendToExistingArray, const FOnReadSentInvitesComplete& Delegate);
202
214 bool PresenceSendInvites(TArray<FString> UserIdArray, const FOnSentInvitesComplete& Delegate = FOnSentInvitesComplete());
215 void OnQuerySendInvitesComplete(ppfMessageHandle Message, bool bIsError, TArray<FPicoApplicationInvite>& OutList, bool bAppendToExistingArray, const FOnSentInvitesComplete& Delegate);
216
225 bool GetSendInvitesList(TArray<FPicoApplicationInvite>& OutList);
226
237 bool PresenceGetDestinations(const FOnGetDestinationsComplete& Delegate = FOnGetDestinationsComplete());
238 void OnQueryGetDestinationsComplete(ppfMessageHandle Message, bool bIsError, TArray<FPicoDestination>& OutList, bool bAppendToExistingArray, const FOnGetDestinationsComplete& Delegate);
239
248 bool PresenceGetDestnationsList(TArray<FPicoDestination>& OutList);
249
250PACKAGE_SCOPE:
251
252 FDelegateHandle OnJoinIntentReceivedHandle;
253 void OnJoinIntentReceiveResult(ppfMessageHandle Message, bool bIsError);
254
255 FDelegateHandle OnLeaveIntentReceivedHandle;
256 void OnLeaveIntentReceiveResult(ppfMessageHandle Message, bool bIsError);
257public:
258
260 FJoinIntentReceived JoinIntentReceivedCallback;
261
263 FLeaveIntentReceived LeaveIntentReceivedCallback;
264}; // end of Presence // end of Function
OnlineSubsystemPico class inherited from FOnlineSubsystemImpl(Unreal Engine)
Definition: OnlineSubsystemPico.h:44
Pico Presence interface class.
Definition: PicoPresenceInterface.h:45
FJoinIntentReceived JoinIntentReceivedCallback
Gets notified when the join intent has been received.
Definition: PicoPresenceInterface.h:260
FLeaveIntentReceived LeaveIntentReceivedCallback
Gets notified when the leave intent has been received.
Definition: PicoPresenceInterface.h:263