PICO Unreal Platform SDK
OnlineLeaderboardInterfacePico.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
15#pragma once
16
17#include "CoreMinimal.h"
18#include "OnlineSubsystemPico.h"
19#include "Interfaces/OnlineLeaderboardInterface.h"
20#include "OnlineIdentityPico.h"
21#include "OnlineSubsystemPicoPackage.h"
22
23#define WRITE_LEADERBOARDS_PAGEINDEX FName(TEXT("WRITELEADERBOARDSPAGEINDEX"))
24#define WRITE_LEADERBOARDS_PAGESIZE FName(TEXT("WRITELEADERBOARDSPAGESIZE"))
25
40class FOnlineLeaderboardPico : public IOnlineLeaderboards
41{
42private:
43
44 // Reference to the owning subsystem
45 FOnlineSubsystemPico& PicoSubsystem;
46
47 bool ReadPicoLeaderboards(bool bOnlyFriends, bool bOnlyLoggedInUser, FOnlineLeaderboardReadRef& ReadObject);
48 void OnReadLeaderboardsComplete(ppfMessageHandle Message, bool bIsError, bool bOnlyFriends, bool bOnlyLoggedInUser, const FOnlineLeaderboardReadRef& ReadObject);
49
50 const char* FilterTypeNames[4] = { "None", "Friends", "Unknown", "UserIds" };
51 const char* StartAtNames[4] = { "Top", "CenteredOnViewer", "CenteredOnViewerOrTop", "Unknown" };
52
53 static void SaveLog(const ELogVerbosity::Type Verbosity, const FString& Log);
54
55public:
56 const int MAX_REQUEST_SIZE = 100; // single max
57 int ReadIndex = 0;
58
59 //Constructor * @param InSubsystem - A reference to the owning subsystem
60 FOnlineLeaderboardPico(FOnlineSubsystemPico& InSubsystem);
61
62 // Default destructor
63 virtual ~FOnlineLeaderboardPico() = default;
64
65 // Begin IOnlineLeaderboard interface
66
81 virtual bool ReadLeaderboards(const TArray< TSharedRef<const FUniqueNetId> >& Players, FOnlineLeaderboardReadRef& ReadObject) override;
82
92 virtual bool ReadLeaderboardsForFriends(int32 LocalUserNum, FOnlineLeaderboardReadRef& ReadObject) override;
93
94 // Not supported. Always return false.
95 virtual bool ReadLeaderboardsAroundRank(int32 Rank, uint32 Range, FOnlineLeaderboardReadRef& ReadObject) override;
96
97 // Not supported. Always return false.
98 virtual bool ReadLeaderboardsAroundUser(TSharedRef<const FUniqueNetId> Player, uint32 Range, FOnlineLeaderboardReadRef& ReadObject) override;
99
100 // Not supported.
101 virtual void FreeStats(FOnlineLeaderboardRead& ReadObject) override;
102
114 virtual bool WriteLeaderboards(const FName& SessionName, const FUniqueNetId& Player, FOnlineLeaderboardWrite& WriteObject) override;
115
125 virtual bool FlushLeaderboards(const FName& SessionName) override;
126
127 // Not supported. Always return false.
128 virtual bool WriteOnlinePlayerRatings(const FName& SessionName, int32 LeaderboardId, const TArray<FOnlinePlayerScore>& PlayerScores) override;
129 // End IOnlineLeaderboard interface
130};
131#if ENGINE_MINOR_VERSION > 26
132typedef TSharedPtr<FOnlineLeaderboardPico, ESPMode::ThreadSafe> FOnlineLeaderboardPicoPtr;
133#elif ENGINE_MINOR_VERSION > 24
134#endif
135 // end of Leaderboard(OnlineSub) // end of Function
Definition: OnlineLeaderboardInterfacePico.h:41
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.