Skip to main content

System

1. Overview

The System module provides some relatively scattered APIs and events.

2. APIs and Events

2.1 OnTssHandled

When some apis are called, if the api requires TSS information, this event will be triggered, and the game needs to fill TSS information in this event. Detailed information about TSS can be found in the documentation TSS Addon and TSS Developer Doc.

/**
* OnTssHandled:
* When some apis are called, if the api requires TSS information, this event will be triggered, and the game needs to fill TSS information in this event.
*
* @param In Contextual information of the API.
* @param Out TSS information that needs to be filled.
*/
DECLARE_DELEGATE_TwoParams(FOnTssHandled, const FClientTssHandledIn& /*In*/, FClientTssHandledOut& /*Out*/);
FOnTssHandled& OnTssHandled() { return TssHandledDelegate; }

2.2 OnGameCustomMsg

The event will be triggered when the game calls the HTTP API 'PushMsg'.

/**
* OnGameCustomMsg:
* The event will be triggered when the game calls the HTTP API 'PushMsg'.
*
* @param Event Info of the event.
*/
DECLARE_MULTICAST_DELEGATE_OneParam(FOnGameCustomMsg, const FClientGameCustomMsgEvt& /*Event*/);
FOnGameCustomMsg& OnGameCustomMsg() { return GameCustomMsgDelegate; }

2.3 GetServerTime

After logged in, you can get the current UTC time of the server in seconds.

Interface prototype:

/**
* Get the current UTC time of the server in seconds.
*
* @return The current UTC time of the server in seconds. The return value is 0 before logging in.
*/
int64 GetServerTime() const;

Example Code:

#include "PgosSDKCpp.h"

void SomeUObjectClass::SomeFunction()
{
auto System = IPgosSDKCpp::Get().GetClientSystemAPI();
if (System)
{

System->GetServerTime([]() {
if (Ret.err_code == (int32)Pgos::PgosErrCode::kSuccess)
{
UE_LOG(LogTemp, Log, TEXT("GetServerTime Success"));
}
else
{
UE_LOG(LogTemp, Log, TEXT("GetServerTime Failed: err_code=%d, err_msg=%s"), Ret.err_code, *Ret.msg);
}
});
}
}