Exemplo n.º 1
0
    private void EventGetGamecenterDataCallback()
    {
        GameDataResponse gameDataResponse = new GameDataResponse();

        gameDataResponse.setData(buffer, 4);
        EventGetGamecenterDataAct(gameDataResponse);
    }
Exemplo n.º 2
0
    private void EventGetMessageBoxCallback()
    {
        GameDataResponse gameDataResponse = new GameDataResponse();

        gameDataResponse.setData(buffer, 4);
        EventGetMessageBoxAct(gameDataResponse);
    }
Exemplo n.º 3
0
    private void EventRemoveAccountCallback()
    {
        GameDataResponse gameDataResponse = new GameDataResponse();

        gameDataResponse.setData(buffer, 4);
        EventRemoveAccountAct(gameDataResponse);
    }
Exemplo n.º 4
0
    private void EventGetDeviceAndSocialCoreDataCallback()
    {
        GameDataResponse gameDataResponse = new GameDataResponse();

        gameDataResponse.setData(buffer, 4);
        EventGetDeviceAndSocialCoreDataAct(gameDataResponse);
    }
Exemplo n.º 5
0
    //调用操作id
    public GameDataResponse DoStoreOperation(string jsonData)
    {
        byte[] byteArray = System.Text.Encoding.Default.GetBytes(jsonData);
        //int len = 1024 * 2048;
        //byte[] ys = new byte[len];

        if (buffer == null)
        {
            buffer = new byte[len];
        }

        for (int i = 0; i < len; i++)
        {
            buffer[i] = 0;
        }

        Array.Copy(byteArray, buffer, byteArray.Length);
        buffer[byteArray.Length] = 0;

        doOfflineOperation(32760, buffer, len);

        GameDataResponse gameDataResponse = new GameDataResponse();

        gameDataResponse.setData(buffer, 0);
        return(gameDataResponse);
    }
Exemplo n.º 6
0
    //登录回调接口
    private void LoginDataCallback()
    {
        GameDataResponse gameDataResponse = new GameDataResponse();

        gameDataResponse.setData(buffer, 4);

        GameDataResponse loginDataResponse = new GameDataResponse();

        if (gameDataResponse.code != 0)
        {
            loginDataResponse.code    = gameDataResponse.code;
            loginDataResponse.data    = "";
            loginDataResponse.message = "Login Failed!";
            Debug.Log("login exception : " + gameDataResponse.data);
            Debug.Log("login exception : " + gameDataResponse.message);
        }
        else
        {
            byte[] ys = new byte[2048];
            getGameConstData(ys, 2048);
            GameConstData gameConstData = new GameConstData();
            gameConstData.setData(ys, 0);

            loginDataResponse.code     = gameDataResponse.code;
            loginDataResponse.data     = CombineJsonMethod(gameConstData.userId, gameConstData.sceneId, gameConstData.token);
            loginDataResponse.message  = "Login Successful!";
            loginDataResponse.gameData = gameDataResponse.data;
            //loginDataResponse.notify = gameDataResponse.notify;
        }

        loginDataAct(loginDataResponse);
    }
Exemplo n.º 7
0
    //-999冲突回调接口
    private void ConflictDataCallback()
    {
        GameDataResponse conflictDataResponse = new GameDataResponse();

        conflictDataResponse.setData(buffer, 4);

        //notify game to handle response.
        conflictDataAct(conflictDataResponse);
    }
Exemplo n.º 8
0
    //数据刷新函数,回调接口
    private void GameDataCallback()
    {
        GameDataResponse gameDataResponse = new GameDataResponse();

        gameDataResponse.setData(buffer, 4);

        //notify game to handle response.
        gameDataAct(gameDataResponse);
    }
Exemplo n.º 9
0
    //调用操作id
    public GameDataResponse DoOfflineOperation(int operationCode)
    {
        byte[] ys = new byte[2048];
        doOfflineOperation(operationCode, ys, 2048);
        GameDataResponse gameDataResponse = new GameDataResponse();

        gameDataResponse.setData(ys, 0);
        return(gameDataResponse);
    }
Exemplo n.º 10
0
    public GameDataResponse DoOfflineOperationByKey(string key, string val)
    {
        Encoding e = Encoding.GetEncoding("UTF-8");

        e.Clone();
        byte[] pKey     = e.GetBytes(key);
        byte[] pTempKey = new byte[pKey.Length + 10];
        int    jj       = 0;

        for (jj = 0; jj < pKey.Length; jj++)
        {
            pTempKey[jj] = pKey[jj];
        }
        pTempKey[jj] = 0;

        Encoding ee = Encoding.GetEncoding("UTF-8");

        ee.Clone();
        byte[] pVal     = ee.GetBytes(val);
        byte[] pTempVal = new byte[pVal.Length + 10];
        int    ii       = 0;

        for (ii = 0; ii < pVal.Length; ii++)
        {
            pTempVal[ii] = pVal[ii];
        }
        pTempVal[ii] = 0;

        if (buffer == null)
        {
            buffer = new byte[len];
        }

        //byte[] ys = new byte[2048 * 1024];
        for (int i = 0; i < len; i++)
        {
            buffer[i] = 0;
        }

        GameDataResponse gameDataResponse = new GameDataResponse();

        doOfflineOperationByKey(pTempKey, pTempVal, buffer);
        gameDataResponse.setData(buffer, 0);
        return(gameDataResponse);
    }
Exemplo n.º 11
0
    //加载游戏数据,id默认为-1
    public GameDataResponse LoadGameData()
    {
        if (buffer == null)
        {
            buffer = new byte[len];
        }

        for (int i = 0; i < len; i++)
        {
            buffer[i] = 0;
        }
        //byte[] ys = new byte[1024 * 2048];
        doOfflineOperation(-1, buffer, 1024 * 2048);
        GameDataResponse gameDataResponse = new GameDataResponse();

        gameDataResponse.setData(buffer, 0);
        return(gameDataResponse);
    }