void OnLoginSuc(U8LoginResult result)
    {
        if (!result.isSuc)
        {
            txtState.text = "登录失败";
            return;
        }

        if (result.isSwitchAccount)
        {
            txtState.text = "切换帐号成功:" + result.token;
        }
        else
        {
            txtState.text = "登录成功:" + result.token;
        }
    }
    //登录成功回调
    public void OnLoginSuc(string jsonData)
    {
        UnityEngine.Debug.LogError("Callback->OnLoginSuc");

        U8LoginResult data = parseLoginResult(jsonData);

        if (data == null)
        {
            UnityEngine.Debug.LogError("The data parse error." + jsonData);
            return;
        }

        if (U8SDKInterface.Instance.OnLoginSuc != null)
        {
            U8SDKInterface.Instance.OnLoginSuc.Invoke(data);
        }
    }
    private U8LoginResult parseLoginResult(string str)
    {
        object jsonParsed = MiniJSON.Json.Deserialize(str);

        if (jsonParsed != null)
        {
            Dictionary <string, object> jsonMap = jsonParsed as Dictionary <string, object>;
            U8LoginResult data = new U8LoginResult();
            if (jsonMap.ContainsKey("isSuc"))
            {
                data.isSuc = bool.Parse(jsonMap["isSuc"].ToString());
            }
            if (jsonMap.ContainsKey("isSwitchAccount"))
            {
                data.isSwitchAccount = bool.Parse(jsonMap["isSwitchAccount"].ToString());
            }
            if (jsonMap.ContainsKey("userID"))
            {
                data.userID = jsonMap["userID"].ToString();
            }
            if (jsonMap.ContainsKey("sdkUserID"))
            {
                data.sdkUserID = jsonMap["sdkUserID"].ToString();
            }
            if (jsonMap.ContainsKey("username"))
            {
                data.username = jsonMap["username"].ToString();
            }

            if (jsonMap.ContainsKey("sdkUsername"))
            {
                data.sdkUsername = jsonMap["sdkUsername"].ToString();
            }
            if (jsonMap.ContainsKey("token"))
            {
                data.token = jsonMap["token"].ToString();
            }

            return(data);
        }

        return(null);
    }