forked from akanyan/mu3-mods
feat: implement TestMenuConfig
This commit is contained in:
40
Extras/TestMenuConfig/MU3.TestMode/patch_TestModePageTop.cs
Normal file
40
Extras/TestMenuConfig/MU3.TestMode/patch_TestModePageTop.cs
Normal file
@ -0,0 +1,40 @@
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using UnityEngine;
|
||||
|
||||
namespace MU3.TestMode;
|
||||
|
||||
internal class patch_TestModePageTop: TestModePageTop {
|
||||
GameObject _testModePageModConfig;
|
||||
|
||||
protected override void createItems() {
|
||||
_bottomMargin = 0.22f;
|
||||
|
||||
_testModePageModConfig = new("TestModePageModConfig");
|
||||
_testModePageModConfig.SetActive(false);
|
||||
_testModePageModConfig.transform.SetParent(transform.parent);
|
||||
_testModePageModConfig.AddComponent<Mod.TestModePageModConfig>();
|
||||
|
||||
FieldInfo fi = typeof(TestModePage).GetField("_itemDefines", BindingFlags.Instance | BindingFlags.NonPublic);
|
||||
var defines = ((ItemDefine[])fi.GetValue(this)).ToList();
|
||||
|
||||
var n = defines.Count;
|
||||
defines.Insert(n - 1, new() {
|
||||
lineNumber = n - 1,
|
||||
label = "MODS",
|
||||
isSelectable = true,
|
||||
hasValueField = false,
|
||||
numValueField = 0,
|
||||
nextPagePrefab = _testModePageModConfig,
|
||||
isFinishOnSelect = false,
|
||||
isDefaultSelection = false,
|
||||
});
|
||||
|
||||
// The exit button
|
||||
defines.Last().lineNumber += 1;
|
||||
|
||||
fi.SetValue(this, defines.ToArray());
|
||||
|
||||
base.createItems();
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user