using MU3.TestMode; using System.Collections.Generic; using System.IO; using System.Linq; using System.Reflection; using UnityEngine; namespace MU3.Mod; class TestModePageModConfig: TestModePage { class Option { public int selection; public string sectionName; public string fieldName; public ItemDefine itemDefine; public List> values; public Option(string label, string fieldName, Dictionary values, int indexDefault, bool selectable, string sectionName = "Extra") { this.values = values.ToList(); this.fieldName = fieldName; this.sectionName = sectionName; itemDefine = new ItemDefine { lineNumber = 0, label = label, isSelectable = selectable, hasValueField = true, numValueField = 1, nextPagePrefab = null, isFinishOnSelect = false, isDefaultSelection = false, }; using IniFile iniFile = new("mu3.ini"); var previous = iniFile.getValue(sectionName, fieldName, values.ElementAt(indexDefault).Value); var found = this.values.FindIndex(i => i.Value == previous); if(found < 0) { itemDefine.isSelectable = false; selection = indexDefault; } else { selection = found; } } } private bool isEnabled(string v) => typeof(TestMenuEnable).GetNestedType(v) != null; private List