Table of Contents

Class RisingPlugin<TContext>

Namespace
RisingV.Core.Plugins
Assembly
RisingV.Core.dll

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
BasePlugin
RisingPlugin<TContext>
Implements
IPlugin<TContext>
Derived
Inherited Members
BasePlugin.AddComponent<T>()
BasePlugin.Log
BasePlugin.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

DatabaseManager

Delegate

public static RisingSharedPlugin<TContext>? Delegate { get; }

Property Value

RisingSharedPlugin<TContext>

EngineManager

The engine manager for the plugin.

public EngineManager EngineManager { get; }

Property Value

EngineManager

EventBus

public ManagedEventBus EventBus { get; }

Property Value

ManagedEventBus

Harmony

public Harmony Harmony { get; }

Property Value

Harmony

PluginConfig

public PluginConfig? PluginConfig { get; }

Property Value

PluginConfig

PluginInfo

public PluginInfo PluginInfo { get; }

Property Value

PluginInfo

PluginTarget

public PluginTarget PluginTarget { get; }

Property Value

PluginTarget

ProcessorManager

The processor manager for the plugin.

public ProcessorManager ProcessorManager { get; }

Property Value

ProcessorManager

SystemManager

The system manager for the plugin.

public SystemManager SystemManager { get; }

Property Value

SystemManager

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 IPlugin

The plugin to which the component belongs.

failIfExists bool

Throw 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 IPlugin

The plugin to which the component belongs.

obj T

The instance of the plugin component to add.

failIfExists bool

Throw 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 Type

The 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 IManager
plugins 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 PluginManager
plugins 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

bool

Reload(PluginManager, ReloadReason)

public void Reload(PluginManager manager, ReloadReason reason)

Parameters

manager PluginManager
reason 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 PluginManager
plugins List<IPlugin>
reason ReloadReason

SetupConfiguration(PluginConfig?)

Sets up the plugin configuration.

public virtual void SetupConfiguration(PluginConfig? pluginConfig)

Parameters

pluginConfig PluginConfig

The plugin configuration to set up.

SetupSharedEventBus(ManagedEventBus)

Sets up the shared event bus for the plugin.

public virtual void SetupSharedEventBus(ManagedEventBus eventBus)

Parameters

eventBus ManagedEventBus

The 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()

Returns

bool