public static bool addEventListener(this GameObject self, string type, Action <SAEventX> listener, int priority = 0) { MonoDispatcher dispatcher = self.GetOrAddComponent <MonoDispatcher>(); return(dispatcher.addEventListener(type, listener, priority)); }
protected void completeHandle(SAEventX e) { MonoDispatcher soundClip = (MonoDispatcher)e.target; string name = soundClip.name; _soundsOnce.Remove(name); soundClip.SetActive(false); }
public static void stopCoroutine(this GameObject self, Coroutine routine) { MonoDispatcher dispatcher = self.GetOrAddComponent <MonoDispatcher>(); if (dispatcher == null) { dispatcher = self.AddComponent <MonoDispatcher>(); } dispatcher.StopCoroutine(routine); }
public static Coroutine StartCoroutine(this GameObject self, IEnumerator routine) { MonoDispatcher dispatcher = self.GetOrAddComponent <MonoDispatcher>(); if (dispatcher == null) { dispatcher = self.AddComponent <MonoDispatcher>(); } return(dispatcher.StartCoroutine(routine)); }
public static bool simpleDispatch(this GameObject self, string type, object data = null) { MonoDispatcher dispatcher = self.GetOrAddComponent <MonoDispatcher>(); if (dispatcher == null) { return(false); } return(dispatcher.simpleDispatch(type, data)); }
public static bool dispatchEvent(this GameObject self, SAEventX e) { MonoDispatcher dispatcher = self.GetOrAddComponent <MonoDispatcher>(); if (dispatcher == null) { return(false); } return(dispatcher.dispatchEvent(e)); }
public static bool removeEventListener(this GameObject self, string type, Action <SAEventX> listener) { MonoDispatcher dispatcher = self.GetOrAddComponent <MonoDispatcher>(); if (dispatcher == null) { return(false); } return(dispatcher.removeEventListener(type, listener)); }
public static bool hasEventListener(this GameObject self, string type) { MonoDispatcher dispatcher = self.GetOrAddComponent <MonoDispatcher>(); if (dispatcher == null) { return(false); } return(dispatcher.hasEventListener(type)); }
public static bool removeEventListener(this Component self, string type, Action <SAEventX> listener) { #if UNITY_EDITOR if (self == null) { return(false); } #endif MonoDispatcher dispatcher = self.GetComponent <MonoDispatcher>(); if (dispatcher == null) { return(false); } return(dispatcher.removeEventListener(type, listener)); }