Class Script
- Namespace
- RisingV.Scripting.RuntimeHost
- Assembly
- RisingV.Scripting.dll
Base class for scripts in the RisingV scripting system.
public abstract class Script : IScript<IScriptContext<ScriptData>>, IScript, IManageableLifecycle<ScriptManager>, IManageableLifecycle, IReloadable, IManageable<ScriptManager>, IManageable
- Inheritance
-
Script
- Implements
- Derived
- Inherited Members
- Extension Methods
Constructors
Script(IScriptContext<ScriptData>)
Base class for scripts in the RisingV scripting system.
protected Script(IScriptContext<ScriptData> context)
Parameters
context
IScriptContext<ScriptData>The script context containing metadata and configuration for the script.
Properties
ClassNamespace
Gets the class name of the script, which is the name of the class that implements the script logic.
public string ClassNamespace { get; }
Property Value
Context
The script context containing metadata and configuration for the script.
public IScriptContext<ScriptData> Context { get; }
Property Value
FileName
Gets the file name of the script, typically the script's source file name.
public string FileName { get; }
Property Value
FilePath
Gets the file path of the script, which includes the directory and file name.
public string FilePath { get; }
Property Value
LoadedAt
Gets the context of the script, which provides access to the script's execution environment and data.
public DateTime LoadedAt { get; set; }
Property Value
LoaderOptions
Gets the class name of the script, which is the name of the class that implements the script logic.
public ScriptLoaderOptions? LoaderOptions { get; }
Property Value
Log
Gets the logger for the script, which is used for logging messages related to the script's execution
public virtual ILogger Log { get; }
Property Value
Name
Gets the name of the script.
public string Name { get; }
Property Value
Methods
Initialize(ScriptManager, List<IPlugin>)
Initializes the script with the provided ScriptManager and plugins. Typically called from the EventBridge.OnPluginsInitializingEvent event.
public abstract void Initialize(ScriptManager manager, List<IPlugin> plugins)
Parameters
manager
ScriptManagerplugins
List<IPlugin>
Load(ScriptManager, List<IPlugin>)
Loads the script into the provided ScriptManager and plugins. Called after all scripts have been initialized. Typically called from the EventBridge.OnPluginsInitializingEvent event.
public abstract void Load(ScriptManager manager, List<IPlugin> plugins)
Parameters
manager
ScriptManagerplugins
List<IPlugin>
OnReload(ScriptManager, List<IPlugin>, ReloadReason)
Called when the manager is reloaded with a specific type. This can be used to handle any specific logic needed during a reload. This can also override the default reload behavior.
public virtual bool OnReload(ScriptManager manager, List<IPlugin> plugins, ReloadReason reason)
Parameters
manager
ScriptManagerplugins
List<IPlugin>reason
ReloadReason
Returns
- bool
true to allow default reload behaviour, false to stop
OnReloaded(ScriptManager, List<IPlugin>, ReloadReason)
protected virtual void OnReloaded(ScriptManager manager, List<IPlugin> plugins, ReloadReason reason)
Parameters
manager
ScriptManagerplugins
List<IPlugin>reason
ReloadReason
Ready(ScriptManager, List<IPlugin>)
Called when the script is ready to be used. Called after all scripts have been loaded. Typically called at the end of the EventBridge.OnPluginsInitializingEvent event.
public virtual void Ready(ScriptManager manager, List<IPlugin> plugins)
Parameters
manager
ScriptManagerplugins
List<IPlugin>
Reload(ScriptManager, List<IPlugin>, ReloadReason)
Reloads the manager and its dependencies with a specific type.
public virtual void Reload(ScriptManager manager, List<IPlugin> plugins, ReloadReason reason)
Parameters
manager
ScriptManagerplugins
List<IPlugin>reason
ReloadReason
Terminate(ScriptManager, List<IPlugin>)
Terminates the manager and cleans up resources with a specific type.
public abstract void Terminate(ScriptManager manager, List<IPlugin> plugins)
Parameters
manager
ScriptManagerplugins
List<IPlugin>
Unload(ScriptManager, List<IPlugin>)
Unloads the script from the provided ScriptManager and plugins.
public virtual void Unload(ScriptManager manager, List<IPlugin> plugins)
Parameters
manager
ScriptManagerplugins
List<IPlugin>