//用于Unity下调试手写识别结果反馈
 public void TestHWRRec(string results)
 {
     AndroidUtil.Log("识别到的结果:" + results);
     if (results != null && results.Length >= 1)
     {
         WordHandler._instance.SetCharacter(results.Substring(0, 1));
     }
 }
 //手写模块识别结果回调,在Anroid那边调用
 public void OnGetRecResult(string results)
 {
     AndroidUtil.Log("识别到的结果:" + results);
     if (results != null && results.Length >= 1)
     {
         var resultArr = results.Split(';');
         if (resultArr.Length > 0)
         {
             WordHandler._instance.SetCharacter(resultArr[0]);
         }
     }
 }
    public static void PostUserInfo(MonoBehaviour behaviour)
    {
        var json    = JsonUtility.ToJson(UserInfoManager._instance.GetUserInfo());
        var iparams = new List <IMultipartFormSection>
        {
            new MultipartFormDataSection("token", Token),
            new MultipartFormDataSection("userInfo", json)
        };

        behaviour.StartCoroutine(PostInfo(PostUserInfoPath, iparams));
        AndroidUtil.Log(json);
    }
    public static void PostErrorWordInfos(MonoBehaviour behaviour)
    {
        var json    = JsonUtility.ToJson(new UserErrorWordInfos(ScoreManager._instance.errorWordList));
        var iparams = new List <IMultipartFormSection>
        {
            new MultipartFormDataSection("token", Token),
            new MultipartFormDataSection("userErrorWordInfos", json)
        };

        behaviour.StartCoroutine(PostInfo(PostErrorWordInfosPath, iparams));
        AndroidUtil.Log(json);
    }
    public static void PostUserLevelInfos(MonoBehaviour behaviour)
    {
        var json = JsonUtility.ToJson(new UserLevelInfoList(LevelDict.Instance.GetUserLevelInfos()));

        var iparams = new List <IMultipartFormSection>
        {
            new MultipartFormDataSection("token", Token),
            new MultipartFormDataSection("userLevelInfos", json)
        };

        behaviour.StartCoroutine(PostInfo(PostUserLevelInfosPath, iparams));
        AndroidUtil.Log(json);
    }
Exemple #6
0
    // Use this for initialization
    private void Awake()
    {
        if (GeneralUtils.IsStringEmpty(HttpUtil.Token))
        {
            BackHandler._instance.GoToLogin();
        }
        else
        {
            AndroidUtil.Log(HttpUtil.Token);
        }

        //soundSlider.interactable = false;
    }
    public void OnRequestSuccess(long responseCode, string response)
    {
        AndroidUtil.Log(response);
        if (responseCode == 200)
        {
            //加载关卡列表
            var levelInfos =
                JsonUtility.FromJson <UserLevelInfoList>(response);
            levelList = levelInfos.userLevelInfos;
            foreach (var levelInfo in levelList)
            {
                LevelDict.Instance.AddLevelInfo(levelInfo);
            }

            initLevelListItem();
        }
    }
    public void OnRequestSuccess(long responseCode, string response)
    {
        response = response.Remove(0, 1);
        AndroidUtil.Log(response);
        var responseInfo = JsonUtility.FromJson <ResponseInfo>(response);

        if (responseCode == 200)
        {
            HttpUtil.Token = responseInfo.attach;
            BackHandler._instance.GoToMain();
            AndroidUtil.Toast("注册成功");
        }
        else if (responseCode == 409)
        {
            AndroidUtil.Toast("用户名重复");
        }
    }
Exemple #9
0
    //网络请求成功回调
    public void OnRequestSuccess(long responseCode, string response)
    {
        AndroidUtil.Log(response);
        AdventureHandler._instance.isCalcTime = true;
        var infoArray = JsonUtility.FromJson <WordInfos>(GeneralUtils.JsonArrayToObject(response, "infos"));

        infos = infoArray.infos;
        for (var i = 0; i < gridNums; i++)
        {
            characterGrids[i].toggle.interactable = true;
        }

        //更新输入框中的信息
        UpdateWordInfo(infos[currentWord]);
        //显示手写识别模块
        GameSetting._instance.SetHWRModule(true);
//        AndroidUtil.Toast("该组长度:" + infos.Length);
    }
        /// <private/>
        public void DBClear()
        {
            if (this._armature != null)
            {
                this._armature = null;
                if (this._disposeProxy)
                {
                    try
                    {
                        var go = gameObject;
                        UnityFactoryHelper.DestroyUnityObject(gameObject);
                    }
                    catch (System.Exception e)
                    {
                        AndroidUtil.Log(e.Message);
                    }
                }
            }

            this.unityData     = null;
            this.armatureName  = null;
            this.animationName = null;
            this.isUGUI        = false;
            this.debugDraw     = false;

            this._disposeProxy = true;
            this._armature     = null;
            this._colorTransform.Identity();
            this._sortingMode      = SortingMode.SortByZ;
            this._sortingLayerName = "Default";
            this._sortingOrder     = 0;
            this._playTimes        = 0;
            this._timeScale        = 1.0f;
            this._zSpace           = 0.0f;
            this._flipX            = false;
            this._flipY            = false;

            this._hasSortingGroup = false;

            this._debugDrawer = null;

            this._armatureZ         = 0;
            this._closeCombineMeshs = false;
        }
Exemple #11
0
    public void UpdateWordInfo(WordInfo word)
    {
        currentCharacter = 0;
        pinYinArray      = word.Pinyin.Split(' ');
        characterArray   = word.Content.Split(' ');
        AndroidUtil.Log(
            "拼音: " + GeneralUtils.printArray(pinYinArray) +
            "\n内容: " + GeneralUtils.printArray(characterArray) +
            "\n详细: " + word.detail);
        for (var i = 0; i < pinYinArray.Length; i++)
        {
            characterGrids[i].pinyin.text  = pinYinArray[i];
            characterGrids[i].content.text = "";
        }

        currentPinYin.text            = pinYinArray[0];
        characterGrids[0].toggle.isOn = true;

        tipPinYin.text = infos[currentWord].Pinyin;
        tipDetail.text = "释义:" + infos[currentWord].Detail;
    }
Exemple #12
0
    public void OnRequestSuccess(long responseCode, string response)
    {
//        print(response);
        //TODO 后台返回数据时多加一个字符,需要删除
        response = response.Remove(0, 1);
        AndroidUtil.Log(response);

        if (responseCode == 200)
        {
            var userInfo = JsonUtility.FromJson <UserInfo>(response);
            UserInfoManager._instance.SetUserInfo(userInfo);
            UpdateUserInfo();
        }
        else if (responseCode == 403)
        {
//            print(response);
            var errorInfo = JsonUtility.FromJson <ResponseInfo>(response);
            AndroidUtil.Log(errorInfo.message);
            AndroidUtil.Toast("登录过期,请重新登录");
            BackHandler._instance.GoToLogin();
        }
    }