示例#1
0
    public static void Broadcast <T, U, V, W>(string eventType, T arg1, U arg2, V arg3, W arg4)
    {
        EventDispatcher.OnBroadcasting(eventType);
        Action action = delegate
        {
            Delegate @delegate;
            if (EventDispatcher.eventTable.TryGetValue(eventType, ref @delegate))
            {
                Callback <T, U, V, W> callback = @delegate as Callback <T, U, V, W>;
                if (callback == null)
                {
                    throw EventDispatcher.CreateBroadcastSignatureException(eventType);
                }
                callback(arg1, arg2, arg3, arg4);
            }
        };

        action.Invoke();
    }
示例#2
0
    public static void BroadcastAsync <T, U, V>(string eventType, T arg1, U arg2, V arg3)
    {
        EventDispatcher.OnBroadcasting(eventType);
        Action ac = delegate
        {
            Delegate @delegate;
            if (EventDispatcher.eventTable.TryGetValue(eventType, ref @delegate))
            {
                Callback <T, U, V> callback = @delegate as Callback <T, U, V>;
                if (callback == null)
                {
                    throw EventDispatcher.CreateBroadcastSignatureException(eventType);
                }
                callback(arg1, arg2, arg3);
            }
        };

        EventDispatcher.messengerHelper.GetComponent <EventDispatcherHelper>().AddTask(ac);
    }
示例#3
0
    public static void Broadcast(string eventType)
    {
        EventDispatcher.OnBroadcasting(eventType);
        Action action = delegate
        {
            Delegate @delegate;
            if (EventDispatcher.eventTable.TryGetValue(eventType, ref @delegate))
            {
                Callback callback = @delegate as Callback;
                if (callback == null)
                {
                    throw EventDispatcher.CreateBroadcastSignatureException(eventType);
                }
                callback();
            }
        };

        action.Invoke();
    }