Writing Plugins that Interface With the Virindi Bundle
Note: This page is designed for developers writing a Decal plugin.
For plugins, functionality is typically exposed by an instance of the plugin's PluginCore object. Properly calling in requires referencing the target plugin, then verifying at runtime that the target assembly is loaded and the plugin is running. To avoid a JIT exception if the user is not running the target plugin, no types from the target assembly should be referenced in an executing method or instantiated class until it is known that the target assembly is already loaded. The example wrappers do this check for you.
There are two approaches you can use to support Virindi Views: require them, or support them optionally with fallback to Decal views.
Most Bundle components have fallback functionality. Fallback functionality is achieved using the MetaViewWrappers. The MetaViewWrappers abstract the concept of a view provider with a set of classes for VVS and Decal views which implement a common interface set. When you ask the ViewSystemSelector to create a new view, it returns the implementation that corresponds to what is currently running. The MetaViewWrapper interfaces are designed to be as identical as possible to the builtin Decal.Adapter classes to facilitate porting. Wrapper_WireupHelper.cs contains a helper class you can call to emulate Decal's attribute-based wireup.
Note that when using the MetaViewWrappers, you must add VVS_REFERENCED as a conditional compilation symbol under Project Properties/Build.
Applicable source files:
- ViewSystemSelector.cs (Determines what is running and constructs views)
- Wrapper.cs (Interface definitions)
- Wrapper_Decal.cs (Implementation for Decal views)
- Wrapper_MyHuds.cs (Implementation for VVS views)
- Wrapper_WireupHelper.cs (Attribute wireup helper)
Example plugins which use VVS with fallback:
- VVS Example Plugin
- Virindi Reporter
- SkunkVision VVS Edition (SkunkVision_CSharp component)
- SSSort VVS Edition (uses WireupHelper)
- SpellbarSaver VVS Edition (uses WireupHelper)
- GoArrow VVS Edition (uses WireupHelper)
Example plugins which construct VVS views directly: