雪居之地 (Wildfrost)

雪居之地 (Wildfrost)

49 个评价
Config Manager
   
奖励
收藏
已收藏
取消收藏
Tools
标签: Mod
文件大小
发表于
更新日期
1.080 MB
2024 年 3 月 8 日 下午 9:37
6 月 5 日 上午 8:50
44 项改动说明 ( 查看 )

订阅以下载
Config Manager

在 Hopeless 的 1 个合集中
Configurables
30 件物品
描述
Adds a Journal button to modify configs for all currently ACTIVE mods, and allows modders to customise their appearance and behaviour


NOTE: If the configs don't automatically update ingame, first try resubscribing to Config Manager and delete your mod's config.cfg. If all else fails, report to me @Hopeful on Discord


Customisation for your mod
Without this mod as a dependency
Without requiring this mod as a dependency, you can still do minimal customisation:
  • Set the description through the comment parameter in your ConfigItem. Make sure new lines use "\n//".
  • Set predefined options by using bool or an enum type as the value of your ConfigItem
You can use sprites using <sprite name="your sprite"> (or <sprite=..> or even <spr=..> for short) in the desc, but keywords and card popups don't work yet. By default this works with the base game stuff, but you can add your own by adding a sprite asset with my VFX & SFX Tools

With this mod as a dependency
In general, each mod has its own ConfigSection in the Journal which contains a ConfigItem for each config. If there are no (visible) configs, then this section won't show up.

Attributes: The main meat
For modders adding this to your mod, you can add any of these new attributes when you define each config item:
  • ConfigManagerTitle : The title to display for this item
  • ConfigManagerDesc : The description to display when hovered. Use this if you want rich text tags like <align> or <voffset>
  • ConfigInput : Adds a button to manually input the config. When used with Options, will only choose between the predefined options, or the range if used with Slider.
  • ConfigOptions : Adds left/right buttons to swap between predefined options. When used with an enum, it will automatically replace _ with spaces
  • ConfigSlider : Adds a slider with a predefined range. Can use with float or int. This shows the current value under the title
  • HideInConfigManager : By default, this item won't show up in the Journal unless any ShowIfConfig is defined

Making manual changes to the config or appearance
Manually make changes to the config (similar to toggling charms with my Unlock Selector mod).
  • ConfigManager.SaveConfig() : This method is missing from the api for some reason so I added it here
  • ConfigManager.ConfigItem : For each config in your mod:
    • configItem.UpdateDesc() : Change the hover popup, possibly overriding the text preprocessing. Same as doing "desc = str"
    • configItem.UpdateTitle() : Change the title displayed. Same as doing "title = str"

Conditional visibility attributes
You can use any number of these to specify when a config should/shouldn't be visible. Optionally set priority parameters if using HideIf and ShowIf together
  • HideIfConfig : This item won't show up in the Journal if the specified config item (by field name) takes some value
  • ShowIfConfig : Use to override HideIf or HideInConfigManager if needed

Events
The main thing here is OnConfigChanged, which is useful for when you need to reload your mod after disabling/enabling any DataFile objects for example (see Miya's blood mod in progress)
  • ConfigManager.OnModLoaded : Event after any mod loads
  • ConfigManager.OnModUnloaded : Event after any mod unloads
  • configSection.OnConfigChanged : Event after a config's value is saved for each mod
I didn't realise the ModLoaded/Unloaded were already part of the api so wtv
1 条留言
Hopeless  [作者] 4 月 20 日 下午 3:28 
This mod's GUID is hope.wildfrost.configs