コード例 #1
0
        /// <summary>
        /// Stop listening specified event.
        /// </summary>
        /// <param name="eventName">Event name.</param>
        /// <param name="listener">Listener.</param>
        public static void StopListening(string eventName, UnityAction <GameObject, object> listener)
        {
            MyEvent thisEvent = null;

            if (instance.eventDictionary.TryGetValue(eventName, out thisEvent))
            {
                thisEvent.RemoveListener(listener);
            }
        }
コード例 #2
0
 private void Update()
 {
     if (Input.GetKeyDown(KeyCode.A))
     {
         e.Broadcast("Test1");
     }
     else if (Input.GetKeyDown(KeyCode.B))
     {
         e.Broadcast("Test2", "assdsd");
         e.RemoveListener("Test1", Handler);
     }
 }
コード例 #3
0
    public static void RemoverEvento(string nome, UnityAction <GameObject, string> evento)
    {
        if (instancia == null)
        {
            return;
        }
        MyEvent esteEvento = null;

        if (instancia.eventos.TryGetValue(nome, out esteEvento))
        {
            esteEvento.RemoveListener(evento);
        }
    }
コード例 #4
0
    /// <summary>
    /// Stop listening specified event.
    /// </summary>
    /// <param name="eventName">Event name.</param>
    /// <param name="listener">Listener.</param>
    public static void StopListening(string eventName, UnityAction <GameObject, string> listener)
    {
        if (Instantiate == null)
        {
            return;
        }
        MyEvent thisEvent = null;

        if (Instantiate.eventDictionary.TryGetValue(eventName, out thisEvent))
        {
            thisEvent.RemoveListener(listener);
        }
    }
コード例 #5
0
        public static void StopListening(string eventName, UnityAction <object> listener)
        {
            if (eventManager == null)
            {
                return;
            }

            MyEvent thisEvent = null;

            if (Singleton.eventDictionary.TryGetValue(eventName, out thisEvent))
            {
                thisEvent.RemoveListener(listener);
            }
        }
コード例 #6
0
 // Start is called before the first frame update
 void Start()
 {
     evt = new MyEvent();
     evt.AddListener(PrintNumber);
     evt.RemoveListener(PrintNumber);
 }