This repository was archived by the owner on Apr 29, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 12
GameModules
exelix edited this page Aug 23, 2018
·
9 revisions
GameModules are the hardest plugin to implement, their job is to open and save levels, instantiate new objects and properties. A GameModule to work needs at least three other classes: ILevelObj, ILevel and IObjList implementations. These interfaces are used to excange data with the editor window. This page will offer a limited explaination, it's better to use the Odyssey and other modules as examples
Here I'll explain the purpose of each property and function:
-
ModuleNameis the module name shown in the credits -
ModelsFoldershould not contain spaces, it's the folder where the extracted models of this extension are saved -
GetClassConvertersContains a list of Types and TypeConverters to correctly display custom types in the propertygrid -
ReservedPropNamesthis is an array of properties (names) the editor won't allow to remove from objects -
ModelFieldPropNamesthis is an array of properties (names) that will make the editor reload the model for the current object when changed -
IsAddListSupportedif the editor allows adding new object lists. -
IsPropertyEditingSupportedif the editor allows removing or adding properties -
ViewFormis a reference to the editor window you should set it in the InitModule function. -
AutoHideListan array of list names that will automatically set to hidden when loading a level -
InitModule(...)called as soon as the editor window is initialized up, here you should set the ViewForm property and register MenuExtensions related to your module. -
FormLoaded()called after the editor window is shown, here you should do your startup checks like setup your base models -
ParseArgs(string[] Args)the editor form args are handled here -
LoadLevel(string path = null)andNewLevel(string path = null)open or create a level, if the path is null should show an OpenFileDialog, return your ILevel implementation or null if the user cancelled -
CreateObjList(string name, IList<dynamic> baseList)returns a new instance of your IObjList implementation, baseList is usually a list of objects -
NewObject()should show a dialog for creating a new instance of your implementation of ILevelObj, return null if the user cancels -
SaveLevel(ILevel level)save the level (you should have stored the path of the loaded level) -
SaveLevelAs(ILevel level)shows a SaveFileDialog and saves the level -
ConvertModelFile(string ObjName, string path)converts a model from the game's format to obj, ObjName is the name of the object, finding the actual model path is the extension's job. path is where the obj should be saved. Returns false if the conversion failed -
GetPlaceholderModel(string ObjName, string ListName)returns the name of a placeholder obj model for an object called ObjName and in the ListName list (the blue cubes in odyssey editor). Only the name is returned, the editor will assume the file is inside theModelsFolderpath. -
OpenLevelFile(string name, Stream file)open a file inside the level files (a property of ILevelObj) if returns false a FileHandler will be used. Return false if unimplemented. -
AddObjList(ILevel level)should show a dialog to add a new IObjList to the current level and return its name. Will never be called ifIsAddListSupportedis false -
EditChildrenNode(ILevelObj obj)Is called to edit the children objects of an object, should call IEditorFormContext.EditList() which will call GameModule.CreateObjList() -GetNewProperty(dynamic target)returns a new property to be added to the target object (do not add it, it will be done by the editor). Item1 is the name Item2 is the property value