コード例 #1
0
    public static void TriggerEvent(string eventName, Hashtable hashtable)
    {
        HashtableEvent unityEvent = null;

        if (instance.eventDictionary.TryGetValue(eventName, out unityEvent))
        {
            unityEvent.Invoke(hashtable);
        }
    }
コード例 #2
0
        /// <summary>
        /// call to trigger the event
        /// </summary>
        public static void TriggerEvent(string eventName, Hashtable eventParams = default(Hashtable))
        {
            HashtableEvent thisEvent = null;

            if (Instance.EventDictionary.TryGetValue(eventName, out thisEvent))
            {
                thisEvent.Invoke(eventParams);
            }
        }
コード例 #3
0
    public static void StopListening(string eventName, UnityAction <Hashtable> listener)
    {
        if (eventManager == null)
        {
            return;
        }
        HashtableEvent unityEvent = null;

        if (instance.eventDictionary.TryGetValue(eventName, out unityEvent))
        {
            unityEvent.RemoveListener(listener);
        }
    }
コード例 #4
0
        /// <summary>
        /// unregister a listener from the event manager
        /// </summary>
        public static void StopListening(string eventName, UnityAction <Hashtable> listener)
        {
            if (Instance == null)
            {
                return;
            }

            HashtableEvent thisEvent = null;

            if (Instance.EventDictionary.TryGetValue(eventName, out thisEvent))
            {
                thisEvent.RemoveListener(listener);
            }
        }
コード例 #5
0
        /// <summary>
        /// register a listener to the event manager
        /// </summary>
        public static void StartListening(string eventName, UnityAction <Hashtable> listener)
        {
            HashtableEvent thisEvent = null;

            if (Instance.EventDictionary.TryGetValue(eventName, out thisEvent))
            {
                thisEvent.AddListener(listener);
            }
            else
            {
                thisEvent = new HashtableEvent();
                thisEvent.AddListener(listener);
                Instance.EventDictionary.Add(eventName, thisEvent);
            }
        }
コード例 #6
0
    public static void StartListening(string eventName, UnityAction <Hashtable> listener)
    {
        HashtableEvent unityEvent = null;

        if (instance.eventDictionary.TryGetValue(eventName, out unityEvent))
        {
            unityEvent.AddListener(listener);
        }
        else
        {
            unityEvent = new HashtableEvent();
            unityEvent.AddListener(listener);
            instance.eventDictionary.Add(eventName, unityEvent);
        }
    }
コード例 #7
0
        public void StopListening(string eventName, UnityAction <Hashtable> listener)
        {
            HashtableEvent thisEvent = null;

            if (eventDictionary.TryGetValue(eventName, out thisEvent))
            {
                if (listener == null)
                {
                    thisEvent.RemoveAllListeners();
                }
                else
                {
                    thisEvent.RemoveListener(listener);
                }
            }
        }