Ejemplo n.º 1
0
    public static void TriggerEvent(string eventName, object param)
    {
        ParamEvent thisEvent = null;

        if (instance.eventDictionary.TryGetValue(eventName, out thisEvent))
        {
            thisEvent.Invoke(param);
        }
    }
Ejemplo n.º 2
0
    public static void TriggerEvent(string eventName, string eventParam)
    {
        ParamEvent thisEvent = null;

        if (instance.eventDictionary.TryGetValue(eventName, out thisEvent))
        {
            thisEvent.Invoke(eventParam);
        }
        else
        {
            Debug.LogWarning("event dictionary does not contain: " + eventName);
        }
    }
Ejemplo n.º 3
0
    public static void StopListening(string eventName, ParamEvent listener)
    {
        ParamEvent thisEvent = null;

        if (instance.eventDictionary.TryGetValue(eventName, out thisEvent))
        {
            thisEvent -= listener;
            if (thisEvent == null)
            {
                instance.eventDictionary.Remove(eventName);
            }
        }
    }
Ejemplo n.º 4
0
    public static void StopListening(string eventName, UnityAction <object> listener)
    {
        if (eventManager == null)
        {
            return;
        }
        ParamEvent thisEvent = null;

        if (instance.eventDictionary.TryGetValue(eventName, out thisEvent))
        {
            thisEvent.RemoveListener(listener);
        }
    }
Ejemplo n.º 5
0
    public static void StartListening(string eventName, ParamEvent listener)
    {
        ParamEvent thisEvent = null;

        if (instance.eventDictionary.TryGetValue(eventName, out thisEvent))
        {
            thisEvent += listener;
        }
        else
        {
            thisEvent = listener;
            instance.eventDictionary.Add(eventName, thisEvent);
        }
    }
Ejemplo n.º 6
0
    public static void StartListening(string eventName, UnityAction <object> listener)
    {
        ParamEvent thisEvent = null;

        if (instance.eventDictionary.TryGetValue(eventName, out thisEvent))
        {
            thisEvent.AddListener(listener);
        }
        else
        {
            thisEvent = new ParamEvent();
            thisEvent.AddListener(listener);
            instance.eventDictionary.Add(eventName, thisEvent);
        }
    }