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 "Pico_Challenges.generated.h"
12
14
15// class UPico_Leaderboard;
16class UPico_Challenge;
20// enum FPico_ChallengeOptions;
21
22
23USTRUCT(BlueprintType, meta = (DisplayName = "ChallengeOptions"))
24struct FPico_ChallengeOptions
25{
26 GENERATED_USTRUCT_BODY()
27
28 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Pico Platform|Challenges|Challenge Options") FString Title;
29 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Pico Platform|Challenges|Challenge Options") int32 StartDate;
30 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Pico Platform|Challenges|Challenge Options") int32 EndDate;
31 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Pico Platform|Challenges|Challenge Options") FString LeaderboardName;
32 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Pico Platform|Challenges|Challenge Options") bool bIncludeActiveChallenges;
33 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Pico Platform|Challenges|Challenge Options") bool bIncludeFutureChallenges;
34 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Pico Platform|Challenges|Challenge Options") bool bIncludePastChallenges;
35 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Pico Platform|Challenges|Challenge Options") EChallengeVisibility Visibility;
36 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Pico Platform|Challenges|Challenge Options") EChallengeViewerFilter ViewerFilter;
37};
38
39
40
41DECLARE_LOG_CATEGORY_EXTERN(PicoChallenges, Log, All);
42
46DECLARE_DYNAMIC_DELEGATE_ThreeParams(FChallengeGet, bool, bIsError, const FString&, ErrorMessage, UPico_Challenge*,
47 Challenge);
48
49DECLARE_DYNAMIC_DELEGATE_ThreeParams(FChallengeGetEntries, bool, bIsError, const FString&, ErrorMessage,
50 UPico_ChallengeEntryArray*, ChallengeEntryList);
51
52DECLARE_DYNAMIC_DELEGATE_ThreeParams(FChallengeGetEntriesAfterRank, bool, bIsError, const FString&, ErrorMessage,
53 UPico_ChallengeEntryArray*, ChallengeEntryList);
54
55DECLARE_DYNAMIC_DELEGATE_ThreeParams(FChallengeGetEntriesByIds, bool, bIsError, const FString&, ErrorMessage,
56 UPico_ChallengeEntryArray*, ChallengeEntryList);
57
58DECLARE_DYNAMIC_DELEGATE_ThreeParams(FChallengeGetList, bool, bIsError, const FString&, ErrorMessage,
59 UPico_ChallengeArray*, ChallengeList);
60
61DECLARE_DYNAMIC_DELEGATE_ThreeParams(FChallengeInvite, bool, bIsError, const FString&, ErrorMessage,
62 UPico_Challenge*, Challenge);
63
64DECLARE_DYNAMIC_DELEGATE_ThreeParams(FChallengeLeave, bool, bIsError, const FString&, ErrorMessage, UPico_Challenge*,
65 Challenge);
66
67DECLARE_DYNAMIC_DELEGATE_ThreeParams(FChallengeJoin, bool, bIsError, const FString&, ErrorMessage, UPico_Challenge*,
68 Challenge);
69DECLARE_DYNAMIC_DELEGATE_ThreeParams(FChallengeLaunchInvitableUserFlow, bool, bIsError, int, ErrorCode, const FString&, ErrorMessage);
70
71DECLARE_MULTICAST_DELEGATE_FourParams(FChallengeInviteAcceptedOrLaunchAppNotify, bool, /*bIsError*/ int, /*ErrorCode*/ const FString&, /*ErrorMessage*/ const FString& /*ChallengeID*/);
83class ONLINESUBSYSTEMPICO_API FPicoChallengesInterface
84{
85private:
86 FOnlineSubsystemPico& PicoSubsystem;
87
88public:
89 FPicoChallengesInterface(FOnlineSubsystemPico& InSubsystem);
91
92 FChallengeGet GetDelegate;
93 FChallengeGetEntries GetEntriesDelegate;
94 FChallengeGetEntriesAfterRank GetEntriesAfterRankDelegate;
95 FChallengeGetEntriesByIds GetEntriesByIdsDelegate;
96 FChallengeGetList GetListDelegate;
97 FChallengeJoin JoinDelegate;
98 FChallengeLeave LeaveDelegate;
99 FChallengeInvite InviteDelegate;
100 FChallengeLaunchInvitableUserFlow LaunchInvitableUserFlowDelegate;
101
102 FChallengeInviteAcceptedOrLaunchAppNotify ChallengeInviteAcceptedOrLaunchAppNotify;
103
104 FDelegateHandle ChallengeInviteAcceptedOrLaunchAppHandle;
105 void OnChallengeInviteAcceptedOrLaunchAppNotification(ppfMessageHandle Message, bool bIsError);
106
117 bool Get(const FString& ChallengeID, FChallengeGet InGetDelegate);
118
148 bool GetEntries(const FString& ChallengeID, int PageIdx, int PageSize, ELeaderboardFilterType Filter,
149 ELeaderboardStartAt StartAt, FChallengeGetEntries InGetEntriesDelegate);
150
165 bool GetEntriesAfterRank(ppfID ChallengeID, int PageIdx, int PageSize, unsigned long long AfterRank,
166 FChallengeGetEntriesAfterRank InGetEntriesAfterRankDelegate);
167
193 bool GetEntriesByIds(const FString& ChallengeID, int PageIdx, int PageSize, ELeaderboardStartAt StartAt,
194 const TArray<FString>& UserIDs, FChallengeGetEntriesByIds InGetEntriesByIdsDelegate);
195
211 bool GetList(FPico_ChallengeOptions ChallengeOptions, int PageIdx, int PageSize, FChallengeGetList InGetListDelegate);
212
223 bool Join(const FString& ChallengeID, FChallengeJoin InJoinDelegate);
224
235 bool Leave(const FString& ChallengeID, FChallengeLeave InLeaveDelegate);
236
248 bool Invite(const FString& ChallengeID, const TArray<FString>& UserIDs, FChallengeInvite Delegate);
249
262 bool LaunchInvitableUserFlow(const FString& ChallengeID, FChallengeLaunchInvitableUserFlow Delegate);
263
264};
265
281UCLASS()
282class ONLINESUBSYSTEMPICO_API UOnlinePicoChallengesFunction : public UBlueprintFunctionLibrary
283{
284 GENERATED_BODY()
285
286
287public:
288
294 UFUNCTION(BlueprintCallable, meta = (WorldContext = "WorldContextObject"), Category = "OnlinePico|Challenges")
295 static void Get(UObject* WorldContextObject, const FString& ChallengeID, FChallengeGet InGetDelegate);
296
321 UFUNCTION(BlueprintCallable, meta = (WorldContext = "WorldContextObject"), Category = "OnlinePico|Challenges")
322 static void GetEntries(UObject* WorldContextObject, const FString& ChallengeID, int PageIdx, int PageSize,
324 FChallengeGetEntries InGetEntriesDelegate);
325
335 UFUNCTION(BlueprintCallable, meta = (WorldContext = "WorldContextObject"), Category = "OnlinePico|Challenges")
336 static void GetEntriesAfterRank(UObject* WorldContextObject, const FString& ChallengeID, int PageIdx, int PageSize,
337 const FString& AfterRank,
338 FChallengeGetEntriesAfterRank InGetEntriesAfterRankDelegate);
339
360 UFUNCTION(BlueprintCallable, meta = (WorldContext = "WorldContextObject"), Category = "OnlinePico|Challenges")
361 static void GetEntriesByIds(UObject* WorldContextObject, const FString& ChallengeID, int PageIdx, int PageSize,
362 ELeaderboardStartAt StartAt, const TArray<FString>& UserIDs,
363 FChallengeGetEntriesByIds InGetEntriesByIdsDelegate);
364
374 UFUNCTION(BlueprintCallable, meta = (WorldContext = "WorldContextObject"), Category = "OnlinePico|Challenges")
375 static void GetList(UObject* WorldContextObject, FPico_ChallengeOptions ChallengeOptions, int PageIdx, int PageSize,
376 FChallengeGetList InGetListDelegate);
377
383 UFUNCTION(BlueprintCallable, meta = (WorldContext = "WorldContextObject"), Category = "OnlinePico|Challenges")
384 static void Join(UObject* WorldContextObject, const FString& ChallengeID, FChallengeJoin InJoinDelegate);
385
391 UFUNCTION(BlueprintCallable, meta = (WorldContext = "WorldContextObject"), Category = "OnlinePico|Challenges")
392 static void Leave(UObject* WorldContextObject, const FString& ChallengeID, FChallengeLeave InLeaveDelegate);
393
400 UFUNCTION(BlueprintCallable, meta = (WorldContext = "WorldContextObject"), Category = "OnlinePico|Challenges")
401 static void Invite(UObject* WorldContextObject, const FString& ChallengeID, const TArray<FString>& UserIDs,
402 FChallengeInvite Delegate);
403
409 UFUNCTION(BlueprintCallable, meta = (WorldContext = "WorldContextObject"), Category = "OnlinePico|Challenges")
410 static void LaunchInvitableUserFlow(UObject* WorldContextObject, const FString& ChallengeID, FChallengeLaunchInvitableUserFlow Delegate);
411};
412 // end of BP_Challenges // end of BlueprintFunction
415
417UCLASS(BlueprintType)
418class ONLINESUBSYSTEMPICO_API UPico_Challenge : public UObject
419{
420 GENERATED_BODY()
421
422public:
423 void InitParams(ppfChallenge* ppfChallengeHandle);
424
425private:
426 ppfChallengeCreationType CreationType;
427 unsigned long long EndDate = 0;
428 unsigned long long StartDate = 0;
429 ppfID ID = 0;
430 FString Title = FString();
431 ppfChallengeVisibility Visibility;
432 UPROPERTY()
433 UPico_UserArray* InvitedUsersOptional;
434 UPROPERTY()
435 UPico_UserArray* ParticipantsOptional;
436 UPROPERTY()
437 UPico_Leaderboard* Leaderboard;
438
439public:
440
442 UFUNCTION(BlueprintPure, Category = "Pico Platform|Challenges|Challenge")
443 EChallengeCreationType GetCreationType();
444
446 UFUNCTION(BlueprintPure, Category = "Pico Platform|Challenges|Challenge")
447 FDateTime GetEndDateTime();
448
450 UFUNCTION(BlueprintPure, Category = "Pico Platform|Challenges|Challenge")
451 FDateTime GetStartDateTime();
452
454 UFUNCTION(BlueprintPure, Category = "Pico Platform|Challenges|Challenge")
455 FString GetEndDate();
456
458 UFUNCTION(BlueprintPure, Category = "Pico Platform|Challenges|Challenge")
459 FString GetStartDate();
460
462 UFUNCTION(BlueprintPure, Category = "Pico Platform|Challenges|Challenge")
463 FString GetID();
464
466 UFUNCTION(BlueprintPure, Category = "Pico Platform|Challenges|Challenge")
467 FString GetTitle();
468
470 UFUNCTION(BlueprintPure, Category = "Pico Platform|Challenges|Challenge")
471 EChallengeVisibility GetVisibility();
472
474 UFUNCTION(BlueprintPure, Category = "Pico Platform|Challenges|Challenge")
475 UPico_UserArray* GetInvitedUsersOptional();
476
478 UFUNCTION(BlueprintPure, Category = "Pico Platform|Challenges|Challenge")
479 UPico_Leaderboard* GetLeaderboard();
480
482 UFUNCTION(BlueprintPure, Category = "Pico Platform|Challenges|Challenge")
483 UPico_UserArray* GetParticipantsOptional();
484};
485
487UCLASS(BlueprintType)
488class ONLINESUBSYSTEMPICO_API UPico_ChallengeEntry : public UObject
489{
490 GENERATED_BODY()
491
492public:
493 void InitParams(ppfChallengeEntryHandle ppfChallengeEntryHandle);
494
495private:
496 FString DisplayScore = FString();
497 TArray<uint8> ExtraData;
498 ppfID ID = 0;
499 int Rank;
500 long Score;
501 unsigned long long Timestamp;
502 UPROPERTY()
503 UPico_User* User;
504
505public:
506
508 UFUNCTION(BlueprintPure, Category = "Pico Platform|Challenges|Challenge Entry")
509 FString GetDisplayScore();
510
512 UFUNCTION(BlueprintPure, Category = "Pico Platform|Challenges|Challenge Entry")
513 TArray<uint8> GetExtraData();
514
516 UFUNCTION(BlueprintPure, Category = "Pico Platform|Challenges|Challenge Entry")
517 FString GetExtraDataString();
518
520 UFUNCTION(BlueprintPure, Category = "Pico Platform|Challenges|Challenge Entry")
521 FString GetID();
522
524 UFUNCTION(BlueprintPure, Category = "Pico Platform|Challenges|Challenge Entry")
525 int32 GetRank();
526
528 UFUNCTION(BlueprintPure, Category = "Pico Platform|Challenges|Challenge Entry")
529 int64 GetScore();
530
532 UFUNCTION(BlueprintPure, Category = "Pico Platform|Challenges|Challenge Entry")
533 FDateTime GetTimestamp();
534
536 UFUNCTION(BlueprintPure, Category = "Pico Platform|Challenges|Challenge Entry")
537 UPico_User* GetUser();
538};
539
541UCLASS(BlueprintType)
542class ONLINESUBSYSTEMPICO_API UPico_ChallengeEntryArray : public UObject
543{
544 GENERATED_BODY()
545private:
546 UPROPERTY()
547 TArray<UPico_ChallengeEntry*> ChallengeEntryArray;
548 int32 Size = 0;
549 bool bHasNextPage;
550 bool bHasPreviousPage;
551 int32 TotalCount = 0;
552public:
553 void InitParams(ppfChallengeEntryArrayHandle InppfChallengeEntryArrayHandle);
554
556 UFUNCTION(BlueprintPure, Category = "Pico Platform|Challenges|Challenge Entry Array")
558
560 UFUNCTION(BlueprintPure, Category = "Pico Platform|Challenges|Challenge Entry Array")
561 int32 GetSize();
562
564 UFUNCTION(BlueprintPure, Category = "Pico Platform|Challenges|Challenge Entry Array")
566
567 UFUNCTION(BlueprintPure, Category = "Pico Platform|Challenges|Challenge Entry Array")
568 bool HasPreviousPage();
569
570 UFUNCTION(BlueprintPure, Category = "Pico Platform|Challenges|Challenge Entry Array")
571 int32 GetTotalCount();
572};
573
575UCLASS(BlueprintType)
576class ONLINESUBSYSTEMPICO_API UPico_ChallengeArray : public UObject
577{
578 GENERATED_BODY()
579private:
580 UPROPERTY()
581 TArray<UPico_Challenge*> ChallengeArray;
582 int32 Size = 0;
583 bool bHasNextPage;
584 bool bHasPreviousPage;
585 int32 TotalCount = 0;
586
587public:
588 void InitParams(ppfChallengeArrayHandle InppfChallengeArrayHandle);
589
591 UFUNCTION(BlueprintPure, Category = "Pico Platform|Challenges|Challenge Array")
593
595 UFUNCTION(BlueprintPure, Category = "Pico Platform|Challenges|Challenge Array")
596 int32 GetSize();
597
599 UFUNCTION(BlueprintPure, Category = "Pico Platform|Challenges|Challenge Array")
601
602 UFUNCTION(BlueprintPure, Category = "Pico Platform|Challenges|Challenge Array")
603 bool HasPreviousPage();
604
605 UFUNCTION(BlueprintPure, Category = "Pico Platform|Challenges|Challenge Array")
606 int32 GetTotalCount();
607};
608
PicoChallengesInterface class.
Definition: Pico_Challenges.h:84
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:283
UPico_ChallengeArray class.
Definition: Pico_Challenges.h:577
int32 GetSize()
Get the size of ChallengeEntryArray .
bool HasNextPage()
Get whether the list has the next page.
UPico_Challenge * GetElement(int32 Index)
Get ChallengeEntryArray element form Index.
UPico_ChallengeEntryArray class.
Definition: Pico_Challenges.h:543
UPico_ChallengeEntry class.
Definition: Pico_Challenges.h:489
UPico_Challenge class.
Definition: Pico_Challenges.h:419
UPico_Leaderboard class.
Definition: Pico_Leaderboards.h:372
UPico_UserArray class.
Definition: Pico_User.h:539
UPico_User class.
Definition: Pico_User.h:451
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