Example #1
0
        //客户端离开房间
        private void Leave(MyClientPeer client)
        {
            //获取离开房间用户的信息
            AccountModel accountModel = chatCache.Leave(client);

            if (accountModel == null)
            {
                return;
            }
            //创建Dto以用来传输数据
            AccountDto accountDto = new AccountDto()
            {
                AccountName = accountModel.AccountName, Password = accountModel.Password
            };

            response.Parameters[80] = RoomCode.Leave;
            response.Parameters[0]  = LitJson.JsonMapper.ToJson(accountDto);
            RoomModel room = chatCache.GetRoomModel();

            //群发给房间其他人,自己要离开
            foreach (var item in room.clientAccountDict.Keys)
            {
                SendResponseToClient(item, response, string.Format("用户 {0} 离开房间", accountDto.AccountName), 0);
            }
        }
Example #2
0
        //获取在线客户端的玩家模型
        public AccountModel GetAccountModel(MyClientPeer client)
        {
            AccountModel model = null;

            clientModelDict.TryGetValue(client, out model);
            return(model);
        }
Example #3
0
        //客户端还有对应的用户模型加入房间
        public RoomModel Enter(MyClientPeer client, AccountModel model)
        {
            if (room.Contains(client))
            {
                return(null);
            }

            room.Add(client, model);
            return(room);
        }
Example #4
0
 //玩家上线
 public void OnLine(MyClientPeer client, string accountName, string password)
 {
     foreach (AccountModel accountModel in accountModelList)
     {
         if (accountModel.AccountName == accountName && accountModel.Password == password)
         {
             clientModelDict.Add(client, accountModel);
             return;
         }
     }
 }
Example #5
0
        //客户端发出聊天信息
        private void Talk(MyClientPeer client, string contentStr)
        {
            AccountModel accountModel = Factory.accountCache.GetAccountModel(client);
            RoomModel    room         = chatCache.GetRoomModel();

            response.Parameters[80] = RoomCode.Talk;
            response.Parameters[0]  = string.Format("{0} : {1}", accountModel.AccountName, contentStr);
            foreach (var item in room.clientAccountDict.Keys)
            {
                SendResponseToClient(item, response);
            }
        }
Example #6
0
        //客户端离开房间,返回对应的用户模型
        public AccountModel Leave(MyClientPeer client)
        {
            if (!room.clientAccountDict.ContainsKey(client))
            {
                return(null);
            }

            AccountModel model = room.clientAccountDict[client];

            room.clientAccountDict.Remove(client);      //从房间模型中剔除这个客户端和其对应的用户模型
            return(model);
        }
Example #7
0
 //注册处理
 private void Register(MyClientPeer client, AccountDto account)
 {
     response.Parameters[80] = AccountCode.Register;
     if (accountCache.Contain(account.AccountName))
     {
         SendResponseToClient(client, response, "该帐号已经存在", -1);
     }
     else
     {
         accountCache.Add(account.AccountName, account.Password);
         SendResponseToClient(client, response, "注册成功", 0);
     }
     return;
 }
Example #8
0
        //处理客户端请求处理
        public override void OnRequest(MyClientPeer client, byte subCode, OperationRequest request)
        {
            //获取发送请求的用户模版信息
            AccountDto dto = JsonMapper.ToObject <AccountDto>(request.Parameters[0].ToString()) as AccountDto;

            switch ((AccountCode)subCode)
            {
            case AccountCode.Login:
                Login(client, dto);
                break;

            case AccountCode.Register:
                Register(client, dto);
                break;
            }
        }
