/// <summary> /// 登录 /// </summary> /// <param name="userName"></param> /// <param name="password"></param> private void Login(string userName, string password) { if (userName == "") { PopupManager.ShowTimerPopUp("username is null"); return; } Debug.Log(userName + "," + password); byte[] result = Encoding.Default.GetBytes(password); //tbPass为输入密码的文本框 MD5 md5 = new MD5CryptoServiceProvider(); byte[] output = md5.ComputeHash(result); string pswMD5 = BitConverter.ToString(output).Replace("-", ""); //tbMd5pass为输出加密文本的文本框 Dictionary <string, string> dic = new Dictionary <string, string> { { "appID", appConfig.appID }, { "channelID", appConfig.channelID }, { "username", userName }, { "psw", pswMD5 } }; // dic.Add("email", "*****@*****.**"); StartCoroutine(ClientHttp.getInstance().POST(appConfig.asdkUrl + "/account/login", dic, LoginResult)); // wai 注册地址:http://host:port/account/register 请求方式:POST PopupManager.AddWindow(PopupWindowName.WAITING_NET); }
/// <summary> /// 游客登录 /// </summary> private void GuestLogin() { Dictionary <string, string> dic = new Dictionary <string, string> { { "appID", appConfig.appID }, { "channelID", appConfig.channelID } }; StartCoroutine(ClientHttp.getInstance().POST(appConfig.asdkUrl + "/account/guest", dic, GuestLoginResult)); PopupManager.AddWindow(PopupWindowName.WAITING_NET); }
private void LoginCenter(string userId, string userName, string token) { if (userName == "") { PopupManager.ShowTimerPopUp("username is empty"); return; } // Debug.Log(userName + "." + userID); Dictionary <string, string> dic = new Dictionary <string, string> { { "userId", userId }, { "token", token }, { "platform", appConfig.appID }, { "channel", appConfig.channelID } }; // dic.Add("email", "*****@*****.**"); StartCoroutine(ClientHttp.getInstance().POST(appConfig.centerUrl + "/user/certify", dic, LoginCenterResult)); // waiwang 注册地址:http://host:port/account/register 请求方式:POST }
/// <summary> /// 注册 /// </summary> /// <param name="userName"></param> /// <param name="password"></param> /// <param name="passwordAgain"></param> private void Register(string userName, string password, string passwordAgain) { if (userName == "") { PopupManager.ShowTimerPopUp("username is null"); return; } else if (password != passwordAgain) { PopupManager.ShowTimerPopUp("password passwordAgain not same"); return; } Dictionary <string, string> dic = new Dictionary <string, string> { { "appID", appConfig.appID }, { "channelID", appConfig.channelID }, { "username", userName }, { "psw", password } }; StartCoroutine(ClientHttp.getInstance().POST(appConfig.asdkUrl + "/account/register", dic, RegisterResult)); }