PICO Unreal Platform SDK
Pico_Leaderboards.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_User.h"
22#include "Pico_Leaderboards.generated.h"
23
25
26DECLARE_LOG_CATEGORY_EXTERN(PicoLeaderboards, Log, All);
27
32class UPico_User;
33
34
38DECLARE_DYNAMIC_DELEGATE_ThreeParams(FGet, bool, bIsError, const FString&, ErrorMessage, UPico_LeaderboardArray*, LeaderboardList);
39DECLARE_DYNAMIC_DELEGATE_ThreeParams(FGetEntries, bool, bIsError, const FString&, ErrorMessage, UPico_LeaderboardEntryArray*, LeaderboardEntryList);
40DECLARE_DYNAMIC_DELEGATE_ThreeParams(FGetEntriesAfterRank, bool, bIsError, const FString&, ErrorMessage, UPico_LeaderboardEntryArray*, LeaderboardEntryList);
41DECLARE_DYNAMIC_DELEGATE_ThreeParams(FGetEntriesByIds, bool, bIsError, const FString&, ErrorMessage, UPico_LeaderboardEntryArray*, LeaderboardEntryList);
42DECLARE_DYNAMIC_DELEGATE_ThreeParams(FWriteEntry, bool, bIsError, const FString&, ErrorMessage, bool, WriteResult);
43DECLARE_DYNAMIC_DELEGATE_ThreeParams(FWriteEntryWithSupplementaryMetric, bool, bIsError, const FString&, ErrorMessage, bool, WriteResult);
44
56class ONLINESUBSYSTEMPICO_API FPicoLeaderboardsInterface
57{
58private:
59
60 FOnlineSubsystemPico& PicoSubsystem;
61
62public:
63 FPicoLeaderboardsInterface(FOnlineSubsystemPico& InSubsystem);
65
66 FGet GetDelegate;
67 FGetEntries GetEntriesDelegate;
68 FGetEntriesAfterRank GetEntriesAfterRankDelegate;
69 FGetEntriesByIds GetEntriesByIdsDelegate;
70 FWriteEntry WriteEntryDelegate;
71 FWriteEntryWithSupplementaryMetric WriteEntryWithSupplementaryMetricDelegate;
72
83 bool Get(const FString& LeaderboardName, FGet InGetDelegate);
84
114 bool GetEntries(const FString& LeaderboardName, int PageIdx, int PageSize, ppfLeaderboardFilterType Filter, ppfLeaderboardStartAt StartAt, FGetEntries InGetEntriesDelegate);
115
130 bool GetEntriesAfterRank(const FString& LeaderboardName, int PageIdx, int PageSize, unsigned long long AfterRank, FGetEntriesAfterRank InGetEntriesAfterRankDelegate);
131
157 bool GetEntriesByIds(const FString& LeaderboardName, int PageIdx, int PageSize, ppfLeaderboardStartAt StartAt, const TArray<FString>& UserIDs, FGetEntriesByIds InGetEntriesByIdsDelegate);
158
174 bool WriteEntry(const FString& LeaderboardName, const int64& Score, const FString& ExtraData, bool ForceUpdate, FWriteEntry InWriteEntryDelegate);
175
192 bool WriteEntryWithSupplementaryMetric(const FString& LeaderboardName, const int64& Score, const int64& SupplementaryMetric, const FString& ExtraData, bool ForceUpdate, FWriteEntryWithSupplementaryMetric InWriteEntryWithSupplementaryMetricDelegate);
193
194};
210UCLASS()
211class ONLINESUBSYSTEMPICO_API UOnlinePicoLeaderboardsFunction : public UBlueprintFunctionLibrary
212{
213 GENERATED_BODY()
214
215
216public:
217
223 UFUNCTION(BlueprintCallable, meta = (WorldContext = "WorldContextObject"), Category = "OnlinePico|Leaderboards")
224 static void Get(UObject* WorldContextObject, const FString& LeaderboardName, FGet InGetDelegate);
225
250 UFUNCTION(BlueprintCallable, meta = (WorldContext = "WorldContextObject"), Category = "OnlinePico|Leaderboards")
251 static void GetEntries(UObject* WorldContextObject, const FString& LeaderboardName, int PageIdx, int PageSize, ELeaderboardFilterType Filter, ELeaderboardStartAt StartAt, FGetEntries InGetEntriesDelegate);
252
262 UFUNCTION(BlueprintCallable, meta = (WorldContext = "WorldContextObject"), Category = "OnlinePico|Leaderboards")
263 static void GetEntriesAfterRank(UObject* WorldContextObject, const FString& LeaderboardName, int PageIdx, int PageSize, const FString& AfterRank, FGetEntriesAfterRank InGetEntriesAfterRankDelegate);
264
285 UFUNCTION(BlueprintCallable, meta = (WorldContext = "WorldContextObject"), Category = "OnlinePico|Leaderboards")
286 static void GetEntriesByIds(UObject* WorldContextObject, const FString& LeaderboardName, int PageIdx, int PageSize, ELeaderboardStartAt StartAt, const TArray<FString>& UserIDs, FGetEntriesByIds InGetEntriesByIdsDelegate);
287
298 UFUNCTION(BlueprintCallable, meta = (WorldContext = "WorldContextObject"), Category = "OnlinePico|Leaderboards")
299 static void WriteEntry(UObject* WorldContextObject, const FString& LeaderboardName, const FString& Score, const FString& ExtraData, bool ForceUpdate, FWriteEntry InWriteEntryDelegate);
300
312 UFUNCTION(BlueprintCallable, meta = (WorldContext = "WorldContextObject"), Category = "OnlinePico|Leaderboards")
313 static void WriteEntryWithSupplementaryMetric(UObject* WorldContextObject, const FString& LeaderboardName, const FString& Score, const FString& SupplementaryMetric, const FString& ExtraData, bool ForceUpdate, FWriteEntryWithSupplementaryMetric InWriteEntryWithSupplementaryMetricDelegate);
314
315};
316 // end of BP_Leaderboards // end of BlueprintFunction
319
320
322UCLASS(BlueprintType)
323class ONLINESUBSYSTEMPICO_API UPico_LeaderboardEntry : public UObject
324{
325
326 GENERATED_BODY()
327
328public:
329 void InitParams(ppfLeaderboardEntryHandle ppfLeaderboardEntryHandle);
330
331private:
332 ppfID ID = 0;
333 FString DisplayScore = FString();
334 int Rank = 0;
335 long Score = 0;
336 FPicoSupplementaryMetric SupplementaryMetricOptional;
337 unsigned long long Timestamp = 0;
338 UPROPERTY()
339 UPico_User* User = nullptr;
340 TArray<uint8> ExtraData;
341public:
342
344 UFUNCTION(BlueprintPure, Category = "Pico Platform|Leaderboards|Leaderboard Entry")
345 FString GetID();
346
348 UFUNCTION(BlueprintPure, Category = "Pico Platform|Leaderboards|Leaderboard Entry")
349 FString GetDisplayScore();
350
352 UFUNCTION(BlueprintPure, Category = "Pico Platform|Leaderboards|Leaderboard Entry")
353 int32 GetRank();
354
356 UFUNCTION(BlueprintPure, Category = "Pico Platform|Leaderboards|Leaderboard Entry")
357 int64 GetScore();
358
360 UFUNCTION(BlueprintPure, Category = "Pico Platform|Leaderboards|Leaderboard Entry")
361 FPicoSupplementaryMetric GetSupplementaryMetricOptional();
362
364 UFUNCTION(BlueprintPure, Category = "Pico Platform|Leaderboards|Leaderboard Entry")
365 FString GetTimestamp();
366
368 UFUNCTION(BlueprintPure, Category = "Pico Platform|Leaderboards|Leaderboard Entry")
369 FDateTime GetTimestampDateTime();
370
372 UFUNCTION(BlueprintPure, Category = "Pico Platform|Leaderboards|Leaderboard Entry")
373 UPico_User* GetUser();
374
376 UFUNCTION(BlueprintPure, Category = "Pico Platform|Leaderboards|Leaderboard Entry")
377 FString GetExtraDataString();
378
379};
380
382UCLASS(BlueprintType)
383class ONLINESUBSYSTEMPICO_API UPico_Leaderboard : public UObject
384{
385
386 GENERATED_BODY()
387
388public:
389 void InitParams(ppfLeaderboard* ppfLeaderboardHandle);
390
391private:
392 FString ApiName = FString();
393 ppfID ID = 0;
394 FPicoDestination DestinationOptional;
395public:
396
398 UFUNCTION(BlueprintPure, Category = "Pico Platform|Leaderboards|Leaderboard")
399 FString GetApiName();
400
402 UFUNCTION(BlueprintPure, Category = "Pico Platform|Leaderboards|Leaderboard")
403 FString GetID();
404
409 UFUNCTION(BlueprintPure, Category = "Pico Platform|Leaderboards|Leaderboard")
410 FPicoDestination GetDestinationOptional();
411};
412
414UCLASS(BlueprintType)
415class ONLINESUBSYSTEMPICO_API UPico_LeaderboardEntryArray : public UObject
416{
417 GENERATED_BODY()
418private:
419 UPROPERTY()
420 TArray<UPico_LeaderboardEntry*> LeaderboardEntryArray;
421 FString NextPageParam = FString();
422 int32 Size = 0;
423 bool bHasNextPage;
424 int32 TotalSize = 0;
425public:
426 void InitParams(ppfLeaderboardEntryArrayHandle InppfLeaderboardEntryArrayHandle);
427
429 UFUNCTION(BlueprintPure, Category = "Pico Platform|Leaderboards|Leaderboard Entry Array")
430 UPico_LeaderboardEntry* GetElement(int32 Index);
431
432 UFUNCTION(BlueprintPure, Category = "Pico Platform|Leaderboards|Leaderboard Entry Array")
433 FString GetNextPageParam();
434
436 UFUNCTION(BlueprintPure, Category = "Pico Platform|Leaderboards|Leaderboard Entry Array")
437 int32 GetSize();
438
439
440 UFUNCTION(BlueprintPure, Category = "Pico Platform|Leaderboards|Leaderboard Entry Array")
441 int32 GetTotalSize();
442
444 UFUNCTION(BlueprintPure, Category = "Pico Platform|Leaderboards|Leaderboard Entry Array")
445 bool HasNextPage();
446};
447
449UCLASS(BlueprintType)
450class ONLINESUBSYSTEMPICO_API UPico_LeaderboardArray : public UObject
451{
452
453 GENERATED_BODY()
454private:
455 UPROPERTY()
456 TArray<UPico_Leaderboard*> LeaderboardArray;
457 FString NextPageParam = FString();
458 int32 Size = 0;
459 bool bHasNextPage;
460
461public:
462 void InitParams(ppfLeaderboardArrayHandle InppfLeaderboardArrayHandle);
463
465 UFUNCTION(BlueprintPure, Category = "Pico Platform|Leaderboards|Leaderboard Definition Array")
466 UPico_Leaderboard* GetElement(int32 Index);
467
468 UFUNCTION(BlueprintPure, Category = "Pico Platform|Leaderboards|Leaderboard Definition Array")
469 FString GetNextPageParam();
470
472 UFUNCTION(BlueprintPure, Category = "Pico Platform|Leaderboards|Leaderboard Definition Array")
473 int32 GetSize();
474
476 UFUNCTION(BlueprintPure, Category = "Pico Platform|Leaderboards|Leaderboard Definition Array")
477 bool HasNextPage();
478};
PicoLeaderboardsInterface class.
Definition: Pico_Leaderboards.h:57
bool WriteEntry(const FString &LeaderboardName, const int64 &Score, const FString &ExtraData, bool ForceUpdate, FWriteEntry InWriteEntryDelegate)
Writes a user's score to the leaderboard.
bool WriteEntryWithSupplementaryMetric(const FString &LeaderboardName, const int64 &Score, const int64 &SupplementaryMetric, const FString &ExtraData, bool ForceUpdate, FWriteEntryWithSupplementaryMetric InWriteEntryWithSupplementaryMetricDelegate)
Adds custom contents when writing a user's score to a leaderboard.
bool GetEntries(const FString &LeaderboardName, int PageIdx, int PageSize, ppfLeaderboardFilterType Filter, ppfLeaderboardStartAt StartAt, FGetEntries InGetEntriesDelegate)
Gets a list of leaderboard entries.
bool GetEntriesAfterRank(const FString &LeaderboardName, int PageIdx, int PageSize, unsigned long long AfterRank, FGetEntriesAfterRank InGetEntriesAfterRankDelegate)
Gets the leaderboard entries after a specified ranking.
bool GetEntriesByIds(const FString &LeaderboardName, int PageIdx, int PageSize, ppfLeaderboardStartAt StartAt, const TArray< FString > &UserIDs, FGetEntriesByIds InGetEntriesByIdsDelegate)
Gets the leaderboard entries for a specified user.
bool Get(const FString &LeaderboardName, FGet InGetDelegate)
Gets a specified leaderboard.
OnlinePicoLeaderboards Blueprint Function class.
Definition: Pico_Leaderboards.h:212
UPico_LeaderboardArray class.
Definition: Pico_Leaderboards.h:451
UPico_LeaderboardEntryArray class.
Definition: Pico_Leaderboards.h:416
UPico_LeaderboardEntry class.
Definition: Pico_Leaderboards.h:324
UPico_Leaderboard class.
Definition: Pico_Leaderboards.h:384
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
ELeaderboardFilterType
The type of filter to use when using leaderboards or challenges.
Definition: OnlineSubsystemPicoNames.h:674
The destination information.
Definition: OnlineSubsystemPicoNames.h:208
Supplementary metrics for leaderboards.
Definition: OnlineSubsystemPicoNames.h:684