Example #9
0
        //客户端进入房间
        private void Enter(MyClientPeer client)
        {
            AccountModel account = Factory.accountCache.GetAccountModel(client);
            RoomModel    room    = chatCache.Enter(client, account);

            //房间获取失败
            if (room == null)
            {
                SendResponseToClient(client, response, "进入房间失败", -1);
                return;
            }

            //进入成功,创建房间模型
            RoomDto roomDto = new RoomDto();

            //获取当前房间所有客户端,发送给客户端
            foreach (var item in room.clientAccountDict.Values)
            {
                roomDto.AccountList.Add(new AccountDto()
                {
                    AccountName = item.AccountName, Password = item.Password
                });
            }
            response.Parameters[80] = RoomCode.Enter;
            response.Parameters[0]  = LitJson.JsonMapper.ToJson(roomDto);
            SendResponseToClient(client, response, "进入房间成功", 0);

            //把这个新来的用户信息告诉房间内的其他客户端
            AccountDto accountDto = new AccountDto()
            {
                AccountName = account.AccountName, Password = account.Password
            };

            response.Parameters[80] = RoomCode.Add;
            response.Parameters[0]  = LitJson.JsonMapper.ToJson(accountDto);
            foreach (var item in room.clientAccountDict.Keys)
            {
                if (item == client)     //除了他自己不发送
                {
                    continue;
                }
                SendResponseToClient(item, response, "新的客户端进入房间", 0);
            }
        }
Example #10
0
        //处理客户端发来的请求
        public override void OnRequest(MyClientPeer client, byte subCode, OperationRequest request)
        {
            switch ((RoomCode)subCode)
            {
            //请求进入房间
            case RoomCode.Enter:
                Enter(client);
                break;

            //发出聊天信息
            case RoomCode.Talk:
                string contentString = request.Parameters[0].ToString();
                Talk(client, contentString);
                break;

            case RoomCode.Leave:
                client.Disconnect();
                break;
            }
        }
Example #11
0
 //登录处理
 private void Login(MyClientPeer client, AccountDto account)
 {
     response.Parameters[80] = AccountCode.Login;
     if (!accountCache.Contain(account.AccountName))
     {
         SendResponseToClient(client, response, "该帐号不存在", -1);
     }
     else if (!accountCache.IsMatch(account.AccountName, account.Password))
     {
         SendResponseToClient(client, response, "帐号密码不匹配", -2);
     }
     else if (accountCache.IsOnline(account.AccountName))
     {
         SendResponseToClient(client, response, "玩家已经在线", -3);
     }
     else
     {
         accountCache.OnLine(client, account.AccountName, account.Password);
         SendResponseToClient(client, response, "登陆成功", 0);
     }
 }
Example #12
0
        public override void OnOperationRequest(OperationRequest operationRequest, SendParameters sendParameters,
                                                ClientPeer clientPeer)
        {
            Dictionary <byte, object> data = operationRequest.Parameters;
            string            username     = DictUtil.GetValue(data, (byte)ParameterCode.Username) as string;
            string            password     = DictUtil.GetValue(data, (byte)ParameterCode.Password) as string;
            IUserDAO          dao          = new IUserDAOImpl();
            Users             u            = new Users(username, password);
            OperationResponse resp         = new OperationResponse(operationRequest.OperationCode);

            resp.ReturnCode = (short)(dao.Verify(u) ? ReturnCode.LoginSuccess : ReturnCode.LoginFailed);
            if (resp.ReturnCode == (short)ReturnCode.LoginSuccess)
            {
                MyClientPeer peer = clientPeer as MyClientPeer;
                if (peer != null)
                {
                    peer.username = username;
                }
            }

            clientPeer.SendOperationResponse(resp, sendParameters);
        }
Example #13
0
 public override void OnOperationRequest(OperationRequest operationRequest, SendParameters sendParameters, MyClientPeer peer)
 {
     throw new NotImplementedException();
 }
Example #14
0
 //断开连接时
 public override void OnDisconnect(MyClientPeer client)
 {
     Leave(client);
 }
Example #15
0
 //是否包含客户端
 public bool Contains(MyClientPeer client)
 {
     return(clientAccountDict.ContainsKey(client));
 }
