/// <summary> /// 点击开始游戏按钮事件处理 /// </summary> private void OnBtnBeginGameClickEventHanlder() { //创建角色界面 if (m_bIsCreateRole) { RoleOperation_CreateRoleProto proto = new RoleOperation_CreateRoleProto(); proto.JobId = (byte)m_currentJobId; proto.RoleNickName = m_uiSceneSelectRoleView.RoleNameInputField.text; //角色昵称合法性检查 if (string.IsNullOrEmpty(proto.RoleNickName)) { UIMessageCtr.Instance.Show("提示", "请输入你的昵称"); return; } //把创建的角色信息发送到服务端 NetWorkSocket.Instance.SendMsg(proto.ToArray()); } //选人界面 else { //开始已有角色逻辑 RoleOperation_EnterGameProto proto = new RoleOperation_EnterGameProto(); proto.RoleId = this.m_currentRoleId; //把角色编号发送给服务器 NetWorkSocket.Instance.SendMsg(proto.ToArray()); } }
/// <summary> /// 点击进入游戏按钮 /// </summary> private void OnClickEnterGameButton() { //创建角色界面点击进入游戏 if (isCreateRole) { if (string.IsNullOrEmpty(selectRoleView.NickNameInput.text)) { MessageCtrl.Instance.Show("创建角色提示", "昵称不能为空"); return; } RoleOperation_CreateRoleProto proto = new RoleOperation_CreateRoleProto(); proto.JobID = m_JobList[selectIndex].Id; proto.NickName = selectRoleView.NickNameInput.text; NetWorkSocket.Instance.SendMsg(proto.ToArray()); } //选择界面点击进入游戏 else { RoleOperation_EnterGameProto proto = new RoleOperation_EnterGameProto(); proto.RoleID = CurrentRoleID; NetWorkSocket.Instance.SendMsg(proto.ToArray()); } }