예제 #1
0
 public static void StartListening(string eventName, UnityAction <Hashtable> listener)
 {
     if (Instance.eventDictionary.TryGetValue(eventName, out ThisEvent thisEvent))
     {
         thisEvent.AddListener(listener);
     }
     else
     {
         thisEvent = new ThisEvent();
         thisEvent.AddListener(listener);
         Instance.eventDictionary.Add(eventName, thisEvent);
     }
 }
예제 #2
0
    public static void StartListening(string eventName, UnityAction <string> listener)
    {
        ThisEvent thisEvent = null;

        if (instance.eventDictionary.TryGetValue(eventName, out thisEvent))
        {
            thisEvent.AddListener(listener);
        }
        else
        {
            thisEvent = new ThisEvent();
            thisEvent.AddListener(listener);
            instance.eventDictionary.Add(eventName, thisEvent);
        }
    }
예제 #3
0
    /// <summary>
    /// function called to insert an event in the dictionary.
    /// </summary>
    /// <param name="eventName"> Event to listen to. </param>
    /// <param name="listener"> Callback action to be called on event. </param>
    public static void StartListening(string eventName, UnityAction <string> listener)
    {
        //print("EventManager:StartListening eventName = " + eventName);

        ThisEvent thisEvent = null;

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