Example #16
0
 //添加客户端及其对应的用户到房间
 public void Add(MyClientPeer client, AccountModel model)
 {
     clientAccountDict.Add(client, model);
 }
Example #17
0
 public abstract void doResponse(OperationRequest operationRequest, SendParameters sendParameters, MyClientPeer peer);
Example #18
0
        public override void doResponse(OperationRequest operationRequest, SendParameters sendParameters, MyClientPeer peer)
        {
            Dictionary <byte, object> responseParameter = new Dictionary <byte, object>();

            try
            {
                //获取并查询用户
                Dictionary <byte, object> parameters = operationRequest.Parameters;
                String userName   = (String)DictionaryUtils.getValue <byte, object>(parameters, (byte)ParameterCode.UserName);
                int    cardsSetId = (int)DictionaryUtils.getValue <byte, object>(parameters, (byte)ParameterCode.CardsSetId);

                //用户卡组变化
                User user = DictionaryUtils.getValue <String, User>(Application.loginUserDict, userName);
                user.CardSets.Remove(cardsSetId);

                //将变化保存到文件数据库
                UserManager.disassembleCardSetsInfo(user.UserName, user.CardSets);

                //保存用户
                Application.loginUserDict.Remove(user.UserName);
                Application.loginUserDict.Add(user.UserName, user);

                //封装信息
                responseParameter.Add((byte)ParameterCode.CardsSetOperationResult, 1);
            }
            catch (Exception e)
            {
                Application.logger.Info(e.ToString());
                responseParameter.Add((byte)ParameterCode.CardsSetOperationResult, 0);
            }

            OperationResponse response = new OperationResponse((byte)OPCode.DeleteCardsSet, responseParameter);

            peer.SendOperationResponse(response, sendParameters);
        }
Example #19
0
        public override void doResponse(OperationRequest operationRequest, SendParameters sendParameters, MyClientPeer peer)
        {
            Dictionary <byte, object> responseParameter = new Dictionary <byte, object>();

            try
            {
                //获取并查询用户
                Dictionary <byte, object> parameters = operationRequest.Parameters;
                String   userName   = (String)DictionaryUtils.getValue <byte, object>(parameters, (byte)ParameterCode.UserName);
                String   cardsSet   = (String)DictionaryUtils.getValue <byte, object>(parameters, (byte)ParameterCode.CardsSet);
                int      cardsSetId = (int)DictionaryUtils.getValue <byte, object>(parameters, (byte)ParameterCode.CardsSetId);
                String[] info       = cardsSet.Split(' ');
                CardsSet set        = new CardsSet();
                set.Name        = info[0];
                set.CardCapable = int.Parse(info[1]);
                set.Changeable  = bool.Parse(info[2]);
                set.Number      = int.Parse(info[3]);
                set.profession  = (Profession)int.Parse(info[4]);
                set.gameMode    = (GameMode)int.Parse(info[5]);
                for (int i = 0; i < set.Number; i++)
                {
                    set.cards[i]    = info[6 + 2 * i];
                    set.isGolden[i] = bool.Parse(info[7 + 2 * i]);
                }

                Application.logger.Info(cardsSetId + set.ToString());

                //用户卡组变化
                User user = DictionaryUtils.getValue <String, User>(Application.loginUserDict, userName);
                user.CardSets.Remove(cardsSetId);
                user.CardSets.Add(cardsSetId, set);

                //将变化保存到文件数据库
                UserManager.disassembleCardSetsInfo(user.UserName, user.CardSets);

                //保存用户
                Application.loginUserDict.Remove(user.UserName);
                Application.loginUserDict.Add(user.UserName, user);

                //封装信息
                responseParameter.Add((byte)ParameterCode.CardsSetOperationResult, 1);
            }
            catch (Exception e)
            {
                Application.logger.Info(e.ToString());
                responseParameter.Add((byte)ParameterCode.CardsSetOperationResult, 0);
            }

            OperationResponse response = new OperationResponse((byte)OPCode.ChangeCardsSet, responseParameter);

            peer.SendOperationResponse(response, sendParameters);
        }
