Class RisingPlugin<TContext>
Base class for RisingV plugins with a specific context. Also see: RisingPluginBase
public abstract class RisingPlugin<TContext> : BasePlugin, IPlugin<TContext>, IPlugin, IManageable<PluginManager>, IReloadable<PluginManager>, IReloadable, IDisposable, IHasPluginContext<TContext>, IPluginContext, IPluginComponent, IManageable<PluginComponentsManager>, IManageable where TContext : PluginContext
Type Parameters
TContextThe type of the plugin context, which must inherit from PluginContext.
- Inheritance
-
BasePluginRisingPlugin<TContext>
- Implements
-
IPlugin<TContext>IHasPluginContext<TContext>
- Derived
- Inherited Members
-
BasePlugin.AddComponent<T>()BasePlugin.LogBasePlugin.Config
- Extension Methods
Constructors
RisingPlugin()
protected RisingPlugin()
RisingPlugin(TContext)
protected RisingPlugin(TContext context)
Parameters
contextTContext
Properties
Context
Gets the specific plugin context associated with this instance.
public TContext Context { get; }
Property Value
- TContext
DatabaseManager
The database manager for the plugin.
public DatabaseManager DatabaseManager { get; }
Property Value
Delegate
public static RisingSharedPlugin<TContext>? Delegate { get; }
Property Value
- RisingSharedPlugin<TContext>
EngineManager
The engine manager for the plugin.
public EngineManager EngineManager { get; }
Property Value
EventBus
public ManagedEventBus EventBus { get; }
Property Value
Harmony
public Harmony Harmony { get; }
Property Value
- Harmony
PluginConfig
public PluginConfig? PluginConfig { get; }
Property Value
PluginInfo
public PluginInfo PluginInfo { get; }
Property Value
PluginTarget
public PluginTarget PluginTarget { get; }
Property Value
ProcessorManager
The processor manager for the plugin.
public ProcessorManager ProcessorManager { get; }
Property Value
SystemManager
The system manager for the plugin.
public SystemManager SystemManager { get; }
Property Value
Methods
AddSharedComponent<T>(IPlugin, bool)
Adds a shared component to the plugin context.
public T? AddSharedComponent<T>(IPlugin plugin, bool failIfExists = true) where T : class, IPluginComponent
Parameters
pluginIPluginThe plugin to which the component belongs.
failIfExistsboolThrow an exception if the shared component already exists. Default: true
Returns
- T
The added plugin component of the specified type, or null if it was not added.
Type Parameters
TThe type of the plugin component to add.
AddSharedComponent<T>(IPlugin, T, bool)
Adds a shared component to the plugin context with an instance of the component.
public void AddSharedComponent<T>(IPlugin plugin, T obj, bool failIfExists = true) where T : class, IPluginComponent
Parameters
pluginIPluginThe plugin to which the component belongs.
objTThe instance of the plugin component to add.
failIfExistsboolThrow an exception if the shared component already exists. Default: true
Type Parameters
TThe type of the plugin component to add.
Dispose()
Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
public virtual void Dispose()
Get()
Gets the current instance of the RisingPlugin.
public static RisingSharedPlugin<TContext> Get()
Returns
- RisingSharedPlugin<TContext>
GetSharedComponent(Type)
Gets a shared component of the specified type from the plugin context.
public IPluginComponent? GetSharedComponent(Type type)
Parameters
typeTypeThe type of the plugin context to retrieve.
Returns
- IPluginComponent
The plugin context of the specified type, or null if not found.
GetSharedComponent<TX>()
Gets a shared component of the specified type from the plugin context.
public TX? GetSharedComponent<TX>() where TX : class, IPluginComponent
Returns
- TX
The plugin component of the specified type, or null if not found.
Type Parameters
TXThe type of the plugin component to retrieve.
Load()
public override void Load()
OnInitialize()
Called when the plugin is initialized (after OnPreLoad()).
public abstract void OnInitialize()
OnLoad()
Called when the plugin is loaded (after OnInitialize()).
public abstract void OnLoad()
OnPreLoad()
Called when the BepInEx plugin Load is called.
public virtual void OnPreLoad()
OnReload(IManager, List<IPlugin>, ReloadReason)
Called when the manager is reloaded. This can be used to handle any specific logic needed during a reload. This can also override the default reload behavior.
public bool OnReload(IManager manager, List<IPlugin> plugins, ReloadReason reason)
Parameters
managerIManagerpluginsList<IPlugin>reasonReloadReason
Returns
- bool
true to allow default reload behaviour, false to stop
OnReload(PluginManager, 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 bool OnReload(PluginManager manager, List<IPlugin> plugins, ReloadReason reason)
Parameters
managerPluginManagerpluginsList<IPlugin>reasonReloadReason
Returns
- bool
true to allow default reload behaviour, false to stop
OnUnload()
Called when the plugin is unloaded.
public abstract bool OnUnload()
Returns
Reload(PluginManager, ReloadReason)
public void Reload(PluginManager manager, ReloadReason reason)
Parameters
managerPluginManagerreasonReloadReason
Reload(PluginManager, List<IPlugin>, ReloadReason)
Reloads the manager and its dependencies with a specific type.
public void Reload(PluginManager manager, List<IPlugin> plugins, ReloadReason reason)
Parameters
managerPluginManagerpluginsList<IPlugin>reasonReloadReason
SetupConfiguration(PluginConfig?)
Sets up the plugin configuration.
public virtual void SetupConfiguration(PluginConfig? pluginConfig)
Parameters
pluginConfigPluginConfigThe plugin configuration to set up.
SetupSharedEventBus(ManagedEventBus)
Sets up the shared event bus for the plugin.
public virtual void SetupSharedEventBus(ManagedEventBus eventBus)
Parameters
eventBusManagedEventBusThe event bus to set up.
TryGet()
Attempts to get the current instance of the RisingPlugin.
public static RisingSharedPlugin<TContext>? TryGet()
Returns
- RisingSharedPlugin<TContext>
Unload()
public override bool Unload()