Ejemplo n.º 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);
 }