Example #20
0
 //玩家下线
 public void OffLine(MyClientPeer client)
 {
     clientModelDict.Remove(client);
 }
Example #21
0
 //把客户端从房间中移除
 public void Remove(MyClientPeer client)
 {
     clientAccountDict.Remove(client);
 }
Example #22
0
        public override void doResponse(OperationRequest operationRequest, SendParameters sendParameters, MyClientPeer peer)
        {
            //信息提取
            Dictionary <byte, object> parameter = operationRequest.Parameters;
            String userName        = (String)DictionaryUtils.getValue <byte, object>(parameter, (byte)ParameterCode.UserName);
            String anotherUserName = (String)DictionaryUtils.getValue <byte, object>(parameter, (byte)ParameterCode.AnotherUserName);

            //发送消息
            Dictionary <byte, object> dict = new Dictionary <byte, object>();

            dict.Add((byte)ParameterCode.UserName, userName);
            EventData data = new EventData((byte)EventCode.FightInvit, dict);

            DictionaryUtils.getValue <String, MyClientPeer>(Application.clientPeerDict, anotherUserName).SendEvent(data, sendParameters);

            //添加信息
            Application.Waiting.Add(userName, anotherUserName);
        }
Example #23
0
        public override void doResponse(OperationRequest operationRequest, SendParameters sendParameters, MyClientPeer peer)
        {
            Dictionary <byte, object> dict = operationRequest.Parameters;
            Dictionary <byte, object> responseParameter = new Dictionary <byte, object>();

            try
            {
                //获取参数
                string userName      = (string)DictionaryUtils.getValue <byte, object>(dict, (byte)ParameterCode.UserName);
                string packageString = (string)DictionaryUtils.getValue <byte, object>(dict, (byte)ParameterCode.CardPackage);
                Series series        = (Series)DictionaryUtils.getValue <byte, object>(dict, (byte)ParameterCode.Series);

                Application.logger.Info("====================" + userName + packageString + "========================");

                //反序列化
                CardPackage package = null;
                using (StringReader reader = new StringReader(packageString))
                {
                    XmlSerializer serializer = new XmlSerializer(typeof(CardPackage));
                    package = (CardPackage)serializer.Deserialize(reader);
                }

                //修改user字典的信息
                User user   = DictionaryUtils.getValue <String, User>(Application.loginUserDict, userName);
                int  number = DictionaryUtils.getValue <Series, int>(user.MyCardsPackage, series);
                number--;
                if (number < 0)
                {
                    responseParameter.Add((byte)ParameterCode.UseCardPackageResult, 0);
                    goto End;
                }
                user.MyCardsPackage.Remove(series);
                if (number != 0)
                {
                    user.MyCardsPackage.Add(series, number);
                }
                for (int i = 0; i < 5; i++)
                {
                    if (package.isGolden[i])
                    {
                        int cardNumber = DictionaryUtils.getValue <String, int>(user.MyCards, package.cards[i]);
                        user.MyCards.Remove(package.cards[i]);
                        user.MyCards.Add(package.cards[i], cardNumber + 1000);
                    }
                    else
                    {
                        int cardNumber = DictionaryUtils.getValue <String, int>(user.MyCards, package.cards[i]);
                        user.MyCards.Remove(package.cards[i]);
                        user.MyCards.Add(package.cards[i], cardNumber + 1);
                    }
                }
                Application.loginUserDict.Remove(userName);
                Application.loginUserDict.Add(userName, user);

                //修改文件数据库的信息
                UserManager.disassembleCardInfo(userName, user.MyCards);
                UserManager.disassembleCardPackageInfo(userName, user.MyCardsPackage);

                //响应信息
                responseParameter.Add((byte)ParameterCode.UseCardPackageResult, 1);
            }
            catch (Exception e) {
                Application.logger.Info("=====================" + e.ToString() + "==========================");
                responseParameter.Add((byte)ParameterCode.UseCardPackageResult, 0);
            }

            //响应客户端
            End : OperationResponse operationResponse = new OperationResponse((byte)OPCode.UseCardPackage, responseParameter);
            peer.SendOperationResponse(operationResponse, sendParameters);
        }
