PICO Unreal Platform SDK
Pico_Challenges.h
1/*******************************************************************************
2Copyright © 2015-2022 PICO Technology Co., Ltd.All rights reserved.
3
4NOTICE:All information contained herein is, and remains the property of
5PICO Technology Co., Ltd. The intellectual and technical concepts
6contained herein are proprietary to PICO Technology Co., Ltd. and may be
7covered by patents, patents in process, and are protected by trade secret or
8copyright law. Dissemination of this information or reproduction of this
9material is strictly forbidden unless prior written permission is obtained from
10PICO Technology Co., Ltd.
11*******************************************************************************/
12// 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.
13// Unreal® Engine, Copyright 1998 – 2022, Epic Games, Inc.All rights reserved.
14#pragma once
15
16#include "CoreMinimal.h"
17#include "UObject/NoExportTypes.h"
18#include "PPF_Platform.h"
19#include "OnlineSubsystemPicoNames.h"
20#include "OnlineSubsystemPico.h"
21#include "Pico_Leaderboards.h"
22#include "Pico_User.h"
23#include "Pico_Challenges.generated.h"
24
26
27// class UPico_Leaderboard;
28class UPico_Challenge;
32// enum FPico_ChallengeOptions;
33
34
35USTRUCT(BlueprintType, meta = (DisplayName = "ChallengeOptions"))
36struct FPico_ChallengeOptions
37{
38 GENERATED_USTRUCT_BODY()
39
40 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Pico Platform|Challenges|Challenge Options") FString Title;
41 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Pico Platform|Challenges|Challenge Options") int32 StartDate;
42 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Pico Platform|Challenges|Challenge Options") int32 EndDate;
43 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Pico Platform|Challenges|Challenge Options") FString LeaderboardName;
44 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Pico Platform|Challenges|Challenge Options") bool bIncludeActiveChallenges;
45 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Pico Platform|Challenges|Challenge Options") bool bIncludeFutureChallenges;
46 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Pico Platform|Challenges|Challenge Options") bool bIncludePastChallenges;
47 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Pico Platform|Challenges|Challenge Options") EChallengeVisibility Visibility;
48 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Pico Platform|Challenges|Challenge Options") EChallengeViewerFilter ViewerFilter;
49};
50
51
52
53DECLARE_LOG_CATEGORY_EXTERN(PicoChallenges, Log, All);
54
58DECLARE_DYNAMIC_DELEGATE_ThreeParams(FChallengeGet, bool, bIsError, const FString&, ErrorMessage, UPico_Challenge*,
59 Challenge);
60
61DECLARE_DYNAMIC_DELEGATE_ThreeParams(FChallengeGetEntries, bool, bIsError, const FString&, ErrorMessage,
62 UPico_ChallengeEntryArray*, ChallengeEntryList);
63
64DECLARE_DYNAMIC_DELEGATE_ThreeParams(FChallengeGetEntriesAfterRank, bool, bIsError, const FString&, ErrorMessage,
65 UPico_ChallengeEntryArray*, ChallengeEntryList);
66
67DECLARE_DYNAMIC_DELEGATE_ThreeParams(FChallengeGetEntriesByIds, bool, bIsError, const FString&, ErrorMessage,
68 UPico_ChallengeEntryArray*, ChallengeEntryList);
69
70DECLARE_DYNAMIC_DELEGATE_ThreeParams(FChallengeGetList, bool, bIsError, const FString&, ErrorMessage,
71 UPico_ChallengeArray*, ChallengeList);
72
73DECLARE_DYNAMIC_DELEGATE_ThreeParams(FChallengeInvite, bool, bIsError, const FString&, ErrorMessage,
74 UPico_Challenge*, Challenge);
75
76DECLARE_DYNAMIC_DELEGATE_ThreeParams(FChallengeLeave, bool, bIsError, const FString&, ErrorMessage, UPico_Challenge*,
77 Challenge);
78
79DECLARE_DYNAMIC_DELEGATE_ThreeParams(FChallengeJoin, bool, bIsError, const FString&, ErrorMessage, UPico_Challenge*,
80 Challenge);
81DECLARE_DYNAMIC_DELEGATE_ThreeParams(FChallengeLaunchInvitableUserFlow, bool, bIsError, int, ErrorCode, const FString&, ErrorMessage);
82
83DECLARE_MULTICAST_DELEGATE_FourParams(FChallengeInviteAcceptedOrLaunchAppNotify, bool, /*bIsError*/ int, /*ErrorCode*/ const FString&, /*ErrorMessage*/ const FString& /*ChallengeID*/);
95class ONLINESUBSYSTEMPICO_API FPicoChallengesInterface
96{
97private:
98 FOnlineSubsystemPico& PicoSubsystem;
99
100public:
101 FPicoChallengesInterface(FOnlineSubsystemPico& InSubsystem);
103
104 FChallengeGet GetDelegate;
105 FChallengeGetEntries GetEntriesDelegate;
106 FChallengeGetEntriesAfterRank GetEntriesAfterRankDelegate;
107 FChallengeGetEntriesByIds GetEntriesByIdsDelegate;
108 FChallengeGetList GetListDelegate;
109 FChallengeJoin JoinDelegate;
110 FChallengeLeave LeaveDelegate;
111 FChallengeInvite InviteDelegate;
112 FChallengeLaunchInvitableUserFlow LaunchInvitableUserFlowDelegate;
113
114 FChallengeInviteAcceptedOrLaunchAppNotify ChallengeInviteAcceptedOrLaunchAppNotify;
115
116 FDelegateHandle ChallengeInviteAcceptedOrLaunchAppHandle;
117 void OnChallengeInviteAcceptedOrLaunchAppNotification(ppfMessageHandle Message, bool bIsError);
118
129 bool Get(const FString& ChallengeID, FChallengeGet InGetDelegate);
130
160 bool GetEntries(const FString& ChallengeID, int PageIdx, int PageSize, ELeaderboardFilterType Filter,
161 ELeaderboardStartAt StartAt, FChallengeGetEntries InGetEntriesDelegate);
162
177 bool GetEntriesAfterRank(ppfID ChallengeID, int PageIdx, int PageSize, unsigned long long AfterRank,
178 FChallengeGetEntriesAfterRank InGetEntriesAfterRankDelegate);
179
205 bool GetEntriesByIds(const FString& ChallengeID, int PageIdx, int PageSize, ELeaderboardStartAt StartAt,
206 const TArray<FString>& UserIDs, FChallengeGetEntriesByIds InGetEntriesByIdsDelegate);
207
223 bool GetList(FPico_ChallengeOptions ChallengeOptions, int PageIdx, int PageSize, FChallengeGetList InGetListDelegate);
224
235 bool Join(const FString& ChallengeID, FChallengeJoin InJoinDelegate);
236
247 bool Leave(const FString& ChallengeID, FChallengeLeave InLeaveDelegate);
248
260 bool Invite(const FString& ChallengeID, const TArray<FString>& UserIDs, FChallengeInvite Delegate);
261
274 bool LaunchInvitableUserFlow(const FString& ChallengeID, FChallengeLaunchInvitableUserFlow Delegate);
275
276};
277
293UCLASS()
294class ONLINESUBSYSTEMPICO_API UOnlinePicoChallengesFunction : public UBlueprintFunctionLibrary
295{
296 GENERATED_BODY()
297
298
299public:
300
306 UFUNCTION(BlueprintCallable, meta = (WorldContext = "WorldContextObject"), Category = "OnlinePico|Challenges")
307 static void Get(UObject* WorldContextObject, const FString& ChallengeID, FChallengeGet InGetDelegate);
308
333 UFUNCTION(BlueprintCallable, meta = (WorldContext = "WorldContextObject"), Category = "OnlinePico|Challenges")
334 static void GetEntries(UObject* WorldContextObject, const FString& ChallengeID, int PageIdx, int PageSize,
336 FChallengeGetEntries InGetEntriesDelegate);
337
347 UFUNCTION(BlueprintCallable, meta = (WorldContext = "WorldContextObject"), Category = "OnlinePico|Challenges")
348 static void GetEntriesAfterRank(UObject* WorldContextObject, const FString& ChallengeID, int PageIdx, int PageSize,
349 const FString& AfterRank,
350 FChallengeGetEntriesAfterRank InGetEntriesAfterRankDelegate);
351
372 UFUNCTION(BlueprintCallable, meta = (WorldContext = "WorldContextObject"), Category = "OnlinePico|Challenges")
373 static void GetEntriesByIds(UObject* WorldContextObject, const FString& ChallengeID, int PageIdx, int PageSize,
374 ELeaderboardStartAt StartAt, const TArray<FString>& UserIDs,
375 FChallengeGetEntriesByIds InGetEntriesByIdsDelegate);
376
386 UFUNCTION(BlueprintCallable, meta = (WorldContext = "WorldContextObject"), Category = "OnlinePico|Challenges")
387 static void GetList(UObject* WorldContextObject, FPico_ChallengeOptions ChallengeOptions, int PageIdx, int PageSize,
388 FChallengeGetList InGetListDelegate);
389
395 UFUNCTION(BlueprintCallable, meta = (WorldContext = "WorldContextObject"), Category = "OnlinePico|Challenges")
396 static void Join(UObject* WorldContextObject, const FString& ChallengeID, FChallengeJoin InJoinDelegate);
397
403 UFUNCTION(BlueprintCallable, meta = (WorldContext = "WorldContextObject"), Category = "OnlinePico|Challenges")
404 static void Leave(UObject* WorldContextObject, const FString& ChallengeID, FChallengeLeave InLeaveDelegate);
405
412 UFUNCTION(BlueprintCallable, meta = (WorldContext = "WorldContextObject"), Category = "OnlinePico|Challenges")
413 static void Invite(UObject* WorldContextObject, const FString& ChallengeID, const TArray<FString>& UserIDs,
414 FChallengeInvite Delegate);
415
421 UFUNCTION(BlueprintCallable, meta = (WorldContext = "WorldContextObject"), Category = "OnlinePico|Challenges")
422 static void LaunchInvitableUserFlow(UObject* WorldContextObject, const FString& ChallengeID, FChallengeLaunchInvitableUserFlow Delegate);
423};
424 // end of BP_Challenges // end of BlueprintFunction
427
429UCLASS(BlueprintType)
430class ONLINESUBSYSTEMPICO_API UPico_Challenge : public UObject
431{
432 GENERATED_BODY()
433
434public:
435 void InitParams(ppfChallenge* ppfChallengeHandle);
436
437private:
438 ppfChallengeCreationType CreationType;
439 unsigned long long EndDate = 0;
440 unsigned long long StartDate = 0;
441 ppfID ID = 0;
442 FString Title = FString();
443 ppfChallengeVisibility Visibility;
444 UPROPERTY()
445 UPico_UserArray* InvitedUsersOptional;
446 UPROPERTY()
447 UPico_UserArray* ParticipantsOptional;
448 UPROPERTY()
449 UPico_Leaderboard* Leaderboard;
450
451public:
452
454 UFUNCTION(BlueprintPure, Category = "Pico Platform|Challenges|Challenge")
455 EChallengeCreationType GetCreationType();
456
458 UFUNCTION(BlueprintPure, Category = "Pico Platform|Challenges|Challenge")
459 FDateTime GetEndDateTime();
460
462 UFUNCTION(BlueprintPure, Category = "Pico Platform|Challenges|Challenge")
463 FDateTime GetStartDateTime();
464
466 UFUNCTION(BlueprintPure, Category = "Pico Platform|Challenges|Challenge")
467 FString GetEndDate();
468
470 UFUNCTION(BlueprintPure, Category = "Pico Platform|Challenges|Challenge")
471 FString GetStartDate();
472
474 UFUNCTION(BlueprintPure, Category = "Pico Platform|Challenges|Challenge")
475 FString GetID();
476
478 UFUNCTION(BlueprintPure, Category = "Pico Platform|Challenges|Challenge")
479 FString GetTitle();
480
482 UFUNCTION(BlueprintPure, Category = "Pico Platform|Challenges|Challenge")
483 EChallengeVisibility GetVisibility();
484
486 UFUNCTION(BlueprintPure, Category = "Pico Platform|Challenges|Challenge")
487 UPico_UserArray* GetInvitedUsersOptional();
488
490 UFUNCTION(BlueprintPure, Category = "Pico Platform|Challenges|Challenge")
491 UPico_Leaderboard* GetLeaderboard();
492
494 UFUNCTION(BlueprintPure, Category = "Pico Platform|Challenges|Challenge")
495 UPico_UserArray* GetParticipantsOptional();
496};
497
499UCLASS(BlueprintType)
500class ONLINESUBSYSTEMPICO_API UPico_ChallengeEntry : public UObject
501{
502 GENERATED_BODY()
503
504public:
505 void InitParams(ppfChallengeEntryHandle ppfChallengeEntryHandle);
506
507private:
508 FString DisplayScore = FString();
509 TArray<uint8> ExtraData;
510 ppfID ID = 0;
511 int Rank;
512 long Score;
513 unsigned long long Timestamp;
514 UPROPERTY()
515 UPico_User* User;
516
517public:
518
520 UFUNCTION(BlueprintPure, Category = "Pico Platform|Challenges|Challenge Entry")
521 FString GetDisplayScore();
522
524 UFUNCTION(BlueprintPure, Category = "Pico Platform|Challenges|Challenge Entry")
525 TArray<uint8> GetExtraData();
526
528 UFUNCTION(BlueprintPure, Category = "Pico Platform|Challenges|Challenge Entry")
529 FString GetExtraDataString();
530
532 UFUNCTION(BlueprintPure, Category = "Pico Platform|Challenges|Challenge Entry")
533 FString GetID();
534
536 UFUNCTION(BlueprintPure, Category = "Pico Platform|Challenges|Challenge Entry")
537 int32 GetRank();
538
540 UFUNCTION(BlueprintPure, Category = "Pico Platform|Challenges|Challenge Entry")
541 int64 GetScore();
542
544 UFUNCTION(BlueprintPure, Category = "Pico Platform|Challenges|Challenge Entry")
545 FDateTime GetTimestamp();
546
548 UFUNCTION(BlueprintPure, Category = "Pico Platform|Challenges|Challenge Entry")
549 UPico_User* GetUser();
550};
551
553UCLASS(BlueprintType)
554class ONLINESUBSYSTEMPICO_API UPico_ChallengeEntryArray : public UObject
555{
556 GENERATED_BODY()
557private:
558 UPROPERTY()
559 TArray<UPico_ChallengeEntry*> ChallengeEntryArray;
560 int32 Size = 0;
561 bool bHasNextPage;
562 bool bHasPreviousPage;
563 int32 TotalCount = 0;
564public:
565 void InitParams(ppfChallengeEntryArrayHandle InppfChallengeEntryArrayHandle);
566
568 UFUNCTION(BlueprintPure, Category = "Pico Platform|Challenges|Challenge Entry Array")
570
572 UFUNCTION(BlueprintPure, Category = "Pico Platform|Challenges|Challenge Entry Array")
573 int32 GetSize();
574
576 UFUNCTION(BlueprintPure, Category = "Pico Platform|Challenges|Challenge Entry Array")
578
579 // UFUNCTION(BlueprintPure, Category = "Pico Platform|Challenges|Challenge Entry Array")
580 // bool HasPreviousPage();
581 //
582 // UFUNCTION(BlueprintPure, Category = "Pico Platform|Challenges|Challenge Entry Array")
583 // int32 GetTotalCount();
584};
585
587UCLASS(BlueprintType)
588class ONLINESUBSYSTEMPICO_API UPico_ChallengeArray : public UObject
589{
590 GENERATED_BODY()
591private:
592 UPROPERTY()
593 TArray<UPico_Challenge*> ChallengeArray;
594 int32 Size = 0;
595 bool bHasNextPage;
596 bool bHasPreviousPage;
597 int32 TotalCount = 0;
598
599public:
600 void InitParams(ppfChallengeArrayHandle InppfChallengeArrayHandle);
601
603 UFUNCTION(BlueprintPure, Category = "Pico Platform|Challenges|Challenge Array")
605
607 UFUNCTION(BlueprintPure, Category = "Pico Platform|Challenges|Challenge Array")
608 int32 GetSize();
609
611 UFUNCTION(BlueprintPure, Category = "Pico Platform|Challenges|Challenge Array")
613
614 // UFUNCTION(BlueprintPure, Category = "Pico Platform|Challenges|Challenge Array")
615 // bool HasPreviousPage();
616 //
617 // UFUNCTION(BlueprintPure, Category = "Pico Platform|Challenges|Challenge Array")
618 // int32 GetTotalCount();
619};
620
PicoChallengesInterface class.
Definition: Pico_Challenges.h:96
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:295
UPico_ChallengeArray class.
Definition: Pico_Challenges.h:589
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:555
UPico_ChallengeEntry class.
Definition: Pico_Challenges.h:501
UPico_Challenge class.
Definition: Pico_Challenges.h:431
UPico_Leaderboard class.
Definition: Pico_Leaderboards.h:384
UPico_UserArray class.
Definition: Pico_User.h:510
UPico_User class.
Definition: Pico_User.h:422
ELeaderboardStartAt
The type of sorting to use when getting leaderboard or challenge entries.
Definition: OnlineSubsystemPicoNames.h:658
EChallengeViewerFilter
The challenge viewer filter.
Definition: OnlineSubsystemPicoNames.h:647
EChallengeCreationType
The creator of the challenge.
Definition: OnlineSubsystemPicoNames.h:629
EChallengeVisibility
The visibility type of the challenge.
Definition: OnlineSubsystemPicoNames.h:638
ELeaderboardFilterType
The type of filter to use when using leaderboards or challenges.
Definition: OnlineSubsystemPicoNames.h:674