Exemplo n.º 1
0
    public static void DispatchEvent(ENUM_EVENT e)
    {
        Delegate d;

        if (_delegate.TryGetValue(e, out d))
        {
            EventDelegate callback = d as EventDelegate;
            if (callback != null)
            {
                callback();
            }
        }
    }
Exemplo n.º 2
0
    public static void AddEventListener(ENUM_EVENT e, EventDelegate c)
    {
        Delegate d;

        if (_delegate.TryGetValue(e, out d))
        {
            _delegate[e] = Delegate.Combine(d, c);
        }
        else
        {
            _delegate.Add(e, c);
        }
    }
Exemplo n.º 3
0
    public static void RemoveEventListener(ENUM_EVENT e, EventDelegate c)
    {
        Delegate d;

        if (_delegate.TryGetValue(e, out d))
        {
            _delegate[e] = Delegate.Remove(d, c);
        }
        else
        {
            _delegate.Remove(e);
        }
    }