Elin
Mod Config GUI
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,如果可以我还是想作为扩展,而不是前置。
xTracr  [author] 23 May @ 5:54am 
@Sivn
手动注册就两行,考虑要判断软件包是否存在也就单独建个文件隔离一下
if (ModManager.ListPluginObject.OfType<BaseUnityPlugin>().Any(plugin => plugin.Info.Metadata.GUID == "me.xtracr.modconfiggui"))
LayerBuilder.RegisterDefaultBuilder(ModGUID, ModName, configFile);
应该还算方便
Sivn 23 May @ 5:23am 
我看到了,你写在postfix了,嗯……
xTracr  [author] 23 May @ 5:21am 
@Sivn
自动绑定?本身就是自动的,很多mod的ConfigFile都是自己new的,不是直接用的BaseUnityPlugin.Config属性,这种我拿不到,只能mod作者手动注册
workshop\content\2135150\3379819704\README.md里有写怎么手动注册
不过之前确实描述里写得不太好,稍微改了一下
Sivn 23 May @ 4:46am 
bro能不能加个自动绑定的功能
Proxyer 10 Jan @ 6:03am 
Thank you for fixed!
DW420 9 Jan @ 11:43pm 
I deleted the error reports to keep the thread tidy. :)
xTracr  [author] 9 Jan @ 11:19pm 
@DW420
It should be fixed now.
Proxyer 9 Jan @ 5:31am 
After Version:EA 23.74 fix 5, mod dead again.
xTracr  [author] 8 Jan @ 5:24pm 
@DW420
这似乎是GUI入口点生成失败导致的。
出现问题时你的Mod Viewer中的最后一个mod是什么?
最好能把错误日志也发给我
This seems to be caused by a exception in GUI entry point generation.
What was the last mod in your Mod Viewer when the problem occurred?
Better yet, send me the error log as well.
DW420 8 Jan @ 5:31am 
Latest update (7/1) bugs out the mods list. (or rather.. it does so on my setup)
Visually this results in all of the local mods disappearing from the list as well as some of the workshop mods.
From there on ..exiting the mod viewer is impossible via normal means and one has to ALT+F4 .
Disabling the Mod Config GUI mod results in everything showing up as normal & being able to exit the mod viewer as normal .
xTracr  [author] 22 Dec, 2024 @ 8:36pm 
@NPOu
这个问题不难解决,但我的解决方案有点丑陋:
在LayerTitle.OnInit()的末尾添加补丁,在进入世界前初始化UIHelper,这样复制Layers(Float)的时候就不会把LayerInventory等窗口一并复制了
This isn't hard to fix, but my solution is a bit ugly:
Add a patch to the end of LayerTitle.OnInit() to initialize the UIHelper before entering the world so that when copying Layers(Float) it doesn't copy LayerInventory and other windows along with it
[HarmonyPostfix]
[HarmonyPatch(typeof(LayerTitle), "OnInit")]
public static void Oninit_Postfix()
{
UnityEngine.Object.Destroy(Layer.Create<LayerMod>().gameObject);
UIHelper.Init();
}
鉴于它暂时没什么影响,我就先不这么做了
Since it doesn't seem to be harmful, I'll leave it as it is for now
NPOu 22 Dec, 2024 @ 5:20pm 
By the way maybe a nitpick but I keep seeing exceptions, even though they seem harmless.

ArgumentOutOfRangeException: Index was out of range. Must be non-negative and less than the size of the collection.
Parameter name: index
at System.Collections.Generic.List`1[T].get_Item (System.Int32 index) [0x00009] in <7e05db41a20b45108859fa03b97088d4>:0
at UIInventory.get_owner () [0x0000a] in <2119054204a4433093b57a78b9b90a5a>:0
at LayerInventory.OnDestroy () [0x0001a] in <2119054204a4433093b57a78b9b90a5a>:0
UnityEngine.Object:DestroyImmediate(Object, Boolean)
UnityEngine.Object:DestroyImmediate(Object)
ClassExtension:DestroyChildren(Component, Boolean, Boolean)
ModConfigGUI.UI.UIHelper:ReplaceComponents(Layer)
ModConfigGUI.UI.UIHelper:AddLayer(ILayerBuilder)
ModConfigGUI.Patches.<>c__DisplayClass1_1:<CombineActions>b__2()
xTracr  [author] 22 Dec, 2024 @ 4:49am 
@NPOu
It supposed to say “Changes have not been saved yet. Save?”, instead of "NotSaved".
This is actually a localization id, because the worksheet name for EN.xlsx is “General)”, with an unexpected bracket......:steamsad:
Fixed.
NPOu 22 Dec, 2024 @ 3:01am 
@xTracr_Owen
Thank you!
Also small thing but when exiting the menu without saving it says "NotSaved", maybe change to "Do you wish to save?"
Thanks again!
xTracr  [author] 21 Dec, 2024 @ 7:18pm 
@NPOu
I set characterLimit to 0, there should be no character limit now.
NPOu 21 Dec, 2024 @ 6:38am 
I was trying to do an InputName and found this code
switch (inputType)
{
case Dialog.InputType.Password:
d.input.field.characterLimit = 8;
d.input.field.contentType = InputField.ContentType.Alphanumeric;
break;
case Dialog.InputType.Item:
d.input.field.characterLimit = 30;
break;
case Dialog.InputType.DistributionFilter:
d.input.field.characterLimit = 100;
break;
}
Maybe it can give you an hint why yours is 24 max.
NPOu 21 Dec, 2024 @ 4:29am 
@xTracr_Owen
Seems like there's a character limit on string fields
"123456789012345678901234", so only 24 characters are supported somehow.
Can this be increased? I don't think there's any pratical limit on string sizes.
If I put 100 characters on the config file, when loaded Mod Config GUI also only shows 24.
Thanks again for the great mod!
鹿经夜夜读,功力日日深 8 Dec, 2024 @ 6:16pm 
似乎会跟yk testing tool冲突,会让它的界面无法显示
xTracr  [author] 7 Dec, 2024 @ 11:11pm 
@NPOu
我记得确实是会有这个报错的,虽然没看出来有什么影响。
但是今天发现不报错了,也不知道为什么
我正想解决它呢...
I remember that it did throw errors like you've said, although I couldn't see anything wrong in the game.
But today I found that it didn't throw errors, and I don't know why.
I was just trying to fix it...
NPOu 7 Dec, 2024 @ 10:37am 
Seems to be throwing some errors though, happens when config is opened.
ArgumentOutOfRangeException: Index was out of range. Must be non-negative and less than the size of the collection.

Also, I'd suggest to add a feedback sound or something (maybe change button text from "save" to "saved") when a setting is saved as the button doesn't give any feedback.
NPOu 7 Dec, 2024 @ 10:35am 
@Zydoo
It applies without a restart.
Zydoo 7 Dec, 2024 @ 8:52am 
does this actively apply the changes to the config files or do you still need to restart the game for changes to apply?
vmxlf 7 Dec, 2024 @ 7:16am 
interesting.
NPOu 7 Dec, 2024 @ 3:57am 
This is a great idea and very useful!
I have a suggestion:
https://i.ibb.co/NjTrppj/image.png
Try to put an option in the ESC menu > Tools and show only mods that have configurations available, so it's easier to find what you need to change.
But really this is great, now modders don't need to go through the trouble of having their own menus!