コード例 #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));
        }
コード例 #9
0
        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));
        }