private IEnumerator checkLogin(List <string> ids)
 {
     while (flag < ids.Count && ID == null)
     {
         yield return(1);
     }
     if (ID == null)
     {
         GameUser user = new GameUser();
         user.username = ids[0];
         user.password = ids[0];
         bmob.Signup <GameUser>(user, (resp, ex) => {
             if (ex != null)
             {
                 print("注册失败, 失败原因为: " + ex.Message);
                 return;
             }
             ID = ids[0];
             print("注册成功, ID:" + ID);
             bmob.Login <GameUser>(ID, ID, (resp1, exception) =>
             {
                 if (exception != null)
                 {
                     print("登录失败, 失败原因为: " + exception.Message);
                     return;
                 }
                 print("登录成功, ID:" + ID);
                 print("登录成功, 当前用户对象Session: " + BmobUser.CurrentUser.sessionToken);
             });
         });
     }
     else
     {
         bmob.Login <GameUser>(ID, ID, (resp, exception) =>
         {
             if (exception != null)
             {
                 print("登录失败, 失败原因为: " + exception.Message);
                 return;
             }
             print("登录成功, ID:" + ID);
             print("登录成功, 当前用户对象Session: " + BmobUser.CurrentUser.sessionToken);
         });
     }
 }
Exemple #2
0
    public void RigisterAccount()
    {
        if (userNameText.text == "")
        {
            tipText.text = "请输入用户名";
            return;
        }

        if (userCodeText.text == "")
        {
            tipText.text = "请输入密码";
            return;
        }

        if (userCodeIsOkText.text == "")
        {
            tipText.text = "请确认密码";
            return;
        }

        if (userCodeIsOkText.text != userCodeText.text)
        {
            tipText.text = "两次密码不一致!";
            return;
        }

        MyBmobUser user = new MyBmobUser();

        user.username = userNameText.text;
        user.password = userCodeText.text;
        Bmob.Signup <MyBmobUser>(user, (response, exception) => {
            if (exception != null)
            {
                print("注册失败" + exception);
                tipText.text = "注册失败";
                return;
            }

            print("注册成功");
            tipText.text = "注册成功";
            RigisterPanelHide();
        }
                                 );
    }
Exemple #3
0
    void Signup()
    {
        MyBmobUser user = new MyBmobUser();

        user.username = "******";
        user.password = "******";
        user.email    = "*****@*****.**";
        user.life     = 0;
        user.attack   = 0;

        Bmob.Signup <MyBmobUser> (user, (resp, exception) =>
        {
            if (exception != null)
            {
                print("注册失败, 失败原因为: " + exception.Message);
                return;
            }

            print("注册成功");
        });
    }