PICO Unreal Platform SDK
Pico_Challenges.h
1// Copyright® 2015-2023 PICO Technology Co., Ltd. All rights reserved.
2#pragma once
3
4#include "CoreMinimal.h"
5#include "UObject/NoExportTypes.h"
6#include "PPF_Platform.h"
7#include "OnlineSubsystemPicoNames.h"
8#include "OnlineSubsystemPico.h"
9#include "Pico_Leaderboards.h"
10#include "Pico_User.h"
11#include "Kismet/BlueprintFunctionLibrary.h"
12#include "Pico_Challenges.generated.h"
13
15
16// class UPico_Leaderboard;
17class UPico_Challenge;
21// enum FPico_ChallengeOptions;
22
23
24USTRUCT(BlueprintType, meta = (DisplayName = "ChallengeOptions"))
25struct FPico_ChallengeOptions
26{
27 GENERATED_USTRUCT_BODY()
28
29 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Pico Platform|Challenges|Challenge Options") FString Title;
30 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Pico Platform|Challenges|Challenge Options") int32 StartDate;
31 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Pico Platform|Challenges|Challenge Options") int32 EndDate;
32 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Pico Platform|Challenges|Challenge Options") FString LeaderboardName;
33 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Pico Platform|Challenges|Challenge Options") bool bIncludeActiveChallenges;
34 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Pico Platform|Challenges|Challenge Options") bool bIncludeFutureChallenges;
35 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Pico Platform|Challenges|Challenge Options") bool bIncludePastChallenges;
36 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Pico Platform|Challenges|Challenge Options") EChallengeVisibility Visibility;
37 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Pico Platform|Challenges|Challenge Options") EChallengeViewerFilter ViewerFilter;
38};
39
40
41
42DECLARE_LOG_CATEGORY_EXTERN(PicoChallenges, Log, All);
43
47DECLARE_DYNAMIC_DELEGATE_ThreeParams(FChallengeGet, bool, bIsError, const FString&, ErrorMessage, UPico_Challenge*,
48 Challenge);
49
50DECLARE_DYNAMIC_DELEGATE_ThreeParams(FChallengeGetEntries, bool, bIsError, const FString&, ErrorMessage,
51 UPico_ChallengeEntryArray*, ChallengeEntryList);
52
53DECLARE_DYNAMIC_DELEGATE_ThreeParams(FChallengeGetEntriesAfterRank, bool, bIsError, const FString&, ErrorMessage,
54 UPico_ChallengeEntryArray*, ChallengeEntryList);
55
56DECLARE_DYNAMIC_DELEGATE_ThreeParams(FChallengeGetEntriesByIds, bool, bIsError, const FString&, ErrorMessage,
57 UPico_ChallengeEntryArray*, ChallengeEntryList);
58
59DECLARE_DYNAMIC_DELEGATE_ThreeParams(FChallengeGetList, bool, bIsError, const FString&, ErrorMessage,
60 UPico_ChallengeArray*, ChallengeList);
61
62DECLARE_DYNAMIC_DELEGATE_ThreeParams(FChallengeInvite, bool, bIsError, const FString&, ErrorMessage,
63 UPico_Challenge*, Challenge);
64
65DECLARE_DYNAMIC_DELEGATE_ThreeParams(FChallengeLeave, bool, bIsError, const FString&, ErrorMessage, UPico_Challenge*,
66 Challenge);
67
68DECLARE_DYNAMIC_DELEGATE_ThreeParams(FChallengeJoin, bool, bIsError, const FString&, ErrorMessage, UPico_Challenge*,
69 Challenge);
70DECLARE_DYNAMIC_DELEGATE_ThreeParams(FChallengeLaunchInvitableUserFlow, bool, bIsError, int, ErrorCode, const FString&, ErrorMessage);
71
72DECLARE_MULTICAST_DELEGATE_FourParams(FChallengeInviteAcceptedOrLaunchAppNotify, bool, /*bIsError*/ int, /*ErrorCode*/ const FString&, /*ErrorMessage*/ const FString& /*ChallengeID*/);
84class ONLINESUBSYSTEMPICO_API FPicoChallengesInterface
85{
86private:
87 FOnlineSubsystemPico& PicoSubsystem;
88
89public:
90 FPicoChallengesInterface(FOnlineSubsystemPico& InSubsystem);
92
93 FChallengeGet GetDelegate;
94 FChallengeGetEntries GetEntriesDelegate;
95 FChallengeGetEntriesAfterRank GetEntriesAfterRankDelegate;
96 FChallengeGetEntriesByIds GetEntriesByIdsDelegate;
97 FChallengeGetList GetListDelegate;
98 FChallengeJoin JoinDelegate;
99 FChallengeLeave LeaveDelegate;
100 FChallengeInvite InviteDelegate;
101 FChallengeLaunchInvitableUserFlow LaunchInvitableUserFlowDelegate;
102
103 FChallengeInviteAcceptedOrLaunchAppNotify ChallengeInviteAcceptedOrLaunchAppNotify;
104
105 FDelegateHandle ChallengeInviteAcceptedOrLaunchAppHandle;
106 void OnChallengeInviteAcceptedOrLaunchAppNotification(ppfMessageHandle Message, bool bIsError);
107
118 bool Get(const FString& ChallengeID, FChallengeGet InGetDelegate);
119
149 bool GetEntries(const FString& ChallengeID, int PageIdx, int PageSize, ELeaderboardFilterType Filter,
150 ELeaderboardStartAt StartAt, FChallengeGetEntries InGetEntriesDelegate);
151
166 bool GetEntriesAfterRank(ppfID ChallengeID, int PageIdx, int PageSize, unsigned long long AfterRank,
167 FChallengeGetEntriesAfterRank InGetEntriesAfterRankDelegate);
168
194 bool GetEntriesByIds(const FString& ChallengeID, int PageIdx, int PageSize, ELeaderboardStartAt StartAt,
195 const TArray<FString>& UserIDs, FChallengeGetEntriesByIds InGetEntriesByIdsDelegate);
196
212 bool GetList(FPico_ChallengeOptions ChallengeOptions, int PageIdx, int PageSize, FChallengeGetList InGetListDelegate);
213
224 bool Join(const FString& ChallengeID, FChallengeJoin InJoinDelegate);
225
236 bool Leave(const FString& ChallengeID, FChallengeLeave InLeaveDelegate);
237
249 bool Invite(const FString& ChallengeID, const TArray<FString>& UserIDs, FChallengeInvite Delegate);
250
263 bool LaunchInvitableUserFlow(const FString& ChallengeID, FChallengeLaunchInvitableUserFlow Delegate);
264
265};
266
282UCLASS()
283class ONLINESUBSYSTEMPICO_API UOnlinePicoChallengesFunction : public UBlueprintFunctionLibrary
284{
285 GENERATED_BODY()
286
287
288public:
289
295 UFUNCTION(BlueprintCallable, meta = (WorldContext = "WorldContextObject"), Category = "OnlinePico|Challenges")
296 static void Get(UObject* WorldContextObject, const FString& ChallengeID, FChallengeGet InGetDelegate);
297
322 UFUNCTION(BlueprintCallable, meta = (WorldContext = "WorldContextObject"), Category = "OnlinePico|Challenges")
323 static void GetEntries(UObject* WorldContextObject, const FString& ChallengeID, int PageIdx, int PageSize,
325 FChallengeGetEntries InGetEntriesDelegate);
326
336 UFUNCTION(BlueprintCallable, meta = (WorldContext = "WorldContextObject"), Category = "OnlinePico|Challenges")
337 static void GetEntriesAfterRank(UObject* WorldContextObject, const FString& ChallengeID, int PageIdx, int PageSize,
338 const FString& AfterRank,
339 FChallengeGetEntriesAfterRank InGetEntriesAfterRankDelegate);
340
361 UFUNCTION(BlueprintCallable, meta = (WorldContext = "WorldContextObject"), Category = "OnlinePico|Challenges")
362 static void GetEntriesByIds(UObject* WorldContextObject, const FString& ChallengeID, int PageIdx, int PageSize,
363 ELeaderboardStartAt StartAt, const TArray<FString>& UserIDs,
364 FChallengeGetEntriesByIds InGetEntriesByIdsDelegate);
365
375 UFUNCTION(BlueprintCallable, meta = (WorldContext = "WorldContextObject"), Category = "OnlinePico|Challenges")
376 static void GetList(UObject* WorldContextObject, FPico_ChallengeOptions ChallengeOptions, int PageIdx, int PageSize,
377 FChallengeGetList InGetListDelegate);
378
384 UFUNCTION(BlueprintCallable, meta = (WorldContext = "WorldContextObject"), Category = "OnlinePico|Challenges")
385 static void Join(UObject* WorldContextObject, const FString& ChallengeID, FChallengeJoin InJoinDelegate);
386
392 UFUNCTION(BlueprintCallable, meta = (WorldContext = "WorldContextObject"), Category = "OnlinePico|Challenges")
393 static void Leave(UObject* WorldContextObject, const FString& ChallengeID, FChallengeLeave InLeaveDelegate);
394
401 UFUNCTION(BlueprintCallable, meta = (WorldContext = "WorldContextObject"), Category = "OnlinePico|Challenges")
402 static void Invite(UObject* WorldContextObject, const FString& ChallengeID, const TArray<FString>& UserIDs,
403 FChallengeInvite Delegate);
404
410 UFUNCTION(BlueprintCallable, meta = (WorldContext = "WorldContextObject"), Category = "OnlinePico|Challenges")
411 static void LaunchInvitableUserFlow(UObject* WorldContextObject, const FString& ChallengeID, FChallengeLaunchInvitableUserFlow Delegate);
412};
413 // end of BP_Challenges // end of BlueprintFunction
416
418UCLASS(BlueprintType)
419class ONLINESUBSYSTEMPICO_API UPico_Challenge : public UObject
420{
421 GENERATED_BODY()
422
423public:
424 void InitParams(ppfChallenge* ppfChallengeHandle);
425
426private:
427 ppfChallengeCreationType CreationType;
428 unsigned long long EndDate = 0;
429 unsigned long long StartDate = 0;
430 ppfID ID = 0;
431 FString Title = FString();
432 ppfChallengeVisibility Visibility;
433 UPROPERTY()
434 UPico_UserArray* InvitedUsersOptional;
435 UPROPERTY()
436 UPico_UserArray* ParticipantsOptional;
437 UPROPERTY()
438 UPico_Leaderboard* Leaderboard;
439
440public:
441
443 UFUNCTION(BlueprintPure, Category = "Pico Platform|Challenges|Challenge")
444 EChallengeCreationType GetCreationType();
445
447 UFUNCTION(BlueprintPure, Category = "Pico Platform|Challenges|Challenge")
448 FDateTime GetEndDateTime();
449
451 UFUNCTION(BlueprintPure, Category = "Pico Platform|Challenges|Challenge")
452 FDateTime GetStartDateTime();
453
455 UFUNCTION(BlueprintPure, Category = "Pico Platform|Challenges|Challenge")
456 FString GetEndDate();
457
459 UFUNCTION(BlueprintPure, Category = "Pico Platform|Challenges|Challenge")
460 FString GetStartDate();
461
463 UFUNCTION(BlueprintPure, Category = "Pico Platform|Challenges|Challenge")
464 FString GetID();
465
467 UFUNCTION(BlueprintPure, Category = "Pico Platform|Challenges|Challenge")
468 FString GetTitle();
469
471 UFUNCTION(BlueprintPure, Category = "Pico Platform|Challenges|Challenge")
472 EChallengeVisibility GetVisibility();
473
475 UFUNCTION(BlueprintPure, Category = "Pico Platform|Challenges|Challenge")
476 UPico_UserArray* GetInvitedUsersOptional();
477
479 UFUNCTION(BlueprintPure, Category = "Pico Platform|Challenges|Challenge")
480 UPico_Leaderboard* GetLeaderboard();
481
483 UFUNCTION(BlueprintPure, Category = "Pico Platform|Challenges|Challenge")
484 UPico_UserArray* GetParticipantsOptional();
485};
486
488UCLASS(BlueprintType)
489class ONLINESUBSYSTEMPICO_API UPico_ChallengeEntry : public UObject
490{
491 GENERATED_BODY()
492
493public:
494 void InitParams(ppfChallengeEntryHandle ppfChallengeEntryHandle);
495
496private:
497 FString DisplayScore = FString();
498 TArray<uint8> ExtraData;
499 ppfID ID = 0;
500 int Rank;
501 long Score;
502 unsigned long long Timestamp;
503 UPROPERTY()
504 UPico_User* User;
505
506public:
507
509 UFUNCTION(BlueprintPure, Category = "Pico Platform|Challenges|Challenge Entry")
510 FString GetDisplayScore();
511
513 UFUNCTION(BlueprintPure, Category = "Pico Platform|Challenges|Challenge Entry")
514 TArray<uint8> GetExtraData();
515
517 UFUNCTION(BlueprintPure, Category = "Pico Platform|Challenges|Challenge Entry")
518 FString GetExtraDataString();
519
521 UFUNCTION(BlueprintPure, Category = "Pico Platform|Challenges|Challenge Entry")
522 FString GetID();
523
525 UFUNCTION(BlueprintPure, Category = "Pico Platform|Challenges|Challenge Entry")
526 int32 GetRank();
527
529 UFUNCTION(BlueprintPure, Category = "Pico Platform|Challenges|Challenge Entry")
530 int64 GetScore();
531
533 UFUNCTION(BlueprintPure, Category = "Pico Platform|Challenges|Challenge Entry")
534 FDateTime GetTimestamp();
535
537 UFUNCTION(BlueprintPure, Category = "Pico Platform|Challenges|Challenge Entry")
538 UPico_User* GetUser();
539};
540
542UCLASS(BlueprintType)
543class ONLINESUBSYSTEMPICO_API UPico_ChallengeEntryArray : public UObject
544{
545 GENERATED_BODY()
546private:
547 UPROPERTY()
548 TArray<UPico_ChallengeEntry*> ChallengeEntryArray;
549 int32 Size = 0;
550 bool bHasNextPage;
551 bool bHasPreviousPage;
552 int32 TotalCount = 0;
553public:
554 void InitParams(ppfChallengeEntryArrayHandle InppfChallengeEntryArrayHandle);
555
557 UFUNCTION(BlueprintPure, Category = "Pico Platform|Challenges|Challenge Entry Array")
559
561 UFUNCTION(BlueprintPure, Category = "Pico Platform|Challenges|Challenge Entry Array")
562 int32 GetSize();
563
565 UFUNCTION(BlueprintPure, Category = "Pico Platform|Challenges|Challenge Entry Array")
567
568 UFUNCTION(BlueprintPure, Category = "Pico Platform|Challenges|Challenge Entry Array")
569 bool HasPreviousPage();
570
571 UFUNCTION(BlueprintPure, Category = "Pico Platform|Challenges|Challenge Entry Array")
572 int32 GetTotalCount();
573};
574
576UCLASS(BlueprintType)
577class ONLINESUBSYSTEMPICO_API UPico_ChallengeArray : public UObject
578{
579 GENERATED_BODY()
580private:
581 UPROPERTY()
582 TArray<UPico_Challenge*> ChallengeArray;
583 int32 Size = 0;
584 bool bHasNextPage;
585 bool bHasPreviousPage;
586 int32 TotalCount = 0;
587
588public:
589 void InitParams(ppfChallengeArrayHandle InppfChallengeArrayHandle);
590
592 UFUNCTION(BlueprintPure, Category = "Pico Platform|Challenges|Challenge Array")
594
596 UFUNCTION(BlueprintPure, Category = "Pico Platform|Challenges|Challenge Array")
597 int32 GetSize();
598
600 UFUNCTION(BlueprintPure, Category = "Pico Platform|Challenges|Challenge Array")
602
603 UFUNCTION(BlueprintPure, Category = "Pico Platform|Challenges|Challenge Array")
604 bool HasPreviousPage();
605
606 UFUNCTION(BlueprintPure, Category = "Pico Platform|Challenges|Challenge Array")
607 int32 GetTotalCount();
608};
609
PicoChallengesInterface class.
Definition: Pico_Challenges.h:85
bool Leave(const FString &ChallengeID, FChallengeLeave InLeaveDelegate)
Lets the current user leave a challenge.
bool Join(const FString &ChallengeID, FChallengeJoin InJoinDelegate)
Lets the current user join a challenge.
bool GetList(FPico_ChallengeOptions ChallengeOptions, int PageIdx, int PageSize, FChallengeGetList InGetListDelegate)
Gets a list of challenges.
bool GetEntriesAfterRank(ppfID ChallengeID, int PageIdx, int PageSize, unsigned long long AfterRank, FChallengeGetEntriesAfterRank InGetEntriesAfterRankDelegate)
Gets the challenge entries after a specified ranking.
bool LaunchInvitableUserFlow(const FString &ChallengeID, FChallengeLaunchInvitableUserFlow Delegate)
Launches the invitation flow to let the current user invite friends to a specified challenge....
bool GetEntriesByIds(const FString &ChallengeID, int PageIdx, int PageSize, ELeaderboardStartAt StartAt, const TArray< FString > &UserIDs, FChallengeGetEntriesByIds InGetEntriesByIdsDelegate)
Gets the challenge entries for specified user(s).
bool Invite(const FString &ChallengeID, const TArray< FString > &UserIDs, FChallengeInvite Delegate)
Invites user(s) to join a challenge.
bool GetEntries(const FString &ChallengeID, int PageIdx, int PageSize, ELeaderboardFilterType Filter, ELeaderboardStartAt StartAt, FChallengeGetEntries InGetEntriesDelegate)
Gets a list of challenge entries.
bool Get(const FString &ChallengeID, FChallengeGet InGetDelegate)
Gets a specified challenge by ID.
OnlinePicoChallenges Blueprint Function class.
Definition: Pico_Challenges.h:284
UPico_ChallengeArray class.
Definition: Pico_Challenges.h:578
int32 GetSize()
Get the size of Challenge Array .
bool HasNextPage()
Get whether the list has the next page.
UPico_Challenge * GetElement(int32 Index)
Get Challenge Array element form Index.
UPico_ChallengeEntryArray class.
Definition: Pico_Challenges.h:544
UPico_ChallengeEntry class.
Definition: Pico_Challenges.h:490
UPico_Challenge class.
Definition: Pico_Challenges.h:420
UPico_Leaderboard class.
Definition: Pico_Leaderboards.h:373
UPico_UserArray class.
Definition: Pico_User.h:608
UPico_User class.
Definition: Pico_User.h:515
ELeaderboardStartAt
The type of sorting to use when getting leaderboard or challenge entries.
Definition: OnlineSubsystemPicoNames.h:646
EChallengeViewerFilter
The challenge viewer filter.
Definition: OnlineSubsystemPicoNames.h:635
EChallengeCreationType
The creator of the challenge.
Definition: OnlineSubsystemPicoNames.h:617
EChallengeVisibility
The visibility type of the challenge.
Definition: OnlineSubsystemPicoNames.h:626
ELeaderboardFilterType
The type of filter to use when using leaderboards or challenges.
Definition: OnlineSubsystemPicoNames.h:662