Beispiel #1
0
 public void OnDisconnect(MobaClient client)
 {
     //每次下线的时候 要通知好友 显示离线状态
     #region 每次下线的时候 要通知好友 显示离线状态
     PlayerModel model = playerCache.GetModel(client);
     if (model != null)
     {
         MobaClient tempClient = null;
         string[]   friends    = model.FriendIdList.Split(',');
         foreach (string item in friends)
         {
             if (string.IsNullOrEmpty(item))
             {
                 continue;
             }
             int id = int.Parse(item);
             if (!playerCache.isOnline(id))
             {
                 continue;
             }
             tempClient = playerCache.GetClient(id);
             Send(tempClient, OpCode.PlayerCode, OpPlayer.FriendOffline, 0, "此玩家已下线", model.Id);
         }
     }
     #endregion
     matchCache.Offline(client, playerCache.GetId(client));
     playerCache.Offline(client);
 }
        public void OnDisconnect(MobaClient client)
        {
            //每次下线的时候要通知好友显示离线状态
            PlayerModel model = playerCache.GetModel(client);

            if (model != null)
            {
                string[] friends = model.FriendIdList.Split(',');
                foreach (string item in friends)
                {
                    if (item.Equals(""))
                    {
                        continue;
                    }
                    int itemId = int.Parse(item);
                    if (!playerCache.IsOnLine(itemId))
                    {
                        continue;
                    }
                    MobaClient tempClient = playerCache.GetClient(itemId);
                    Send(tempClient, OpCode.PlayerCode, OpPlayer.FriendOffLine, 0, "此玩家下线", model.Id);
                }

                matchCache.OffLine(client, playerCache.GetId(client));
                playerCache.OffLine(client);
            }
        }
Beispiel #3
0
        /// <summary>
        /// 玩家确认选择
        /// </summary>
        /// <param name="client"></param>
        private void onReady(MobaClient client)
        {
            int        playerId = playerCache.GetId(client);
            SelectRoom room     = selectCache.Ready(playerId);

            if (room == null)
            {
                //告诉他自己确认失败
                Send(client, OpCode.SelectCode, OpSelect.Ready, -1, "确认失败");
                return;
            }
            //告诉房间所有人此人确认选择了
            room.Brocast(OpCode.SelectCode, OpSelect.Ready, 0, "有人确认选择了", null, playerId);
            //判断是否全部准备了 如果全部准备了 就开始战斗
            if (room.IsAllReady)
            {
                //TODO
                this.StartFightEvent(room.team1Dict.Values.ToList(), room.team2Dict.Values.ToList());
                //给客户端发送消息 准备战斗 切换场景
                room.Brocast(OpCode.SelectCode, OpSelect.StartFight, 0, "准备进入战斗场景", null);
                //销毁房间
                selectCache.Destroy(room.Id);
            }
        }
Beispiel #4
0
 public void OnDisconnect(MobaClient client)
 {
     selectCache.Offline(client, playerCache.GetId(client));
 }
Beispiel #5
0
 public void OnDisconnect(MobaClient client)
 {
     //找到要解散的房间,通知房间解散
     selectCache.OffLine(client, playerCache.GetId(client));
 }