Пример #1
0
 public override BaseMessage GetInnerMessage()
 {
     switch (Type)
     {
         case SIMessageType.Abonents:
             {
                 ServerInfoAbonentsMessage msg = new ServerInfoAbonentsMessage();
                 msg.UTFDeSerialize(this.Message);
                 return msg;
             }
         case SIMessageType.Rooms:
             {
                 ServerInfoRoomsMessage msg = new ServerInfoRoomsMessage();
                 msg.UTFDeSerialize(this.Message);
                 return msg;
             }
         case SIMessageType.Error:
             {
                 ServerInfoErrorMessage msg = new ServerInfoErrorMessage();
                 msg.UTFDeSerialize(this.Message);
                 return msg;
             }
     }
     return null;
 }
Пример #2
0
 private void AfterAbonentsInfoRecieved(ServerInfoAbonentsMessage abnmsg)
 {
     var oldAbns = Abonents.ToList();
     var newAbns = new List<GameAbonentInfo>();
     foreach (var abn in abnmsg.Abonents)
     {
         var ab = Abonents.FirstOrDefault(a => a.Id == abn.Id);
         if (ab != null)
         {
             AbonentChanged(ab, abn);
             oldAbns.Remove(abn);
         }
         else
             newAbns.Add(abn);
     }
     foreach (var rm in oldAbns)
         Abonents.Remove(rm);
     foreach (var rm in newAbns)
         Abonents.Add(rm);
 }
Пример #3
0
 public void SendRoomStatusMessage()
 {
     var msg = new ServerInfoAbonentsMessage() { Abonents = new List<GameAbonentInfo>() };
     foreach (var abon in AbnsToList())
         msg.Abonents.Add(abon.Gamer);
     var smsg = msg.GetTC();
     this.SendMessage(smsg);
 }