PICO Unreal Platform SDK
OnlineLeaderboardInterfacePico.h
1// Copyright® 2015-2023 PICO Technology Co., Ltd. All rights reserved.
2
3#pragma once
4
5#include "CoreMinimal.h"
6#include "OnlineSubsystemPico.h"
7#include "Interfaces/OnlineLeaderboardInterface.h"
8#include "OnlineIdentityPico.h"
9#include "OnlineSubsystemPicoPackage.h"
10
11#define WRITE_LEADERBOARDS_PAGEINDEX FName(TEXT("WRITELEADERBOARDSPAGEINDEX"))
12#define WRITE_LEADERBOARDS_PAGESIZE FName(TEXT("WRITELEADERBOARDSPAGESIZE"))
13
28class FOnlineLeaderboardPico : public IOnlineLeaderboards
29{
30private:
31
32 // Reference to the owning subsystem
33 FOnlineSubsystemPico& PicoSubsystem;
34
35 bool ReadPicoLeaderboards(bool bOnlyFriends, bool bOnlyLoggedInUser, FOnlineLeaderboardReadRef& ReadObject);
36 void OnReadLeaderboardsComplete(ppfMessageHandle Message, bool bIsError, bool bOnlyFriends, bool bOnlyLoggedInUser, const FOnlineLeaderboardReadRef& ReadObject);
37
38 const char* FilterTypeNames[4] = { "None", "Friends", "Unknown", "UserIds" };
39 const char* StartAtNames[4] = { "Top", "CenteredOnViewer", "CenteredOnViewerOrTop", "Unknown" };
40
41 static void SaveLog(const ELogVerbosity::Type Verbosity, const FString& Log);
42
43public:
44 const int MAX_REQUEST_SIZE = 100; // single max
45 int ReadIndex = 0;
46
47 //Constructor * @param InSubsystem - A reference to the owning subsystem
48 FOnlineLeaderboardPico(FOnlineSubsystemPico& InSubsystem);
49
50 // Default destructor
51 virtual ~FOnlineLeaderboardPico() = default;
52
53 // Begin IOnlineLeaderboard interface
54
69 virtual bool ReadLeaderboards(const TArray< TSharedRef<const FUniqueNetId> >& Players, FOnlineLeaderboardReadRef& ReadObject) override;
70
80 virtual bool ReadLeaderboardsForFriends(int32 LocalUserNum, FOnlineLeaderboardReadRef& ReadObject) override;
81
82 // Not supported. Always return false.
83 virtual bool ReadLeaderboardsAroundRank(int32 Rank, uint32 Range, FOnlineLeaderboardReadRef& ReadObject) override;
84
85 // Not supported. Always return false.
86 virtual bool ReadLeaderboardsAroundUser(TSharedRef<const FUniqueNetId> Player, uint32 Range, FOnlineLeaderboardReadRef& ReadObject) override;
87
88 // Not supported.
89 virtual void FreeStats(FOnlineLeaderboardRead& ReadObject) override;
90
102 virtual bool WriteLeaderboards(const FName& SessionName, const FUniqueNetId& Player, FOnlineLeaderboardWrite& WriteObject) override;
103
113 virtual bool FlushLeaderboards(const FName& SessionName) override;
114
115 // Not supported. Always return false.
116 virtual bool WriteOnlinePlayerRatings(const FName& SessionName, int32 LeaderboardId, const TArray<FOnlinePlayerScore>& PlayerScores) override;
117 // End IOnlineLeaderboard interface
118};
119#if ENGINE_MINOR_VERSION > 26
120typedef TSharedPtr<FOnlineLeaderboardPico, ESPMode::ThreadSafe> FOnlineLeaderboardPicoPtr;
121#elif ENGINE_MINOR_VERSION > 24
122#endif
123 // end of Leaderboard(OnlineSub) // end of Function
Definition: OnlineLeaderboardInterfacePico.h:29
virtual bool FlushLeaderboards(const FName &SessionName) override
Executes developer-defined functions.
virtual bool ReadLeaderboardsForFriends(int32 LocalUserNum, FOnlineLeaderboardReadRef &ReadObject) override
Gets the entries of the friends of the current logged-in user on a leaderboard.
virtual bool WriteLeaderboards(const FName &SessionName, const FUniqueNetId &Player, FOnlineLeaderboardWrite &WriteObject) override
Writes an entry to a leaderboard for the current logged-in user.
virtual bool ReadLeaderboards(const TArray< TSharedRef< const FUniqueNetId > > &Players, FOnlineLeaderboardReadRef &ReadObject) override
Gets the entries of a leaderboard.