Beispiel #1
0
    /// <summary>
    /// returns true if any listeners are called
    /// </summary>
    public bool SendToLocal(EventType e)
    {
        if (active)
        {
            if (messageBoard != null)
            {
                messageBoard.IncrementCallCount();
            }

            ++callCountLocal;

            var listenerList = new List <EventListener>(messageList);
            foreach (var listener in listenerList)
            {
                listener(e);
            }

            return(true);
        }
        return(false);
    }
Beispiel #2
0
    /// <summary>
    /// returns true if any listeners are called
    /// </summary>
    public int SendToLocal(EventType e, int consumeQuantity = 1)
    {
        if (active)
        {
            if (messageBoard != null)
            {
                messageBoard.IncrementCallCount();
            }

            ++callCountLocal;

            var listenerList = new List <FFMessage <EventType> .EventListener>(messageList);
            for (int i = 0; i < listenerList.Count && consumeQuantity > 0; ++i)
            {
                consumeQuantity -= listenerList[i](e);
            }

            return(consumeQuantity);
        }
        return(consumeQuantity);
    }