#include "LYWSDKPlatform.h"
static LYWSDKPlatform* _instance = NULL;
LYWSDKPlatform::LYWSDKPlatform():
_allCallBack(NULL)
{
}
LYWSDKPlatform::~LYWSDKPlatform()
{
if (_instance)
}
}
LYWSDKPlatform* LYWSDKPlatform::getInstance()
{
if (_instance == NULL)
{
_instance = new LYWSDKPlatform();
}
return _instance;
}
void LYWSDKPlatform::lywSDKCallBack(const char* callBackJsonMessage)
{
LYWSDKPlatform::getInstance()->_allCallBack(callBackJsonMessage);
}
void LYWSDKPlatform::init(char *jsonParam, LYWSDKCallBack callBack)
{
LYWSDKPlatform::getInstance()->_allCallBack = callBack;
LYWSDKPlatformManager::getInstance()->getProtocol()->initSDK(this, "lywSDKInit", jsonParam);
}
void LYWSDKPlatform::login(char *jsonParam)
{
LYWSDKPlatformManager::getInstance()->getProtocol()->callFunctionWithParam("login", jsonParam);
}
void LYWSDKPlatform::pay(char *jsonParam)
{
LYWSDKPlatformManager::getInstance()->getProtocol()->callFunctionWithParam("pay", jsonParam);
}
void LYWSDKPlatform::loop()
{
LYWSDKPlatformManager::getInstance()->getProtocol()->callFunctionWithParam("loop", NULL);
}
static LYWSDKPlatform* _instance = NULL;
LYWSDKPlatform::LYWSDKPlatform():
_allCallBack(NULL)
{
}
LYWSDKPlatform::~LYWSDKPlatform()
{
if (_instance)
{
free(&_allCallBack);
delete _instance;}
}
LYWSDKPlatform* LYWSDKPlatform::getInstance()
{
if (_instance == NULL)
{
_instance = new LYWSDKPlatform();
}
return _instance;
}
void LYWSDKPlatform::lywSDKCallBack(const char* callBackJsonMessage)
{
LYWSDKPlatform::getInstance()->_allCallBack(callBackJsonMessage);
}
void LYWSDKPlatform::init(char *jsonParam, LYWSDKCallBack callBack)
{
LYWSDKPlatform::getInstance()->_allCallBack = callBack;
if(LYWSDKPlatform::getInstance()->_allCallBack == NULL)
{
return;
}
LYWSDKPlatformManager::getInstance()->getProtocol()->initSDK(this, "lywSDKInit", jsonParam);
}
void LYWSDKPlatform::login(char *jsonParam)
{
LYWSDKPlatformManager::getInstance()->getProtocol()->callFunctionWithParam("login", jsonParam);
}
void LYWSDKPlatform::pay(char *jsonParam)
{
LYWSDKPlatformManager::getInstance()->getProtocol()->callFunctionWithParam("pay", jsonParam);
}
void LYWSDKPlatform::loop()
{
LYWSDKPlatformManager::getInstance()->getProtocol()->callFunctionWithParam("loop", NULL);
}
LYWSDK平台模块实现
本文介绍了一个名为LYWSDKPlatform的平台模块实现细节。该模块包含实例化、回调处理、初始化、登录及支付等功能,并通过JSON参数进行配置。此外还展示了如何与LYWSDKPlatformManager交互以执行核心功能。

被折叠的 条评论
为什么被折叠?