Example #24
0
        public override void OnOperationRequest(OperationRequest operationRequest, SendParameters sendParameters, MyClientPeer peer)
        {
            List <string> usernameList = new List <string>();

            foreach (MyClientPeer clientpeer in MyServer.Instance.PeerList)
            {
                if (!string.IsNullOrEmpty(clientpeer.username) && clientpeer != peer)
                {
                    usernameList.Add(clientpeer.username);
                    EventData eventdata = new EventData((byte)EventCode.SyncPlayer);
                    Dictionary <byte, object> eventdict = new Dictionary <byte, object>();
                    eventdict.Add((byte)ParameterCode.Username, peer.username);
                    eventdata.Parameters = eventdict;
                    clientpeer.SendEvent(eventdata, sendParameters);
                }
            }
            //StringWriter sw = new StringWriter();
            //XmlSerializer Serializer = new XmlSerializer(typeof(List<string>));
            //Serializer.Serialize(sw, usernameList);
            //string usernameListString;
            //usernameListString = sw.ToString();
            //sw.Dispose();
            byte[] usernameBytes = ProtobufTool.Serialize <List <string> >(usernameList);

            OperationResponse         operationresponse = new OperationResponse((byte)OperationCode.SyncPlayer);
            Dictionary <byte, object> dict = new Dictionary <byte, object>();

            dict.Add((byte)ParameterCode.SyncPlayerList, usernameBytes);
            operationresponse.Parameters = dict;
            peer.SendOperationResponse(operationresponse, sendParameters);
        }
Example #25
0
        public override void doResponse(OperationRequest operationRequest, SendParameters sendParameters, MyClientPeer peer)
        {
            Dictionary <byte, object> responseParameter = new Dictionary <byte, object>();

            try
            {
                //获取并查询用户
                Dictionary <byte, object> parameters = operationRequest.Parameters;
                String   userName   = (String)DictionaryUtils.getValue <byte, object>(parameters, (byte)ParameterCode.UserName);
                String   cardString = (String)DictionaryUtils.getValue <byte, object>(parameters, (byte)ParameterCode.CardName);
                String[] info       = cardString.Split(' ');
                Card     card       = new Card((Series)int.Parse(info[0]), (Profession)int.Parse(info[1]), (Rarity)int.Parse(info[2]), (CardType)int.Parse(info[3])
                                               , int.Parse(info[4]), info[5], info[6], int.Parse(info[7]), int.Parse(info[8]), (Species)int.Parse(info[9]));
                bool isgolden = (bool)DictionaryUtils.getValue <byte, object>(parameters, (byte)ParameterCode.IsColden);

                //用户卡牌变化
                User user       = DictionaryUtils.getValue <String, User>(Application.loginUserDict, userName);
                int  cardNumber = DictionaryUtils.getValue <String, int>(user.MyCards, card.Name);
                if (cardNumber == default(int))
                {
                    cardNumber = 0;
                }
                else
                {
                    user.MyCards.Remove(card.Name);
                }
                if (isgolden)
                {
                    cardNumber += 1000;
                }
                else
                {
                    cardNumber += 1;
                }
                user.MyCards.Add(card.Name, cardNumber);

                //将变化保存到文件数据库
                UserManager.disassembleCardInfo(user.UserName, user.MyCards);

                //用户奥术之尘变化
                user.ArcaneDust -= DataUtils.getNumberOfArcaneDustWhenManufacture(card.Rarity, isgolden);

                //将变化保存到数据库
                UserManager.Update(user);

                //保存用户
                Application.loginUserDict.Remove(user.UserName);
                Application.loginUserDict.Add(user.UserName, user);

                //封装信息
                responseParameter.Add((byte)ParameterCode.CardOperationResult, 1);
            }
            catch (Exception e) {
                Application.logger.Info(e.ToString());
                responseParameter.Add((byte)ParameterCode.CardOperationResult, 0);
            }

            OperationResponse response = new OperationResponse((byte)OPCode.ManufactureCard, responseParameter);

            peer.SendOperationResponse(response, sendParameters);
        }
