Interface IServerComponentRegistry<TNetworkManager, TConnection, TServerComponent>
Generic interface for server component registries. Defines the contract for registering, retrieving, and managing server components (behaviours, data containers, etc.).
public interface IServerComponentRegistry<TNetworkManager, TConnection, TServerComponent> where TServerComponent : IServerComponent
Type Parameters
TNetworkManagerThe network manager type.
TConnectionThe connection type.
TServerComponentThe base component type being managed.
Methods
DeinitializeAll()
Deinitializes and cleans up all registered components.
void DeinitializeAll()
Get<T>()
Gets a registered component instance, or null if not found.
T Get<T>() where T : class, TServerComponent
Returns
- T
The component instance if found, otherwise null.
Type Parameters
TThe type of the component to retrieve.
InitializeAll(IServer)
Initializes all registered components with the provided server context.
void InitializeAll(IServer server)
Parameters
serverIServerThe server instance that owns this registry.
Register<T>(T)
Registers a component instance for global access. The component will be registered under every interface it implements that derives from TServerComponent, as well as under its concrete type.
void Register<T>(T component) where T : class, TServerComponent
Parameters
componentTThe component instance to register.
Type Parameters
TThe concrete type of the component.
TryGet<T>(out T)
Attempts to get a registered component instance.
bool TryGet<T>(out T component) where T : class, TServerComponent
Parameters
componentTThe output component instance if found.
Returns
- bool
True if the component was found, otherwise false.
Type Parameters
TThe type of the component to retrieve.
Unregister<T>(T)
Unregisters a component instance from global access. Removes any entries keyed by the concrete type and by any interfaces it implemented.
void Unregister<T>(T component) where T : class, TServerComponent
Parameters
componentTThe component instance to unregister.
Type Parameters
TThe concrete type of the component.