示例#1
0
    public void LoadFromJSON(SupportedKeyboardsServerJSONResponse serverJSONResponse)
    {
        this.keyboards = new List <SupportedKeyboard>();

        for (int i = 0; i < serverJSONResponse.keyboards.Length; i++)
        {
            SupportedKeyboard aKeyboard = new SupportedKeyboard(serverJSONResponse.keyboards[i].name);

            for (int j = 0; j < serverJSONResponse.keyboards[i].skins.Length; j++)
            {
                SupportedSkin aSkin = new SupportedSkin(serverJSONResponse.keyboards[i].skins[j].name);
                aKeyboard.skins.Add(aSkin);
            }

            this.keyboards.Add(aKeyboard);
        }
    }
    public BridgeEnums.EGetSupportedKeyboardsErrorCode GetSupportedKeyboards(ref SupportedKeyboards sk)
    {
        unsafe
        {
            fixed(byte *responseBufferPtr = &responseBuffer[0])
            {
                UGetSupportedKeyboards(responseBufferPtr, responseBufferSize);
            }

            responseAsString = System.Text.Encoding.ASCII.GetString(responseBuffer, 0, responseBuffer.Length);
        }

        // Parse json message we received:
        supportedKeyboardsServerResponse = JsonUtility.FromJson <SupportedKeyboardsServerJSONResponse>(responseAsString);

        if ((BridgeEnums.EGetSupportedKeyboardsErrorCode)supportedKeyboardsServerResponse.error_code == BridgeEnums.EGetSupportedKeyboardsErrorCode.SUCCESS)
        {
            sk.LoadFromJSON(supportedKeyboardsServerResponse);
        }

        return((BridgeEnums.EGetSupportedKeyboardsErrorCode)supportedKeyboardsServerResponse.error_code);
    }