Example #26
0
        public override void doResponse(OperationRequest operationRequest, SendParameters sendParameters, MyClientPeer peer)
        {
            //获取并查询用户
            Dictionary <byte, object> parameters = operationRequest.Parameters;
            String userName = (String)DictionaryUtils.getValue <byte, object>(parameters, (byte)ParameterCode.UserName);
            String password = (String)DictionaryUtils.getValue <byte, object>(parameters, (byte)ParameterCode.Password);

            Application.logger.Info("===================" + userName + " " + password + "尝试登录===========================");

            //检查登录结果
            int result = UserInfoServices.verify(userName, password);

            if (result == 2)
            {
                Application.logger.Info("===================" + userName + " " + password + "登录失败(账号不存在)===========================");
            }
            else if (result == 1)
            {
                Application.logger.Info("===================" + userName + " " + password + "登录成功===========================");
            }
            else
            {
                Application.logger.Info("===================" + userName + " " + password + "登录失败(密码错误)===========================");
            }

            //封装所有信息
            User   user       = null;
            String userString = null;

            if (result == 1)
            {
                user = UserInfoServices.encapsulateAllUserInfo(userName);

                //存放在loginUser字典中
                if (DictionaryUtils.getValue <String, User>(Application.loginUserDict, userName) != null)
                {
                    Application.loginUserDict.Remove(userName);
                }
                Application.loginUserDict.Add(user.UserName, user);

                //尝试序列化
                userString = UserManager.praseUserToUserString(user);
            }

            //开始封装返回参数
            Dictionary <byte, object> responseParameters = new Dictionary <byte, object>();

            responseParameters.Add((byte)ParameterCode.LoginResult, result);
            responseParameters.Add((byte)ParameterCode.User, userString);

            //将用户名保存到客户端对象之中
            if (user != null)
            {
                peer.userName = user.UserName;
                if (DictionaryUtils.getValue <String, MyClientPeer>(Application.clientPeerDict, user.UserName) != null)
                {
                    Application.clientPeerDict.Remove(userName);
                }
                Application.clientPeerDict.Add(userName, peer);
            }

            //发送响应
            OperationResponse operationResponse = new OperationResponse((byte)this.opCode, responseParameters);

            peer.SendOperationResponse(operationResponse, sendParameters);
        }
        public override void OnOperationRequest(OperationRequest operationRequest, SendParameters sendParameters, MyClientPeer peer)
        {
            //获取所有已登录的在线玩家用户名
            List <string> usernameList = new List <string>();

            foreach (MyClientPeer peerTemp in MyGameServer.Instance.m_peerList)
            {
                if (!String.IsNullOrEmpty(peerTemp.m_userName) && peerTemp != peer)
                {
                    usernameList.Add(peerTemp.m_userName);
                }
            }

            //序列化传输对象
            string usernameListString = XML.Serializer <List <string> >(usernameList);

            //向新的用户发送 所有player的信息
            Dictionary <byte, object> data = new Dictionary <byte, object>();

            data.Add((byte)ParameterCode.UsernameList, usernameListString);
            OperationResponse response = new OperationResponse(operationRequest.OperationCode);

            response.Parameters = data;

            //向已有用户发送 新player的信息
            foreach (MyClientPeer peerTemp in MyGameServer.Instance.m_peerList)
            {
                if (!String.IsNullOrEmpty(peerTemp.m_userName) && peerTemp != peer)
                {
                    EventData ed = new EventData((byte)EventCode.NewPlayer);
                    Dictionary <byte, Object> data2 = new Dictionary <byte, object>();
                    data2.Add((byte)ParameterCode.Username, peer.m_userName);
                    ed.Parameters = data2;

                    peerTemp.SendEvent(ed, sendParameters);
                }
            }

            peer.SendOperationResponse(response, sendParameters);
        }
