Beispiel #1
0
 public void SendMessageToPlayers(AsyncMessage message, bool exceptCreator = false)
 {
     foreach (Player player in Players)
     {
         if (!exceptCreator || (exceptCreator && player.UserId != Creator.UserId))
             Longpool.Longpool.Instance.PushMessageToUser(player.UserId, message);
     }
 }
Beispiel #2
0
 /// <summary>
 /// Send message to all clients
 /// </summary>
 /// <param name="message"></param>
 public void PushMessage(AsyncMessage message)
 {
     lock (_lock)
     {
         foreach (ClientState clientState in _clientStateList)
         {
             clientState.Push(message);
         }
     }
 }
Beispiel #3
0
 /// <summary>
 /// Send message to all clients
 /// </summary>
 /// <param name="message"></param>
 public void PushMessage(AsyncMessage message)
 {
     lock (_lock)
     {
         foreach (ClientState clientState in _clientStateList)
         {
             clientState.Push(message);
         }
     }
 }
Beispiel #4
0
 public void PushMessageToUser(User User, AsyncMessage asyncMessage)
 {
     lock (_lock)
     {
         var clientState = _clientStateList.FirstOrDefault(x => x.User.Id == User.Id);
         if (clientState != null)
         {
             clientState.Push(asyncMessage);
         }
     }
 }
Beispiel #5
0
 public void PushMessageToUserDelayed(Guid Guid, AsyncMessage asyncMessage)
 {
     lock (_lock)
     {
         var clientState = _clientStateList.FirstOrDefault(x => x.User.Id == Guid);
         if (clientState != null)
         {
             clientState.AddToPool(asyncMessage);
         }
     }
 }
Beispiel #6
0
 public void PushMessageToUser(User User, AsyncMessage asyncMessage)
 {
     lock (_lock)
     {
         var clientState = _clientStateList.FirstOrDefault(x => x.User.Id == User.Id);
         if (clientState != null)
         {
             clientState.Push(asyncMessage);
         }
     }
 }
Beispiel #7
0
 public void Push(AsyncMessage message)
 {
     if (IsCompleted)
     {
         Messages.Add(message);
     }
     else
     {
         CurrentContext.Response.Write(message.ToString());
         CompleteRequest();
     }
 }
Beispiel #8
0
 public bool AddToPool(AsyncMessage message)
 {
     return Messages.Add(message);
 }
Beispiel #9
0
 public void PushMessageToUserDelayed(Guid Guid, AsyncMessage asyncMessage)
 {
     lock (_lock)
     {
         var clientState = _clientStateList.FirstOrDefault(x => x.User.Id == Guid);
         if (clientState != null)
         {
             clientState.AddToPool(asyncMessage);
         }
     }
 }