/// <summary> /// 注册消息 /// </summary> /// <param name="msg"></param> /// <returns></returns> public SocketMsg <Dictionary <string, string> > ReqRegMsg(object msg) { UserInfo userinfo = msg as UserInfo; if (userinfo.Phone == "" || userinfo.Password == "") { // promptMsg.Change("请输入用户名和验证码", Color.white); promptMsg.Change(LanguageService.Instance.GetStringByKey("404", String.Empty), Color.white); Dispatch(AreaCode.UI, UIEvent.HINT_ACTIVE, promptMsg); return(null); } if (!MsgTool.CheckMobile(userinfo.Phone)) { // promptMsg.Change("请输入正确的手机号码", Color.white); promptMsg.Change(LanguageService.Instance.GetStringByKey("402", String.Empty), Color.white); Dispatch(AreaCode.UI, UIEvent.HINT_ACTIVE, promptMsg); return(null); } if (!MsgTool.CheckPass(userinfo.Password)) { // promptMsg.Change("8-16位字符,可包含数字,字母,下划线", Color.white); promptMsg.Change(LanguageService.Instance.GetStringByKey("408", String.Empty), Color.white); Dispatch(AreaCode.UI, UIEvent.HINT_ACTIVE, promptMsg); return(null); } if (!MsgTool.CheckNickName(userinfo.NickName)) { // promptMsg.Change("2-10位字符,可包含数字,字母,下划线,汉字", Color.white); promptMsg.Change(LanguageService.Instance.GetStringByKey("405", String.Empty), Color.white); Dispatch(AreaCode.UI, UIEvent.HINT_ACTIVE, promptMsg); return(null); } Dictionary <string, string> t = new Dictionary <string, string> { ["username"] = userinfo.Phone, ["userpass"] = MsgTool.MD5Encrypt(userinfo.Password), ["code"] = userinfo.Identity, ["nick"] = userinfo.NickName, ["invite"] = userinfo.InviteCode }; messageData.Change("consumer/player", SocketEventType.Regist, t); Debug.LogError(LoginInfo.ClientId); socketMsg.Change(LoginInfo.ClientId, "注册操作", messageData); return(socketMsg); }
/// <summary> /// 注册消息 /// </summary> /// <param name="msg"></param> /// <returns></returns> public SocketMsg ReqRegMsg(object msg) { UserInfo userinfo = msg as UserInfo; if (userinfo.Phone == "" || userinfo.Password == "") { promptMsg.Change("请输入用户名和验证码", Color.red); Dispatch(AreaCode.UI, UIEvent.HINT_ACTIVE, promptMsg); return(null); } if (!MsgTool.CheckMobile(userinfo.Phone)) { promptMsg.Change("请输入正确的手机号码", Color.red); Dispatch(AreaCode.UI, UIEvent.HINT_ACTIVE, promptMsg); return(null); } if (!MsgTool.CheckPass(userinfo.Password)) { promptMsg.Change("8-16位字符,可包含数字,字母,下划线", Color.red); Dispatch(AreaCode.UI, UIEvent.HINT_ACTIVE, promptMsg); return(null); } if (!MsgTool.CheckNickName(userinfo.NickName)) { promptMsg.Change("2-10位字符,可包含数字,字母,下划线,汉字", Color.red); Dispatch(AreaCode.UI, UIEvent.HINT_ACTIVE, promptMsg); return(null); } MessageData messageData = new MessageData(); messageData.t = new Dictionary <string, string> { ["username"] = userinfo.Phone, ["userpass"] = userinfo.Password, ["code"] = userinfo.Identity, ["nick"] = userinfo.NickName, ["invite"] = userinfo.InviteCode }; messageData.model = "consumer"; messageData.type = "reg"; Debug.LogError(LoginInfo.ClientId); SocketMsg socketMsg = new SocketMsg(LoginInfo.ClientId, "注册操作", messageData); return(socketMsg); }