Example #28
0
        public override void doResponse(OperationRequest operationRequest, SendParameters sendParameters, MyClientPeer peer)
        {
            //信息提取
            Dictionary <byte, object> parameter = operationRequest.Parameters;
            String userName = (String)DictionaryUtils.getValue <byte, object>(parameter, (byte)ParameterCode.UserName);

            bool has = false;

            foreach (String s in Application.readyList)
            {
                if (s.Equals(userName))
                {
                    has = true;
                }
            }
            if (!has)
            {
                //将用户名添加到List之中
                Application.readyList.Add(userName);
            }

            //转化准备好的userNameList字符串
            String all = "";

            foreach (String s in Application.readyList)
            {
                all += s + " ";
            }

            Dictionary <byte, object> responseParameter = new Dictionary <byte, object>();

            responseParameter.Add((byte)ParameterCode.ReadyUserNameList, all);

            //通知其他所有准备好的客户端有新的客户端加入
            foreach (String s in Application.readyList)
            {
                if (!s.Equals(userName))
                {
                    Dictionary <byte, object> dict = new Dictionary <byte, object>();
                    dict.Add((byte)ParameterCode.ReadyUserNameList, all);
                    EventData data = new EventData((byte)EventCode.Ready, dict);
                    DictionaryUtils.getValue <String, MyClientPeer>(Application.clientPeerDict, s).SendEvent(data, sendParameters);
                }
            }

            //响应客户端
            OperationResponse operationResponse = new OperationResponse((byte)OPCode.Ready, responseParameter);

            peer.SendOperationResponse(operationResponse, sendParameters);
        }
Example #29
0
 public abstract void OnOperationRequest(OperationRequest operationRequest, SendParameters sendParameters, MyClientPeer peer);
Example #30
0
        public override void doResponse(OperationRequest operationRequest, SendParameters sendParameters, MyClientPeer peer)
        {
            //信息提取
            Dictionary <byte, object> parameter = operationRequest.Parameters;
            String userName                 = (String)DictionaryUtils.getValue <byte, object>(parameter, (byte)ParameterCode.UserName);
            String anotherUserName          = (String)DictionaryUtils.getValue <byte, object>(parameter, (byte)ParameterCode.AnotherUserName);
            bool   fightInvitResponseResult = (bool)DictionaryUtils.getValue <byte, object>(parameter, (byte)ParameterCode.FightInvitResponseResult);

            //waiting应当删除键值对
            if (DictionaryUtils.getValue <String, String>(Application.Waiting, anotherUserName) != null)
            {
                Application.Waiting.Remove(anotherUserName);
            }

            if (fightInvitResponseResult)
            {
                //Fighting应当添加,List应当去除
                try
                {
                    Application.Fighting.Add(anotherUserName, userName);
                    Application.Fighting.Add(userName, anotherUserName);
                    Application.readyList.Remove(anotherUserName);
                    Application.readyList.Remove(userName);
                }
                catch (Exception e) {
                    e.ToString();
                }
            }
            else
            {
            }

            //发送消息
            Dictionary <byte, object> dict = new Dictionary <byte, object>();

            dict.Add((byte)ParameterCode.FightInvitResponseResult, fightInvitResponseResult);
            EventData data = new EventData((byte)EventCode.FightInvitResponse, dict);

            DictionaryUtils.getValue <String, MyClientPeer>(Application.clientPeerDict, anotherUserName).SendEvent(data, sendParameters);
        }