Class ServiceManager
Manager which administers registered services These services need to implement the IService interface and do not need to inherit from MonoBehaviour
Namespace: i5.Toolkit.Core.ServiceCore
Assembly: cs.temp.dll.dll
Syntax
public class ServiceManager : IServiceManager, IRunnerReceiver
Constructors
ServiceManager()
Creates a new instance of a ServiceManager
Declaration
public ServiceManager()
Properties
Instance
The instance of the service manager
Declaration
public static ServiceManager Instance { get; }
Property Value
Type | Description |
---|---|
ServiceManager |
Runner
The runner in the scene This runner object provides MonoBehaviour events to the service manager It can be accessed by servies to run MonoBehaviour functionality, e.g. co-routines
Declaration
public ServiceManagerRunner Runner { get; }
Property Value
Type | Description |
---|---|
ServiceManagerRunner |
Methods
GetService<T>()
Gets the service instance with the given type
Declaration
public static T GetService<T>()
where T : IService
Returns
Type | Description |
---|---|
T | Returns the registered service instance |
Type Parameters
Name | Description |
---|---|
T | The type of service |
InstGetService<T>()
Gets the service instance with the given type that is registered at this instance
Declaration
public T InstGetService<T>()
where T : IService
Returns
Type | Description |
---|---|
T | Returns the registered service instance |
Type Parameters
Name | Description |
---|---|
T | The type of service |
InstRegisterService<T>(T)
Instance method for registering a new service
Declaration
public void InstRegisterService<T>(T service)
where T : IService
Parameters
Type | Name | Description |
---|---|---|
T | service | The service instance which should be registered |
Type Parameters
Name | Description |
---|---|
T | The type of service |
InstRemoveService<T>()
Removes a service with the given type from this ServiceManager instance
Declaration
public void InstRemoveService<T>()
where T : IService
Type Parameters
Name | Description |
---|---|
T | The type of service |
InstServiceExists<T>()
Checks if a service with the given type exists at this instance
Declaration
public bool InstServiceExists<T>()
where T : IService
Returns
Type | Description |
---|---|
Boolean | Returns true if a service of the given type was registered at this instance |
Type Parameters
Name | Description |
---|---|
T | The type of service |
OnRunnerDestroyed()
Called if the runner object is destroyed Makes sure that the runner persists if it was destroyed by some other script
Declaration
public void OnRunnerDestroyed()
RegisterService<T>(T)
Registers a new service at the service manager
Declaration
public static void RegisterService<T>(T service)
where T : IService
Parameters
Type | Name | Description |
---|---|---|
T | service | The service instance which should be registered at the ServiceManager |
Type Parameters
Name | Description |
---|---|
T | The type of service |
RemoveService<T>()
Removes a provider with the given type from the ServiceManager
Declaration
public static void RemoveService<T>()
where T : IService
Type Parameters
Name | Description |
---|---|
T | The type of service |
ServiceExists<T>()
Checks if a service with the given type exists at the ServiceManager
Declaration
public static bool ServiceExists<T>()
where T : IService
Returns
Type | Description |
---|---|
Boolean | Returns true if a service of the given type was registered |
Type Parameters
Name | Description |
---|---|
T | The type of service |
Update()
Called by the update runner Updates the updateable services
Declaration
public void Update()