示例#1
0
        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));
        }
示例#2
0
        protected void completeHandle(SAEventX e)
        {
            MonoDispatcher soundClip = (MonoDispatcher)e.target;
            string         name      = soundClip.name;

            _soundsOnce.Remove(name);
            soundClip.SetActive(false);
        }
示例#3
0
        public static void stopCoroutine(this GameObject self, Coroutine routine)
        {
            MonoDispatcher dispatcher = self.GetOrAddComponent <MonoDispatcher>();

            if (dispatcher == null)
            {
                dispatcher = self.AddComponent <MonoDispatcher>();
            }
            dispatcher.StopCoroutine(routine);
        }
示例#4
0
        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));
        }
示例#5
0
        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));
        }
示例#6
0
        public static bool dispatchEvent(this GameObject self, SAEventX e)
        {
            MonoDispatcher dispatcher = self.GetOrAddComponent <MonoDispatcher>();

            if (dispatcher == null)
            {
                return(false);
            }

            return(dispatcher.dispatchEvent(e));
        }
示例#7
0
        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));
        }
示例#8
0
        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));
        }