C++ Buy Now Button
From J2Play
On the gameplay splash screen, when the game has expired, or wherever you would like the option to unlock the full game to be made available, you will want to display a 'Buy Now' button that calls the j2play API:
Playground::SwitchToStoreTab();
This will pause the current game, taking the user directly to the Store to allow them to purchase/unlock the full game.
After the user switches back to your game, in the GameResume event handler, you need to add following DRM check code to check the DRM status, and lock/unlock your game according it.
Note: You need to intergrate the DRM client first and include "DRMClient.h".
void CAppGameFrameWnd::msgResume()
{
unsigned int result = J2Play::DRMClient::GetInstance()->Check();
if (result == J2Play::DRMClient::DRM_UNLOCK)
{
// TODO: Unlock your game here
}
else
{
// TODO: Lock your game here
// if result == J2Play::DRMClient::DRM_FAILURE,
// you can get the error message by J2Play::DRMClient::GetInstance()->GetMessage()
}
}
After calling the “Playground::SwitchToStoreTab()” function the game will switch to the buy page for that game.
