Example #1
0
        public static void StartListening <T0, T1>(string eventName, UnityAction <T0, T1> listener)
        {
            if (Instance == null)
            {
                return;
            }

            CustomEvent <T0, T1> thisEvent = null;
            object thisEventObject         = null;

            if (Instance.eventDictionary.TryGetValue(eventName, out thisEventObject))
            {
                thisEvent = thisEventObject as CustomEvent <T0, T1>;
                if (thisEvent == null)
                {
                    thisEvent = new CustomEvent <T0, T1>();
                    thisEvent.AddListener(listener);

                    Instance.eventDictionary[eventName] = thisEvent;
                }
                else
                {
                    thisEvent.AddListener(listener);
                }
            }
            else
            {
                thisEvent = new CustomEvent <T0, T1>();
                thisEvent.AddListener(listener);
                Instance.eventDictionary.Add(eventName, thisEvent);
            }
        }
    public static void StartListening(string eventName, UnityAction <System.Object> listener)
    {
        CustomEvent thisEvent = null;

        if (Instance._eventDictionary.TryGetValue(eventName, out thisEvent))
        {
            thisEvent.AddListener(listener);
        }
        else
        {
            thisEvent = new CustomEvent();
            thisEvent.AddListener(listener);
            Instance._eventDictionary.Add(eventName, thisEvent);
        }
    }
Example #3
0
    public void StartListening(EventType eventType, UnityAction <EventInfo> listener)
    {
        CustomEvent thisEvent = null;

        if (eventDictionary.TryGetValue(eventType, out thisEvent))
        {
            thisEvent.AddListener(listener);
        }
        else
        {
            thisEvent = new CustomEvent();
            thisEvent.AddListener(listener);
            eventDictionary.Add(eventType, thisEvent);
        }
    }
Example #4
0
    public static void StartListening(EventType eventType, UnityAction <string> listener)
    {
        CustomEvent thisEvent = null;

        if (Instance.m_EventMap.TryGetValue(eventType, out thisEvent))
        {
            thisEvent.AddListener(listener);
        }
        else
        {
            thisEvent = new CustomEvent();
            thisEvent.AddListener(listener);
            Instance.m_EventMap.Add(eventType, thisEvent);
        }
    }
Example #5
0
 public void AddRightMouseDownListener(UnityAction <Event, bool> action) => onRightMouseDownEvent.AddListener(action);
Example #6
0
 public void AddLeftMouseUpListener(UnityAction <Event, bool> action) => onLeftMouseUpEvent.AddListener(action);
Example #7
0
 public void AddKeyUpListener(UnityAction <Event, bool> action) => onKeyUpEvent.AddListener(action);