Exemple #1
0
    public void onComplete(int action, object resp)
    {
        var act = (ActionType)action;

        switch (act)
        {
        case ActionType.GetCode:
            isSend = true;
            sendCodeBtn.interactable = false;

            break;

        case ActionType.CommitCode:

            var resp_data = JsonMapper.ToObject(resp.ToString());
            if (resp_data["phone"].ToString() != PhoneNumberInput.text)
            {
                CurrentScene.OpenView <LoadView>().SetText("手机号与验证码不匹配!");
                return;
            }
            UserBmobDao user_dao = new UserBmobDao(resp_data["phone"].ToString(), "");
            user_dao.FindByID((user) => {
                if (user != null)
                {
                    user_dao = user;
                    PlayerPrefs.SetString(GameConstData.LOGINING_PHONE_NUMBER, user_dao.id);
                    BmobManager.Instance.UserBmobDao = user_dao;
                    SaveManager.Instance.LoginType   = LoginType.短信;
                    LoadingScene.LoadScene(GameConstData.CHOOSE_ACTOR_SCENE_NAME);
                }
                else
                {
                    user_dao.Insert(() => {
                        PlayerPrefs.SetString(GameConstData.LOGINING_PHONE_NUMBER, user_dao.id);
                        BmobManager.Instance.UserBmobDao = user_dao;
                        SaveManager.Instance.LoginType   = LoginType.短信;
                        LoadingScene.LoadScene(GameConstData.CHOOSE_ACTOR_SCENE_NAME);
                    });
                }

                CurrentScene.CloseView <LoadView>();
            }, () => { CurrentScene.OpenView <LoadView>().SetText("登录失败,请检查网络设置"); });

            break;

        default:
            break;
        }
    }
Exemple #2
0
    public void ContinoueLogin()
    {
        CurrentScene.OpenView <LoadView>();
        UserBmobDao user_dao = new UserBmobDao(PlayerPrefs.GetString(GameConstData.LOGINING_PHONE_NUMBER), "");

        user_dao.FindByID((user) => {
            if (user != null)
            {
                user_dao = user;
                BmobManager.Instance.UserBmobDao = user_dao;
                SaveManager.Instance.LoginType   = LoginType.短信;
                LoadingScene.LoadScene(GameConstData.CHOOSE_ACTOR_SCENE_NAME);
            }
            else
            {
                CurrentScene.OpenView <LoadView>().SetText("登录失败! 没找到此用户");
                return;
            }
            CurrentScene.CloseView <LoadView>();
        }, () => { CurrentScene.OpenView <LoadView>().SetText("登录失败!请检查网络设置"); });
    }