Ejemplo n.º 1
0
    public static void Dispatch(string type, AbstractMessage message = null)
    {
        ObjUnityEvent thisEvent = null;

        if (instance.eventDictionary.TryGetValue(type, out thisEvent))
        {
            thisEvent.Invoke(message);
        }
    }
Ejemplo n.º 2
0
    public static void StopListening(string type, UnityAction <AbstractMessage> listener)
    {
        if (eventManager == null)
        {
            return;
        }
        ObjUnityEvent thisEvent = null;

        if (instance.eventDictionary.TryGetValue(type, out thisEvent))
        {
            thisEvent.RemoveListener(listener);
        }
    }
Ejemplo n.º 3
0
    public static void Listen(string type, UnityAction <AbstractMessage> listener)
    {
        ObjUnityEvent thisEvent = null;

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