010-SDK框架之LYWSDKPlatform.cpp

来源:互联网 发布:centos 升级glibc 编辑:程序博客网 时间:2024/05/17 03:32
#include "LYWSDKPlatform.h"

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);
}
原创粉丝点击