/// <summary> /// Sequentialitemsprocessor triggers this tasked based /// </summary> /// <param name="parameter"></param> public void HandlePacket(MapPacket parameter) { //handle iterative operations //notify clients about changes OnBroadCast(parameter); }
public void OnBroadCast(MapPacket mapPacket) { var handler = NotifyClients; if (handler != null) { handler(mapPacket, new EventArgs()); } }
/// <summary> /// Get notificated from outside the Session. /// </summary> /// <param name="sender">Sender of the packet.</param> /// <param name="e">Eventargs e.</param> private void GetNotification(object sender, EventArgs e) { MapPacket mapPacket = (MapPacket)sender; switch (mapPacket.Receiver) { case ReceiverType.All: { _client.SendPacket(mapPacket.Content); break; } case ReceiverType.AllExceptMe: { if (mapPacket.Session.Client.ClientId != this.Client.ClientId) { _client.SendPacket(mapPacket.Content); } break; } case ReceiverType.OnlyMe: { if (mapPacket.Session.Client.ClientId == this.Client.ClientId) { _client.SendPacket(mapPacket.Content); } break; } default: { Logger.Log.ErrorFormat("Unknown Notification ReceiverType for client, {0}", Client.ClientId); break; } } }
public static void OnBroadCast(MapPacket mapPacket) { var handler = NotifyChildren; if (handler != null) { handler(mapPacket, new EventArgs()); } }
/// <summary> /// Send packet to all clients /// </summary> /// <param name="mapPacket">The MapPacket to send.</param> public void BroadCast(MapPacket mapPacket) { QueuePacket(mapPacket); }
/// <summary> /// Enqueue a packet for the Map. /// </summary> /// <param name="mapPacket"></param> private void QueuePacket(MapPacket mapPacket) { threadedBase.Queue.EnqueueMessage(mapPacket); }