ConfigEditor
Dependency plugin edit JSON object via GUI.
模組介紹 作者原文
Config Editor Plugin
This unofficial TaleSpire dependency plugin for automatically creating a runtime
config editor which allows the editing or simple and complex object JSON files
through a GUI interface.
Change Log
1.3.1: Added diagnostic configurations
1.3.1: Remapped configuration settings
1.3.0: Fix for BR udpate regarding keyboard endable/disable
1.2.2: Disable core TS processing of keyboard when editor is open
1.2.1: Exposed default layout settings to config
1.2.0: Added multiple subscription functionality
1.2.0: Added functionality for a token based subscribe and unsubscribe
1.1.1: Removed unused dependencies
1.1.0: Simplified usage
1.1.0: Added Color Picker support
1.0.2: Updated package to include default background colors. No plugin change.
1.0.1: Added mandatory header to Render method
1.0.0: Initial release
Install
Install using R2ModMan usually as a dependency of some other plugin.
Usage: Quick Start Quide
When you want to add a Config Editor for some JSON do the following:
- In the Awake() or similar add the `Subcribe(callback)` function.
The callback will do something with the updated JSON when the
user presses the Save button.
- In your code call the Open(header, json, buttons) method to open
the Config Editor.
- In the OnGUI() method, add `Render()`. You don't need to make this
conditional. The Config Editor will only render if it is opne even
if you call Render when it is close
- Call Close() in your callback
Usage: I Need More Customization
This is a dependency plugin so it does not provide any user features directly.
Instead other plugins can make use of it to render config editor GUIs for
editing most JSON configurations. The following methods are expoded:
Subscribe(Action saveCallback)
When the Config Editor is showing, any changes are not automatically saved.
Instead you can add buttons (defined in the Open method) and those buttons
generate a callback when pressed. The callback takes two strings. The first
string is the name of the button that was pressed. The second string is the
update json of the Config Editor. The callback can be used to implement any
function from Cancel to Apply to Save.
Using a callback like this gives the benefit that the user can do whatever with
the updated JSON and it also avoids constant disk writing by waiting until all
the changes are made before writing the updated config to disk.
Subscription(Action saveCallback)
Same as Subscribe but returns a subscription id which can be used in the below
method to remove a subscription.
RemoveSubscription(System.Guid subscriptionGuid)
Removes a previously made subscription using the subscription id that was provdied
in the Subscription method call. Subscriptions made with the Subscribe method cannot
be unsubscribed.
SetLayout(int startX = 60, int startY = 90,
int menuVerticalSpacing = 20, int menuHorizontalSpacing = 300,
int menuEntryWidth = 280, int menuHorizontalOffsetToEntry = 200,
int menuEntryIndent = 5, float menuEntrydebunchngFactor = 0.8f)
The Config Editor has a default layout as indicated by the default numbers for
each parameter. However, if desired, this method can be used to change the default
layout parameters to customize the spacing of the Config Editor.
`startX` indicates the horizontal offset from the left side of the screen in pixels
where the Config Editor dialog appears.
`startY` indicates the vertical offset from the top of screen in pixels where the
Config Editor dialog appears.
`menuVerticalSpacing` indicates the height, in pixels, of the menu entries. This is
the space from one entry to another. The actual background and text area will be a
fraction of this value based on the menuEntrydebunchngFactor. Font size is automatically
determined from this value.
`menuHorizontalSpacing` indicates the width, in pixels, of the menu columns. This is
the space between one column of entries and the next.
`menuEntryWidth` indicates the width, in pixels, of the menu entries. This is
the width
安裝與使用 安裝:按包內說明操作
- 解壓本站下載的壓縮包,先讀包內的 readme / 說明檔案。
- 多數模組依賴遊戲的模組載入器:常見做法是用社群模組管理器(如 r2modman)選中本遊戲安裝,由管理器自動處理載入器與依賴。
- 手動安裝時,把模組檔案放進遊戲目錄下對應的 Mod / plugins 資料夾。
- 啟動遊戲確認載入成功;帶「前置依賴」的模組需要把依賴一併安裝。
不同模組的安裝位置差異較大,包內說明是最可靠的依據。
下面這些內容需要先安裝,否則該模組不會生效: