Exemple #1
0
    public static void AddListener <T, U, V, W>(EventID eventId, EventFun4 <T, U, V, W> listener)
    {
        BaseEvents baseEvents = null;

        if (!Instance.eventDictionary.TryGetValue(eventId, out baseEvents))
        {
            baseEvents = new GenericEvents4 <T, U, V, W>();
            Instance.eventDictionary.Add(eventId, baseEvents);
        }
        ((GenericEvents4 <T, U, V, W>)baseEvents).eventList.Add(listener);
    }
Exemple #2
0
    public static void RemoveListener <T, U, V, W>(EventID eventId, EventFun4 <T, U, V, W> listener)
    {
        BaseEvents baseEvents;

        if (Instance.eventDictionary.TryGetValue(eventId, out baseEvents))
        {
            GenericEvents4 <T, U, V, W> impEvents = baseEvents as GenericEvents4 <T, U, V, W>;
            if (!impEvents.isLock)
            {
                impEvents.eventList.Remove(listener);
            }
            else
            {
                impEvents.deleteRequests.Add(listener);
            }
        }
    }