Class GameEventBase<TListener, TCodeListener>
- Namespace
- ElectricDrill.AstraRpgFramework.Events
- Assembly
- com.electricdrill.astra-rpg-framework.Runtime.dll
Shared event dispatch base for parameterless and generic game events. It centralizes listener storage, snapshotting, registration-order delivery, and reentrancy handling.
public abstract class GameEventBase<TListener, TCodeListener> : ScriptableObject
Type Parameters
TListenerThe MonoBehaviour-based listener type.
TCodeListenerThe code listener delegate type.
- Inheritance
-
objectGameEventBase<TListener, TCodeListener>
- Derived
Methods
Dispatch<TInvoker>(TInvoker)
Dispatches the event to a snapshot of the current listeners in registration order. Subscribe/unsubscribe during a callback never mutates the active iteration. The non-reentrant path reuses snapshot buffers after warmup; reentrant raises allocate fresh buffers.
protected void Dispatch<TInvoker>(TInvoker invoker) where TInvoker : struct, GameEventBase<TListener, TCodeListener>.IDispatchInvoker
Parameters
invokerTInvokerThe invoker that calls the concrete listener signatures.
Type Parameters
TInvokerThe listener invoker for the concrete event arity.
RegisterCodeListener(TCodeListener)
Registers a code listener to be notified when this event is raised. Duplicate listeners are automatically prevented.
protected void RegisterCodeListener(TCodeListener listener)
Parameters
listenerTCodeListenerThe listener to register.
RegisterMonoListener(TListener)
Registers a MonoBehaviour-based listener to be notified when this event is raised. Duplicate listeners are automatically prevented.
protected void RegisterMonoListener(TListener listener)
Parameters
listenerTListenerThe listener to register.
UnregisterCodeListener(TCodeListener)
Unregisters a code listener so it will no longer be notified when this event is raised.
protected void UnregisterCodeListener(TCodeListener listener)
Parameters
listenerTCodeListenerThe listener to unregister.
UnregisterMonoListener(TListener)
Unregisters a MonoBehaviour-based listener so it will no longer be notified when this event is raised.
protected void UnregisterMonoListener(TListener listener)
Parameters
listenerTListenerThe listener to unregister.