private void CreateResponse(int result) { if (result == -1) { promptMsg.Change("Illegal Login", Color.red); Dispatch(AreaCode.UI, UIEvent.PROMPT_MSG, promptMsg); //TODO 应该强制跳转到登录界面或退出游戏 } else if (result == -2) { promptMsg.Change("Repeat Create User", Color.red); Dispatch(AreaCode.UI, UIEvent.PROMPT_MSG, promptMsg); //TODO 重复创建应该关闭创建面板 } else if (result == -3) { promptMsg.Change("Name Is Exist", Color.red); Dispatch(AreaCode.UI, UIEvent.PROMPT_MSG, promptMsg); } if (result == 0) { //create successfully Dispatch(AreaCode.UI, UIEvent.CREATE_PANEL_ACTIVE, false); socketmsg.Change(OpCode.USER, UserCode.GET_INFO_CREQ, null); Dispatch(AreaCode.NET, 0, socketmsg); } }
/// <summary> /// 开始游戏的广播处理 /// </summary> private void startBro() { promptMsg.Change("所有玩家准备开始游戏", Color.blue); Dispatch(AreaCode.UI, UIEvent.PROMPT_MSG, promptMsg); //开始游戏 隐藏状态面板的准备文字 Dispatch(AreaCode.UI, UIEvent.PLAYER_HIDE_STATE, null); }
/// <summary> /// 登录按钮的点击事件处理 /// </summary> private void loginClick() { if (string.IsNullOrEmpty(usernameInput.text)) { promptMsg.Change("登录的用户名不能为空!", Color.red); Dispatch(AreaCode.UI, UIEvent.PROMPT_MSG, promptMsg); return; } if (string.IsNullOrEmpty(passwordInput.text)) { promptMsg.Change("登录的密码不能为空!", Color.red); Dispatch(AreaCode.UI, UIEvent.PROMPT_MSG, promptMsg); return; } if (passwordInput.text.Length < 4 || passwordInput.text.Length > 16) { promptMsg.Change("登录的密码长度不合法,应该在4-16个字符之内!", Color.red); Dispatch(AreaCode.UI, UIEvent.PROMPT_MSG, promptMsg); return; } UserDto dto = new UserDto(usernameInput.text, passwordInput.text); socketMsg.Change(OpCode.User, UserCode.LOGIN, dto); Dispatch(AreaCode.NET, 0, socketMsg); //本地记录用户的相关信息 PlayerPrefs.SetString("username", usernameInput.text); PlayerPrefs.SetString("password", passwordInput.text); }
/// <summary> /// 注册按钮的点击事件处理 /// </summary> private void registClick() { if (string.IsNullOrEmpty(inputAccount.text)) { promptMsg.Change("注册的用户名不能为空!", Color.red); Dispatch(AreaCode.UI, UIEvent.PROMPT_MSG, promptMsg); return; } if (string.IsNullOrEmpty(inputPassword.text) || inputPassword.text.Length < 4 || inputPassword.text.Length > 16) { promptMsg.Change("注册的密码不合法!", Color.red); Dispatch(AreaCode.UI, UIEvent.PROMPT_MSG, promptMsg); return; } if (string.IsNullOrEmpty(inputRepeat.text) || inputRepeat.text != inputPassword.text) { promptMsg.Change("请确保两次输入的密码一致!", Color.red); Dispatch(AreaCode.UI, UIEvent.PROMPT_MSG, promptMsg); return; } AccountDto dto = new AccountDto(inputAccount.text, inputPassword.text); socketMsg.Change(OpCode.ACCOUNT, AccountCode.REGIST_CREQ, dto); Dispatch(AreaCode.NET, 0, socketMsg); }
public void RegistClick() { if (string.IsNullOrEmpty(inputAcc.text)) { promptMsg.Change("Account cannot be empty !", Color.red); Dispatch(AreaCode.UI, UIEvent.PROMPT_MSG, promptMsg); return; } if (string.IsNullOrEmpty(inputPwd.text) || string.IsNullOrEmpty(inputPwd2.text)) { promptMsg.Change("Password cannot be empty !", Color.red); Dispatch(AreaCode.UI, UIEvent.PROMPT_MSG, promptMsg); return; } if (inputPwd.text.Length < 4 || inputPwd.text.Length > 16) { promptMsg.Change("Password is invalid !", Color.red); Dispatch(AreaCode.UI, UIEvent.PROMPT_MSG, promptMsg); return; } if ((inputPwd2.text != inputPwd.text)) { promptMsg.Change("The two passwords you typed do not match", Color.red); Dispatch(AreaCode.UI, UIEvent.PROMPT_MSG, promptMsg); return; } AccountDto dto = new AccountDto(inputAcc.text, inputPwd.text); socketMsg.Change(OpCode.ACCOUNT, AccountCode.REGIST_CREQ, dto); Dispatch(AreaCode.NET, 0, socketMsg); CloseClick(); }
void LoginClick() { if (string.IsNullOrEmpty(inputAccount.text)) { promptMsg.Change("用户名不能为空", Color.red); Dispatch(AreaCode.UI, UIEvent.PROMPT_MSG, promptMsg); Debug.Log("帐号不能为空!"); return; } if (string.IsNullOrEmpty(inputPsaaword.text)) { promptMsg.Change("密码不能为空", Color.red); Dispatch(AreaCode.UI, UIEvent.PROMPT_MSG, promptMsg); Debug.Log("密码不能为空"); return; } if (inputPsaaword.text.Length < 4 || inputPsaaword.text.Length > 16) { promptMsg.Change("密码长度应该在4-16位之间", Color.red); Dispatch(AreaCode.UI, UIEvent.PROMPT_MSG, promptMsg); Debug.Log("密码长度应该在4-16位之间"); return; } AccountDto dto = new AccountDto(inputAccount.text, inputPsaaword.text); socketMsg.Change(OpCode.ACCOUNT, AccountCode.LOGIN, dto); Dispatch(AreaCode.NET, 0, socketMsg); }
/// <summary> /// 登录按钮的点击事件处理 /// </summary> private void loginClick() { if (string.IsNullOrEmpty(inputAccount.text)) { promptMsg.Change("登录的用户名不能为空!", Color.red); Dispatch(AreaCode.UI, UIEvent.PROMPT_MSG, promptMsg); return; } if (string.IsNullOrEmpty(inputPassword.text)) { promptMsg.Change("登录的密码不能为空!", Color.red); Dispatch(AreaCode.UI, UIEvent.PROMPT_MSG, promptMsg); return; } if (inputPassword.text.Length < 4 || inputPassword.text.Length > 16) { promptMsg.Change("登录的密码长度不合法,应该在4-16个字符之内!", Color.red); Dispatch(AreaCode.UI, UIEvent.PROMPT_MSG, promptMsg); return; } AccountDto dto = new AccountDto(inputAccount.text, inputPassword.text); socketMsg.Change(OpCode.ACCOUNT, AccountCode.LOGIN, dto); Dispatch(AreaCode.NET, 0, socketMsg); }
/// <summary> /// 注册按钮的点击事件处理 /// </summary> private void RegisterClick() { if (string.IsNullOrEmpty(usernameInput.text)) { promptMsg.Change("注册的用户名不能为空!", Color.red); Dispatch(AreaCode.UI, UIEvent.PROMPT_MSG, promptMsg); return; } if (string.IsNullOrEmpty(passwordInput.text) || passwordInput.text.Length < 4 || passwordInput.text.Length > 16) { promptMsg.Change("注册的密码不合法!", Color.red); Dispatch(AreaCode.UI, UIEvent.PROMPT_MSG, promptMsg); return; } if (string.IsNullOrEmpty(repasswordInput.text) || repasswordInput.text != passwordInput.text) { promptMsg.Change("请确保两次输入的密码一致!", Color.red); Dispatch(AreaCode.UI, UIEvent.PROMPT_MSG, promptMsg); return; } //UserDto dto = new UserDto(usernameInput.text, passwordInput.text); socketMsg.Change(OpCode.User, UserCode.REGIST_CREQ, dto); dto.username = usernameInput.text; dto.password = passwordInput.text; socketMsg.OpCode = OpCode.User; socketMsg.SubCode = UserCode.REGIST_CREQ; socketMsg.Value = dto; Dispatch(AreaCode.NET, 0, socketMsg); }
private void LoginBtnOnClick() { string acc = accountTxt.text; string pwd = pwdTxt.text; //输入校验 if (string.IsNullOrEmpty(acc)) { promptMsg.Change("账号不能为空", Color.red); Dispatch(AreaCode.UI, UIEvent.PROMPT_PANEL_SHOW, promptMsg); return; } if (string.IsNullOrEmpty(pwd)) { promptMsg.Change("密码不能为空", Color.red); Dispatch(AreaCode.UI, UIEvent.PROMPT_PANEL_SHOW, promptMsg); return; } if (pwd.Length < 4 || pwd.Length > 16) { promptMsg.Change("密码长度不合法", Color.red); Dispatch(AreaCode.UI, UIEvent.PROMPT_PANEL_SHOW, promptMsg); return; } AccountDto accountDto = new AccountDto(acc, pwd); msg.Change(OpCode.ACCOUNT, AccountSubCode.LOGIN_CREQ, accountDto); Dispatch(AreaCode.NET, NetEvent.SENDMSG, msg); }
/// <summary> /// register response /// </summary> /// <param name="result"></param> private void registResponse(int result) { switch (result) { case 0: promptMsg.Change("Sign Up Successful!", Color.green); Dispatch(AreaCode.UI, UIEvent.PROMPT_MSG, promptMsg); break; case -1: promptMsg.Change("Error:Account already exist!", Color.red); Dispatch(AreaCode.UI, UIEvent.PROMPT_MSG, promptMsg); break; case -2: promptMsg.Change("Error:Account is invalid!", Color.red); Dispatch(AreaCode.UI, UIEvent.PROMPT_MSG, promptMsg); break; case -3: promptMsg.Change("Error:Passord is invalid", Color.red); Dispatch(AreaCode.UI, UIEvent.PROMPT_MSG, promptMsg); break; default: break; } }
public void Login() { if (string.IsNullOrEmpty(inputAccount.text)) { promptMsg.Change("Username cannot be empty!", Color.red); Dispatch(AreaCode.UI, UIEvent.PROMPT_MSG, promptMsg); return; } if (string.IsNullOrEmpty(inputPassword.text)) { promptMsg.Change("Password cannot be empty!", Color.red); Dispatch(AreaCode.UI, UIEvent.PROMPT_MSG, promptMsg); return; } if (inputPassword.text.Length < 4 || inputPassword.text.Length > 16) { promptMsg.Change("Password is invalid", Color.red); Dispatch(AreaCode.UI, UIEvent.PROMPT_MSG, promptMsg); return; } AccountDto dto = new AccountDto(inputAccount.text, inputPassword.text); socketMsg.Change(OpCode.ACCOUNT, AccountCode.LOGIN, dto); Dispatch(AreaCode.NET, 0, socketMsg); }
/// <summary> /// 登录按钮的点击事件处理 /// </summary> private void loginClick() { // 若用户名输入为空 if (string.IsNullOrEmpty(inputAccount.text)) { promptMsg.Change("用户名输入为空", Color.red); Dispatch(AreaCode.UI, UIEvent.PROMPT_MSG, promptMsg); return; } // 若密码输入为空 if (string.IsNullOrEmpty(inputPassword.text)) { promptMsg.Change("密码输入为空", Color.red); Dispatch(AreaCode.UI, UIEvent.PROMPT_MSG, promptMsg); return; } // 若密码输入不是4到16位 if (inputPassword.text.Length < 4 || inputPassword.text.Length > 16) { promptMsg.Change("密码输入不是4到16位", Color.red); Dispatch(AreaCode.UI, UIEvent.PROMPT_MSG, promptMsg); return; } //需要和服务器交互了 AccountDto dto = new AccountDto(inputAccount.text, inputPassword.text); socketMsg.Change(OpCode.ACCOUNT, AccountCode.LOGIN, dto); Dispatch(AreaCode.NET, 0, socketMsg); }
//AccountDto dto = new AccountDto(); //SocketMsg socketMsg = new SocketMsg(); private void OnbtnRegist() { if (string.IsNullOrEmpty(inputAccount.text)) { promptMsg.Change("注册的用户名不能为空", Color.red); Dispatch(AreaCode.UI, UIEvent.PROMPT_MSG, promptMsg); return; } if (string.IsNullOrEmpty(inputPassword.text) || inputPassword.text.Length < 4 || inputPassword.text.Length > 16) { promptMsg.Change("注册的密码不合法", Color.red); Dispatch(AreaCode.UI, UIEvent.PROMPT_MSG, promptMsg); return; } if (string.IsNullOrEmpty(inputRepeat.text) || inputRepeat.text != inputPassword.text) { promptMsg.Change("请确保两次输入的密码一致", Color.red); Dispatch(AreaCode.UI, UIEvent.PROMPT_MSG, promptMsg); return; } AccountDto dto = new AccountDto(inputAccount.text, inputPassword.text); socketMsg.Change(OpCode.ACCOUNT, AccountCode.REGIST_CREQ, dto); //dto.Account = inputAccount.text; //dto.Password = inputPassword.text; //socketMsg.OpCode = OpCode.ACCOUNT; //socketMsg.SubCode = AccountCode.REGIST_CREQ; //socketMsg.Value = dto; Dispatch(AreaCode.NET, 0, socketMsg); }
/// <summary> /// 创建角色的响应 /// </summary> /// <param name="result"></param> private void CreateResponse(int result) { if (result == -1) { promptMsg.Change("角色当前非法登录!", Color.red); Dispatch(AreaCode.UI, UIEvent.PROMPT_MSG, promptMsg); //TODO 应该强制跳转到登录界面或退出游戏 } else if (result == -2) { promptMsg.Change("重复创建角色", Color.red); Dispatch(AreaCode.UI, UIEvent.PROMPT_MSG, promptMsg); //TODO 重复创建应该关闭创建面板 } else if (result == -3) { promptMsg.Change("名字已被使用", Color.red); Dispatch(AreaCode.UI, UIEvent.PROMPT_MSG, promptMsg); } else if (result == 0) { //创建成功 Dispatch(AreaCode.UI, UIEvent.CREATE_PANEL_ACTIVE, false); socketMsg.Change(OpCode.USER, UserCode.GET_INFO_CREQ, null); Dispatch(AreaCode.NET, 0, socketMsg); } }
/// <summary> /// 收到进入匹配房间广播信息 /// </summary> /// <param name="matchRoom"></param> private void EnterBro(UserDto newUser) { Models.gameModel.matchRoomDto.Add(newUser); // TODO 进行UI更新 // 给用户一个提示 promptMsg.Change("有新玩家(" + newUser.Name + ")进入", Color.green); Dispatch(AreaCode.UI, UIEvent.PROMPT_MSG, promptMsg); }
/// <summary> /// 要了一张牌 /// </summary> /// <param name="dto"></param> private void getCard(CardDto dto) { //增加 Dispatch(AreaCode.CHARACTER, CharacterEvent.GET_PLAYER_CARD, dto); if (dto == null) { promptMsg.Change("已经21点,不能要牌", Color.red); Dispatch(AreaCode.UI, UIEvent.PROMPT_MSG, promptMsg); } }
/// <summary> /// 注册响应 /// </summary> /// <param name="value"></param> private void Register(string value) { if (value == "账号已经存在") { promptMsg.Change("账号已经存在", Color.red); Dispatch(AreaCode.UI, UIEvent.PROMPT_PANEL_SHOW, promptMsg); return; } if (value == "输入的账号不合法") { promptMsg.Change("输入的账号不合法", Color.red); Dispatch(AreaCode.UI, UIEvent.PROMPT_PANEL_SHOW, promptMsg); return; } if (value == "密码长度不合法") { promptMsg.Change("密码长度不合法", Color.red); Dispatch(AreaCode.UI, UIEvent.PROMPT_PANEL_SHOW, promptMsg); return; } if (value == "注册成功") { promptMsg.Change("注册成功", Color.green); Dispatch(AreaCode.UI, UIEvent.PROMPT_PANEL_SHOW, promptMsg); return; } }
private void dealResponse(int result) { if (result == -1) { promptMsg.Change("Deal too small", Color.red); Dispatch(AreaCode.UI, UIEvent.PROMPT_MSG, promptMsg); Debug.Log("Deal too small"); Dispatch(AreaCode.UI, UIEvent.SHOW_DEAL_BUTTON, true); } else if (result == 0) { Dispatch(AreaCode.UI, UIEvent.SHOW_DEAL_BUTTON, false); } }
/// <summary> /// 服务器发回不出的响应 /// </summary> /// <param name="result"></param> private void nDealResponse(int result) { //玩家可以不出牌,隐藏按钮 if (result == 0) { Dispatch(AreaCode.UI, UIEvent.SHOW_DEAL_BUTTON, false); //播放音效 Dispatch(AreaCode.AUDIO, AudioEvent.PLAY_EFFECT_AUDIO, "Fight/Woman_buyao1"); } else if (result == -1)//玩家是最大出牌者,不可以不出牌 { //提示必须出牌 Dispatch(AreaCode.UI, UIEvent.SHOW_DEAL_BUTTON, true); promptMsg.Change("你的出牌回合必须出牌", Color.red); Dispatch(AreaCode.UI, UIEvent.PROMPT_MSG, promptMsg); } }
/// <summary> /// 登录响应 /// </summary> private void loginResponse(int result) { switch (result) { case 0: //跳转场景 LoadSceneMsg msg = new LoadSceneMsg(1, () => { //向服务器获取信息 SocketMsg socketMsg = new SocketMsg(OpCode.USER, UserCode.GET_INFO_CREQ, null); Dispatch(AreaCode.NET, 0, socketMsg); }); Dispatch(AreaCode.SENCE, SceneEvent.LOAD_SCENE, msg); break; case -1: promptMsg.Change("账号不存在", Color.red); Dispatch(AreaCode.UI, UIEvent.PROMPT_MSG, promptMsg); break; case -2: promptMsg.Change("账号密码不匹配", Color.red); Dispatch(AreaCode.UI, UIEvent.PROMPT_MSG, promptMsg); break; case -3: promptMsg.Change("帐号在线", Color.red); Dispatch(AreaCode.UI, UIEvent.PROMPT_MSG, promptMsg); break; default: break; } }
/// <summary> /// 登录响应 /// </summary> private void loginResponse(int result) { switch (result) { case 0: //跳转场景 LoadSceneMsg msg = new LoadSceneMsg(1, delegate() { //TODO //向服务器获取信息 Debug.Log("加载完成!"); }); Dispatch(AreaCode.SCENE, SceneEvent.LOAD_SCENE, msg); break; case -1: promptMsg.Change("账号不存在", Color.red); Dispatch(AreaCode.UI, UIEvent.PROMPT_MSG, promptMsg); break; case -2: promptMsg.Change("账号在线", Color.red); Dispatch(AreaCode.UI, UIEvent.PROMPT_MSG, promptMsg); break; case -3: promptMsg.Change("账号密码不匹配", Color.red); Dispatch(AreaCode.UI, UIEvent.PROMPT_MSG, promptMsg); break; default: break; } }
void CreateClick() { if (string.IsNullOrEmpty(InputName.text)) { promptMsg.Change("Nickname cannot be empty", Color.red); Dispatch(AreaCode.UI, UIEvent.PROMPT_MSG, promptMsg); return; } if (InputName.text.Length > 8) { promptMsg.Change("Nickname length cannot longer than 8 !", Color.red); Dispatch(AreaCode.UI, UIEvent.PROMPT_MSG, promptMsg); return; } socketMsg.Change(OpCode.USER, UserCode.CREATE_CREQ, InputName.text); Dispatch(AreaCode.NET, 0, socketMsg); }
void CreateClick() { if (string.IsNullOrEmpty(InputName.text)) { //非法输入 promptMsg.Change("名字不能为空", Color.red); Dispatch(AreaCode.UI, UIEvent.PROMPT_MSG, promptMsg); return; } if (InputName.text.Length > 8) { promptMsg.Change("名字最长为8位数", Color.red); Dispatch(AreaCode.UI, UIEvent.PROMPT_MSG, promptMsg); return; } //向服务器发送创建请求 socketMsg.Change(OpCode.USER, UserCode.CREATE_CREQ, InputName.text); Dispatch(AreaCode.NET, 0, socketMsg); }
private void GameStart() { //1、游戏开始 关闭准备面板 Dispatch(AreaCode.UI, UIEvent.READY_PANEL_ACTIVE, false); promptMsg.Change("游戏开始了", Color.green); Dispatch(AreaCode.UI, UIEvent.PROMPT_MSG, promptMsg); //2、通知游戏模块开始游戏初始化 Dispatch(AreaCode.GAME, GameEvent.GAME_START, null); }
void DestroyPlayer(object value) { PlayerDto playerDto = value as PlayerDto; GameObject tempPlayer = GameObject.Find(playerNames[playerDto.color - 1]); //1、发送玩家击败的消息 promptMsg.Change(tempPlayer.transform.Find("UserName").GetComponentInChildren <Text>().text + "已经被击败了", Color.green); MsgCenter.Instance.Dispatch(AreaCode.UI, UIEvent.PROMPT_MSG, promptMsg); //2、控制玩家的坦克消失 Destroy(tempPlayer); }
private void onbtnCreateClick() { if (string.IsNullOrEmpty(iptName.text)) { promptMsg.Change("请输入正确的用户名", Color.red); Dispatch(AreaCode.UI, UIEvent.PROMPT_PANEL_SHOW, promptMsg); return; } //向服务器发送创建用户请求 //TODO Dispatch(AreaCode.NET, NetEvent.SENDMSG, new SocketMsg(OpCode.USER, UserSubCode.CREATE_USER_CREQ, iptName.text)); }
private void createClick() { if (string.IsNullOrEmpty(inputName.text)) { //非法输入 promptMsg.Change("请正确输入您的名称", Color.red); Dispatch(AreaCode.UI, UIEvent.PROMPT_MSG, promptMsg); return; } //自身处理:进行一些其他的判断 比如 长度 符号。。。 }
private void OnbtnLogin() { if (string.IsNullOrEmpty(inputAccount.text)) { promptMsg.Change("登录的用户名不能为空", Color.red); Dispatch(AreaCode.UI, UIEvent.PROMPT_MSG, promptMsg); return; } if (string.IsNullOrEmpty(inputPassword.text) || inputPassword.text.Length < 4 || inputPassword.text.Length > 16) { promptMsg.Change("登录的密码不合法", Color.red); Dispatch(AreaCode.UI, UIEvent.PROMPT_MSG, promptMsg); return; } AccountDto dto = new AccountDto(inputAccount.text, inputPassword.text); //SocketMsg socketMsg = new SocketMsg(OpCode.ACCOUNT, AccountCode.LOGIN, dto); socketMsg.Change(OpCode.ACCOUNT, AccountCode.LOGIN, dto); Dispatch(AreaCode.NET, 0, socketMsg); }
private void enterBro(MultiEnterDto multiEnterDto) { if (isEnter) { //更新房间数据 MutiRoomDto room = Models.GameModel.MutiRoomDto; room.Add(multiEnterDto.userDto, multiEnterDto.position); //给UI绑定数据 switch (multiEnterDto.position) { case 1: Dispatch(AreaCode.UI, UIEvent.SET_1_PLAYER_DATA, multiEnterDto.userDto); break; case 2: Dispatch(AreaCode.UI, UIEvent.SET_2_PLAYER_DATA, multiEnterDto.userDto); break; case 3: Dispatch(AreaCode.UI, UIEvent.SET_3_PLAYER_DATA, multiEnterDto.userDto); break; case 4: Dispatch(AreaCode.UI, UIEvent.SET_4_PLAYER_DATA, multiEnterDto.userDto); break; default: break; } //发消息 显示玩家的状态面板所有游戏物体 Dispatch(AreaCode.UI, UIEvent.MULTI_PLAYER_ENTER, multiEnterDto.userDto.Id); //给用户一个提示 promptMsg.Change("有新玩家 ( " + multiEnterDto.userDto.Name + " )进入", UnityEngine.Color.blue); Dispatch(AreaCode.UI, UIEvent.PROMPT_MSG, promptMsg); } //进来一个显示一个 }
/// <summary> /// 注册按钮的点击事件处理 /// </summary> private void registClick() { // 若用户名输入为空 if (string.IsNullOrEmpty(inputAccount.text)) { promptMsg.Change("用户名输入为空", Color.red); Dispatch(AreaCode.UI, UIEvent.PROMPT_MSG, promptMsg); return; } // 若密码输入为空 if (string.IsNullOrEmpty(inputPassword.text)) { promptMsg.Change("密码输入为空", Color.red); Dispatch(AreaCode.UI, UIEvent.PROMPT_MSG, promptMsg); return; } // 若密码输入不是4到16位 if (inputPassword.text.Length < 4 || inputPassword.text.Length > 16) { promptMsg.Change("密码输入不是4到16位", Color.red); Dispatch(AreaCode.UI, UIEvent.PROMPT_MSG, promptMsg); return; } // 若重复输入密码不相同 if (!inputPassword.text.Equals(inputRepeat.text)) { promptMsg.Change("两次输入密码不相同", Color.red); Dispatch(AreaCode.UI, UIEvent.PROMPT_MSG, promptMsg); return; } //需要和服务器交互了 AccountDto dto = new AccountDto(inputAccount.text, inputPassword.text); socketMsg.Change(OpCode.ACCOUNT, AccountCode.REGIST_CREQ, dto); Dispatch(AreaCode.NET, 0, socketMsg); }