Class ServerComponentRegistry<TNetworkManager, TConnection, TServerComponent>
- Namespace
- FishMMO.Server.Implementation
- Assembly
- FishMMO.Server.dll
Generic base implementation for server component registries. Handles registration, lookup, and lifecycle management of server components. Can be extended for specific component types (behaviours, data containers, etc.).
public abstract class ServerComponentRegistry<TNetworkManager, TConnection, TServerComponent> : IServerComponentRegistry<TNetworkManager, TConnection, TServerComponent> where TServerComponent : IServerComponent
Type Parameters
TNetworkManagerThe network manager type.
TConnectionThe connection type.
TServerComponentThe base component type being managed.
- Inheritance
-
ServerComponentRegistry<TNetworkManager, TConnection, TServerComponent>
- Implements
-
IServerComponentRegistry<TNetworkManager, TConnection, TServerComponent>
- Derived
- Inherited Members
Fields
components
Dictionary mapping component interface types and concrete types to their instances.
protected Dictionary<Type, TServerComponent> components
Field Value
- Dictionary<Type, TServerComponent>
Properties
RegistryName
Name of the registry for logging purposes. Override in derived classes.
protected abstract string RegistryName { get; }
Property Value
Methods
DeinitializeAll()
Deinitializes all registered components. Must be implemented by derived classes to handle component-specific deinitialization logic.
public abstract void DeinitializeAll()
Get<T>()
Gets a registered component of type T, or null if not found.
public virtual T Get<T>() where T : class, TServerComponent
Returns
- T
Type Parameters
T
InitializeAll(IServer)
Initializes all registered components. Must be implemented by derived classes to handle component-specific initialization logic.
public abstract void InitializeAll(IServer server)
Parameters
serverIServer
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.
public virtual void Register<T>(T component) where T : class, TServerComponent
Parameters
componentT
Type Parameters
T
TryGet<T>(out T)
Attempts to get a registered component of type T.
public virtual bool TryGet<T>(out T component) where T : class, TServerComponent
Parameters
componentT
Returns
Type Parameters
T
Unregister<T>(T)
Unregisters a component instance from global access.
public virtual void Unregister<T>(T component) where T : class, TServerComponent
Parameters
componentT
Type Parameters
T