void Login() { Bmob.Login <MyBmobUser> ("test", "123456", (resp, exception) => { if (exception != null) { print("登录失败, 失败原因为: " + exception.Message); return; } print("登录成功, @" + resp.username + "(" + resp.life + ")$[" + resp.sessionToken + "]"); print("登录成功, 当前用户对象Session: " + BmobUser.CurrentUser.sessionToken); }); }
public void LoginAccount() { if (userNameText.text == "") { tipText.text = "请输入用户名"; return; } if (userCodeText.text == "") { tipText.text = "请输入密码"; return; } Bmob.Login <MyBmobUser>(userNameText.text, userCodeText.text, (response, exception) => { if (exception != null) { print("登录失败" + exception); tipText.text = "登录失败"; return; } print("登录成功"); //保存用户登录的数据objectId PlayerPrefs.SetString("objectId", response.objectId); tipText.text = "登录成功"; UnityEngine.SceneManagement.SceneManager.LoadScene(1); } ); }
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); }); } }