-
Notifications
You must be signed in to change notification settings - Fork 12
Plugin Development
EditorCore can be extended through plugins, plugins can add three different kinds of functionality:
- A Game Module allows to edit the levels for a game, it includes all the logic to handle its file formats
- A FileHandler allows to open file formats that aren't levels, such as archives or textures, it can be called by other plugins as well.
- A MenuExtension adds buttons to the various menus in the application with custom logic, these can't be called by other extensions.
A dll can include an unlimited number of extensions but the editor can use a single Game module per instance. There is no limit for other kinds of extensions.
With visual studio create a new classes library (.net dll) you might want to call the project "*something*Ext" because the final dll name must end with "Ext.dll" this way the editor can quickly load only its extensions.
Once you created the project add a reference to EditorCoreCommon.dll and create a new extension manifest:
using EditorCore.Interfaces;
...
class MyExtension: ExtensionManifest
{
public string ModuleName => "MyExtension";
public string Author => "";
public string ExtraText => null;
public IMenuExtension MenuExt => null
public bool HasGameModule => false;
public IGameModule GetNewGameModule() => null;
public IFileHander[] Handlers => null;
public void CheckForUpdates()
{
return;
}
}
The manifest doesn't need to be public as it will be loaded through reflection. You can include multiple manifests but it's not recommended.
Each property must return a new class :
public IFileHander[] Handlers => new IFileHander[] { new BymlFileHandler() };
public IMenuExtension MenuExt => new MyMenuExtension();
this is because controls can't be shared among multiple forms.