Space Plunder
Loading...
Searching...
No Matches
URequestGlobalStats Class Reference

#include <RequestGlobalStats.h>

Inheritance diagram for URequestGlobalStats:

Static Public Member Functions

static URequestGlobalStatsRequestGlobalStats (int32 HistoryInDays)
 

Public Attributes

FResponseRequestGlobalStatsDelegate onSuccess
 
FResponseRequestGlobalStatsDelegate onFailure
 

Private Member Functions

virtual void Activate () override
 
void OnGlobalStatsReceived (GlobalStatsReceived_t *pCallback, bool bIOFailure)
 

Private Attributes

int32 HistoryInDays = 0
 
CCallResult< URequestGlobalStats, GlobalStatsReceived_t > m_callRequestGlobalStats
 

Member Function Documentation

◆ Activate()

void URequestGlobalStats::Activate ( )
overrideprivatevirtual
17{
18 if (SteamAPI_Init())
19 {
20 SteamAPICall_t hSteamAPICall = SteamUserStats()->RequestGlobalStats(HistoryInDays);
22 }
23 else
24 {
25 GEngine->AddOnScreenDebugMessage(-1, 5.f, FColor::Red, TEXT("Failed to initialize the Steam API!"));
26
27 onFailure.Broadcast(EResult::k_EResultFail);
28 RemoveFromRoot();
29 }
30
31 return;
32}
FResponseRequestGlobalStatsDelegate onFailure
Definition RequestGlobalStats.h:44
void OnGlobalStatsReceived(GlobalStatsReceived_t *pCallback, bool bIOFailure)
Definition RequestGlobalStats.cpp:34
int32 HistoryInDays
Definition RequestGlobalStats.h:59
CCallResult< URequestGlobalStats, GlobalStatsReceived_t > m_callRequestGlobalStats
Definition RequestGlobalStats.h:62

◆ OnGlobalStatsReceived()

void URequestGlobalStats::OnGlobalStatsReceived ( GlobalStatsReceived_t * pCallback,
bool bIOFailure )
private
35{
36 if (!bIOFailure && pCallback->m_nGameID == SteamUtils()->GetAppID() && pCallback->m_eResult == EResult::k_EResultOK)
37 {
38 AsyncTask(ENamedThreads::GameThread, [this, pCallback]()
39 {
40 onSuccess.Broadcast(pCallback->m_eResult);
41 }
42 );
43
44 RemoveFromRoot();
45 }
46 else
47 {
48 GEngine->AddOnScreenDebugMessage(-1, 5.f, FColor::Red, TEXT("Failed to receive global stats!"));
49
50 onFailure.Broadcast(pCallback->m_eResult);
51 RemoveFromRoot();
52 }
53
54 return;
55}
FResponseRequestGlobalStatsDelegate onSuccess
Definition RequestGlobalStats.h:41

◆ RequestGlobalStats()

URequestGlobalStats * URequestGlobalStats::RequestGlobalStats ( int32 HistoryInDays)
static
8{
9 URequestGlobalStats* selfRef = NewObject<URequestGlobalStats>();
10
12
13 return selfRef;
14}
Definition RequestGlobalStats.h:36

Member Data Documentation

◆ HistoryInDays

int32 URequestGlobalStats::HistoryInDays = 0
private

◆ m_callRequestGlobalStats

CCallResult<URequestGlobalStats, GlobalStatsReceived_t> URequestGlobalStats::m_callRequestGlobalStats
private

◆ onFailure

FResponseRequestGlobalStatsDelegate URequestGlobalStats::onFailure

◆ onSuccess

FResponseRequestGlobalStatsDelegate URequestGlobalStats::onSuccess

The documentation for this class was generated from the following files: