Writing Plugins that Interface With the Virindi Bundle

From VirindiPlugins
Revision as of 13:39, 3 January 2014 by Virindi (talk | contribs) (Created page with "'''Note: This page is designed for developers writing a Decal plugin.''' Plugins in the Virindi Plugin Bundle are designed to be easy to extend by other plugins. Many add...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Note: This page is designed for developers writing a Decal plugin.

Plugins in the Virindi Plugin Bundle are designed to be easy to extend by other plugins. Many addon functions have wrappers for your convenience provided in the [Virindi Public Code Repo].

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.


Virindi Views

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:


Example plugins which construct VVS views directly: