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