Class CoreController<TProjectContext>
The base class for all core controllers.
Inheritance
Namespace: AlchemyBow.Core
Assembly: AlchemyBow.Core.dll
Syntax
public abstract class CoreController<TProjectContext> : MonoBehaviour where TProjectContext : CoreProjectContext
Type Parameters
Name | Description |
---|---|
TProjectContext | The type of the project context visible for the controller. |
Properties
Container
Returns the container used for dependency injection or null
before the binding stage.
Declaration
protected Container Container { get; }
Property Value
Type | Description |
---|---|
Container | The container used for dependency injection or |
PostLoadingDelay
The additional delay between the loading and working stages (measured in seconds, real time).
Declaration
protected virtual float PostLoadingDelay { get; }
Property Value
Type | Description |
---|---|
System.Single |
PreLoadingDelay
The additional delay between the binding and loading stages (measured in seconds, real time).
Declaration
protected virtual float PreLoadingDelay { get; }
Property Value
Type | Description |
---|---|
System.Single |
Methods
ChangeScene(Int32)
Starts a scene change process.
Declaration
protected void ChangeScene(int buildIndex)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | buildIndex | The build index of the scene to load. |
DestroyProjectContext()
Destroys the project context. A potential use of this method is to allow you to switch between different project contexts.
Declaration
protected void DestroyProjectContext()
GetLoadables()
Override this method to specify an ordered collection of loading members.
Declaration
protected abstract IEnumerable<ICoreLoadable> GetLoadables()
Returns
Type | Description |
---|---|
System.Collections.Generic.IEnumerable<ICoreLoadable> | Returns an ordered collection of loading members or |
InstallAdditionalBindings(IBindOnlyContainer)
Override this method to install additional bindings.
Declaration
protected virtual void InstallAdditionalBindings(IBindOnlyContainer container)
Parameters
Type | Name | Description |
---|---|---|
IBindOnlyContainer | container | The dependency injection container. |
OnBindingFinished()
This method is called after the dependencies are resolved (before the start of the loading stage).
Declaration
protected virtual void OnBindingFinished()
OnKeepUnloading(OperationHandle)
This method is called after OnSceneChangeStarted()
and before the actual scene change process. You can use it to clean up external resources, such as additional scenes.
Declaration
protected virtual void OnKeepUnloading(OperationHandle operationHandle)
Parameters
Type | Name | Description |
---|---|---|
OperationHandle | operationHandle | The handle of the operation. (The base verision of the method marks the operation handle done.) |
OnLoadablesProgressed(LoadablesProgress)
Override this method to respond to the the loading process progress. For example, to update your loading screen.
Declaration
protected virtual void OnLoadablesProgressed(LoadablesProgress progress)
Parameters
Type | Name | Description |
---|---|---|
LoadablesProgress | progress | The current progress. |
Remarks
This method is called twice for each loadable during the loading process (not once if there are none). Project context loadables are included if they haven't been loaded previously.
OnLoadingFinished()
This method is called when binding and loading is completed (when the controller enters the working stage).
Declaration
protected virtual void OnLoadingFinished()
Remarks
By default, it invokes ICoreLoadingCallbacksHandler.OnCoreLoadingFinished()
.
OnSceneChangeStarted()
This method is called when the scene change process begins. By default, it invokes ICoreLoadingCallbacksHandler.OnCoreSceneChangeStarted()
.
Declaration
protected virtual void OnSceneChangeStarted()
Remarks
If you use the UnityEngine.UI
package, you may need to add UnityEngine.EventSystems.EventSystem.current.enabled = false;
here.
OnStarted(OperationHandle)
This method is called when the script instance is being loaded. It can be used to perform operations such as turning on a loading screen.
Declaration
protected virtual void OnStarted(OperationHandle operationHandle)
Parameters
Type | Name | Description |
---|---|---|
OperationHandle | operationHandle | The handle of the operation. (The base verision of the method marks the operation handle done.) |
Remarks
It's called before the binding stage, so dependencies are not injected yet.