Elin
108 ratings
Mod Config GUI
   
Award
Favorite
Favorited
Unfavorite
Gameplay: General
System: Mod Library
File Size
Posted
Updated
122.308 KB
7 Dec, 2024 @ 3:43am
10 Jun @ 1:21am
14 Change Notes ( view )

Subscribe to download
Mod Config GUI

Description
自动为拥有由BepInEx直接生成的配置文件的模组生成GUI。
通常而言,受支持的配置文件是Elin\BepInEx\config文件夹下的cfg文件。

以下内容详情见workshop\content\2135150\3379819704\README.md:
支持多语言本地化,从Mod文件夹\LangConfig\中读取xlsx文件的'Config'工作表,文件名:语言.xlsx,如EN.xlsx。
ConfigFile必须是Mod的BaseUnityPlugin.Config属性,否则无法直接生成,需由Mod作者注册对应Builder。
GUI支持Mod作者进行一定程度的自定义,也支持非BepInEx的配置文件,但无法自动生成。

GPT translation:

EN:
This mod automatically generates a GUI for mods that has config files directly generated by BepInEx.
Generally, the supported config files are cfg files in the Elin\BepInEx\config folder.

The following content is in workshop\content\2135150\3379819704\README.md:
It supports multi-language localization, reading the 'Config' worksheet of the xlsx file in the Mod folder\LangConfig\, file name: language.xlsx, such as EN.xlsx.
ConfigFile must be the BaseUnityPlugin.Config property of the mod, otherwise it cannot be generated directly, and the mod author needs to register the corresponding Builder.
GUI supports mod authors to make some customizations, also supports non-BepInEx config files, but cannot be automatically generated.

JP:
このMODは、BepInExによって直接生成された設定ファイルを持つMODのGUIを自動生成します。
通常、サポートされる設定ファイルは、Elin\BepInEx\configフォルダ内のcfgファイルです。

ワークシートの内容は、workshop\content\2135150\3379819704\README.mdにあります。
多言語対応、Modフォルダ\LangConfig\にあるxlsxファイルの'Config'ワークシートを読み取ります。ファイル名:言語.xlsx、例:EN.xlsx。
ConfigFileは、MODのBaseUnityPlugin.Configプロパティである必要があります。そうでない場合、直接生成できません。MOD作者は、対応するBuilderを登録する必要があります。
GUIは、MOD作者が少しカスタマイズできるようになります。非BepInExの設定ファイルもサポートしていますが、自動生成できません。
34 Comments
Sivn 23 May @ 6:39am 
base.GetType().BaseType.GetField("<Config>k__BackingField", BindingFlags.Instance | BindingFlags.NonPublic).SetValue(this, configFile);
this是BaseUnityPluging派生类
Sivn 23 May @ 6:38am 
ok,成功了,顺便发现个小小bug,如果有重复mod就不会给重复中的任意一个起效,不过这个情况机会不存在。我订阅了我自己的mod才出现这种情况。
Sivn 23 May @ 6:34am 
不行吧,不作为前置怎么引用。
另一个可行的方法就是检查是否有这个mod,然后通过反射调用你的函数, 但我觉得这个更麻烦。
xTracr  [author] 23 May @ 6:29am 
@Sivn
不过引用也行吧,单独建个文件隔离一下,先检测是否有ModConfigGUI,有的话再调用那个文件里的方法,就不必须作为前置了
(这个操作在dnspy上好不好做我就不知道了
Sivn 23 May @ 6:18am 
是,按照cs的自动生成规则,应该叫<Config>k__BackingField,然后现在我找不到System.Reflection了。linux上用dnspy还是太蛋疼了。
xTracr  [author] 23 May @ 6:15am 
@Sivn
哦,你的是用反射改BaseUnityPlugin.Config吗
如果是的话,那确实有点烦人了...
xTracr  [author] 23 May @ 6:08am 
@Sivn
我对用dnspy改没有概念
不过能用反射改就行,也挺方便(我是这么觉得的
Sivn 23 May @ 6:00am 
感觉要用反射改了
Sivn 23 May @ 6:00am 
哎,可惜不是虚属性,不然直接重写就好了
Sivn 23 May @ 5:59am 
我手头缺少工具,只能用dnspy改,而且这意味这我要引用你的mod,如果可以我还是想作为扩展,而不是前置。