示例#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();
            }
        }
    }
示例#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);
        }
    }
示例#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);
        }
    }