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(); }
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); }
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(); }