예제 #1
0
        static public void Broadcast <TReturn>(string eventType, Action <TReturn> returnCall, MessengerMode mode)
        {
            MessengerInternal.OnBroadcasting(eventType, mode);
            var invocationList = MessengerInternal.GetInvocationList <Func <TReturn> >(eventType);

            foreach (var result in invocationList.Select(del => del.Invoke()).Cast <TReturn>())
            {
                returnCall.Invoke(result);
            }
        }
예제 #2
0
        static public void Broadcast(string eventType, MessengerMode mode)
        {
            MessengerInternal.OnBroadcasting(eventType, mode);
            var invocationList = MessengerInternal.GetInvocationList <Action>(eventType);

            foreach (var callback in invocationList)
            {
                callback.Invoke();
            }
        }
        public void Broadcast <TReturn>(string eventType, Action <TReturn> returnCall, MessengerMode mode)
        {
            MessengerInternal.OnBroadcasting(eventType, mode);
            var invocationList = MessengerInternal.GetInvocationList <Func <TReturn> >(eventType);

            if (invocationList == null && mode == MessengerMode.DONT_REQUIRE_LISTENER)
            {
                return;
            }
            foreach (var result in invocationList.Select(del => del.Invoke()).Cast <TReturn>())
            {
                returnCall.Invoke(result);
            }
        }
        public void Broadcast(string eventType, MessengerMode mode)
        {
            MessengerInternal.OnBroadcasting(eventType, mode);
            var invocationList = MessengerInternal.GetInvocationList <Action>(eventType);

            if (invocationList == null && mode == MessengerMode.DONT_REQUIRE_LISTENER)
            {
                return;
            }
            foreach (var callback in invocationList)
            {
                callback.Invoke();
            }
        }