#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);
}