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;
29class UPico_ChallengeEntry;
30class UPico_ChallengeEntryArray;
31class UPico_ChallengeArray;
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
128 bool Get(const FString& ChallengeID, FChallengeGet InGetDelegate);
129
158 bool GetEntries(const FString& ChallengeID, int PageIdx, int PageSize, ELeaderboardFilterType Filter,
159 ELeaderboardStartAt StartAt, FChallengeGetEntries InGetEntriesDelegate);
160
174 bool GetEntriesAfterRank(ppfID ChallengeID, int PageIdx, int PageSize, unsigned long long AfterRank,
175 FChallengeGetEntriesAfterRank InGetEntriesAfterRankDelegate);
176
201 bool GetEntriesByIds(const FString& ChallengeID, int PageIdx, int PageSize, ELeaderboardStartAt StartAt,
202 const TArray<FString>& UserIDs, FChallengeGetEntriesByIds InGetEntriesByIdsDelegate);
203
218 bool GetList(FPico_ChallengeOptions ChallengeOptions, int PageIdx, int PageSize, FChallengeGetList InGetListDelegate);
219
229 bool Join(const FString& ChallengeID, FChallengeJoin InJoinDelegate);
230
240 bool Leave(const FString& ChallengeID, FChallengeLeave InLeaveDelegate);
241
252 bool Invite(const FString& ChallengeID, const TArray<FString>& UserIDs, FChallengeInvite Delegate);
253
265 bool LaunchInvitableUserFlow(const FString& ChallengeID, FChallengeLaunchInvitableUserFlow Delegate);
266
267};
268
284UCLASS()
285class ONLINESUBSYSTEMPICO_API UOnlinePicoChallengesFunction : public UBlueprintFunctionLibrary
286{
287 GENERATED_BODY()
288
289
290public:
291
296 UFUNCTION(BlueprintCallable, meta = (WorldContext = "WorldContextObject"), Category = "OnlinePico|Challenges")
297 static void Get(UObject* WorldContextObject, const FString& ChallengeID, FChallengeGet InGetDelegate);
298
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
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
359 UFUNCTION(BlueprintCallable, meta = (WorldContext = "WorldContextObject"), Category = "OnlinePico|Challenges")
360 static void GetEntriesByIds(UObject* WorldContextObject, const FString& ChallengeID, int PageIdx, int PageSize,
361 ELeaderboardStartAt StartAt, const TArray<FString>& UserIDs,
362 FChallengeGetEntriesByIds InGetEntriesByIdsDelegate);
363
372 UFUNCTION(BlueprintCallable, meta = (WorldContext = "WorldContextObject"), Category = "OnlinePico|Challenges")
373 static void GetList(UObject* WorldContextObject, FPico_ChallengeOptions ChallengeOptions, int PageIdx, int PageSize,
374 FChallengeGetList InGetListDelegate);
375
380 UFUNCTION(BlueprintCallable, meta = (WorldContext = "WorldContextObject"), Category = "OnlinePico|Challenges")
381 static void Join(UObject* WorldContextObject, const FString& ChallengeID, FChallengeJoin InJoinDelegate);
382
387 UFUNCTION(BlueprintCallable, meta = (WorldContext = "WorldContextObject"), Category = "OnlinePico|Challenges")
388 static void Leave(UObject* WorldContextObject, const FString& ChallengeID, FChallengeLeave InLeaveDelegate);
389
395 UFUNCTION(BlueprintCallable, meta = (WorldContext = "WorldContextObject"), Category = "OnlinePico|Challenges")
396 static void Invite(UObject* WorldContextObject, const FString& ChallengeID, const TArray<FString>& UserIDs,
397 FChallengeInvite Delegate);
398
403 UFUNCTION(BlueprintCallable, meta = (WorldContext = "WorldContextObject"), Category = "OnlinePico|Challenges")
404 static void LaunchInvitableUserFlow(UObject* WorldContextObject, const FString& ChallengeID, FChallengeLaunchInvitableUserFlow Delegate);
405};
406 // end of BP_Challenges // end of BlueprintFunction
409
410
411UCLASS(BlueprintType)
412class ONLINESUBSYSTEMPICO_API UPico_Challenge : public UObject
413{
414 GENERATED_BODY()
415
416public:
417 void InitParams(ppfChallenge* ppfChallengeHandle);
418
419private:
420 ppfChallengeCreationType CreationType;
421 unsigned long long EndDate = 0;
422 unsigned long long StartDate = 0;
423 ppfID ID = 0;
424 FString Title = FString();
425 ppfChallengeVisibility Visibility;
426 UPROPERTY()
427 UPico_UserArray* InvitedUsersOptional;
428 UPROPERTY()
429 UPico_UserArray* ParticipantsOptional;
430 UPROPERTY()
431 UPico_Leaderboard* Leaderboard;
432
433public:
434 UFUNCTION(BlueprintPure, Category = "Pico Platform|Challenges|Challenge")
435 EChallengeCreationType GetCreationType();
436
437 UFUNCTION(BlueprintPure, Category = "Pico Platform|Challenges|Challenge")
438 FDateTime GetEndDateTime();
439
440 UFUNCTION(BlueprintPure, Category = "Pico Platform|Challenges|Challenge")
441 FDateTime GetStartDateTime();
442
443 UFUNCTION(BlueprintPure, Category = "Pico Platform|Challenges|Challenge")
444 FString GetEndDate();
445
446 UFUNCTION(BlueprintPure, Category = "Pico Platform|Challenges|Challenge")
447 FString GetStartDate();
448
449 UFUNCTION(BlueprintPure, Category = "Pico Platform|Challenges|Challenge")
450 FString GetID();
451
452 UFUNCTION(BlueprintPure, Category = "Pico Platform|Challenges|Challenge")
453 FString GetTitle();
454
455 UFUNCTION(BlueprintPure, Category = "Pico Platform|Challenges|Challenge")
456 EChallengeVisibility GetVisibility();
457
458 UFUNCTION(BlueprintPure, Category = "Pico Platform|Challenges|Challenge")
459 UPico_UserArray* GetInvitedUsersOptional();
460
461 UFUNCTION(BlueprintPure, Category = "Pico Platform|Challenges|Challenge")
462 UPico_Leaderboard* GetLeaderboard();
463
464 UFUNCTION(BlueprintPure, Category = "Pico Platform|Challenges|Challenge")
465 UPico_UserArray* GetParticipantsOptional();
466};
467
468//
469UCLASS(BlueprintType)
470class ONLINESUBSYSTEMPICO_API UPico_ChallengeEntry : public UObject
471{
472 GENERATED_BODY()
473
474public:
475 void InitParams(ppfChallengeEntryHandle ppfChallengeEntryHandle);
476
477private:
478 FString DisplayScore = FString();
479 TArray<uint8> ExtraData;
480 ppfID ID = 0;
481 int Rank;
482 long Score;
483 unsigned long long Timestamp;
484 UPROPERTY()
485 UPico_User* User;
486
487public:
488 UFUNCTION(BlueprintPure, Category = "Pico Platform|Challenges|Challenge Entry")
489 FString GetDisplayScore();
490
491 UFUNCTION(BlueprintPure, Category = "Pico Platform|Challenges|Challenge Entry")
492 TArray<uint8> GetExtraData();
493
494 UFUNCTION(BlueprintPure, Category = "Pico Platform|Challenges|Challenge Entry")
495 FString GetExtraDataString();
496
497 UFUNCTION(BlueprintPure, Category = "Pico Platform|Challenges|Challenge Entry")
498 FString GetID();
499
500 UFUNCTION(BlueprintPure, Category = "Pico Platform|Challenges|Challenge Entry")
501 int32 GetRank();
502
503 UFUNCTION(BlueprintPure, Category = "Pico Platform|Challenges|Challenge Entry")
504 int64 GetScore();
505
506 UFUNCTION(BlueprintPure, Category = "Pico Platform|Challenges|Challenge Entry")
507 FDateTime GetTimestamp();
508
509 UFUNCTION(BlueprintPure, Category = "Pico Platform|Challenges|Challenge Entry")
510 UPico_User* GetUser();
511};
512
513UCLASS(BlueprintType)
514class ONLINESUBSYSTEMPICO_API UPico_ChallengeEntryArray : public UObject
515{
516 GENERATED_BODY()
517private:
518 UPROPERTY()
519 TArray<UPico_ChallengeEntry*> ChallengeEntryArray;
520 int32 Size = 0;
521 bool bHasNextPage;
522 bool bHasPreviousPage;
523 int32 TotalCount = 0;
524public:
525 void InitParams(ppfChallengeEntryArrayHandle InppfChallengeEntryArrayHandle);
526
527 UFUNCTION(BlueprintPure, Category = "Pico Platform|Challenges|Challenge Entry Array")
528 UPico_ChallengeEntry* GetElement(int32 Index);
529
530 UFUNCTION(BlueprintPure, Category = "Pico Platform|Challenges|Challenge Entry Array")
531 int32 GetSize();
532
533 UFUNCTION(BlueprintPure, Category = "Pico Platform|Challenges|Challenge Entry Array")
534 bool HasNextPage();
535
536 // UFUNCTION(BlueprintPure, Category = "Pico Platform|Challenges|Challenge Entry Array")
537 // bool HasPreviousPage();
538 //
539 // UFUNCTION(BlueprintPure, Category = "Pico Platform|Challenges|Challenge Entry Array")
540 // int32 GetTotalCount();
541};
542
543UCLASS(BlueprintType)
544class ONLINESUBSYSTEMPICO_API UPico_ChallengeArray : public UObject
545{
546 GENERATED_BODY()
547private:
548 UPROPERTY()
549 TArray<UPico_Challenge*> ChallengeArray;
550 int32 Size = 0;
551 bool bHasNextPage;
552 bool bHasPreviousPage;
553 int32 TotalCount = 0;
554
555public:
556 void InitParams(ppfChallengeArrayHandle InppfChallengeArrayHandle);
557
558 UFUNCTION(BlueprintPure, Category = "Pico Platform|Challenges|Challenge Array")
559 UPico_Challenge* GetElement(int32 Index);
560
561 UFUNCTION(BlueprintPure, Category = "Pico Platform|Challenges|Challenge Array")
562 int32 GetSize();
563
564 UFUNCTION(BlueprintPure, Category = "Pico Platform|Challenges|Challenge Array")
565 bool HasNextPage();
566
567 // UFUNCTION(BlueprintPure, Category = "Pico Platform|Challenges|Challenge Array")
568 // bool HasPreviousPage();
569 //
570 // UFUNCTION(BlueprintPure, Category = "Pico Platform|Challenges|Challenge Array")
571 // int32 GetTotalCount();
572};
573
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:286
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