Init(args)
Scripting Reference
Loading...
Searching...
No Matches
Sisus.Init.Service Class Reference

Description

Utility class that clients can use to retrieve services that are accessible to them.

Get<TService> and TryGet<TService> can be used to acquire global services, while GetFor<TService>(Component) and TryGetFor<TService>(Component, out TService) can be used to acquire local services specific to a particular client.

Services can be registered automatically using the ServiceAttribute, or manually using the Set<TService> and AddFor<TService>(Clients, TService, Component) methods.

Services can also be registered using the Inspector by selecting the "Make Service Of Type..." context menu item, or by dragging and dropping components onto a Services component.

Static Public Member Functions

static bool ExistsFor< TService > ([DisallowNull] object client)
 Determines whether service of type TService is available for the client .
 
static bool ExistsFor< TService > ([DisallowNull] Component client)
 Gets a value indicating whether service of type TService is available for the client .
 
static bool ExistsFor< TService > ([DisallowNull] GameObject client)
 Determines whether service of type TService is available for the client .
 
static bool Exists< TService > ()
 Determines whether a global service of type TService is available.
 
static bool ForEquals< TService > ([DisallowNull] GameObject client, TService @object)
 Determines whether the given object is a service accessible by the client .
 
static bool TryGetFor< TService > ([DisallowNull] object client, [NotNullWhen(true), MaybeNullWhen(false)] out TService service)
 Tries to get service of type TService for the client .
 
static bool TryGetFor< TService > ([DisallowNull] Component client, [NotNullWhen(true), MaybeNullWhen(false)] out TService service)
 Tries to get service of type TService for client .
 
static bool TryGetFor< TService > ([DisallowNull] GameObject client, [NotNullWhen(true), MaybeNullWhen(false)] out TService service)
 Tries to get service of type TService for client .
 
static bool TryGet< TService > ([NotNullWhen(true), MaybeNullWhen(false)] out TService service)
 Tries to get a global service of type TService .
 
static TService GetFor< TService > ([DisallowNull] Component client)
 Gets service of type TService for client .
 
static async System.Threading.Tasks.Task< TService > GetForAsync< TService > ([DisallowNull] Component client, Context context=Context.MainThread)
 Gets service of type TService for client asynchrounously.
 
static async System.Threading.Tasks.Task< TService > GetAsync< TService > (Context context=Context.MainThread)
 Gets service of type TService asynchrounously.
 
static TService GetFor< TService > ([DisallowNull] GameObject client)
 Gets service of type TService for client .
 
static TService Get< TService > ()
 Gets service of type TService for any client.
 
static void Set< TService > ([DisallowNull] TService newInstance)
 Sets the TService service instance shared across clients to the given value.
 
static void SetInstance< TService > ([DisallowNull] TService newInstance)
 Obsolete.
 
static void AddFor< TService > (Clients clients, [DisallowNull] TService service, [DisallowNull] Component registerer)
 Registers a service with the defining type TService available to a limited set of clients.
 
static void AddFor< TService > (Clients clients, [DisallowNull] TService service)
 Registers a service with the defining type TService available to a limited set of clients.
 
static void RemoveFrom< TService > (Clients clients, [DisallowNull] TService service, [DisallowNull] Component serviceProvider)
 Unregisters a service with the defining type TService that has been available to a limited set of clients.
 
static void RemoveFrom< TService > (Clients clients, [DisallowNull] Component registerer)
 Unregisters a service with the defining type TService that has been available to a limited set of clients.
 
static void RemoveFrom< TService > (Clients clients, [DisallowNull] TService service)
 Unregisters a service with the defining type TService that has been available to a limited set of clients.
 
static void AddInstanceChangedListener< TService > (ServiceChangedHandler< TService > method)
 Subscribes the provided method to listen for changes made to the shared instance of service of type TService .
 
static void RemoveInstanceChangedListener< TService > (ServiceChangedHandler< TService > method)
 Unsubscribes the provided method from listening for changes made to the shared instance of service of type TService .
 
static bool IsServiceProviderFor< TService > ([DisallowNull] Component client, [DisallowNull] object test)
 Gets a value indicating whether test is a value provider service which is accessible to client.