DocumentsPlug-Ins
Write code using UTF8.
Plug-in specifications can be added or changed.
Plug-Ins Overview
Here's a brief explanation about plug-ins.
This refers to script plug-ins. These plug-ins are managed internally and can point to UI parameters of the software (for example, the auto-tile plug-in, individual action command plug-ins, individual link condition plug-ins, etc.).
The language supported is JavaScript. Script plug-ins can be written in CoffeeScript as well, which will be automatically converted into JavaScript when being used.
Script plug-ins can be added using the "Plug-ins" tool. Added plug-ins are saved in the plugins folder within the project folder itself. Javascript files have a .js extension. Coffeescript files are .coffee. Coffeescript is automatically converted into Javascript when the plug-in is loaded or updated and saved in the plugins folder as a .js JavaScript file.
To support multiple languages for script plug-ins, the software's locale is defined with the setLocale() function. By changing the language according to the function's returned value, multiple languages can be supported. Regional identifying text such as ja_JP may be attached, but the first two characters can be removed if the region is unnecessary.
Script plug-ins need to return a JavaScript object (script plug-in object) when script file is loading. If the load fails (JavaScript analysis failed), or getInfo data retrieval fails, this object is destroyed. Try not to pollute the global environment. Script plug-in objects are stored as Agtk.plugins and can be accessed through Agtk.plugins[< pluginID >].
At the moment, script plug-in objects need to provide the following functions.
getInfo | Function |
---|---|
initialize | Function |
finalize | Function |
call | Function |
setLocale | Function |
update | Function(※Optional) |
You can call cocos2d-x's JSB API in script plug-ins.
http://www.cocos2d-x.org/docs/api-ref/js/v3x/
Detailed Features
For more details about plug-ins, refer to the following PDF.