Class PluginFeature
Represents an feature of a certain type provided by a plugin
Inheritance
Implements
Namespace: Artemis.Core
Assembly: Artemis.Core.dll
Syntax
public abstract class PluginFeature : CorePropertyChanged, IDisposable
Constructors
PluginFeature()
Declaration
protected PluginFeature()
Properties
Id
Gets the identifier of this plugin feature
Declaration
public string Id { get; }
Property Value
Type | Description |
---|---|
string |
Info
Gets the plugin feature info related to this feature
Declaration
public PluginFeatureInfo Info { get; }
Property Value
Type | Description |
---|---|
PluginFeatureInfo |
IsEnabled
Gets whether the plugin is enabled
Declaration
public bool IsEnabled { get; }
Property Value
Type | Description |
---|---|
bool |
Plugin
Gets the plugin that provides this feature
Declaration
public Plugin Plugin { get; }
Property Value
Type | Description |
---|---|
Plugin |
Profiler
Gets the profiler that can be used to take profiling measurements
Declaration
public Profiler Profiler { get; }
Property Value
Type | Description |
---|---|
Profiler |
Methods
AddTimedUpdate(TimeSpan, Action<double>, string?)
Registers a timed update that whenever the plugin is enabled calls the provided action
at the
provided
interval
Declaration
public TimedUpdateRegistration AddTimedUpdate(TimeSpan interval, Action<double> action, string? name = null)
Parameters
Type | Name | Description |
---|---|---|
TimeSpan | interval | The interval at which the update should occur |
Action<double> | action | The action to call every time the interval has passed. The delta time parameter represents the time passed since the last update in seconds |
string | name | An optional name used in exceptions and profiling |
Returns
Type | Description |
---|---|
TimedUpdateRegistration | The resulting plugin update registration which can be used to stop the update |
AddTimedUpdate(TimeSpan, Func<double, Task>, string?)
Registers a timed update that whenever the plugin is enabled calls the provided asyncAction
at
the
provided
interval
Declaration
public TimedUpdateRegistration AddTimedUpdate(TimeSpan interval, Func<double, Task> asyncAction, string? name = null)
Parameters
Type | Name | Description |
---|---|---|
TimeSpan | interval | The interval at which the update should occur |
Func<double, Task> | asyncAction | The async action to call every time the interval has passed. The delta time parameter represents the time passed since the last update in seconds |
string | name | An optional name used in exceptions and profiling |
Returns
Type | Description |
---|---|
TimedUpdateRegistration | The resulting plugin update registration |
Disable()
Called when the feature is deactivated or when Artemis shuts down
Declaration
public abstract void Disable()
Dispose()
Declaration
public void Dispose()
Dispose(bool)
Releases the unmanaged resources used by the plugin feature and optionally releases the managed resources.
Declaration
protected virtual void Dispose(bool disposing)
Parameters
Type | Name | Description |
---|---|---|
bool | disposing | true to release both managed and unmanaged resources; false to release only unmanaged resources. |
Enable()
Called when the feature is activated
Declaration
public abstract void Enable()
OnDisabled()
Triggers the Disabled event
Declaration
protected virtual void OnDisabled()
OnEnabled()
Triggers the Enabled event
Declaration
protected virtual void OnEnabled()
Events
Disabled
Occurs when the feature is disabled
Declaration
public event EventHandler? Disabled
Event Type
Type | Description |
---|---|
EventHandler |
Enabled
Occurs when the feature is enabled
Declaration
public event EventHandler? Enabled
Event Type
Type | Description |
---|---|
EventHandler |