The PC SDK provides APIs to integrate popups into your game. Pop-ups supported by PC SDK include automatic, manual, news, coupon, and community.
The PC SDK provides data for popups to the game. The game creates a pop-up view using the provided data.
Each popup is defined as follows.
In order to use the PC SDK popup API, the metadata registration of the popup integrated with Partners must be preceded.
To communicate with the PC SDK using the pop-up API, the game must define a callback function to connect to the callback pointer of the StovePCCallback
structure below.
struct StovePCCallback
{
void(*OnError)(const StovePCError error);
void(*OnInitComplete)();
void(*OnToken)(const StovePCToken token);
void(*OnUser)(const StovePCUser user);
void(*OnOwnership)(int size, StovePCOwnership* ownership);
/// Callback called when GetAutoPopup processing is complete
void(*OnAutoPopup)(int size, StovePCAutoPopup* autoPopup, int headerSize, StovePCPopupRequestHeader* header);
/// Callback called when GetManualPopup processing is complete
void(*OnManualPopup)(int size, StovePCManualPopup* manualPopup, int headerSize, StovePCPopupRequestHeader* header);
/// Callback called when GetNewsPopup processing is complete
void(*OnNewsPopup)(StovePCNewsPopup newsPopup, int headerSize, StovePCPopupRequestHeader* header);
/// Callback called when GetCouponPopup processing is complete
void(*OnCouponPopup)(StovePCCouponPopup couponPopup, int headerSize, StovePCPopupRequestHeader* header);
/// Callback called when GetCommunityPopup processing is complete
void(*OnCommunityPopup)(StovePCCommunityPopup communityPopup, int cookieSize, StovePCPopupRequestCookie* cookie);
};
Connect the callback function to the callback pointer of the StovePCCallback
structure as in Config, Callbak setting
.
// Create StovePCCallback structure instance
StovePCCallback callback;
// Initialize all function pointers to NULL
memset(&callback, 0, sizeof(StovePCCallback));
// Link implemented function pointers
callback.OnError = OnMyErrorCallback; /* Callback function defined globally */
callback.OnInitComplete = OnMyInitCompleteCallback; /* Callback function defined globally */
callback.OnToken = OnMyTokenCallback; /* Callback function defined globally */
callback.OnUser = OnMyUserInfoCallback; /* Callback function defined globally */
callback.OnOwnership = OnMyOwnershipCallback; /* Callback function defined globally */
// pop-up
callback.OnAutoPopup = OnMyAutoPopup; /* Callback function defined globally */
callback.OnManualPopup = OnMyManualPopup; /* Callback function defined globally */
callback.OnNewsPopup = OnMyNewsPopup; /* Callback function defined globally */
callback.OnCouponPopup = OnMyCouponPopup; /* Callback function defined globally */
callback.OnCommunityPopup = OnMyCommunityPopup; /*Callback function defined globally*
You are not required to implement the OnAutoPopup
, OnManualPopup
, OnNewsPopup
, OnCouponPopup
, OnCommunityPopup
callbacks.
All you need to do is implement and connect only the callback function that is necessary for the popup used in the game.
Set game world and character information with StovePC_SetGameProfile
function.
Set information is used in pop-ups, so it must be set before using pop-ups.
The validity of the game profile is not checked separately. Therefore, you must enter the correct value by proceeding with validation (null) when entering.
The entered game profile is only valid for the life cycle of PCSDK.