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
TContext
The 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
context
TContext
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
plugin
IPluginThe plugin to which the component belongs.
failIfExists
boolThrow 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
T
The 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
plugin
IPluginThe plugin to which the component belongs.
obj
TThe instance of the plugin component to add.
failIfExists
boolThrow an exception if the shared component already exists. Default: true
Type Parameters
T
The 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
type
TypeThe 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
TX
The 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
manager
IManagerplugins
List<IPlugin>reason
ReloadReason
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
manager
PluginManagerplugins
List<IPlugin>reason
ReloadReason
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
manager
PluginManagerreason
ReloadReason
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
manager
PluginManagerplugins
List<IPlugin>reason
ReloadReason
SetupConfiguration(PluginConfig?)
Sets up the plugin configuration.
public virtual void SetupConfiguration(PluginConfig? pluginConfig)
Parameters
pluginConfig
PluginConfigThe plugin configuration to set up.
SetupSharedEventBus(ManagedEventBus)
Sets up the shared event bus for the plugin.
public virtual void SetupSharedEventBus(ManagedEventBus eventBus)
Parameters
eventBus
ManagedEventBusThe 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()