public static void StopListening(string eventName, UnityAction <string> listener) { if (eventManager == null) { return; } MyUnityEvent thisEvent = null; if (instance.eventDictionary.TryGetValue(eventName, out thisEvent)) { thisEvent.RemoveListener(listener); } }
public static void StopListening(TypeOfEvent theType, UnityAction <EventInfo> listener) { if (_eventManager == null) { return; } MyUnityEvent thisEvent = null; if (eventManager.eventDictionary.TryGetValue(theType, out thisEvent)) { thisEvent.RemoveListener(listener); } }
/// <summary> /// アクションが呼ばれるまで待機する /// </summary> public static IEnumerator WaitAction <T1, T2>(MyUnityEvent <T1, T2> action, Action callback = null) { bool isCalled = false; UnityAction <T1, T2> act = ((arg1, arg2) => isCalled = true); action.AddListener(act); yield return(new WaitUntil(() => isCalled)); action.RemoveListener(act); if (callback != null) { callback.Invoke(); } }