Space Plunder
Loading...
Searching...
No Matches
DownloadLeaderboard.h
Go to the documentation of this file.
1// Fill out your copyright notice in the Description page of Project Settings.
2
3#pragma once
4#pragma warning(disable:4996)
5#pragma warning(disable:4265)
6#pragma warning(disable:4701)
7
8#include "CoreMinimal.h"
9#include "SteamRequests.h"
10#include "Kismet/BlueprintAsyncActionBase.h"
11#pragma push_macro("ARRAY_COUNT")
12#undef ARRAY_COUNT
13
14#if USING_CODE_ANALYSIS
15MSVC_PRAGMA(warning(push))
16MSVC_PRAGMA(warning(disable : ALL_CODE_ANALYSIS_WARNINGS))
17#endif
18
19#include "OnlineSubsystem.h"
20#include "OnlineSubsystemSteam.h"
21#include <steam/steam_api.h>
22
23#include "LeaderboardData.h"
24
25#if USING_CODE_ANALYSIS
26MSVC_PRAGMA(warning(pop))
27#endif
28
29#pragma pop_macro("ARRAY_COUNT")
30#include "DownloadLeaderboard.generated.h"
31
33DECLARE_DYNAMIC_MULTICAST_DELEGATE_TwoParams(FResponseDownloadLeaderboardDelegate, const TArray<FSteamLeaderboardEntry>&, LeaderboardResults, int32, SteamErrorOutput);
34
36UCLASS()
37class STATSINTEGRATION_API UDownloadLeaderboard : public UBlueprintAsyncActionBase
38{
39 GENERATED_BODY()
40
41public:
42 UPROPERTY(BlueprintAssignable)
43 FResponseDownloadLeaderboardDelegate OnSuccess;
44
45 UPROPERTY(BlueprintAssignable)
46 FResponseDownloadLeaderboardDelegate OnFailure;
47
48 // Asks the Steam back-end for a set of rows in the leaderboard.
49 // This call is asynchronous, with the result returned in LeaderboardScoresDownloaded_t
50 // LeaderboardScoresDownloaded_t will contain a handle to pull the results from GetDownloadedLeaderboardEntries() (below)
51 // You can ask for more entries than exist, and it will return as many as do exist.
52 // k_ELeaderboardDataRequestGlobal requests rows in the leaderboard from the full table, with nRangeStart & nRangeEnd in the range [1, TotalEntries]
53 // k_ELeaderboardDataRequestGlobalAroundUser requests rows around the current user, nRangeStart being negate
54 // e.g. DownloadLeaderboardEntries( hLeaderboard, k_ELeaderboardDataRequestGlobalAroundUser, -3, 3 ) will return 7 rows, 3 before the user, 3 after
55 // k_ELeaderboardDataRequestFriends requests all the rows for friends of the current user
56 UFUNCTION(BlueprintCallable, meta = (BlueprintInternalUseOnly = "true"), Category = "Simple Steam Stats & Achievements")
57 static UDownloadLeaderboard* DownloadLeaderboard(const FSteamLeaderboardHandle Handle, const ESteamLeaderboardDataRequest RequestType, const int32 Start, const int32 End);
58
59 // as above, but downloads leaderboard entries for an arbitrary set of users - ELeaderboardDataRequest is k_ELeaderboardDataRequestUsers
60 // if a user doesn't have a leaderboard entry, they won't be included in the result
61 // a max of 100 users can be downloaded at a time, with only one outstanding call at a time
62 // UFUNCTION(BlueprintCallable, meta = (BlueprintInternalUseOnly = "true"), Category = "Simple Steam Stats & Achievements")
63 // virtual UDownloadLeaderboard* DownloadLeaderboardEntriesForUsers(const FSteamLeaderboardHandle Handle, CSteamID *prgUsers, const int32 Users);
64
65private:
66 FOnlineSubsystemSteam* SteamSubsystem;
67 virtual void Activate() override;
68
69 void DownloadLeaderboardEntries();
70
71 FSteamLeaderboardHandle LeaderboardHandle;
72 FString LeaderboardName;
74 int32 RangeStart;
75 int32 RangeEnd;
76
77 TArray<FSteamLeaderboardEntry> SteamLeaderboardResults;
78
79 void OnLeaderboardDownloaded(LeaderboardScoresDownloaded_t* pLeaderboardScoresDownloaded, bool bIOFailure);
80 CCallResult<UDownloadLeaderboard, LeaderboardScoresDownloaded_t> m_callDownloadResult;
81};
UCLASS(Blueprintable, BlueprintType, ClassGroup=(BucciGames), meta=(BlueprintSpawnableComponent)) class CHATSYSTEM_API UChatSystemComponent
Definition ChatSystemComponent.h:13
DECLARE_DYNAMIC_MULTICAST_DELEGATE_TwoParams(FResponseDownloadLeaderboardDelegate, const TArray< FSteamLeaderboardEntry > &, LeaderboardResults, int32, SteamErrorOutput)
ESteamLeaderboardDataRequest
Definition LeaderboardData.h:37
Definition DownloadLeaderboard.h:38
Definition LeaderboardData.h:11
Definition LeaderboardData.h:68