void OnLoginClick() { if (string.IsNullOrEmpty(inputAccount.text)) { promptMsg.Text = "用户名不能为空!"; promptPanel.PromptMessage(promptMsg); return; } if (string.IsNullOrEmpty(inputPassword.text)) { promptMsg.Text = "密码不能为空!"; promptPanel.PromptMessage(promptMsg); return; } if (inputPassword.text.Length < 4 || inputPassword.text.Length > 16) { promptMsg.Text = "密码长度错误!应在4~16个字符之间"; promptPanel.PromptMessage(promptMsg); return; } UserInfo userInfo = new UserInfo { Account = inputAccount.text, Password = inputPassword.text }; //给服务端发送数据 NetManager.Instance.Send(new SocketMsg { OpCode = (int)MsgType.Account, SubCode = (int)MsgType.Login, value = userInfo }); }
private void OnRegistClick() { if (string.IsNullOrEmpty(inputAccount.text)) { promptMsg.Text = "用户名不能为空!"; promptPanel.PromptMessage(promptMsg); return; } if (string.IsNullOrEmpty(inputPassword.text)) { promptMsg.Text = "密码不能为空!"; promptPanel.PromptMessage(promptMsg); return; } if (inputPassword.text.Length < 4 || inputPassword.text.Length > 16) { promptMsg.Text = "密码长度错误!应在4~16个字符之间"; promptPanel.PromptMessage(promptMsg); return; } if (string.IsNullOrEmpty(inputPasswordRepeat.text) || inputPasswordRepeat.text != inputPassword.text) { promptMsg.Text = "请确保两次输入的密码一致!"; promptPanel.PromptMessage(promptMsg); return; } UserInfo userInfo = new UserInfo { Account = inputAccount.text, Password = inputPassword.text }; NetManager.Instance.Send(new SocketMsg { OpCode = (int)MsgType.Account, SubCode = (int)MsgType.Registe, value = userInfo }); }