Esempio 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);
 }