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
28class UPico_Leaderboard;
29class UPico_LeaderboardEntry;
30class UPico_LeaderboardEntryArray;
31class UPico_LeaderboardArray;
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
82 bool Get(const FString& LeaderboardName, FGet InGetDelegate);
83
112 bool GetEntries(const FString& LeaderboardName, int PageIdx, int PageSize, ppfLeaderboardFilterType Filter, ppfLeaderboardStartAt StartAt, FGetEntries InGetEntriesDelegate);
113
127 bool GetEntriesAfterRank(const FString& LeaderboardName, int PageIdx, int PageSize, unsigned long long AfterRank, FGetEntriesAfterRank InGetEntriesAfterRankDelegate);
128
153 bool GetEntriesByIds(const FString& LeaderboardName, int PageIdx, int PageSize, ppfLeaderboardStartAt StartAt, const TArray<FString>& UserIDs, FGetEntriesByIds InGetEntriesByIdsDelegate);
154
169 bool WriteEntry(const FString& LeaderboardName, const int64& Score, const FString& ExtraData, bool ForceUpdate, FWriteEntry InWriteEntryDelegate);
170
186 bool WriteEntryWithSupplementaryMetric(const FString& LeaderboardName, const int64& Score, const int64& SupplementaryMetric, const FString& ExtraData, bool ForceUpdate, FWriteEntryWithSupplementaryMetric InWriteEntryWithSupplementaryMetricDelegate);
187
188};
204UCLASS()
205class ONLINESUBSYSTEMPICO_API UOnlinePicoLeaderboardsFunction : public UBlueprintFunctionLibrary
206{
207 GENERATED_BODY()
208
209
210public:
211
216 UFUNCTION(BlueprintCallable, meta = (WorldContext = "WorldContextObject"), Category = "OnlinePico|Leaderboards")
217 static void Get(UObject* WorldContextObject, const FString& LeaderboardName, FGet InGetDelegate);
218
242 UFUNCTION(BlueprintCallable, meta = (WorldContext = "WorldContextObject"), Category = "OnlinePico|Leaderboards")
243 static void GetEntries(UObject* WorldContextObject, const FString& LeaderboardName, int PageIdx, int PageSize, ELeaderboardFilterType Filter, ELeaderboardStartAt StartAt, FGetEntries InGetEntriesDelegate);
244
253 UFUNCTION(BlueprintCallable, meta = (WorldContext = "WorldContextObject"), Category = "OnlinePico|Leaderboards")
254 static void GetEntriesAfterRank(UObject* WorldContextObject, const FString& LeaderboardName, int PageIdx, int PageSize, const FString& AfterRank, FGetEntriesAfterRank InGetEntriesAfterRankDelegate);
255
275 UFUNCTION(BlueprintCallable, meta = (WorldContext = "WorldContextObject"), Category = "OnlinePico|Leaderboards")
276 static void GetEntriesByIds(UObject* WorldContextObject, const FString& LeaderboardName, int PageIdx, int PageSize, ELeaderboardStartAt StartAt, const TArray<FString>& UserIDs, FGetEntriesByIds InGetEntriesByIdsDelegate);
277
287 UFUNCTION(BlueprintCallable, meta = (WorldContext = "WorldContextObject"), Category = "OnlinePico|Leaderboards")
288 static void WriteEntry(UObject* WorldContextObject, const FString& LeaderboardName, const FString& Score, const FString& ExtraData, bool ForceUpdate, FWriteEntry InWriteEntryDelegate);
289
300 UFUNCTION(BlueprintCallable, meta = (WorldContext = "WorldContextObject"), Category = "OnlinePico|Leaderboards")
301 static void WriteEntryWithSupplementaryMetric(UObject* WorldContextObject, const FString& LeaderboardName, const FString& Score, const FString& SupplementaryMetric, const FString& ExtraData, bool ForceUpdate, FWriteEntryWithSupplementaryMetric InWriteEntryWithSupplementaryMetricDelegate);
302
303};
304 // end of BP_Leaderboards // end of BlueprintFunction
307
308
309//
310UCLASS(BlueprintType)
311class ONLINESUBSYSTEMPICO_API UPico_LeaderboardEntry : public UObject
312{
313
314 GENERATED_BODY()
315
316public:
317 void InitParams(ppfLeaderboardEntryHandle ppfLeaderboardEntryHandle);
318
319private:
320 ppfID ID = 0;
321 FString DisplayScore = FString();
322 int Rank = 0;
323 long Score = 0;
324 FPicoSupplementaryMetric SupplementaryMetricOptional;
325 unsigned long long Timestamp = 0;
326 UPROPERTY()
327 UPico_User* User = nullptr;
328 TArray<uint8> ExtraData;
329public:
330
331 UFUNCTION(BlueprintPure, Category = "Pico Platform|Leaderboards|Leaderboard Entry")
332 FString GetID();
333 UFUNCTION(BlueprintPure, Category = "Pico Platform|Leaderboards|Leaderboard Entry")
334 FString GetDisplayScore();
335 UFUNCTION(BlueprintPure, Category = "Pico Platform|Leaderboards|Leaderboard Entry")
336 int32 GetRank();
337 UFUNCTION(BlueprintPure, Category = "Pico Platform|Leaderboards|Leaderboard Entry")
338 int64 GetScore();
339 UFUNCTION(BlueprintPure, Category = "Pico Platform|Leaderboards|Leaderboard Entry")
340 FPicoSupplementaryMetric GetSupplementaryMetricOptional();
341 UFUNCTION(BlueprintPure, Category = "Pico Platform|Leaderboards|Leaderboard Entry")
342 FString GetTimestamp();
343 UFUNCTION(BlueprintPure, Category = "Pico Platform|Leaderboards|Leaderboard Entry")
344 FDateTime GetTimestampDateTime();
345 UFUNCTION(BlueprintPure, Category = "Pico Platform|Leaderboards|Leaderboard Entry")
346 UPico_User* GetUser();
347 UFUNCTION(BlueprintPure, Category = "Pico Platform|Leaderboards|Leaderboard Entry")
348 FString GetExtraDataString();
349
350};
351UCLASS(BlueprintType)
352class ONLINESUBSYSTEMPICO_API UPico_Leaderboard : public UObject
353{
354
355 GENERATED_BODY()
356
357public:
358 void InitParams(ppfLeaderboard* ppfLeaderboardHandle);
359
360private:
361 FString ApiName = FString();
362 ppfID ID = 0;
363 FPicoDestination DestinationOptional;
364public:
365
366 UFUNCTION(BlueprintPure, Category = "Pico Platform|Leaderboards|Leaderboard")
367 FString GetApiName();
368
369 UFUNCTION(BlueprintPure, Category = "Pico Platform|Leaderboards|Leaderboard")
370 FString GetID();
371
372 UFUNCTION(BlueprintPure, Category = "Pico Platform|Leaderboards|Leaderboard")
373 FPicoDestination GetDestinationOptional();
374};
375
376UCLASS(BlueprintType)
377class ONLINESUBSYSTEMPICO_API UPico_LeaderboardEntryArray : public UObject
378{
379 GENERATED_BODY()
380private:
381 UPROPERTY()
382 TArray<UPico_LeaderboardEntry*> LeaderboardEntryArray;
383 FString NextPageParam = FString();
384 int32 Size = 0;
385 bool bHasNextPage;
386 int32 TotalSize = 0;
387public:
388 void InitParams(ppfLeaderboardEntryArrayHandle InppfLeaderboardEntryArrayHandle);
389
390 UFUNCTION(BlueprintPure, Category = "Pico Platform|Leaderboards|Leaderboard Entry Array")
391 UPico_LeaderboardEntry* GetElement(int32 Index);
392
393 UFUNCTION(BlueprintPure, Category = "Pico Platform|Leaderboards|Leaderboard Entry Array")
394 FString GetNextPageParam();
395
396 UFUNCTION(BlueprintPure, Category = "Pico Platform|Leaderboards|Leaderboard Entry Array")
397 int32 GetSize();
398
399 UFUNCTION(BlueprintPure, Category = "Pico Platform|Leaderboards|Leaderboard Entry Array")
400 int32 GetTotalSize();
401
402 UFUNCTION(BlueprintPure, Category = "Pico Platform|Leaderboards|Leaderboard Entry Array")
403 bool HasNextPage();
404};
405
406UCLASS(BlueprintType)
407class ONLINESUBSYSTEMPICO_API UPico_LeaderboardArray : public UObject
408{
409
410 GENERATED_BODY()
411private:
412 UPROPERTY()
413 TArray<UPico_Leaderboard*> LeaderboardArray;
414 FString NextPageParam = FString();
415 int32 Size = 0;
416 bool bHasNextPage;
417
418public:
419 void InitParams(ppfLeaderboardArrayHandle InppfLeaderboardArrayHandle);
420
421 UFUNCTION(BlueprintPure, Category = "Pico Platform|Leaderboards|Leaderboard Definition Array")
422 UPico_Leaderboard* GetElement(int32 Index);
423
424 UFUNCTION(BlueprintPure, Category = "Pico Platform|Leaderboards|Leaderboard Definition Array")
425 FString GetNextPageParam();
426
427 UFUNCTION(BlueprintPure, Category = "Pico Platform|Leaderboards|Leaderboard Definition Array")
428 int32 GetSize();
429
430 UFUNCTION(BlueprintPure, Category = "Pico Platform|Leaderboards|Leaderboard Definition Array")
431 bool HasNextPage();
432};
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:206
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