public DisplayOnPacketEnqueued(NodeIdentifier nodeId, IObservable <NetworkEvent> networkEvents, PacketTypeReadModel packetTypeReadModel, IDisplayPacketEnqueue consumerPacket) { networkEvents .OfType <NetworkEvent, NetworkEvent.PacketEnqueued>() .Where(packetEnqued => packetEnqued.NodeId == nodeId) .Select(packetEnqued => packetTypeReadModel[packetEnqued.PacketId]) .Do(packetEnqueued => Debug.Log($"Packet Enqueued {packetEnqueued}")) .Subscribe(color => consumerPacket.EnqueuePacket(color)); }
public DisplayOnPacketDequeued(NodeIdentifier nodeId, IObservable <NetworkEvent> networkEvents, PacketTypeReadModel packetTypeReadModel, IDisplayPacketEnqueue consumerPacket) { networkEvents .OfType <NetworkEvent, NetworkEvent.PacketDequeued>() .Where(packetDequed => packetDequed.NodeId == nodeId) .Subscribe(color => consumerPacket.DequeuePacket()); }