Last active
February 6, 2024 14:40
-
-
Save KaiStarkk/41b391585d1ef9a1ab58a34b602a71ca to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public abstract class EventBusBase | |
{ | |
protected readonly List<Object> _publishers = new(); | |
// More EventBus implementation. | |
// Notably, doesn't have a member for the event, nor any methods | |
// accessing the event, because it won't be possible to override | |
// the event in sub-classes with different delegates. So most methods | |
// have to be repeated as below. | |
} | |
} | |
public abstract class EventBus : EventBusBase | |
{ | |
public event UnityAction OnEventRaised; | |
public void Publish(Object publisher) { } // Implementation | |
// ... Repeated implementation of other members accessing the event | |
} | |
public abstract class EventBus<T> : EventBusBase | |
{ | |
public event UnityAction<T> OnEventRaised; | |
public void Publish(Object publisher) { } // Implementation | |
// ... Repeated implementation of other members accessing the event | |
} | |
public abstract class EventBus<T0, T1> : EventBusBase | |
{ | |
public event UnityAction<T0, T1> OnEventRaised; | |
public void Publish(Object publisher) { } // Implementation | |
// ... Repeated implementation of other members accessing the event | |
} | |
public abstract class EventBus<T0, T1, T2> : EventBusBase | |
{ | |
public event UnityAction<T0, T1, T2> OnEventRaised; | |
public void Publish(Object publisher) { } // Implementation | |
// ... Repeated implementation of other members accessing the event | |
} | |
public abstract class EventBus<T0, T1, T2, T3> : EventBusBase | |
{ | |
public event UnityAction<T0, T1, T2, T3> OnEventRaised; | |
public void Publish(Object publisher) { } // Implementation | |
// ... Repeated implementation of other members accessing the event | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment