using System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using System.Text; using System.Text.RegularExpressions; using System.Threading; using BepInEx; using GlobalEnums; using Microsoft.CodeAnalysis; using Newtonsoft.Json; using UnityEngine; using UnityEngine.EventSystems; using UnityEngine.Events; using UnityEngine.SceneManagement; using UnityEngine.UI; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("0.0.0.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace NativeUIMaker { [Serializable] public class UIControlConfig { public string name; public string type; public string page; public Vector2 position; public Vector2 size; public string title; public string description; public string[] toggleTexts; public int toggleIndex; public string labelText; public int fontSize; public Color color; public float minValue; public float maxValue; public float value; public bool wholeNumbers; public int optionIndex; public string[] options; public int direction; public bool playAnim; public bool clickable; public bool draggable; public string inputText; public string placeholderText; public int style; public Vector2 iconOffset; public Vector2 titleOffset; public Vector2 descOffset; public float sliderXOffset; public float sliderWidth; public float labelXOffset; public float valueXOffset; } [Serializable] public class ConfigData { public List controls = new List(); } public class DebugWindow : MonoBehaviour { [Serializable] [CompilerGenerated] private sealed class <>c { public static readonly <>c <>9 = new <>c(); public static Func <>9__79_0; public static Func <>9__82_0; public static UnityAction <>9__82_1; public static UnityAction <>9__87_0; public static Predicate <>9__97_0; public static Predicate <>9__98_0; public static Predicate <>9__99_0; public static Predicate <>9__100_0; public static Predicate <>9__101_0; public static Predicate <>9__102_0; public static Func <>9__104_0; public static Func <>9__107_0; public static UnityAction <>9__108_0; public static UnityAction <>9__118_0; public static Predicate <>9__120_0; public static Predicate <>9__120_1; public static Predicate <>9__120_2; public static Predicate <>9__120_3; public static Predicate <>9__120_4; public static Predicate <>9__120_5; public static Predicate <>9__123_0; public static UnityAction <>9__126_7; internal bool b__79_0(NativePage p) { return p != null; } internal string b__82_0(string s) { return s.Trim(); } internal void b__82_1() { Debug.Log((object)UILocale.Get("按钮被点击")); } internal void b__87_0() { Debug.Log((object)UILocale.Get("箭头被点击")); } internal bool b__97_0(NativeButton b) { return b == null || (Object)(object)b.gameObject == (Object)null; } internal bool b__98_0(NativeLabel l) { return l == null || (Object)(object)l.gameObject == (Object)null; } internal bool b__99_0(NativeSlider s) { return s == null || (Object)(object)s.gameObject == (Object)null; } internal bool b__100_0(NativeOption o) { return o == null || (Object)(object)o.gameObject == (Object)null; } internal bool b__101_0(NativeArrow a) { return a == null || (Object)(object)a.gameObject == (Object)null; } internal bool b__102_0(NativeInput i) { return i == null || (Object)(object)i.gameObject == (Object)null; } internal string b__104_0(string s) { return s.Trim(); } internal string b__107_0(string s) { return s.Trim(); } internal void b__108_0() { Debug.Log((object)UILocale.Get("箭头被点击")); } internal void b__118_0() { Debug.Log((object)UILocale.Get("箭头被点击")); } internal bool b__120_0(NativeButton b) { return b == null || (Object)(object)b.gameObject == (Object)null; } internal bool b__120_1(NativeLabel l) { return l == null || (Object)(object)l.gameObject == (Object)null; } internal bool b__120_2(NativeSlider s) { return s == null || (Object)(object)s.gameObject == (Object)null; } internal bool b__120_3(NativeOption o) { return o == null || (Object)(object)o.gameObject == (Object)null; } internal bool b__120_4(NativeArrow a) { return a == null || (Object)(object)a.gameObject == (Object)null; } internal bool b__120_5(NativeInput i) { return i == null || (Object)(object)i.gameObject == (Object)null; } internal bool b__123_0(NativeButton btn) { <>c__DisplayClass123_0 CS$<>8__locals0 = new <>c__DisplayClass123_0 { btn = btn }; return NativeArrow.AllInstances.Any((NativeArrow arr) => arr != null && (Object)(object)arr.gameObject == (Object)(object)CS$<>8__locals0.btn.gameObject); } internal void b__126_7() { Debug.Log((object)UILocale.Get("箭头被点击")); } } [CompilerGenerated] private sealed class <>c__DisplayClass123_0 { public NativeButton btn; internal bool b__1(NativeArrow arr) { return arr != null && (Object)(object)arr.gameObject == (Object)(object)btn.gameObject; } } private static DebugWindow _instance; private Rect _windowRect = new Rect(50f, 50f, 800f, 1500f); private Vector2 _scrollPos; private bool _showWindow = true; private int _selectedTab = 0; private object _selectedControl = null; private string _editTitle = ""; private string _editDesc = ""; private Vector2 _editPos = Vector2.zero; private Vector2 _editSize = Vector2.zero; private string _editLabelText = ""; private int _editFontSize = 30; private Color _editColor = Color.white; private float _editSliderMin; private float _editSliderMax; private float _editSliderValue; private bool _editSliderWhole; private string _editSliderLabel = ""; private float _editSliderXOffset = 0f; private float _editSliderWidth = 0f; private float _editLabelXOffset = 0f; private float _editValueXOffset = 0f; private string _editOptionLabel = ""; private string _editOptionDesc = ""; private string[] _editOptionOptions; private int _editOptionIndex; private int _editArrowDirection; private bool _editArrowPlayAnim; private bool _editArrowClickable; private bool _editArrowDraggable; private string _editInputText = ""; private string _editInputPlaceholder = ""; private string _editToggleTextsInput = ""; private Vector2 _editIconOffset = Vector2.zero; private Vector2 _editTitleOffset = Vector2.zero; private Vector2 _editDescOffset = Vector2.zero; private List _allButtons = new List(); private List _allLabels = new List(); private List _allSliders = new List(); private List _allOptions = new List(); private List _allArrows = new List(); private List _allInputs = new List(); private ButtonStyle _selectedCreateStyle = ButtonStyle.IconButton; private string[] _styleNames = new string[3] { "图标按钮", "纯文字按钮", "小型按钮" }; private string _toggleTextsInput = "选项1,选项2,选项3"; private string _iconPathInput = ""; private NativePage _selectedCreateTargetPage = null; private string[] _pageNamesForDropdown = new string[0]; private int _selectedPageDropdownIndex = 0; private List _externalButtons = new List(); private List _externalLabels = new List(); private List _externalSliders = new List(); private List _externalOptions = new List(); private List _externalArrows = new List(); private List _externalInputs = new List(); private bool _externalScanned = false; private List _allPages = new List(); private NativePage _selectedPage = null; private List _pageControlsCache = new List(); private static bool _tempDragEnabled; private static GameObject _tempDragTarget; public static DebugWindow Instance => _instance; private string PluginDirectory => NativeUIMakerMod.PluginDirectory; public static GameObject CurrentlySelectedForDrag { get; private set; } public static bool TempDragEnabled => _tempDragEnabled; public static GameObject TempDragTarget => _tempDragTarget; public static void Create() { //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Expected O, but got Unknown if (!((Object)(object)_instance != (Object)null)) { GameObject val = new GameObject("DebugWindow"); _instance = val.AddComponent(); Object.DontDestroyOnLoad((Object)(object)val); } } public GameObject GetSelectedGameObject() { if (_selectedControl == null) { return null; } if (_selectedControl is NativeButton nativeButton) { return nativeButton.gameObject; } if (_selectedControl is NativeLabel nativeLabel) { return nativeLabel.gameObject; } if (_selectedControl is NativeSlider nativeSlider) { return nativeSlider.gameObject; } if (_selectedControl is NativeOption nativeOption) { return nativeOption.gameObject; } if (_selectedControl is NativeArrow nativeArrow) { return nativeArrow.gameObject; } if (_selectedControl is NativeInput nativeInput) { return nativeInput.gameObject; } return null; } public void RefreshEditFieldsForSelected() { if (_selectedControl != null) { UpdateEditFieldsFromControl(); } } private void OnGUI() { //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Expected O, but got Unknown //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Unknown result type (might be due to invalid IL or missing references) if (_showWindow) { _windowRect = GUI.Window(123456, _windowRect, new WindowFunction(DrawWindow), UILocale.Get("NativeUIMaker 调试窗口")); } } private void DrawWindow(int id) { //IL_0157: Unknown result type (might be due to invalid IL or missing references) //IL_016b: Unknown result type (might be due to invalid IL or missing references) //IL_0170: Unknown result type (might be due to invalid IL or missing references) GUILayout.BeginVertical(Array.Empty()); GUILayout.BeginHorizontal(Array.Empty()); if (GUILayout.Button("CN", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(50f) })) { UILocale.SetForceChinese(true); } if (GUILayout.Button("EN", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(50f) })) { UILocale.SetForceChinese(false); } if (GUILayout.Button(UILocale.Get("Auto"), (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(50f) })) { UILocale.SetForceChinese(null); } GUILayout.EndHorizontal(); GUILayout.Space(10f); GUILayout.BeginHorizontal(Array.Empty()); if (GUILayout.Button(UILocale.Get("本地控件"), (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(30f) })) { _selectedTab = 0; } if (GUILayout.Button(UILocale.Get("外部控件"), (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(30f) })) { _selectedTab = 1; } if (GUILayout.Button(UILocale.Get("页面管理"), (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(30f) })) { _selectedTab = 2; } GUILayout.EndHorizontal(); _scrollPos = GUILayout.BeginScrollView(_scrollPos, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.ExpandHeight(true) }); if (_selectedTab == 0) { DrawLocalControlsTab(); } else if (_selectedTab == 1) { DrawExternalControlsTab(); } else { DrawPageManagementTab(); } GUILayout.EndScrollView(); DrawUnifiedEditor(); GUILayout.BeginHorizontal(Array.Empty()); if (GUILayout.Button(UILocale.Get("隐藏窗口"), Array.Empty())) { _showWindow = false; } GUILayout.EndHorizontal(); GUILayout.EndVertical(); GUI.DragWindow(); } private void DrawLocalControlsTab() { DrawCreateTargetSelector(); GUILayout.Space(10f); DrawCreateButtonSection(); DrawLocalButtonsList(); GUILayout.Space(10f); DrawCreateLabelSection(); DrawLocalLabelsList(); GUILayout.Space(10f); DrawCreateSliderSection(); DrawLocalSlidersList(); GUILayout.Space(10f); DrawCreateOptionSection(); DrawLocalOptionsList(); GUILayout.Space(10f); DrawCreateArrowSection(); DrawLocalArrowsList(); GUILayout.Space(10f); DrawCreateInputSection(); DrawLocalInputsList(); } private void RefreshPageDropdownList() { List list = NativePage.AllInstances.Where((NativePage p) => p != null).ToList(); _pageNamesForDropdown = new string[list.Count + 1]; _pageNamesForDropdown[0] = UILocale.Get("全局画布 (独立于页面)"); for (int i = 0; i < list.Count; i++) { _pageNamesForDropdown[i + 1] = ((Object)list[i].gameObject).name; } if (_selectedCreateTargetPage != null) { int num = list.IndexOf(_selectedCreateTargetPage); if (num >= 0) { _selectedPageDropdownIndex = num + 1; return; } _selectedCreateTargetPage = null; _selectedPageDropdownIndex = 0; } else { _selectedPageDropdownIndex = 0; } } private void DrawCreateTargetSelector() { GUILayout.BeginHorizontal(Array.Empty()); GUILayout.Label(UILocale.Get("创建目标:"), (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(60f) }); RefreshPageDropdownList(); int num = GUILayout.SelectionGrid(_selectedPageDropdownIndex, _pageNamesForDropdown, 1, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(200f) }); if (num != _selectedPageDropdownIndex) { _selectedPageDropdownIndex = num; if (num == 0) { _selectedCreateTargetPage = null; } else { List list = NativePage.AllInstances.ToList(); if (num - 1 < list.Count) { _selectedCreateTargetPage = list[num - 1]; } else { _selectedCreateTargetPage = null; } } } if (_selectedCreateTargetPage != null) { GUILayout.Label(UILocale.Get("当前:") + " " + ((Object)_selectedCreateTargetPage.gameObject).name, Array.Empty()); } else { GUILayout.Label(UILocale.Get("当前:") + " " + UILocale.Get("全局画布"), Array.Empty()); } GUILayout.EndHorizontal(); } private RectTransform GetCurrentParent() { if (_selectedCreateTargetPage != null && (Object)(object)_selectedCreateTargetPage.rectTransform != (Object)null) { return _selectedCreateTargetPage.rectTransform; } return UIParent.GetDefaultParent(); } private void DrawCreateButtonSection() { //IL_0124: Unknown result type (might be due to invalid IL or missing references) //IL_023f: Unknown result type (might be due to invalid IL or missing references) //IL_0244: Unknown result type (might be due to invalid IL or missing references) //IL_024a: Expected O, but got Unknown GUILayout.Label(UILocale.Get("=== 创建新按钮 ==="), Array.Empty()); GUILayout.Label(UILocale.Get("选择按钮样式:"), Array.Empty()); _selectedCreateStyle = (ButtonStyle)GUILayout.Toolbar((int)_selectedCreateStyle, new string[3] { UILocale.Get("图标按钮"), UILocale.Get("纯文字按钮"), UILocale.Get("小型按钮") }, Array.Empty()); if (_selectedCreateStyle == ButtonStyle.IconButton) { GUILayout.Label(UILocale.Get("图标文件路径 (绝对或相对路径,留空则不设置):"), Array.Empty()); _iconPathInput = GUILayout.TextField(_iconPathInput, Array.Empty()); } GUILayout.Label(UILocale.Get("切换文字序列(逗号分隔):"), Array.Empty()); _toggleTextsInput = GUILayout.TextField(_toggleTextsInput, Array.Empty()); if (!GUILayout.Button(string.Format(UILocale.Get("创建 {0}"), _styleNames[(int)_selectedCreateStyle]), Array.Empty())) { return; } RectTransform currentParent = GetCurrentParent(); NativeButton nativeButton = NativeButton.Create(currentParent, _selectedCreateStyle); if (nativeButton == null) { return; } nativeButton.SetPosition(Vector2.zero); nativeButton.SetSize(400f, 100f); nativeButton.SetTitle(UILocale.Get("新按钮")); nativeButton.SetDescription(UILocale.Get("可编辑描述")); if (_selectedCreateStyle == ButtonStyle.IconButton && !string.IsNullOrEmpty(_iconPathInput)) { Sprite val = NativeButton.LoadSpriteFromFile(_iconPathInput); if ((Object)(object)val != (Object)null) { nativeButton.SetIcon(val); } } string[] array = (from s in _toggleTextsInput.Split(new char[1] { ',' }) select s.Trim()).ToArray(); if (array.Length >= 2) { nativeButton.SetToggleTexts(array); } else if (array.Length == 1) { nativeButton.SetTitle(array[0]); nativeButton.SetDescription(array[0]); } else { object obj = <>c.<>9__82_1; if (obj == null) { UnityAction val2 = delegate { Debug.Log((object)UILocale.Get("按钮被点击")); }; <>c.<>9__82_1 = val2; obj = (object)val2; } nativeButton.AddClickListener((UnityAction)obj); } _allButtons.Add(nativeButton); _selectedControl = nativeButton; UpdateEditFieldsFromControl(); } private void DrawCreateLabelSection() { //IL_0047: Unknown result type (might be due to invalid IL or missing references) GUILayout.Label(UILocale.Get("=== 创建新标签 ==="), Array.Empty()); if (GUILayout.Button(UILocale.Get("创建文本标签 (StandardLabel)"), Array.Empty())) { RectTransform currentParent = GetCurrentParent(); NativeLabel nativeLabel = NativeLabel.Create(currentParent); if (nativeLabel != null) { nativeLabel.SetPosition(Vector2.zero); nativeLabel.SetSize(400f, 60f); nativeLabel.SetText(UILocale.Get("新标签")); _allLabels.Add(nativeLabel); _selectedControl = nativeLabel; UpdateEditFieldsFromControl(); } } } private void DrawCreateSliderSection() { //IL_004a: Unknown result type (might be due to invalid IL or missing references) GUILayout.Label(UILocale.Get("=== 创建新滑块 ==="), Array.Empty()); if (GUILayout.Button(UILocale.Get("创建滑块 (NativeSlider)"), Array.Empty())) { RectTransform currentParent = GetCurrentParent(); NativeSlider nativeSlider = NativeSlider.Create(currentParent); if (nativeSlider != null) { nativeSlider.SetPosition(Vector2.zero); nativeSlider.SetSize(600f, 60f); nativeSlider.SetLabel(UILocale.Get("新滑块")); nativeSlider.SetMinMax(0f, 100f); nativeSlider.Value = 50f; _allSliders.Add(nativeSlider); _selectedControl = nativeSlider; UpdateEditFieldsFromControl(); } } } private void DrawCreateOptionSection() { //IL_004d: Unknown result type (might be due to invalid IL or missing references) GUILayout.Label(UILocale.Get("=== 创建新选项行 (无滑块) ==="), Array.Empty()); if (GUILayout.Button(UILocale.Get("创建选项行 (NativeOption)"), Array.Empty())) { RectTransform currentParent = GetCurrentParent(); NativeOption nativeOption = NativeOption.Create(currentParent); if (nativeOption != null) { nativeOption.SetPosition(Vector2.zero); nativeOption.SetSize(600f, 80f); nativeOption.SetLabel(UILocale.Get("新选项")); nativeOption.SetDescription(UILocale.Get("这是描述文字")); nativeOption.SetOptions(new string[2] { UILocale.Get("选项1"), UILocale.Get("选项2") }); _allOptions.Add(nativeOption); _selectedControl = nativeOption; UpdateEditFieldsFromControl(); } } } private void DrawCreateArrowSection() { GUILayout.Label(UILocale.Get("=== 创建新箭头 ==="), Array.Empty()); GUILayout.BeginHorizontal(Array.Empty()); if (GUILayout.Button(UILocale.Get("左箭头"), Array.Empty())) { CreateArrow(NativeArrow.Direction.Left); } if (GUILayout.Button(UILocale.Get("右箭头"), Array.Empty())) { CreateArrow(NativeArrow.Direction.Right); } if (GUILayout.Button(UILocale.Get("上箭头"), Array.Empty())) { CreateArrow(NativeArrow.Direction.Up); } if (GUILayout.Button(UILocale.Get("下箭头"), Array.Empty())) { CreateArrow(NativeArrow.Direction.Down); } GUILayout.EndHorizontal(); } private void CreateArrow(NativeArrow.Direction dir) { //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Expected O, but got Unknown RectTransform currentParent = GetCurrentParent(); NativeArrow nativeArrow = NativeArrow.Create(currentParent, dir); if (nativeArrow == null) { return; } nativeArrow.SetPosition(Vector2.zero); nativeArrow.SetSize(80f, 80f); object obj = <>c.<>9__87_0; if (obj == null) { UnityAction val = delegate { Debug.Log((object)UILocale.Get("箭头被点击")); }; <>c.<>9__87_0 = val; obj = (object)val; } nativeArrow.SetClickable(clickable: true, (UnityAction)obj); _allArrows.Add(nativeArrow); _selectedControl = nativeArrow; UpdateEditFieldsFromControl(); } private void DrawCreateInputSection() { //IL_0047: Unknown result type (might be due to invalid IL or missing references) GUILayout.Label(UILocale.Get("=== 创建新输入框 ==="), Array.Empty()); if (GUILayout.Button(UILocale.Get("创建输入框"), Array.Empty())) { RectTransform currentParent = GetCurrentParent(); NativeInput nativeInput = NativeInput.Create(currentParent); if (nativeInput != null) { nativeInput.SetPosition(Vector2.zero); nativeInput.SetSize(300f, 60f); nativeInput.SetText(""); _allInputs.Add(nativeInput); _selectedControl = nativeInput; UpdateEditFieldsFromControl(); } } } private void DrawLocalButtonsList() { GUILayout.Label(UILocale.Get("=== 已创建的按钮 ==="), Array.Empty()); for (int i = 0; i < _allButtons.Count; i++) { NativeButton nativeButton = _allButtons[i]; if (nativeButton != null && !((Object)(object)nativeButton.gameObject == (Object)null) && GUILayout.Button(string.Format(UILocale.Get("按钮 {0}: {1}"), i, nativeButton.GetTitle()), Array.Empty())) { _selectedControl = nativeButton; UpdateEditFieldsFromControl(); } } } private void DrawLocalLabelsList() { GUILayout.Label(UILocale.Get("=== 已创建的标签 ==="), Array.Empty()); for (int i = 0; i < _allLabels.Count; i++) { NativeLabel nativeLabel = _allLabels[i]; if (nativeLabel != null && !((Object)(object)nativeLabel.gameObject == (Object)null) && GUILayout.Button(string.Format(UILocale.Get("标签 {0}: {1}"), i, nativeLabel.GetText()), Array.Empty())) { _selectedControl = nativeLabel; UpdateEditFieldsFromControl(); } } } private void DrawLocalSlidersList() { GUILayout.Label(UILocale.Get("=== 已创建的滑块 ==="), Array.Empty()); for (int i = 0; i < _allSliders.Count; i++) { NativeSlider nativeSlider = _allSliders[i]; if (nativeSlider != null && !((Object)(object)nativeSlider.gameObject == (Object)null) && GUILayout.Button(string.Format(UILocale.Get("滑块 {0}: {1} 当前值={2}"), i, nativeSlider.GetLabel(), nativeSlider.Value), Array.Empty())) { _selectedControl = nativeSlider; UpdateEditFieldsFromControl(); } } } private void DrawLocalOptionsList() { GUILayout.Label(UILocale.Get("=== 已创建的选项行 ==="), Array.Empty()); for (int i = 0; i < _allOptions.Count; i++) { NativeOption nativeOption = _allOptions[i]; if (nativeOption != null && !((Object)(object)nativeOption.gameObject == (Object)null) && GUILayout.Button(string.Format(UILocale.Get("选项 {0}: {1} 当前值={2}"), i, nativeOption.GetLabel(), nativeOption.GetCurrentValue()), Array.Empty())) { _selectedControl = nativeOption; UpdateEditFieldsFromControl(); } } } private void DrawLocalArrowsList() { //IL_005c: Unknown result type (might be due to invalid IL or missing references) GUILayout.Label(UILocale.Get("=== 已创建的箭头 ==="), Array.Empty()); for (int i = 0; i < _allArrows.Count; i++) { NativeArrow nativeArrow = _allArrows[i]; if (nativeArrow != null && !((Object)(object)nativeArrow.gameObject == (Object)null) && GUILayout.Button(string.Format(UILocale.Get("箭头 {0}: {1} 位置={2}"), i, nativeArrow.GetDirection(), nativeArrow.GetPosition()), Array.Empty())) { _selectedControl = nativeArrow; UpdateEditFieldsFromControl(); } } } private void DrawLocalInputsList() { GUILayout.Label(UILocale.Get("=== 已创建的输入框 ==="), Array.Empty()); for (int i = 0; i < _allInputs.Count; i++) { NativeInput nativeInput = _allInputs[i]; if (nativeInput != null && !((Object)(object)nativeInput.gameObject == (Object)null) && GUILayout.Button(string.Format(UILocale.Get("输入框 {0}: {1}"), i, nativeInput.GetText()), Array.Empty())) { _selectedControl = nativeInput; UpdateEditFieldsFromControl(); } } } private void DrawExternalControlsTab() { GUILayout.BeginHorizontal(Array.Empty()); if (GUILayout.Button(UILocale.Get("扫描外部控件"), (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(30f) })) { ScanExternalControls(); _externalScanned = true; } if (GUILayout.Button(UILocale.Get("保存配置"), (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(30f) })) { SaveConfigToFile(); } if (GUILayout.Button(UILocale.Get("加载配置"), (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(30f) })) { LoadConfigFromFile(); } GUILayout.EndHorizontal(); if (!_externalScanned) { GUILayout.Label(UILocale.Get("点击“扫描外部控件”以发现其他模组创建的UI元素。"), Array.Empty()); return; } DrawExternalButtonsList(); GUILayout.Space(10f); DrawExternalLabelsList(); GUILayout.Space(10f); DrawExternalSlidersList(); GUILayout.Space(10f); DrawExternalOptionsList(); GUILayout.Space(10f); DrawExternalArrowsList(); GUILayout.Space(10f); DrawExternalInputsList(); } private void ScanExternalControls() { CleanInvalidControls(); _externalButtons.Clear(); _externalLabels.Clear(); _externalSliders.Clear(); _externalOptions.Clear(); _externalArrows.Clear(); _externalInputs.Clear(); foreach (NativeButton btn in NativeButton.AllInstances) { if (btn != null && !((Object)(object)btn.gameObject == (Object)null) && !NativeArrow.AllInstances.Any((NativeArrow arr) => arr != null && (Object)(object)arr.gameObject == (Object)(object)btn.gameObject) && !_allButtons.Contains(btn)) { _externalButtons.Add(btn); } } foreach (NativeLabel allInstance in NativeLabel.AllInstances) { if (allInstance != null && !((Object)(object)allInstance.gameObject == (Object)null) && !_allLabels.Contains(allInstance)) { _externalLabels.Add(allInstance); } } foreach (NativeSlider allInstance2 in NativeSlider.AllInstances) { if (allInstance2 != null && !((Object)(object)allInstance2.gameObject == (Object)null) && !_allSliders.Contains(allInstance2)) { _externalSliders.Add(allInstance2); } } foreach (NativeOption allInstance3 in NativeOption.AllInstances) { if (allInstance3 != null && !((Object)(object)allInstance3.gameObject == (Object)null) && !_allOptions.Contains(allInstance3)) { _externalOptions.Add(allInstance3); } } foreach (NativeArrow allInstance4 in NativeArrow.AllInstances) { if (allInstance4 != null && !((Object)(object)allInstance4.gameObject == (Object)null) && !_allArrows.Contains(allInstance4)) { _externalArrows.Add(allInstance4); } } foreach (NativeInput allInstance5 in NativeInput.AllInstances) { if (allInstance5 != null && !((Object)(object)allInstance5.gameObject == (Object)null) && !_allInputs.Contains(allInstance5)) { _externalInputs.Add(allInstance5); } } Debug.Log((object)$"扫描完成: 按钮={_externalButtons.Count}, 标签={_externalLabels.Count}, 滑块={_externalSliders.Count}, 选项={_externalOptions.Count}, 箭头={_externalArrows.Count}, 输入框={_externalInputs.Count}"); } private void DrawExternalButtonsList() { _externalButtons.RemoveAll((NativeButton b) => b == null || (Object)(object)b.gameObject == (Object)null); GUILayout.Label(string.Format("{0} ({1})", UILocale.Get("外部按钮"), _externalButtons.Count), Array.Empty()); for (int i = 0; i < _externalButtons.Count; i++) { NativeButton nativeButton = _externalButtons[i]; if (nativeButton != null && !((Object)(object)nativeButton.gameObject == (Object)null) && GUILayout.Button(string.Format(UILocale.Get("按钮 {0}: {1}"), i, nativeButton.GetTitle()), Array.Empty())) { _selectedControl = nativeButton; UpdateEditFieldsFromControl(); } } } private void DrawExternalLabelsList() { _externalLabels.RemoveAll((NativeLabel l) => l == null || (Object)(object)l.gameObject == (Object)null); GUILayout.Label(string.Format("{0} ({1})", UILocale.Get("外部标签"), _externalLabels.Count), Array.Empty()); for (int i = 0; i < _externalLabels.Count; i++) { NativeLabel nativeLabel = _externalLabels[i]; if (nativeLabel != null && !((Object)(object)nativeLabel.gameObject == (Object)null) && GUILayout.Button(string.Format(UILocale.Get("标签 {0}: {1}"), i, nativeLabel.GetText()), Array.Empty())) { _selectedControl = nativeLabel; UpdateEditFieldsFromControl(); } } } private void DrawExternalSlidersList() { _externalSliders.RemoveAll((NativeSlider s) => s == null || (Object)(object)s.gameObject == (Object)null); GUILayout.Label(string.Format("{0} ({1})", UILocale.Get("外部滑块"), _externalSliders.Count), Array.Empty()); for (int i = 0; i < _externalSliders.Count; i++) { NativeSlider nativeSlider = _externalSliders[i]; if (nativeSlider != null && !((Object)(object)nativeSlider.gameObject == (Object)null) && GUILayout.Button(string.Format(UILocale.Get("滑块 {0}: {1} 值={2}"), i, nativeSlider.GetLabel(), nativeSlider.Value), Array.Empty())) { _selectedControl = nativeSlider; UpdateEditFieldsFromControl(); } } } private void DrawExternalOptionsList() { _externalOptions.RemoveAll((NativeOption o) => o == null || (Object)(object)o.gameObject == (Object)null); GUILayout.Label(string.Format("{0} ({1})", UILocale.Get("外部选项行"), _externalOptions.Count), Array.Empty()); for (int i = 0; i < _externalOptions.Count; i++) { NativeOption nativeOption = _externalOptions[i]; if (nativeOption != null && !((Object)(object)nativeOption.gameObject == (Object)null) && GUILayout.Button(string.Format(UILocale.Get("选项 {0}: {1} 当前={2}"), i, nativeOption.GetLabel(), nativeOption.GetCurrentValue()), Array.Empty())) { _selectedControl = nativeOption; UpdateEditFieldsFromControl(); } } } private void DrawExternalArrowsList() { //IL_00a1: Unknown result type (might be due to invalid IL or missing references) _externalArrows.RemoveAll((NativeArrow a) => a == null || (Object)(object)a.gameObject == (Object)null); GUILayout.Label(string.Format("{0} ({1})", UILocale.Get("外部箭头"), _externalArrows.Count), Array.Empty()); for (int i = 0; i < _externalArrows.Count; i++) { NativeArrow nativeArrow = _externalArrows[i]; if (nativeArrow != null && !((Object)(object)nativeArrow.gameObject == (Object)null) && GUILayout.Button(string.Format(UILocale.Get("箭头 {0}: {1} 位置={2}"), i, nativeArrow.GetDirection(), nativeArrow.GetPosition()), Array.Empty())) { _selectedControl = nativeArrow; UpdateEditFieldsFromControl(); } } } private void DrawExternalInputsList() { _externalInputs.RemoveAll((NativeInput i) => i == null || (Object)(object)i.gameObject == (Object)null); GUILayout.Label(string.Format("{0} ({1})", UILocale.Get("外部输入框"), _externalInputs.Count), Array.Empty()); for (int j = 0; j < _externalInputs.Count; j++) { NativeInput nativeInput = _externalInputs[j]; if (nativeInput != null && !((Object)(object)nativeInput.gameObject == (Object)null) && GUILayout.Button(string.Format(UILocale.Get("输入框 {0}: {1}"), j, nativeInput.GetText()), Array.Empty())) { _selectedControl = nativeInput; UpdateEditFieldsFromControl(); } } } private void DrawUnifiedEditor() { if (_selectedControl == null) { GUILayout.Label(UILocale.Get("未选中任何控件"), Array.Empty()); return; } GameObject val = null; if (_selectedControl is NativeButton nativeButton) { val = nativeButton.gameObject; } else if (_selectedControl is NativeLabel nativeLabel) { val = nativeLabel.gameObject; } else if (_selectedControl is NativeSlider nativeSlider) { val = nativeSlider.gameObject; } else if (_selectedControl is NativeOption nativeOption) { val = nativeOption.gameObject; } else if (_selectedControl is NativeArrow nativeArrow) { val = nativeArrow.gameObject; } else if (_selectedControl is NativeInput nativeInput) { val = nativeInput.gameObject; } if ((Object)(object)val == (Object)null) { _selectedControl = null; CurrentlySelectedForDrag = null; GUILayout.Label(UILocale.Get("控件已被销毁"), Array.Empty()); return; } GUILayout.BeginVertical(GUIStyle.op_Implicit("box"), Array.Empty()); if (_selectedControl is NativeButton btn) { DrawButtonEditor(btn); } else if (_selectedControl is NativeLabel lbl) { DrawLabelEditor(lbl); } else if (_selectedControl is NativeSlider sld) { DrawSliderEditor(sld); } else if (_selectedControl is NativeOption opt) { DrawOptionEditor(opt); } else if (_selectedControl is NativeArrow arr) { DrawArrowEditor(arr); } else if (_selectedControl is NativeInput inp) { DrawInputEditor(inp); } GUILayout.Space(10f); GUILayout.BeginHorizontal(Array.Empty()); if (GUILayout.Button(UILocale.Get("固定到当前页面"), (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(30f) })) { PinSelectedControlToTargetPage(); } GUILayout.EndHorizontal(); GUILayout.EndVertical(); } private void DrawButtonEditor(NativeButton btn) { //IL_02d0: Unknown result type (might be due to invalid IL or missing references) //IL_0235: Unknown result type (might be due to invalid IL or missing references) //IL_036a: Unknown result type (might be due to invalid IL or missing references) //IL_04ca: Unknown result type (might be due to invalid IL or missing references) //IL_050d: Unknown result type (might be due to invalid IL or missing references) //IL_051a: Unknown result type (might be due to invalid IL or missing references) //IL_0500: Unknown result type (might be due to invalid IL or missing references) if (btn == null || (Object)(object)btn.gameObject == (Object)null) { _selectedControl = null; CurrentlySelectedForDrag = null; GUILayout.Label(UILocale.Get("控件已被销毁"), Array.Empty()); return; } GUILayout.Label(string.Format(UILocale.Get("编辑按钮: {0}"), btn.GetTitle()), Array.Empty()); GUILayout.Label(UILocale.Get("标题:"), Array.Empty()); _editTitle = GUILayout.TextField(_editTitle, Array.Empty()); GUILayout.Label(UILocale.Get("描述:"), Array.Empty()); _editDesc = GUILayout.TextField(_editDesc, Array.Empty()); GUILayout.Label(UILocale.Get("位置 (x, y):"), Array.Empty()); string s2 = GUILayout.TextField(_editPos.x.ToString(), Array.Empty()); string s3 = GUILayout.TextField(_editPos.y.ToString(), Array.Empty()); float.TryParse(s2, out _editPos.x); float.TryParse(s3, out _editPos.y); GUILayout.Label(UILocale.Get("尺寸 (宽, 高):"), Array.Empty()); string s4 = GUILayout.TextField(_editSize.x.ToString(), Array.Empty()); string s5 = GUILayout.TextField(_editSize.y.ToString(), Array.Empty()); float.TryParse(s4, out _editSize.x); float.TryParse(s5, out _editSize.y); if (btn.HasIcon()) { GUILayout.Label(UILocale.Get("图标偏移 (x, y):"), Array.Empty()); string s6 = GUILayout.TextField(_editIconOffset.x.ToString(), Array.Empty()); string s7 = GUILayout.TextField(_editIconOffset.y.ToString(), Array.Empty()); float.TryParse(s6, out _editIconOffset.x); float.TryParse(s7, out _editIconOffset.y); if (GUILayout.Button(UILocale.Get("应用图标偏移"), Array.Empty())) { btn.SetIconOffset(_editIconOffset); } } GUILayout.Label(UILocale.Get("标题文字偏移 (x, y):"), Array.Empty()); string s8 = GUILayout.TextField(_editTitleOffset.x.ToString(), Array.Empty()); string s9 = GUILayout.TextField(_editTitleOffset.y.ToString(), Array.Empty()); float.TryParse(s8, out _editTitleOffset.x); float.TryParse(s9, out _editTitleOffset.y); if (GUILayout.Button(UILocale.Get("应用标题偏移"), Array.Empty())) { btn.SetTitleOffset(_editTitleOffset); } GUILayout.Label(UILocale.Get("描述文字偏移 (x, y):"), Array.Empty()); string s10 = GUILayout.TextField(_editDescOffset.x.ToString(), Array.Empty()); string s11 = GUILayout.TextField(_editDescOffset.y.ToString(), Array.Empty()); float.TryParse(s10, out _editDescOffset.x); float.TryParse(s11, out _editDescOffset.y); if (GUILayout.Button(UILocale.Get("应用描述偏移"), Array.Empty())) { btn.SetDescOffset(_editDescOffset); } bool flag = btn.IsDraggable(); bool flag2 = GUILayout.Toggle(flag, UILocale.Get("允许拖拽 (按住鼠标左键拖动)"), Array.Empty()); if (flag2 != flag) { btn.SetDraggable(flag2); } GUILayout.Label(UILocale.Get("设置切换文字序列(逗号分隔):"), Array.Empty()); _editToggleTextsInput = GUILayout.TextField(_editToggleTextsInput, Array.Empty()); if (GUILayout.Button(UILocale.Get("应用切换序列"), Array.Empty())) { string[] array = (from s in _editToggleTextsInput.Split(new char[1] { ',' }) select s.Trim()).ToArray(); if (array.Length >= 2) { btn.SetToggleTexts(array); UpdateEditFieldsFromControl(); } else if (array.Length == 1) { btn.SetTitle(array[0]); btn.SetDescription(array[0]); btn.SetToggleTexts(null); } else { btn.SetToggleTexts(null); } } if (GUILayout.Button(UILocale.Get("应用更改"), Array.Empty())) { btn.SetTitle(_editTitle); btn.SetDescription(_editDesc); btn.SetPosition(_editPos); btn.SetSize(_editSize.x, _editSize.y); if (btn.HasIcon()) { btn.SetIconOffset(_editIconOffset); } btn.SetTitleOffset(_editTitleOffset); btn.SetDescOffset(_editDescOffset); } if (GUILayout.Button(UILocale.Get("删除此控件"), Array.Empty())) { btn.Destroy(); RemoveFromList(btn); _selectedControl = null; CurrentlySelectedForDrag = null; } } private void DrawLabelEditor(NativeLabel lbl) { //IL_02c9: Unknown result type (might be due to invalid IL or missing references) //IL_0300: Unknown result type (might be due to invalid IL or missing references) //IL_025c: Unknown result type (might be due to invalid IL or missing references) //IL_0261: Unknown result type (might be due to invalid IL or missing references) if (lbl == null || (Object)(object)lbl.gameObject == (Object)null) { _selectedControl = null; CurrentlySelectedForDrag = null; GUILayout.Label(UILocale.Get("控件已被销毁"), Array.Empty()); return; } GUILayout.Label(string.Format(UILocale.Get("编辑标签: {0}"), lbl.GetText()), Array.Empty()); GUILayout.Label(UILocale.Get("文本:"), Array.Empty()); _editLabelText = GUILayout.TextField(_editLabelText, Array.Empty()); GUILayout.Label(UILocale.Get("位置 (x, y):"), Array.Empty()); string s = GUILayout.TextField(_editPos.x.ToString(), Array.Empty()); string s2 = GUILayout.TextField(_editPos.y.ToString(), Array.Empty()); float.TryParse(s, out _editPos.x); float.TryParse(s2, out _editPos.y); GUILayout.Label(UILocale.Get("尺寸 (宽, 高):"), Array.Empty()); string s3 = GUILayout.TextField(_editSize.x.ToString(), Array.Empty()); string s4 = GUILayout.TextField(_editSize.y.ToString(), Array.Empty()); float.TryParse(s3, out _editSize.x); float.TryParse(s4, out _editSize.y); GUILayout.Label(UILocale.Get("字体大小:"), Array.Empty()); string s5 = GUILayout.TextField(_editFontSize.ToString(), Array.Empty()); int.TryParse(s5, out _editFontSize); GUILayout.Label(UILocale.Get("颜色 (R,G,B):"), Array.Empty()); string text = GUILayout.TextField($"{_editColor.r:F2},{_editColor.g:F2},{_editColor.b:F2}", Array.Empty()); string[] array = text.Split(new char[1] { ',' }); if (array.Length == 3 && float.TryParse(array[0], out var result) && float.TryParse(array[1], out var result2) && float.TryParse(array[2], out var result3)) { _editColor = new Color(result, result2, result3, 1f); } bool flag = lbl.IsDraggable(); bool flag2 = GUILayout.Toggle(flag, UILocale.Get("允许拖拽 (按住鼠标左键拖动)"), Array.Empty()); if (flag2 != flag) { lbl.SetDraggable(flag2); } if (GUILayout.Button(UILocale.Get("应用更改"), Array.Empty())) { lbl.SetText(_editLabelText); lbl.SetPosition(_editPos); lbl.SetSize(_editSize.x, _editSize.y); lbl.SetFontSize(_editFontSize); lbl.SetColor(_editColor); } if (GUILayout.Button(UILocale.Get("删除此控件"), Array.Empty())) { lbl.Destroy(); RemoveFromList(lbl); _selectedControl = null; CurrentlySelectedForDrag = null; } } private void DrawSliderEditor(NativeSlider sld) { //IL_03a8: Unknown result type (might be due to invalid IL or missing references) //IL_03ad: Unknown result type (might be due to invalid IL or missing references) //IL_03b0: Unknown result type (might be due to invalid IL or missing references) //IL_03b5: Unknown result type (might be due to invalid IL or missing references) //IL_041f: Unknown result type (might be due to invalid IL or missing references) //IL_0428: Unknown result type (might be due to invalid IL or missing references) //IL_042f: Unknown result type (might be due to invalid IL or missing references) if (sld == null || (Object)(object)sld.gameObject == (Object)null) { _selectedControl = null; CurrentlySelectedForDrag = null; GUILayout.Label(UILocale.Get("控件已被销毁"), Array.Empty()); return; } GUILayout.Label(string.Format(UILocale.Get("编辑滑块: {0}"), sld.GetLabel()), Array.Empty()); GUILayout.Label(UILocale.Get("标签:"), Array.Empty()); _editSliderLabel = GUILayout.TextField(_editSliderLabel, Array.Empty()); GUILayout.Label(UILocale.Get("位置 (x, y):"), Array.Empty()); string s = GUILayout.TextField(_editPos.x.ToString(), Array.Empty()); string s2 = GUILayout.TextField(_editPos.y.ToString(), Array.Empty()); float.TryParse(s, out _editPos.x); float.TryParse(s2, out _editPos.y); GUILayout.Label(UILocale.Get("尺寸 (宽, 高):"), Array.Empty()); string s3 = GUILayout.TextField(_editSize.x.ToString(), Array.Empty()); string s4 = GUILayout.TextField(_editSize.y.ToString(), Array.Empty()); float.TryParse(s3, out _editSize.x); float.TryParse(s4, out _editSize.y); GUILayout.Label(UILocale.Get("滑块 X 偏移:"), Array.Empty()); string s5 = GUILayout.TextField(_editSliderXOffset.ToString(), Array.Empty()); float.TryParse(s5, out _editSliderXOffset); GUILayout.Label(UILocale.Get("滑块宽度 (0=原生):"), Array.Empty()); string s6 = GUILayout.TextField(_editSliderWidth.ToString(), Array.Empty()); float.TryParse(s6, out _editSliderWidth); GUILayout.Label(UILocale.Get("标签 X 偏移:"), Array.Empty()); string s7 = GUILayout.TextField(_editLabelXOffset.ToString(), Array.Empty()); float.TryParse(s7, out _editLabelXOffset); GUILayout.Label(UILocale.Get("数值 X 偏移:"), Array.Empty()); string s8 = GUILayout.TextField(_editValueXOffset.ToString(), Array.Empty()); float.TryParse(s8, out _editValueXOffset); GUILayout.Label(string.Format(UILocale.Get("最小值: {0}"), _editSliderMin), Array.Empty()); string s9 = GUILayout.TextField(_editSliderMin.ToString(), Array.Empty()); float.TryParse(s9, out _editSliderMin); GUILayout.Label(string.Format(UILocale.Get("最大值: {0}"), _editSliderMax), Array.Empty()); string s10 = GUILayout.TextField(_editSliderMax.ToString(), Array.Empty()); float.TryParse(s10, out _editSliderMax); GUILayout.Label(string.Format(UILocale.Get("当前值: {0}"), _editSliderValue), Array.Empty()); string s11 = GUILayout.TextField(_editSliderValue.ToString(), Array.Empty()); float.TryParse(s11, out _editSliderValue); _editSliderWhole = GUILayout.Toggle(_editSliderWhole, UILocale.Get("整数步进"), Array.Empty()); bool flag = sld.IsDraggable(); bool flag2 = GUILayout.Toggle(flag, UILocale.Get("允许拖拽 (按住鼠标左键拖动)"), Array.Empty()); if (flag2 != flag) { sld.SetDraggable(flag2); } if (GUILayout.Button(UILocale.Get("应用更改"), Array.Empty())) { Vector2 position = sld.GetPosition(); Vector2 size = sld.GetSize(); sld.SetLabel(_editSliderLabel); sld.SetSliderXOffset(_editSliderXOffset); sld.SetSliderWidth(_editSliderWidth); sld.SetLabelXOffset(_editLabelXOffset); sld.SetValueXOffset(_editValueXOffset); sld.SetMinMax(_editSliderMin, _editSliderMax, _editSliderWhole); sld.Value = _editSliderValue; sld.SetPosition(position); sld.SetSize(size.x, size.y); } if (GUILayout.Button(UILocale.Get("删除此控件"), Array.Empty())) { sld.Destroy(); RemoveFromList(sld); _selectedControl = null; CurrentlySelectedForDrag = null; } } private void DrawOptionEditor(NativeOption opt) { //IL_0383: Unknown result type (might be due to invalid IL or missing references) if (opt == null || (Object)(object)opt.gameObject == (Object)null) { _selectedControl = null; CurrentlySelectedForDrag = null; GUILayout.Label(UILocale.Get("控件已被销毁"), Array.Empty()); return; } GUILayout.Label(string.Format(UILocale.Get("编辑选项行: {0}"), opt.GetLabel()), Array.Empty()); GUILayout.Label(UILocale.Get("标签:"), Array.Empty()); _editOptionLabel = GUILayout.TextField(_editOptionLabel, Array.Empty()); GUILayout.Label(UILocale.Get("描述:"), Array.Empty()); _editOptionDesc = GUILayout.TextField(_editOptionDesc, Array.Empty()); GUILayout.Label(UILocale.Get("位置 (x, y):"), Array.Empty()); string s2 = GUILayout.TextField(_editPos.x.ToString(), Array.Empty()); string s3 = GUILayout.TextField(_editPos.y.ToString(), Array.Empty()); float.TryParse(s2, out _editPos.x); float.TryParse(s3, out _editPos.y); GUILayout.Label(UILocale.Get("尺寸 (宽, 高):"), Array.Empty()); string s4 = GUILayout.TextField(_editSize.x.ToString(), Array.Empty()); string s5 = GUILayout.TextField(_editSize.y.ToString(), Array.Empty()); float.TryParse(s4, out _editSize.x); float.TryParse(s5, out _editSize.y); GUILayout.Label(UILocale.Get("选项列表 (用逗号分隔):"), Array.Empty()); string text = ((_editOptionOptions != null) ? string.Join(",", _editOptionOptions) : ""); string text2 = GUILayout.TextField(text, Array.Empty()); if (text2 != text) { _editOptionOptions = (from s in text2.Split(new char[1] { ',' }) select s.Trim()).ToArray(); } if (_editOptionOptions != null && _editOptionOptions.Length != 0) { _editOptionIndex = Mathf.Clamp(_editOptionIndex, 0, _editOptionOptions.Length - 1); GUILayout.Label(string.Format(UILocale.Get("当前选中: {0} (索引 {1})"), _editOptionOptions[_editOptionIndex], _editOptionIndex), Array.Empty()); GUILayout.BeginHorizontal(Array.Empty()); if (GUILayout.Button(UILocale.Get("上一个"), Array.Empty())) { _editOptionIndex = (_editOptionIndex - 1 + _editOptionOptions.Length) % _editOptionOptions.Length; } if (GUILayout.Button(UILocale.Get("下一个"), Array.Empty())) { _editOptionIndex = (_editOptionIndex + 1) % _editOptionOptions.Length; } GUILayout.EndHorizontal(); } bool flag = opt.IsDraggable(); bool flag2 = GUILayout.Toggle(flag, UILocale.Get("允许拖拽 (按住鼠标左键拖动)"), Array.Empty()); if (flag2 != flag) { opt.SetDraggable(flag2); } if (GUILayout.Button(UILocale.Get("应用更改"), Array.Empty())) { opt.SetLabel(_editOptionLabel); opt.SetDescription(_editOptionDesc); opt.SetPosition(_editPos); opt.SetSize(_editSize.x, _editSize.y); if (_editOptionOptions != null && _editOptionOptions.Length != 0) { opt.SetOptions(_editOptionOptions, _editOptionIndex); } } if (GUILayout.Button(UILocale.Get("删除此控件"), Array.Empty())) { opt.Destroy(); RemoveFromList(opt); _selectedControl = null; CurrentlySelectedForDrag = null; } } private void DrawArrowEditor(NativeArrow arr) { //IL_01a2: Unknown result type (might be due to invalid IL or missing references) //IL_01e5: Unknown result type (might be due to invalid IL or missing references) //IL_01ea: Unknown result type (might be due to invalid IL or missing references) //IL_01f0: Expected O, but got Unknown if (arr == null || (Object)(object)arr.gameObject == (Object)null) { _selectedControl = null; CurrentlySelectedForDrag = null; GUILayout.Label(UILocale.Get("控件已被销毁"), Array.Empty()); return; } GUILayout.Label(string.Format(UILocale.Get("编辑箭头: {0}"), arr.GetDirection()), Array.Empty()); GUILayout.Label(UILocale.Get("位置 (x, y):"), Array.Empty()); string s = GUILayout.TextField(_editPos.x.ToString(), Array.Empty()); string s2 = GUILayout.TextField(_editPos.y.ToString(), Array.Empty()); float.TryParse(s, out _editPos.x); float.TryParse(s2, out _editPos.y); GUILayout.Label(UILocale.Get("尺寸 (宽, 高):"), Array.Empty()); string s3 = GUILayout.TextField(_editSize.x.ToString(), Array.Empty()); string s4 = GUILayout.TextField(_editSize.y.ToString(), Array.Empty()); float.TryParse(s3, out _editSize.x); float.TryParse(s4, out _editSize.y); _editArrowClickable = GUILayout.Toggle(_editArrowClickable, UILocale.Get("可点击 (添加按钮)"), Array.Empty()); _editArrowDraggable = GUILayout.Toggle(_editArrowDraggable, UILocale.Get("允许拖拽 (按住鼠标左键拖动)"), Array.Empty()); if (GUILayout.Button(UILocale.Get("应用更改"), Array.Empty())) { arr.SetPosition(_editPos); arr.SetSize(_editSize.x, _editSize.y); bool editArrowClickable = _editArrowClickable; object obj = <>c.<>9__108_0; if (obj == null) { UnityAction val = delegate { Debug.Log((object)UILocale.Get("箭头被点击")); }; <>c.<>9__108_0 = val; obj = (object)val; } arr.SetClickable(editArrowClickable, (UnityAction)obj); arr.SetDraggable(_editArrowDraggable); } if (GUILayout.Button(UILocale.Get("删除此控件"), Array.Empty())) { arr.Destroy(); RemoveFromList(arr); _selectedControl = null; CurrentlySelectedForDrag = null; } } private void DrawInputEditor(NativeInput inp) { //IL_021b: Unknown result type (might be due to invalid IL or missing references) if (inp == null || (Object)(object)inp.gameObject == (Object)null) { _selectedControl = null; CurrentlySelectedForDrag = null; GUILayout.Label(UILocale.Get("控件已被销毁"), Array.Empty()); return; } GUILayout.Label(UILocale.Get("编辑输入框"), Array.Empty()); GUILayout.Label(UILocale.Get("文本内容:"), Array.Empty()); _editInputText = GUILayout.TextField(_editInputText, Array.Empty()); GUILayout.Label(UILocale.Get("占位符:"), Array.Empty()); _editInputPlaceholder = GUILayout.TextField(_editInputPlaceholder, Array.Empty()); GUILayout.Label(UILocale.Get("位置 (x, y):"), Array.Empty()); string s = GUILayout.TextField(_editPos.x.ToString(), Array.Empty()); string s2 = GUILayout.TextField(_editPos.y.ToString(), Array.Empty()); float.TryParse(s, out _editPos.x); float.TryParse(s2, out _editPos.y); GUILayout.Label(UILocale.Get("尺寸 (宽, 高):"), Array.Empty()); string s3 = GUILayout.TextField(_editSize.x.ToString(), Array.Empty()); string s4 = GUILayout.TextField(_editSize.y.ToString(), Array.Empty()); float.TryParse(s3, out _editSize.x); float.TryParse(s4, out _editSize.y); bool flag = inp.IsDraggable(); bool flag2 = GUILayout.Toggle(flag, UILocale.Get("允许拖拽 (按住鼠标左键拖动)"), Array.Empty()); if (flag2 != flag) { inp.SetDraggable(flag2); } if (GUILayout.Button(UILocale.Get("应用更改"), Array.Empty())) { inp.SetText(_editInputText); Graphic placeholder = inp.inputField.placeholder; Text val = (Text)(object)((placeholder is Text) ? placeholder : null); if ((Object)(object)val != (Object)null) { val.text = _editInputPlaceholder; } inp.SetPosition(_editPos); inp.SetSize(_editSize.x, _editSize.y); } if (GUILayout.Button(UILocale.Get("删除此控件"), Array.Empty())) { inp.Destroy(); RemoveFromList(inp); _selectedControl = null; CurrentlySelectedForDrag = null; } } private void UpdateEditFieldsFromControl() { //IL_0163: Unknown result type (might be due to invalid IL or missing references) //IL_0168: Unknown result type (might be due to invalid IL or missing references) //IL_016f: Unknown result type (might be due to invalid IL or missing references) //IL_0174: Unknown result type (might be due to invalid IL or missing references) //IL_017b: Unknown result type (might be due to invalid IL or missing references) //IL_0180: Unknown result type (might be due to invalid IL or missing references) //IL_0187: Unknown result type (might be due to invalid IL or missing references) //IL_018c: Unknown result type (might be due to invalid IL or missing references) //IL_0193: Unknown result type (might be due to invalid IL or missing references) //IL_0198: Unknown result type (might be due to invalid IL or missing references) //IL_020a: Unknown result type (might be due to invalid IL or missing references) //IL_020f: Unknown result type (might be due to invalid IL or missing references) //IL_0217: Unknown result type (might be due to invalid IL or missing references) //IL_021c: Unknown result type (might be due to invalid IL or missing references) //IL_028a: Unknown result type (might be due to invalid IL or missing references) //IL_028f: Unknown result type (might be due to invalid IL or missing references) //IL_0297: Unknown result type (might be due to invalid IL or missing references) //IL_029c: Unknown result type (might be due to invalid IL or missing references) //IL_0371: Unknown result type (might be due to invalid IL or missing references) //IL_0376: Unknown result type (might be due to invalid IL or missing references) //IL_037e: Unknown result type (might be due to invalid IL or missing references) //IL_0383: Unknown result type (might be due to invalid IL or missing references) //IL_03c4: Unknown result type (might be due to invalid IL or missing references) //IL_03c9: Unknown result type (might be due to invalid IL or missing references) //IL_03d1: Unknown result type (might be due to invalid IL or missing references) //IL_03d6: Unknown result type (might be due to invalid IL or missing references) //IL_024e: Unknown result type (might be due to invalid IL or missing references) //IL_0247: Unknown result type (might be due to invalid IL or missing references) //IL_042e: Unknown result type (might be due to invalid IL or missing references) //IL_0433: Unknown result type (might be due to invalid IL or missing references) //IL_043b: Unknown result type (might be due to invalid IL or missing references) //IL_0440: Unknown result type (might be due to invalid IL or missing references) //IL_0253: Unknown result type (might be due to invalid IL or missing references) if (_tempDragEnabled) { _tempDragEnabled = false; _tempDragTarget = null; Debug.Log((object)"[DebugWindow] 由于选中新控件,临时拖拽模式已关闭"); } if (_selectedControl == null) { CurrentlySelectedForDrag = null; return; } GameObject val = null; if (_selectedControl is NativeButton nativeButton) { val = nativeButton.gameObject; } else if (_selectedControl is NativeLabel nativeLabel) { val = nativeLabel.gameObject; } else if (_selectedControl is NativeSlider nativeSlider) { val = nativeSlider.gameObject; } else if (_selectedControl is NativeOption nativeOption) { val = nativeOption.gameObject; } else if (_selectedControl is NativeArrow nativeArrow) { val = nativeArrow.gameObject; } else if (_selectedControl is NativeInput nativeInput) { val = nativeInput.gameObject; } if ((Object)(object)val == (Object)null) { _selectedControl = null; CurrentlySelectedForDrag = null; return; } if (_selectedControl is NativeButton nativeButton2) { _editTitle = nativeButton2.GetTitle(); _editDesc = nativeButton2.GetDescription(); _editPos = nativeButton2.GetPosition(); _editSize = nativeButton2.GetSize(); _editIconOffset = nativeButton2.GetIconOffset(); _editTitleOffset = nativeButton2.GetTitleOffset(); _editDescOffset = nativeButton2.GetDescOffset(); if (nativeButton2.toggleTexts != null && nativeButton2.toggleTexts.Length != 0) { _editToggleTextsInput = string.Join(",", nativeButton2.toggleTexts); } else { _editToggleTextsInput = ""; } } else if (_selectedControl is NativeLabel nativeLabel2) { _editLabelText = nativeLabel2.GetText(); _editPos = nativeLabel2.GetPosition(); _editSize = nativeLabel2.GetSize(); Text textComponent = nativeLabel2.textComponent; _editFontSize = ((textComponent != null) ? textComponent.fontSize : 30); Text textComponent2 = nativeLabel2.textComponent; _editColor = ((textComponent2 != null) ? ((Graphic)textComponent2).color : Color.white); } else if (_selectedControl is NativeSlider nativeSlider2) { _editSliderLabel = nativeSlider2.GetLabel(); _editPos = nativeSlider2.GetPosition(); _editSize = nativeSlider2.GetSize(); Slider slider = nativeSlider2.slider; _editSliderMin = ((slider != null) ? slider.minValue : 0f); Slider slider2 = nativeSlider2.slider; _editSliderMax = ((slider2 != null) ? slider2.maxValue : 100f); _editSliderValue = nativeSlider2.Value; Slider slider3 = nativeSlider2.slider; _editSliderWhole = slider3 == null || slider3.wholeNumbers; _editSliderXOffset = nativeSlider2.GetSliderXOffset(); _editSliderWidth = nativeSlider2.GetSliderWidth(); _editLabelXOffset = nativeSlider2.GetLabelXOffset(); _editValueXOffset = nativeSlider2.GetValueXOffset(); } else if (_selectedControl is NativeOption nativeOption2) { _editOptionLabel = nativeOption2.GetLabel(); _editOptionDesc = nativeOption2.GetDescription(); _editPos = nativeOption2.GetPosition(); _editSize = nativeOption2.GetSize(); _editOptionOptions = nativeOption2.GetOptions(); _editOptionIndex = nativeOption2.GetCurrentIndex(); } else if (_selectedControl is NativeArrow nativeArrow2) { _editPos = nativeArrow2.GetPosition(); _editSize = nativeArrow2.GetSize(); _editArrowDirection = (int)nativeArrow2.GetDirection(); _editArrowClickable = nativeArrow2.IsClickable(); _editArrowDraggable = nativeArrow2.IsDraggable(); } else if (_selectedControl is NativeInput nativeInput2) { _editInputText = nativeInput2.GetText(); _editPos = nativeInput2.GetPosition(); _editSize = nativeInput2.GetSize(); Graphic placeholder = nativeInput2.inputField.placeholder; Text val2 = (Text)(object)((placeholder is Text) ? placeholder : null); _editInputPlaceholder = (((Object)(object)val2 != (Object)null) ? val2.text : UILocale.Get("输入...")); } CurrentlySelectedForDrag = GetSelectedGameObject(); } private void RemoveFromList(object control) { if (control is NativeButton item) { _allButtons.Remove(item); } else if (control is NativeLabel item2) { _allLabels.Remove(item2); } else if (control is NativeSlider item3) { _allSliders.Remove(item3); } else if (control is NativeOption item4) { _allOptions.Remove(item4); } else if (control is NativeArrow item5) { _allArrows.Remove(item5); } else if (control is NativeInput item6) { _externalInputs.Remove(item6); _allInputs.Remove(item6); } } private void DrawPageManagementTab() { _allPages = NativePage.AllInstances.ToList(); GUILayout.Label(UILocale.Get("可用页面:"), Array.Empty()); for (int i = 0; i < _allPages.Count; i++) { NativePage nativePage = _allPages[i]; if (nativePage != null && GUILayout.Button(string.Format(UILocale.Get("页面 {0}: {1}"), i, ((Object)nativePage.gameObject).name), Array.Empty())) { _selectedPage = nativePage; RefreshPageControlsCache(); } } if (_selectedPage == null) { return; } GUILayout.Label(string.Format(UILocale.Get("当前页面: {0} 包含控件: {1}"), ((Object)_selectedPage.gameObject).name, _pageControlsCache.Count), Array.Empty()); GUILayout.BeginHorizontal(Array.Empty()); if (GUILayout.Button(UILocale.Get("保存页面配置"), Array.Empty())) { SavePageConfig(); } if (GUILayout.Button(UILocale.Get("加载页面配置"), Array.Empty())) { LoadPageConfig(); } if (GUILayout.Button(UILocale.Get("刷新"), Array.Empty())) { RefreshPageControlsCache(); } GUILayout.EndHorizontal(); GUILayout.Label(UILocale.Get("页面内控件列表:"), Array.Empty()); foreach (UIControlConfig item in _pageControlsCache) { GUILayout.Label(string.Format(" {0}: {1} - {2}({3:F0},{4:F0})", item.type, item.name, UILocale.Get("位置"), item.position.x, item.position.y), Array.Empty()); } } private void RefreshPageControlsCache() { if (_selectedPage != null) { _pageControlsCache.Clear(); AddIfChild(NativeButton.AllInstances); AddIfChild(NativeLabel.AllInstances); AddIfChild(NativeSlider.AllInstances); AddIfChild(NativeOption.AllInstances); AddIfChild(NativeArrow.AllInstances); AddIfChild(NativeInput.AllInstances); } void AddIfChild(List instances) where T : class { foreach (T instance in instances) { GameObject val = null; if (instance is NativeButton nativeButton) { val = nativeButton.gameObject; } else if (instance is NativeLabel nativeLabel) { val = nativeLabel.gameObject; } else if (instance is NativeSlider nativeSlider) { val = nativeSlider.gameObject; } else if (instance is NativeOption nativeOption) { val = nativeOption.gameObject; } else if (instance is NativeArrow nativeArrow) { val = nativeArrow.gameObject; } else if (instance is NativeInput nativeInput) { val = nativeInput.gameObject; } if ((Object)(object)val != (Object)null && IsChildOf(val.transform, _selectedPage.gameObject.transform)) { _pageControlsCache.Add(GetControlConfig(instance)); } } } } private bool IsChildOf(Transform child, Transform parent) { while ((Object)(object)child != (Object)null) { if ((Object)(object)child == (Object)(object)parent) { return true; } child = child.parent; } return false; } private UIControlConfig GetControlConfig(object ctrl) { //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_0079: Unknown result type (might be due to invalid IL or missing references) //IL_0080: Unknown result type (might be due to invalid IL or missing references) //IL_0085: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_0091: Unknown result type (might be due to invalid IL or missing references) //IL_0112: Unknown result type (might be due to invalid IL or missing references) //IL_0117: Unknown result type (might be due to invalid IL or missing references) //IL_011f: Unknown result type (might be due to invalid IL or missing references) //IL_0124: Unknown result type (might be due to invalid IL or missing references) //IL_01b7: Unknown result type (might be due to invalid IL or missing references) //IL_01bc: Unknown result type (might be due to invalid IL or missing references) //IL_01c4: Unknown result type (might be due to invalid IL or missing references) //IL_01c9: Unknown result type (might be due to invalid IL or missing references) //IL_02b6: Unknown result type (might be due to invalid IL or missing references) //IL_02bb: Unknown result type (might be due to invalid IL or missing references) //IL_02c3: Unknown result type (might be due to invalid IL or missing references) //IL_02c8: Unknown result type (might be due to invalid IL or missing references) //IL_0348: Unknown result type (might be due to invalid IL or missing references) //IL_034d: Unknown result type (might be due to invalid IL or missing references) //IL_0355: Unknown result type (might be due to invalid IL or missing references) //IL_035a: Unknown result type (might be due to invalid IL or missing references) //IL_0163: Unknown result type (might be due to invalid IL or missing references) //IL_015c: Unknown result type (might be due to invalid IL or missing references) //IL_03c0: Unknown result type (might be due to invalid IL or missing references) //IL_03c5: Unknown result type (might be due to invalid IL or missing references) //IL_03d2: Unknown result type (might be due to invalid IL or missing references) //IL_03d7: Unknown result type (might be due to invalid IL or missing references) //IL_0168: Unknown result type (might be due to invalid IL or missing references) UIControlConfig uIControlConfig = new UIControlConfig(); if (ctrl is NativeButton nativeButton) { uIControlConfig.type = "Button"; uIControlConfig.name = ((Object)nativeButton.gameObject).name; uIControlConfig.position = nativeButton.GetPosition(); uIControlConfig.size = nativeButton.GetSize(); uIControlConfig.title = nativeButton.GetTitle(); uIControlConfig.description = nativeButton.GetDescription(); uIControlConfig.draggable = nativeButton.IsDraggable(); uIControlConfig.iconOffset = nativeButton.GetIconOffset(); uIControlConfig.titleOffset = nativeButton.GetTitleOffset(); uIControlConfig.descOffset = nativeButton.GetDescOffset(); uIControlConfig.style = (int)nativeButton.Style; if (nativeButton.toggleTexts != null && nativeButton.toggleTexts.Length != 0) { uIControlConfig.toggleTexts = nativeButton.toggleTexts; uIControlConfig.toggleIndex = nativeButton.currentToggleIndex; } } else if (ctrl is NativeLabel nativeLabel) { uIControlConfig.type = "Label"; uIControlConfig.name = ((Object)nativeLabel.gameObject).name; uIControlConfig.position = nativeLabel.GetPosition(); uIControlConfig.size = nativeLabel.GetSize(); uIControlConfig.labelText = nativeLabel.GetText(); Text textComponent = nativeLabel.textComponent; uIControlConfig.fontSize = ((textComponent != null) ? textComponent.fontSize : 30); Text textComponent2 = nativeLabel.textComponent; uIControlConfig.color = ((textComponent2 != null) ? ((Graphic)textComponent2).color : Color.white); uIControlConfig.draggable = nativeLabel.IsDraggable(); } else if (ctrl is NativeSlider nativeSlider) { uIControlConfig.type = "Slider"; uIControlConfig.name = ((Object)nativeSlider.gameObject).name; uIControlConfig.position = nativeSlider.GetPosition(); uIControlConfig.size = nativeSlider.GetSize(); uIControlConfig.labelText = nativeSlider.GetLabel(); Slider slider = nativeSlider.slider; uIControlConfig.minValue = ((slider != null) ? slider.minValue : 0f); Slider slider2 = nativeSlider.slider; uIControlConfig.maxValue = ((slider2 != null) ? slider2.maxValue : 100f); uIControlConfig.value = nativeSlider.Value; Slider slider3 = nativeSlider.slider; uIControlConfig.wholeNumbers = slider3 == null || slider3.wholeNumbers; uIControlConfig.draggable = nativeSlider.IsDraggable(); uIControlConfig.sliderXOffset = nativeSlider.GetSliderXOffset(); uIControlConfig.sliderWidth = nativeSlider.GetSliderWidth(); uIControlConfig.labelXOffset = nativeSlider.GetLabelXOffset(); uIControlConfig.valueXOffset = nativeSlider.GetValueXOffset(); } else if (ctrl is NativeOption nativeOption) { uIControlConfig.type = "Option"; uIControlConfig.name = ((Object)nativeOption.gameObject).name; uIControlConfig.position = nativeOption.GetPosition(); uIControlConfig.size = nativeOption.GetSize(); uIControlConfig.labelText = nativeOption.GetLabel(); uIControlConfig.description = nativeOption.GetDescription(); uIControlConfig.options = nativeOption.GetOptions(); uIControlConfig.optionIndex = nativeOption.GetCurrentIndex(); uIControlConfig.draggable = nativeOption.IsDraggable(); } else if (ctrl is NativeArrow nativeArrow) { uIControlConfig.type = "Arrow"; uIControlConfig.name = ((Object)nativeArrow.gameObject).name; uIControlConfig.position = nativeArrow.GetPosition(); uIControlConfig.size = nativeArrow.GetSize(); uIControlConfig.direction = (int)nativeArrow.GetDirection(); uIControlConfig.clickable = nativeArrow.IsClickable(); uIControlConfig.draggable = nativeArrow.IsDraggable(); } else if (ctrl is NativeInput nativeInput) { uIControlConfig.type = "Input"; uIControlConfig.name = ((Object)nativeInput.gameObject).name; uIControlConfig.position = nativeInput.GetPosition(); uIControlConfig.size = nativeInput.rectTransform.sizeDelta; uIControlConfig.inputText = nativeInput.GetText(); Graphic placeholder = nativeInput.inputField.placeholder; Text val = (Text)(object)((placeholder is Text) ? placeholder : null); uIControlConfig.placeholderText = (((Object)(object)val != (Object)null) ? val.text : ""); } return uIControlConfig; } private void SavePageConfig() { if (_selectedPage != null) { RefreshPageControlsCache(); ConfigData configData = new ConfigData { controls = _pageControlsCache }; string text = ((Object)_selectedPage.gameObject).name.Replace(" ", "_"); string text2 = Path.Combine(PluginDirectory, "PageConfigs"); Directory.CreateDirectory(text2); string text3 = Path.Combine(text2, "PageConfig_" + text + ".json"); File.WriteAllText(text3, JsonConvert.SerializeObject((object)configData, (Formatting)1)); Debug.Log((object)("页面配置已保存至 " + text3)); } } private void LoadPageConfig() { if (_selectedPage == null) { return; } string text = ((Object)_selectedPage.gameObject).name.Replace(" ", "_"); string path = Path.Combine(PluginDirectory, "PageConfigs"); string text2 = Path.Combine(path, "PageConfig_" + text + ".json"); if (!File.Exists(text2)) { return; } ConfigData configData = JsonConvert.DeserializeObject(File.ReadAllText(text2)); if (configData == null) { return; } foreach (UIControlConfig control in configData.controls) { ApplyConfigToControlInPage(control); } Canvas.ForceUpdateCanvases(); Debug.Log((object)("已加载页面配置 " + text2)); } private void ApplyConfigToControlInPage(UIControlConfig cfg) { //IL_01bd: Unknown result type (might be due to invalid IL or missing references) //IL_0081: Unknown result type (might be due to invalid IL or missing references) //IL_037a: Unknown result type (might be due to invalid IL or missing references) //IL_0316: Unknown result type (might be due to invalid IL or missing references) //IL_022d: Unknown result type (might be due to invalid IL or missing references) //IL_0104: Unknown result type (might be due to invalid IL or missing references) //IL_0111: Unknown result type (might be due to invalid IL or missing references) //IL_011e: Unknown result type (might be due to invalid IL or missing references) //IL_0466: Unknown result type (might be due to invalid IL or missing references) //IL_0502: Unknown result type (might be due to invalid IL or missing references) //IL_04ab: Unknown result type (might be due to invalid IL or missing references) //IL_04b0: Unknown result type (might be due to invalid IL or missing references) //IL_04b6: Expected O, but got Unknown GameObject val = FindChildByName(_selectedPage.gameObject.transform, cfg.name); if ((Object)(object)val == (Object)null) { return; } if (cfg.type == "Button") { NativeButton component = val.GetComponent(); if (component == null) { return; } if (component.Style != (ButtonStyle)cfg.style) { component.SetStyle((ButtonStyle)cfg.style); } component.SetPosition(cfg.position); component.SetSize(cfg.size.x, cfg.size.y); if (!string.IsNullOrEmpty(cfg.title)) { component.SetTitle(cfg.title.Trim()); } if (!string.IsNullOrEmpty(cfg.description)) { component.SetDescription(cfg.description.Trim()); } component.SetDraggable(cfg.draggable); component.SetIconOffset(cfg.iconOffset); component.SetTitleOffset(cfg.titleOffset); component.SetDescOffset(cfg.descOffset); if (cfg.toggleTexts != null && cfg.toggleTexts.Length != 0) { component.SetToggleTexts(cfg.toggleTexts); if (cfg.toggleIndex >= 0 && cfg.toggleIndex < cfg.toggleTexts.Length) { component.SetToggleIndex(cfg.toggleIndex); } } } else if (cfg.type == "Label") { NativeLabel component2 = val.GetComponent(); if (component2 != null) { component2.SetPosition(cfg.position); component2.SetSize(cfg.size.x, cfg.size.y); if (!string.IsNullOrEmpty(cfg.labelText)) { component2.SetText(cfg.labelText.Trim()); } if (cfg.fontSize > 0) { component2.SetFontSize(cfg.fontSize); } component2.SetColor(cfg.color); component2.SetDraggable(cfg.draggable); } } else if (cfg.type == "Slider") { NativeSlider component3 = val.GetComponent(); if (component3 != null) { if (!string.IsNullOrEmpty(cfg.labelText)) { component3.SetLabel(cfg.labelText.Trim()); } component3.SetMinMax(cfg.minValue, cfg.maxValue, cfg.wholeNumbers); component3.Value = cfg.value; component3.SetDraggable(cfg.draggable); component3.SetSliderXOffset(cfg.sliderXOffset); component3.SetSliderWidth(cfg.sliderWidth); component3.SetLabelXOffset(cfg.labelXOffset); component3.SetValueXOffset(cfg.valueXOffset); component3.SetPosition(cfg.position); component3.SetSize(cfg.size.x, cfg.size.y); } } else if (cfg.type == "Option") { NativeOption component4 = val.GetComponent(); if (component4 != null) { component4.SetPosition(cfg.position); component4.SetSize(cfg.size.x, cfg.size.y); if (!string.IsNullOrEmpty(cfg.labelText)) { component4.SetLabel(cfg.labelText.Trim()); } if (!string.IsNullOrEmpty(cfg.description)) { component4.SetDescription(cfg.description.Trim()); } if (cfg.options != null && cfg.options.Length != 0) { component4.SetOptions(cfg.options, cfg.optionIndex); } component4.SetDraggable(cfg.draggable); } } else if (cfg.type == "Arrow") { NativeArrow component5 = val.GetComponent(); if (component5 == null) { return; } component5.SetPosition(cfg.position); component5.SetSize(cfg.size.x, cfg.size.y); bool clickable = cfg.clickable; object obj = <>c.<>9__118_0; if (obj == null) { UnityAction val2 = delegate { Debug.Log((object)UILocale.Get("箭头被点击")); }; <>c.<>9__118_0 = val2; obj = (object)val2; } component5.SetClickable(clickable, (UnityAction)obj); component5.SetDraggable(cfg.draggable); } else { if (!(cfg.type == "Input")) { return; } NativeInput component6 = val.GetComponent(); if (component6 != null) { component6.SetPosition(cfg.position); component6.SetSize(cfg.size.x, cfg.size.y); component6.SetText(cfg.inputText); Graphic placeholder = component6.inputField.placeholder; Text val3 = (Text)(object)((placeholder is Text) ? placeholder : null); if ((Object)(object)val3 != (Object)null) { val3.text = cfg.placeholderText; } } } } private GameObject FindChildByName(Transform parent, string name) { //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Expected O, but got Unknown if (((Object)parent).name == name) { return ((Component)parent).gameObject; } foreach (Transform item in parent) { Transform parent2 = item; GameObject val = FindChildByName(parent2, name); if ((Object)(object)val != (Object)null) { return val; } } return null; } private void CleanInvalidControls() { _externalButtons.RemoveAll((NativeButton b) => b == null || (Object)(object)b.gameObject == (Object)null); _externalLabels.RemoveAll((NativeLabel l) => l == null || (Object)(object)l.gameObject == (Object)null); _externalSliders.RemoveAll((NativeSlider s) => s == null || (Object)(object)s.gameObject == (Object)null); _externalOptions.RemoveAll((NativeOption o) => o == null || (Object)(object)o.gameObject == (Object)null); _externalArrows.RemoveAll((NativeArrow a) => a == null || (Object)(object)a.gameObject == (Object)null); _externalInputs.RemoveAll((NativeInput i) => i == null || (Object)(object)i.gameObject == (Object)null); } private void EnsureUniqueNames() { EnsureUniqueNamesInList(_externalButtons); EnsureUniqueNamesInList(_externalLabels); EnsureUniqueNamesInList(_externalSliders); EnsureUniqueNamesInList(_externalOptions); EnsureUniqueNamesInList(_externalArrows); EnsureUniqueNamesInList(_externalInputs); } private void EnsureUniqueNamesInList(List list) where T : class { if (list == null) { return; } Dictionary dictionary = new Dictionary(); List list2 = new List(); foreach (T item in list) { GameObject val = null; if (item is NativeButton nativeButton) { val = nativeButton.gameObject; } else if (item is NativeLabel nativeLabel) { val = nativeLabel.gameObject; } else if (item is NativeSlider nativeSlider) { val = nativeSlider.gameObject; } else if (item is NativeOption nativeOption) { val = nativeOption.gameObject; } else if (item is NativeArrow nativeArrow) { val = nativeArrow.gameObject; } else if (item is NativeInput nativeInput) { val = nativeInput.gameObject; } if ((Object)(object)val != (Object)null) { list2.Add(val); } } foreach (GameObject item2 in list2) { string name = ((Object)item2).name; if (dictionary.ContainsKey(name)) { dictionary[name]++; } else { dictionary[name] = 1; } } Dictionary dictionary2 = new Dictionary(); foreach (GameObject item3 in list2) { string name2 = ((Object)item3).name; if (dictionary[name2] > 1) { if (!dictionary2.ContainsKey(name2)) { dictionary2[name2] = 1; } else { dictionary2[name2]++; } if (dictionary2[name2] > 1) { string text2 = (((Object)item3).name = $"{name2}_{dictionary2[name2]}"); Debug.Log((object)("[DebugWindow] 为避免重名,已将控件 " + name2 + " 重命名为 " + text2)); } } } } private void SaveConfigToFile() { CleanInvalidControls(); _externalButtons.RemoveAll((NativeButton btn) => NativeArrow.AllInstances.Any((NativeArrow arr) => arr != null && (Object)(object)arr.gameObject == (Object)(object)btn.gameObject)); EnsureUniqueNames(); string text = Path.Combine(PluginDirectory, "NativeUIMaker_Config.json"); ConfigData configData = new ConfigData(); CollectControls(_allButtons, "Button", configData); CollectControls(_allLabels, "Label", configData); CollectControls(_allSliders, "Slider", configData); CollectControls(_allOptions, "Option", configData); CollectControls(_allArrows, "Arrow", configData); CollectControls(_allInputs, "Input", configData); CollectControls(_externalButtons, "Button", configData); CollectControls(_externalLabels, "Label", configData); CollectControls(_externalSliders, "Slider", configData); CollectControls(_externalOptions, "Option", configData); CollectControls(_externalArrows, "Arrow", configData); CollectControls(_externalInputs, "Input", configData); File.WriteAllText(text, JsonConvert.SerializeObject((object)configData, (Formatting)1)); Debug.Log((object)$"配置已保存至 {text},共 {configData.controls.Count} 项"); } private string GetPageNameForControl(GameObject go) { Transform val = go.transform; while ((Object)(object)val != (Object)null) { foreach (NativePage allInstance in NativePage.AllInstances) { if ((Object)(object)allInstance.gameObject == (Object)(object)((Component)val).gameObject) { return ((Object)allInstance.gameObject).name; } } val = val.parent; } return null; } private void CollectControls(List list, string typeName, ConfigData data) where T : class { //IL_022c: Unknown result type (might be due to invalid IL or missing references) //IL_0231: Unknown result type (might be due to invalid IL or missing references) //IL_0239: Unknown result type (might be due to invalid IL or missing references) //IL_023e: Unknown result type (might be due to invalid IL or missing references) //IL_026d: Unknown result type (might be due to invalid IL or missing references) //IL_0272: Unknown result type (might be due to invalid IL or missing references) //IL_027a: Unknown result type (might be due to invalid IL or missing references) //IL_027f: Unknown result type (might be due to invalid IL or missing references) //IL_0287: Unknown result type (might be due to invalid IL or missing references) //IL_028c: Unknown result type (might be due to invalid IL or missing references) //IL_02f9: Unknown result type (might be due to invalid IL or missing references) //IL_02fe: Unknown result type (might be due to invalid IL or missing references) //IL_0306: Unknown result type (might be due to invalid IL or missing references) //IL_030b: Unknown result type (might be due to invalid IL or missing references) //IL_0386: Unknown result type (might be due to invalid IL or missing references) //IL_038b: Unknown result type (might be due to invalid IL or missing references) //IL_0393: Unknown result type (might be due to invalid IL or missing references) //IL_0398: Unknown result type (might be due to invalid IL or missing references) //IL_046d: Unknown result type (might be due to invalid IL or missing references) //IL_0472: Unknown result type (might be due to invalid IL or missing references) //IL_047a: Unknown result type (might be due to invalid IL or missing references) //IL_047f: Unknown result type (might be due to invalid IL or missing references) //IL_04e7: Unknown result type (might be due to invalid IL or missing references) //IL_04ec: Unknown result type (might be due to invalid IL or missing references) //IL_04f4: Unknown result type (might be due to invalid IL or missing references) //IL_04f9: Unknown result type (might be due to invalid IL or missing references) //IL_034a: Unknown result type (might be due to invalid IL or missing references) //IL_0343: Unknown result type (might be due to invalid IL or missing references) //IL_0544: Unknown result type (might be due to invalid IL or missing references) //IL_0549: Unknown result type (might be due to invalid IL or missing references) //IL_0556: Unknown result type (might be due to invalid IL or missing references) //IL_055b: Unknown result type (might be due to invalid IL or missing references) //IL_034f: Unknown result type (might be due to invalid IL or missing references) foreach (T item in list) { if (item == null) { continue; } GameObject val = null; try { if (item is NativeButton nativeButton) { val = nativeButton.gameObject; } else if (item is NativeLabel nativeLabel) { val = nativeLabel.gameObject; } else if (item is NativeSlider nativeSlider) { val = nativeSlider.gameObject; } else if (item is NativeOption nativeOption) { val = nativeOption.gameObject; } else if (item is NativeArrow nativeArrow) { val = nativeArrow.gameObject; } else if (item is NativeInput nativeInput) { val = nativeInput.gameObject; } } catch { continue; } if ((Object)(object)val == (Object)null) { continue; } UIControlConfig uIControlConfig = new UIControlConfig(); if (item is NativeArrow) { uIControlConfig.type = "Arrow"; } else if (item is NativeButton) { uIControlConfig.type = "Button"; } else if (item is NativeLabel) { uIControlConfig.type = "Label"; } else if (item is NativeSlider) { uIControlConfig.type = "Slider"; } else if (item is NativeOption) { uIControlConfig.type = "Option"; } else if (item is NativeInput) { uIControlConfig.type = "Input"; } else { uIControlConfig.type = typeName; } uIControlConfig.name = ((Object)val).name; uIControlConfig.page = GetPageNameForControl(val); try { if (item is NativeButton nativeButton2) { uIControlConfig.position = nativeButton2.GetPosition(); uIControlConfig.size = nativeButton2.GetSize(); uIControlConfig.title = nativeButton2.GetTitle(); uIControlConfig.description = nativeButton2.GetDescription(); uIControlConfig.draggable = nativeButton2.IsDraggable(); uIControlConfig.iconOffset = nativeButton2.GetIconOffset(); uIControlConfig.titleOffset = nativeButton2.GetTitleOffset(); uIControlConfig.descOffset = nativeButton2.GetDescOffset(); uIControlConfig.style = (int)nativeButton2.Style; if (nativeButton2.toggleTexts != null && nativeButton2.toggleTexts.Length != 0) { uIControlConfig.toggleTexts = nativeButton2.toggleTexts; uIControlConfig.toggleIndex = nativeButton2.currentToggleIndex; } } else if (item is NativeLabel nativeLabel2) { uIControlConfig.position = nativeLabel2.GetPosition(); uIControlConfig.size = nativeLabel2.GetSize(); uIControlConfig.labelText = nativeLabel2.GetText(); Text textComponent = nativeLabel2.textComponent; uIControlConfig.fontSize = ((textComponent != null) ? textComponent.fontSize : 30); Text textComponent2 = nativeLabel2.textComponent; uIControlConfig.color = ((textComponent2 != null) ? ((Graphic)textComponent2).color : Color.white); uIControlConfig.draggable = nativeLabel2.IsDraggable(); } else if (item is NativeSlider nativeSlider2) { uIControlConfig.position = nativeSlider2.GetPosition(); uIControlConfig.size = nativeSlider2.GetSize(); uIControlConfig.labelText = nativeSlider2.GetLabel(); Slider slider = nativeSlider2.slider; uIControlConfig.minValue = ((slider != null) ? slider.minValue : 0f); Slider slider2 = nativeSlider2.slider; uIControlConfig.maxValue = ((slider2 != null) ? slider2.maxValue : 100f); uIControlConfig.value = nativeSlider2.Value; Slider slider3 = nativeSlider2.slider; uIControlConfig.wholeNumbers = slider3 == null || slider3.wholeNumbers; uIControlConfig.draggable = nativeSlider2.IsDraggable(); uIControlConfig.sliderXOffset = nativeSlider2.GetSliderXOffset(); uIControlConfig.sliderWidth = nativeSlider2.GetSliderWidth(); uIControlConfig.labelXOffset = nativeSlider2.GetLabelXOffset(); uIControlConfig.valueXOffset = nativeSlider2.GetValueXOffset(); } else if (item is NativeOption nativeOption2) { uIControlConfig.position = nativeOption2.GetPosition(); uIControlConfig.size = nativeOption2.GetSize(); uIControlConfig.labelText = nativeOption2.GetLabel(); uIControlConfig.description = nativeOption2.GetDescription(); uIControlConfig.options = nativeOption2.GetOptions(); uIControlConfig.optionIndex = nativeOption2.GetCurrentIndex(); uIControlConfig.draggable = nativeOption2.IsDraggable(); } else if (item is NativeArrow nativeArrow2) { uIControlConfig.position = nativeArrow2.GetPosition(); uIControlConfig.size = nativeArrow2.GetSize(); uIControlConfig.direction = (int)nativeArrow2.GetDirection(); uIControlConfig.clickable = nativeArrow2.IsClickable(); uIControlConfig.draggable = nativeArrow2.IsDraggable(); } else if (item is NativeInput nativeInput2) { uIControlConfig.position = nativeInput2.GetPosition(); uIControlConfig.size = nativeInput2.rectTransform.sizeDelta; uIControlConfig.inputText = nativeInput2.GetText(); Graphic placeholder = nativeInput2.inputField.placeholder; Text val2 = (Text)(object)((placeholder is Text) ? placeholder : null); uIControlConfig.placeholderText = (((Object)(object)val2 != (Object)null) ? val2.text : ""); } } catch (Exception ex) { Debug.LogError((object)("保存控件 " + uIControlConfig.name + " 时出错: " + ex.Message)); continue; } data.controls.Add(uIControlConfig); } } private void LoadConfigFromFile() { //IL_04ab: Unknown result type (might be due to invalid IL or missing references) //IL_0314: Unknown result type (might be due to invalid IL or missing references) //IL_06be: Unknown result type (might be due to invalid IL or missing references) //IL_0662: Unknown result type (might be due to invalid IL or missing references) //IL_0545: Unknown result type (might be due to invalid IL or missing references) //IL_03cc: Unknown result type (might be due to invalid IL or missing references) //IL_03e0: Unknown result type (might be due to invalid IL or missing references) //IL_03f4: Unknown result type (might be due to invalid IL or missing references) //IL_07db: Unknown result type (might be due to invalid IL or missing references) //IL_087e: Unknown result type (might be due to invalid IL or missing references) //IL_0832: Unknown result type (might be due to invalid IL or missing references) //IL_0837: Unknown result type (might be due to invalid IL or missing references) //IL_083d: Expected O, but got Unknown string path = Path.Combine(PluginDirectory, "NativeUIMaker_Config.json"); if (!File.Exists(path)) { return; } ConfigData configData = JsonConvert.DeserializeObject(File.ReadAllText(path)); if (configData == null) { return; } foreach (UIControlConfig control in configData.controls) { UILocale.TranslateControlConfig(control); } ScanExternalControls(); foreach (UIControlConfig cfg in configData.controls) { object obj = null; if (cfg.type == "Button") { obj = _externalButtons.Find((NativeButton b) => ((Object)b.gameObject).name == cfg.name); } else if (cfg.type == "Label") { obj = _externalLabels.Find((NativeLabel l) => ((Object)l.gameObject).name == cfg.name); } else if (cfg.type == "Slider") { obj = _externalSliders.Find((NativeSlider s) => ((Object)s.gameObject).name == cfg.name); } else if (cfg.type == "Option") { obj = _externalOptions.Find((NativeOption o) => ((Object)o.gameObject).name == cfg.name); } else if (cfg.type == "Arrow") { obj = _externalArrows.Find((NativeArrow a) => ((Object)a.gameObject).name == cfg.name); if (obj == null) { string baseName = Regex.Replace(cfg.name, "_\\d+$", ""); NativeArrow nativeArrow = _externalArrows.Find((NativeArrow a) => ((Object)a.gameObject).name == baseName); if (nativeArrow != null) { ((Object)nativeArrow.gameObject).name = cfg.name; obj = nativeArrow; Debug.Log((object)("[DebugWindow] 箭头名称不匹配,已将 " + baseName + " 重命名为 " + cfg.name)); } } } else if (cfg.type == "Input") { obj = _externalInputs.Find((NativeInput i) => ((Object)i.gameObject).name == cfg.name); } if (obj == null) { continue; } if (obj is NativeButton nativeButton) { if (nativeButton.Style != (ButtonStyle)cfg.style) { nativeButton.SetStyle((ButtonStyle)cfg.style); } nativeButton.SetPosition(cfg.position); nativeButton.SetSize(cfg.size.x, cfg.size.y); if (!string.IsNullOrEmpty(cfg.title)) { nativeButton.SetTitle(cfg.title.Trim()); } if (!string.IsNullOrEmpty(cfg.description)) { nativeButton.SetDescription(cfg.description.Trim()); } nativeButton.SetDraggable(cfg.draggable); nativeButton.SetIconOffset(cfg.iconOffset); nativeButton.SetTitleOffset(cfg.titleOffset); nativeButton.SetDescOffset(cfg.descOffset); if (cfg.toggleTexts != null && cfg.toggleTexts.Length != 0) { nativeButton.SetToggleTexts(cfg.toggleTexts); if (cfg.toggleIndex >= 0 && cfg.toggleIndex < cfg.toggleTexts.Length) { nativeButton.SetToggleIndex(cfg.toggleIndex); } } } else if (obj is NativeLabel nativeLabel) { nativeLabel.SetPosition(cfg.position); nativeLabel.SetSize(cfg.size.x, cfg.size.y); if (!string.IsNullOrEmpty(cfg.labelText)) { nativeLabel.SetText(cfg.labelText.Trim()); } if (cfg.fontSize > 0) { nativeLabel.SetFontSize(cfg.fontSize); } nativeLabel.SetColor(cfg.color); nativeLabel.SetDraggable(cfg.draggable); } else if (obj is NativeSlider nativeSlider) { if (!string.IsNullOrEmpty(cfg.labelText)) { nativeSlider.SetLabel(cfg.labelText.Trim()); } nativeSlider.SetMinMax(cfg.minValue, cfg.maxValue, cfg.wholeNumbers); nativeSlider.Value = cfg.value; nativeSlider.SetDraggable(cfg.draggable); nativeSlider.SetSliderXOffset(cfg.sliderXOffset); nativeSlider.SetSliderWidth(cfg.sliderWidth); nativeSlider.SetLabelXOffset(cfg.labelXOffset); nativeSlider.SetValueXOffset(cfg.valueXOffset); nativeSlider.SetPosition(cfg.position); nativeSlider.SetSize(cfg.size.x, cfg.size.y); } else if (obj is NativeOption nativeOption) { nativeOption.SetPosition(cfg.position); nativeOption.SetSize(cfg.size.x, cfg.size.y); if (!string.IsNullOrEmpty(cfg.labelText)) { nativeOption.SetLabel(cfg.labelText.Trim()); } if (!string.IsNullOrEmpty(cfg.description)) { nativeOption.SetDescription(cfg.description.Trim()); } if (cfg.options != null && cfg.options.Length != 0) { nativeOption.SetOptions(cfg.options, cfg.optionIndex); } nativeOption.SetDraggable(cfg.draggable); } else if (obj is NativeArrow nativeArrow2) { nativeArrow2.SetPosition(cfg.position); nativeArrow2.SetSize(cfg.size.x, cfg.size.y); bool clickable = cfg.clickable; object obj2 = <>c.<>9__126_7; if (obj2 == null) { UnityAction val = delegate { Debug.Log((object)UILocale.Get("箭头被点击")); }; <>c.<>9__126_7 = val; obj2 = (object)val; } nativeArrow2.SetClickable(clickable, (UnityAction)obj2); nativeArrow2.SetDraggable(cfg.draggable); } else if (obj is NativeInput nativeInput) { nativeInput.SetPosition(cfg.position); nativeInput.SetSize(cfg.size.x, cfg.size.y); nativeInput.SetText(cfg.inputText); Graphic placeholder = nativeInput.inputField.placeholder; Text val2 = (Text)(object)((placeholder is Text) ? placeholder : null); if ((Object)(object)val2 != (Object)null) { val2.text = cfg.placeholderText; } } } Canvas.ForceUpdateCanvases(); Debug.Log((object)$"配置加载完成,共 {configData.controls.Count} 项"); } private void PinSelectedControlToTargetPage() { //IL_00dd: Unknown result type (might be due to invalid IL or missing references) //IL_00f3: Unknown result type (might be due to invalid IL or missing references) //IL_0109: Unknown result type (might be due to invalid IL or missing references) if (_selectedControl == null) { Debug.LogWarning((object)"[DebugWindow] 未选中任何控件,无法固定到页面"); return; } GameObject selectedGameObject = GetSelectedGameObject(); if ((Object)(object)selectedGameObject == (Object)null) { Debug.LogWarning((object)"[DebugWindow] 控件的 GameObject 无效"); return; } RectTransform currentParent = GetCurrentParent(); if ((Object)(object)currentParent == (Object)null) { Debug.LogError((object)"[DebugWindow] 无法获取目标父物体"); return; } if ((Object)(object)selectedGameObject.transform.parent == (Object)(object)currentParent) { Debug.Log((object)("[DebugWindow] 控件 " + ((Object)selectedGameObject).name + " 已经在目标页面中,无需移动")); return; } Transform parent = selectedGameObject.transform.parent; selectedGameObject.transform.SetParent((Transform)(object)currentParent, true); RectTransform component = selectedGameObject.GetComponent(); if ((Object)(object)component != (Object)null) { component.anchorMin = new Vector2(0.5f, 0.5f); component.anchorMax = new Vector2(0.5f, 0.5f); component.pivot = new Vector2(0.5f, 0.5f); } Debug.Log((object)("[DebugWindow] 已将控件 " + ((Object)selectedGameObject).name + " 从 " + (((parent != null) ? ((Object)parent).name : null) ?? "null") + " 移动到 " + ((Object)currentParent).name)); UpdateEditFieldsFromControl(); if (_selectedTab == 2 && _selectedPage != null) { RefreshPageControlsCache(); } } private void DumpButtonStructure(GameObject go) { } private void DumpTransform(Transform t, int indent) { } private void Update() { if (Input.GetKeyDown((KeyCode)290)) { _showWindow = !_showWindow; } if (!Input.GetKeyDown((KeyCode)306)) { return; } if (_selectedControl != null) { bool flag = false; if (_selectedControl is NativeButton nativeButton) { flag = !nativeButton.IsDraggable(); nativeButton.SetDraggable(flag); } else if (_selectedControl is NativeLabel nativeLabel) { flag = !nativeLabel.IsDraggable(); nativeLabel.SetDraggable(flag); } else if (_selectedControl is NativeSlider nativeSlider) { flag = !nativeSlider.IsDraggable(); nativeSlider.SetDraggable(flag); } else if (_selectedControl is NativeOption nativeOption) { flag = !nativeOption.IsDraggable(); nativeOption.SetDraggable(flag); } else if (_selectedControl is NativeArrow nativeArrow) { flag = !nativeArrow.IsDraggable(); nativeArrow.SetDraggable(flag); } else if (_selectedControl is NativeInput nativeInput) { flag = !nativeInput.IsDraggable(); nativeInput.SetDraggable(flag); } UpdateEditFieldsFromControl(); GameObject selectedGameObject = GetSelectedGameObject(); Debug.Log((object)("[DebugWindow] 控件 " + ((selectedGameObject != null) ? ((Object)selectedGameObject).name : null) + " 拖拽状态切换为: " + (flag ? "开启" : "关闭"))); } else { Debug.Log((object)"[DebugWindow] 未选中任何控件,无法切换拖拽状态"); } } } public class DragHandler : MonoBehaviour, IDragHandler, IEventSystemHandler, IBeginDragHandler, IEndDragHandler { private RectTransform rectTransform; private Canvas canvas; private Vector2 originalAnchoredPosition; private MenuButton menuButton; private CanvasGroup canvasGroup; private void Awake() { rectTransform = ((Component)this).GetComponent(); canvas = ((Component)this).GetComponentInParent(); menuButton = ((Component)this).GetComponent(); canvasGroup = ((Component)this).GetComponent(); } public void OnBeginDrag(PointerEventData eventData) { //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)DebugWindow.CurrentlySelectedForDrag != (Object)(object)((Component)this).gameObject) && ((Behaviour)this).enabled) { originalAnchoredPosition = rectTransform.anchoredPosition; if ((Object)(object)menuButton != (Object)null) { ((Selectable)menuButton).interactable = false; } if ((Object)(object)canvasGroup != (Object)null) { canvasGroup.blocksRaycasts = false; } } } public void OnDrag(PointerEventData eventData) { //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_0075: Unknown result type (might be due to invalid IL or missing references) //IL_0076: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_0089: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)canvas == (Object)null)) { Vector2 delta = eventData.delta; Transform transform = ((Component)canvas).transform; Vector2 val = default(Vector2); RectTransformUtility.ScreenPointToLocalPointInRectangle((RectTransform)(object)((transform is RectTransform) ? transform : null), eventData.position, canvas.worldCamera, ref val); Transform transform2 = ((Component)canvas).transform; Vector2 val2 = default(Vector2); RectTransformUtility.ScreenPointToLocalPointInRectangle((RectTransform)(object)((transform2 is RectTransform) ? transform2 : null), eventData.position - delta, canvas.worldCamera, ref val2); Vector2 val3 = val - val2; RectTransform obj = rectTransform; obj.anchoredPosition += val3; } } public void OnEndDrag(PointerEventData eventData) { //IL_0012: Unknown result type (might be due to invalid IL or missing references) Debug.Log((object)$"[DragHandler] 控件 {((Object)this).name} 移动到: {rectTransform.anchoredPosition}"); if ((Object)(object)menuButton != (Object)null) { ((Selectable)menuButton).interactable = true; } if ((Object)(object)canvasGroup != (Object)null) { canvasGroup.blocksRaycasts = true; } if ((Object)(object)DebugWindow.Instance != (Object)null) { DebugWindow.Instance.RefreshEditFieldsForSelected(); } } } public class NativeArrow { public enum Direction { Left, Right, Up, Down } public static List AllInstances = new List(); private Direction _direction = Direction.Left; private bool _directionLocked = false; private GameObject cursorLeft; private GameObject cursorRight; private UnityAction _currentClickHandler; public GameObject gameObject { get; private set; } public RectTransform rectTransform { get; private set; } public NativeButton nativeButton { get; private set; } public static NativeArrow Create(RectTransform parent = null, Direction dir = Direction.Left) { //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_0218: Unknown result type (might be due to invalid IL or missing references) NativeButton nativeButton = NativeButton.Create(parent, ButtonStyle.SmallButton); if (nativeButton == null) { return null; } nativeButton.SetTitle(""); nativeButton.SetDescription(""); Image component = nativeButton.gameObject.GetComponent(); if ((Object)(object)component != (Object)null) { ((Graphic)component).color = Color.clear; } if ((Object)(object)nativeButton.menuButton != (Object)null) { ((MenuSelectable)nativeButton.menuButton).playSubmitSound = false; } if ((Object)(object)nativeButton.menuButton != (Object)null) { ((Selectable)nativeButton.menuButton).interactable = true; } CanvasGroup component2 = nativeButton.gameObject.GetComponent(); if ((Object)(object)component2 != (Object)null) { component2.blocksRaycasts = true; component2.interactable = true; } else { component2 = nativeButton.gameObject.AddComponent(); component2.alpha = 1f; component2.interactable = true; component2.blocksRaycasts = true; } DragHandler component3 = nativeButton.gameObject.GetComponent(); if ((Object)(object)component3 != (Object)null) { ((Behaviour)component3).enabled = false; } NativeArrow nativeArrow = new NativeArrow(); nativeArrow.gameObject = nativeButton.gameObject; nativeArrow.rectTransform = nativeButton.rectTransform; nativeArrow.nativeButton = nativeButton; nativeArrow.cursorLeft = nativeArrow.FindChildRecursive(nativeButton.gameObject.transform, "CursorLeft"); nativeArrow.cursorRight = nativeArrow.FindChildRecursive(nativeButton.gameObject.transform, "CursorRight"); if ((Object)(object)nativeArrow.cursorLeft != (Object)null) { nativeArrow.MakeArrowAlwaysVisible(nativeArrow.cursorLeft); } if ((Object)(object)nativeArrow.cursorRight != (Object)null) { nativeArrow.MakeArrowAlwaysVisible(nativeArrow.cursorRight); } if ((Object)(object)nativeArrow.cursorLeft != (Object)null) { nativeArrow.cursorLeft.SetActive(false); } if ((Object)(object)nativeArrow.cursorRight != (Object)null) { nativeArrow.cursorRight.SetActive(false); } nativeArrow.SetDirection(dir); nativeArrow.SetSize(100f, 50f); nativeArrow.SetPosition(Vector2.zero); AllInstances.Add(nativeArrow); return nativeArrow; } private GameObject FindChildRecursive(Transform parent, string name) { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Expected O, but got Unknown foreach (Transform item in parent) { Transform val = item; if (((Object)val).name == name) { return ((Component)val).gameObject; } GameObject val2 = FindChildRecursive(val, name); if ((Object)(object)val2 != (Object)null) { return val2; } } return null; } private void MakeArrowAlwaysVisible(GameObject arrowObj) { //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)arrowObj == (Object)null)) { CanvasGroup component = arrowObj.GetComponent(); if ((Object)(object)component != (Object)null) { component.alpha = 1f; component.interactable = false; component.blocksRaycasts = false; } Image component2 = arrowObj.GetComponent(); if ((Object)(object)component2 != (Object)null) { Color color = ((Graphic)component2).color; color.a = 1f; ((Graphic)component2).color = color; } Animator component3 = arrowObj.GetComponent(); if ((Object)(object)component3 != (Object)null) { ((Behaviour)component3).enabled = false; } } } public void SetDirection(Direction dir) { //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0124: Unknown result type (might be due to invalid IL or missing references) //IL_0179: Unknown result type (might be due to invalid IL or missing references) if (_directionLocked) { return; } _direction = dir; if ((Object)(object)rectTransform != (Object)null) { ((Transform)rectTransform).localEulerAngles = Vector3.zero; } if ((Object)(object)cursorLeft != (Object)null) { cursorLeft.SetActive(false); } if ((Object)(object)cursorRight != (Object)null) { cursorRight.SetActive(false); } switch (dir) { case Direction.Left: if ((Object)(object)cursorLeft != (Object)null) { cursorLeft.SetActive(true); } break; case Direction.Right: if ((Object)(object)cursorRight != (Object)null) { cursorRight.SetActive(true); } break; case Direction.Up: if ((Object)(object)cursorLeft != (Object)null) { cursorLeft.SetActive(true); if ((Object)(object)rectTransform != (Object)null) { ((Transform)rectTransform).localEulerAngles = new Vector3(0f, 0f, 90f); } } break; case Direction.Down: if ((Object)(object)cursorLeft != (Object)null) { cursorLeft.SetActive(true); if ((Object)(object)rectTransform != (Object)null) { ((Transform)rectTransform).localEulerAngles = new Vector3(0f, 0f, -90f); } } break; } _directionLocked = true; } public Direction GetDirection() { return _direction; } public void SetPlayAnimation(bool play) { if ((Object)(object)nativeButton?.menuButton?.flashEffect != (Object)null) { ((Behaviour)nativeButton.menuButton.flashEffect).enabled = play; } } public void SetPosition(Vector2 anchoredPosition) { //IL_0017: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)rectTransform != (Object)null) { rectTransform.anchoredPosition = anchoredPosition; } } public Vector2 GetPosition() { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Unknown result type (might be due to invalid IL or missing references) RectTransform obj = rectTransform; return (obj != null) ? obj.anchoredPosition : Vector2.zero; } public void SetSize(float width, float height) { //IL_0019: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)rectTransform != (Object)null) { rectTransform.sizeDelta = new Vector2(width, height); } } public Vector2 GetSize() { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Unknown result type (might be due to invalid IL or missing references) RectTransform obj = rectTransform; return (obj != null) ? obj.sizeDelta : Vector2.zero; } public void SetClickable(bool clickable, UnityAction onClick = null) { if (nativeButton != null) { if (_currentClickHandler != null) { nativeButton.OnClick -= _currentClickHandler; } _currentClickHandler = null; if (clickable && onClick != null) { _currentClickHandler = onClick; nativeButton.OnClick += _currentClickHandler; } } } public bool IsClickable() { return nativeButton != null && nativeButton.GetListenerCount() > 0; } public void SetDraggable(bool draggable) { nativeButton?.SetDraggable(draggable); } public bool IsDraggable() { return nativeButton?.IsDraggable() ?? false; } public void Show() { nativeButton?.Show(); } public void Hide() { nativeButton?.Hide(); } public void Destroy() { AllInstances.Remove(this); nativeButton?.Destroy(); } } public enum ButtonStyle { IconButton, TextButton, SmallButton } public class NativeButton { public static List AllInstances = new List(); private Text[] allTexts; private Text titleText; private Text descText; private Image iconImage; public string[] toggleTexts; public int currentToggleIndex = -1; [CompilerGenerated] [DebuggerBrowsable(DebuggerBrowsableState.Never)] private UnityAction m_OnClick; public GameObject gameObject { get; private set; } public MenuButton menuButton { get; private set; } public RectTransform rectTransform { get; private set; } public ButtonStyle Style { get; private set; } public event UnityAction OnClick { [CompilerGenerated] add { //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Expected O, but got Unknown UnityAction val = this.m_OnClick; UnityAction val2; do { val2 = val; UnityAction value2 = (UnityAction)Delegate.Combine((Delegate?)(object)val2, (Delegate?)(object)value); val = Interlocked.CompareExchange(ref this.m_OnClick, value2, val2); } while (val != val2); } [CompilerGenerated] remove { //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Expected O, but got Unknown UnityAction val = this.m_OnClick; UnityAction val2; do { val2 = val; UnityAction value2 = (UnityAction)Delegate.Remove((Delegate?)(object)val2, (Delegate?)(object)value); val = Interlocked.CompareExchange(ref this.m_OnClick, value2, val2); } while (val != val2); } } public static NativeButton Create(RectTransform parent = null, ButtonStyle style = ButtonStyle.IconButton) { //IL_01d9: Unknown result type (might be due to invalid IL or missing references) //IL_03e3: Unknown result type (might be due to invalid IL or missing references) //IL_03fb: Unknown result type (might be due to invalid IL or missing references) //IL_040a: Unknown result type (might be due to invalid IL or missing references) //IL_040c: Unknown result type (might be due to invalid IL or missing references) //IL_0419: Unknown result type (might be due to invalid IL or missing references) //IL_0438: Unknown result type (might be due to invalid IL or missing references) //IL_0442: Expected O, but got Unknown //IL_04b0: Unknown result type (might be due to invalid IL or missing references) //IL_04d0: Unknown result type (might be due to invalid IL or missing references) //IL_04f0: Unknown result type (might be due to invalid IL or missing references) //IL_0506: Unknown result type (might be due to invalid IL or missing references) //IL_0526: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)parent == (Object)null) { parent = UIParent.GetDefaultParent(); } string text = style.ToString(); GameObject val = PrefabMenuObjects.Get(text); if ((Object)(object)val == (Object)null) { Debug.LogError((object)("[NativeButton] 无法获取 " + text + " 预制体")); return null; } GameObject val2 = Object.Instantiate(val); if ((Object)(object)parent != (Object)null) { val2.transform.SetParent((Transform)(object)parent, false); } ((Object)val2).name = $"NativeButton_{style}"; NativeButton btn = new NativeButton(); btn.gameObject = val2; btn.menuButton = val2.GetComponent(); btn.rectTransform = val2.GetComponent(); btn.Style = style; if ((Object)(object)btn.menuButton == (Object)null) { Debug.LogError((object)("[NativeButton] 预制体 " + text + " 缺少 MenuButton 组件!按钮 " + ((Object)val2).name + " 将不可用,已销毁。")); Object.Destroy((Object)(object)val2); return null; } if (style == ButtonStyle.IconButton) { Transform val3 = val2.transform.Find("Image"); if ((Object)(object)val3 != (Object)null) { btn.iconImage = ((Component)val3).GetComponent(); } else { btn.iconImage = val2.GetComponent(); if ((Object)(object)btn.iconImage == (Object)null) { Debug.LogWarning((object)"[NativeButton] IconButton 未找到 Image 组件,图标功能不可用"); } } if ((Object)(object)btn.iconImage != (Object)null) { btn.SetIconOffset(new Vector2(-400f, -20f)); } } btn.allTexts = val2.GetComponentsInChildren(true); Text[] array = (from t in btn.allTexts where (Object)(object)t != (Object)null orderby t.fontSize descending select t).ToArray(); if (array.Length != 0) { btn.titleText = array[0]; } if (array.Length > 1) { btn.descText = array[1]; } else if (array.Length == 1) { btn.descText = array[0]; } AutoLocalizeTextUI[] componentsInChildren = val2.GetComponentsInChildren(true); AutoLocalizeTextUI[] array2 = componentsInChildren; foreach (AutoLocalizeTextUI val4 in array2) { Object.Destroy((Object)(object)val4); } EventTrigger[] componentsInChildren2 = val2.GetComponentsInChildren(true); EventTrigger[] array3 = componentsInChildren2; foreach (EventTrigger val5 in array3) { Object.Destroy((Object)(object)val5); } StartGameEventTrigger[] componentsInChildren3 = val2.GetComponentsInChildren(true); StartGameEventTrigger[] array4 = componentsInChildren3; foreach (StartGameEventTrigger val6 in array4) { Object.Destroy((Object)(object)val6); } AudioSource[] componentsInChildren4 = val2.GetComponentsInChildren(true); AudioSource[] array5 = componentsInChildren4; foreach (AudioSource val7 in array5) { Object.Destroy((Object)(object)val7); } Component[] componentsInChildren5 = val2.GetComponentsInChildren(true); Component[] array6 = componentsInChildren5; foreach (Component val8 in array6) { if ((Object)(object)val8 != (Object)null && ((object)val8).GetType().Name.Contains("Audio")) { Object.Destroy((Object)(object)val8); } } ((UnityEventBase)btn.menuButton.OnSubmitPressed).RemoveAllListeners(); ((MenuSelectable)btn.menuButton).cancelAction = (CancelAction)0; ((MenuSelectable)btn.menuButton).playSubmitSound = false; Navigation val9 = default(Navigation); ((Navigation)(ref val9)).mode = (Mode)3; Navigation navigation = val9; ((Selectable)btn.menuButton).navigation = navigation; btn.menuButton.OnSubmitPressed.AddListener((UnityAction)delegate { UnityAction onClick = btn.OnClick; if (onClick != null) { onClick.Invoke(); } }); CanvasGroup val10 = val2.GetComponent(); if ((Object)(object)val10 == (Object)null) { val10 = val2.AddComponent(); } val10.alpha = 1f; val10.interactable = true; val10.blocksRaycasts = true; if ((Object)(object)btn.rectTransform != (Object)null) { btn.rectTransform.anchorMin = new Vector2(0.5f, 0.5f); btn.rectTransform.anchorMax = new Vector2(0.5f, 0.5f); btn.rectTransform.pivot = new Vector2(0.5f, 0.5f); btn.rectTransform.anchoredPosition = Vector2.zero; btn.rectTransform.sizeDelta = new Vector2(400f, 100f); } DragHandler dragHandler = val2.AddComponent(); ((Behaviour)dragHandler).enabled = false; val2.SetActive(true); AllInstances.Add(btn); NativeUIEventDispatcher.RegisterControl(btn); return btn; } public static NativeButton Create(RectTransform parent = null) { return Create(parent, ButtonStyle.IconButton); } public static Sprite LoadSpriteFromFile(string filePath) { //IL_009e: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: Expected O, but got Unknown //IL_0121: Unknown result type (might be due to invalid IL or missing references) //IL_0130: Unknown result type (might be due to invalid IL or missing references) if (string.IsNullOrEmpty(filePath)) { return null; } string text = filePath; if (!Path.IsPathRooted(filePath) && !string.IsNullOrEmpty(NativeUIMakerMod.PluginDirectory)) { string text2 = Path.Combine(NativeUIMakerMod.PluginDirectory, filePath); if (File.Exists(text2)) { text = text2; } else { Debug.LogWarning((object)("[NativeButton] 相对路径文件不存在(插件目录): " + text2)); } } if (!File.Exists(text)) { Debug.LogError((object)("[NativeButton] 文件不存在: " + text)); return null; } try { WWW val = new WWW("file://" + text); try { while (!val.isDone) { } if (!string.IsNullOrEmpty(val.error)) { Debug.LogError((object)("[NativeButton] WWW 加载失败: " + val.error)); return null; } Texture2D texture = val.texture; if ((Object)(object)texture != (Object)null) { return Sprite.Create(texture, new Rect(0f, 0f, (float)((Texture)texture).width, (float)((Texture)texture).height), new Vector2(0.5f, 0.5f)); } Debug.LogError((object)("[NativeButton] 无法从文件创建纹理: " + text)); return null; } finally { ((IDisposable)val)?.Dispose(); } } catch (Exception ex) { Debug.LogError((object)("[NativeButton] 加载图标失败: " + ex.Message)); return null; } } public void SetIcon(Sprite sprite) { if (Style != 0) { Debug.LogWarning((object)"[NativeButton] 只有 IconButton 可以设置图标"); } else if ((Object)(object)iconImage != (Object)null) { iconImage.sprite = sprite; } else { Debug.LogWarning((object)"[NativeButton] 无法设置图标,未找到 Image 组件"); } } public void SetIconFromFile(string filePath) { Sprite val = LoadSpriteFromFile(filePath); if ((Object)(object)val != (Object)null) { SetIcon(val); } } public bool HasIcon() { return Style == ButtonStyle.IconButton && (Object)(object)iconImage != (Object)null; } public void SetIconOffset(Vector2 offset) { //IL_0028: Unknown result type (might be due to invalid IL or missing references) Image obj = iconImage; if ((Object)(object)((obj != null) ? ((Graphic)obj).rectTransform : null) != (Object)null) { ((Graphic)iconImage).rectTransform.anchoredPosition = offset; } } public Vector2 GetIconOffset() { //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Unknown result type (might be due to invalid IL or missing references) Image obj = iconImage; Vector2? obj2; if (obj == null) { obj2 = null; } else { RectTransform obj3 = ((Graphic)obj).rectTransform; obj2 = ((obj3 != null) ? new Vector2?(obj3.anchoredPosition) : null); } return (Vector2)(((??)obj2) ?? Vector2.zero); } public void SetTitleOffset(Vector2 offset) { //IL_0028: Unknown result type (might be due to invalid IL or missing references) Text obj = titleText; if ((Object)(object)((obj != null) ? ((Graphic)obj).rectTransform : null) != (Object)null) { ((Graphic)titleText).rectTransform.anchoredPosition = offset; } } public Vector2 GetTitleOffset() { //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Unknown result type (might be due to invalid IL or missing references) Text obj = titleText; Vector2? obj2; if (obj == null) { obj2 = null; } else { RectTransform obj3 = ((Graphic)obj).rectTransform; obj2 = ((obj3 != null) ? new Vector2?(obj3.anchoredPosition) : null); } return (Vector2)(((??)obj2) ?? Vector2.zero); } public void SetDescOffset(Vector2 offset) { //IL_0028: Unknown result type (might be due to invalid IL or missing references) Text obj = descText; if ((Object)(object)((obj != null) ? ((Graphic)obj).rectTransform : null) != (Object)null) { ((Graphic)descText).rectTransform.anchoredPosition = offset; } } public Vector2 GetDescOffset() { //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Unknown result type (might be due to invalid IL or missing references) Text obj = descText; Vector2? obj2; if (obj == null) { obj2 = null; } else { RectTransform obj3 = ((Graphic)obj).rectTransform; obj2 = ((obj3 != null) ? new Vector2?(obj3.anchoredPosition) : null); } return (Vector2)(((??)obj2) ?? Vector2.zero); } public void SetDraggable(bool draggable) { DragHandler component = gameObject.GetComponent(); if ((Object)(object)component != (Object)null) { ((Behaviour)component).enabled = draggable; } } public bool IsDraggable() { DragHandler component = gameObject.GetComponent(); return (Object)(object)component != (Object)null && ((Behaviour)component).enabled; } public void SetTitle(string text) { if ((Object)(object)titleText != (Object)null) { titleText.text = text; } else { Debug.LogWarning((object)"[NativeButton] 未找到标题 Text 组件"); } } public string GetTitle() { Text obj = titleText; return ((obj != null) ? obj.text : null) ?? ""; } public void SetDescription(string text) { if ((Object)(object)descText != (Object)null) { descText.text = text; } else { Debug.LogWarning((object)"[NativeButton] 未找到描述 Text 组件"); } } public string GetDescription() { Text obj = descText; return ((obj != null) ? obj.text : null) ?? ""; } public void SetToggleTexts(string[] texts) { //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Expected O, but got Unknown //IL_007b: Unknown result type (might be due to invalid IL or missing references) //IL_0085: Expected O, but got Unknown //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Expected O, but got Unknown if (texts == null || texts.Length == 0) { toggleTexts = null; currentToggleIndex = -1; OnClick -= new UnityAction(OnToggleClick); return; } toggleTexts = texts; currentToggleIndex = 0; SetTitle(toggleTexts[0]); SetDescription(toggleTexts[0]); OnClick -= new UnityAction(OnToggleClick); OnClick += new UnityAction(OnToggleClick); } private void OnToggleClick() { if (toggleTexts != null && toggleTexts.Length != 0) { currentToggleIndex = (currentToggleIndex + 1) % toggleTexts.Length; string text = toggleTexts[currentToggleIndex]; SetTitle(text); SetDescription(text); Debug.Log((object)("[NativeButton] 文字切换: " + text)); } } public void SetStyle(ButtonStyle newStyle) { //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_00bb: Unknown result type (might be due to invalid IL or missing references) //IL_00c4: Unknown result type (might be due to invalid IL or missing references) //IL_00ca: Unknown result type (might be due to invalid IL or missing references) //IL_00f4: Unknown result type (might be due to invalid IL or missing references) //IL_00fe: Unknown result type (might be due to invalid IL or missing references) //IL_0108: Unknown result type (might be due to invalid IL or missing references) if (newStyle == Style) { return; } Vector2 position = GetPosition(); Vector2 size = GetSize(); string title = GetTitle(); string description = GetDescription(); bool draggable = IsDraggable(); Vector2 iconOffset = GetIconOffset(); Vector2 titleOffset = GetTitleOffset(); Vector2 descOffset = GetDescOffset(); Sprite val = (HasIcon() ? iconImage.sprite : null); string[] array = toggleTexts; int num = currentToggleIndex; Object.Destroy((Object)(object)gameObject); AllInstances.Remove(this); Transform parent = ((Transform)rectTransform).parent; NativeButton nativeButton = Create((RectTransform)(object)((parent is RectTransform) ? parent : null), newStyle); if (nativeButton != null) { nativeButton.SetPosition(position); nativeButton.SetSize(size.x, size.y); nativeButton.SetTitle(title); nativeButton.SetDescription(description); nativeButton.SetDraggable(draggable); nativeButton.SetIconOffset(iconOffset); nativeButton.SetTitleOffset(titleOffset); nativeButton.SetDescOffset(descOffset); if ((Object)(object)val != (Object)null && newStyle == ButtonStyle.IconButton) { nativeButton.SetIcon(val); } if (array != null) { nativeButton.SetToggleTexts(array); } if (num >= 0) { nativeButton.SetToggleIndex(num); } gameObject = nativeButton.gameObject; menuButton = nativeButton.menuButton; rectTransform = nativeButton.rectTransform; Style = nativeButton.Style; titleText = nativeButton.titleText; descText = nativeButton.descText; iconImage = nativeButton.iconImage; toggleTexts = nativeButton.toggleTexts; currentToggleIndex = nativeButton.currentToggleIndex; } } public void SetPosition(Vector2 pos) { //IL_0017: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)rectTransform != (Object)null) { rectTransform.anchoredPosition = pos; } } public Vector2 GetPosition() { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Unknown result type (might be due to invalid IL or missing references) RectTransform obj = rectTransform; return (obj != null) ? obj.anchoredPosition : Vector2.zero; } public void SetSize(float w, float h) { //IL_0019: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)rectTransform != (Object)null) { rectTransform.sizeDelta = new Vector2(w, h); } } public Vector2 GetSize() { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Unknown result type (might be due to invalid IL or missing references) RectTransform obj = rectTransform; return (obj != null) ? obj.sizeDelta : Vector2.zero; } public void Show() { GameObject obj = gameObject; if (obj != null) { obj.SetActive(true); } } public void Hide() { GameObject obj = gameObject; if (obj != null) { obj.SetActive(false); } } public void Destroy() { AllInstances.Remove(this); Object.Destroy((Object)(object)gameObject); } public void AddClickListener(UnityAction action) { OnClick += action; } public void RemoveClickListener(UnityAction action) { OnClick -= action; } public void ClearClickListeners() { //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Expected O, but got Unknown if (this.OnClick != null) { Delegate[] invocationList = ((Delegate)(object)this.OnClick).GetInvocationList(); for (int i = 0; i < invocationList.Length; i++) { UnityAction value = (UnityAction)invocationList[i]; OnClick -= value; } } } public void SetToggleIndex(int index) { if (toggleTexts != null && index >= 0 && index < toggleTexts.Length) { currentToggleIndex = index; SetTitle(toggleTexts[index]); SetDescription(toggleTexts[index]); } } public int GetListenerCount() { UnityAction onClick = this.OnClick; return (onClick != null) ? ((Delegate)(object)onClick).GetInvocationList().Length : 0; } } public class NativeInput { public static List AllInstances = new List(); public GameObject gameObject { get; private set; } public InputField inputField { get; private set; } public RectTransform rectTransform { get; private set; } public event Action OnTextChanged; public static NativeInput Create(RectTransform parent) { //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Expected O, but got Unknown //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Expected O, but got Unknown //IL_00d0: Unknown result type (might be due to invalid IL or missing references) //IL_00fb: Unknown result type (might be due to invalid IL or missing references) //IL_0102: Expected O, but got Unknown //IL_0142: Unknown result type (might be due to invalid IL or missing references) //IL_01b9: Unknown result type (might be due to invalid IL or missing references) //IL_01d9: Unknown result type (might be due to invalid IL or missing references) //IL_01f9: Unknown result type (might be due to invalid IL or missing references) //IL_020f: Unknown result type (might be due to invalid IL or missing references) //IL_022f: Unknown result type (might be due to invalid IL or missing references) GameObject val2 = new GameObject("NativeInput"); val2.AddComponent(); Image val3 = val2.AddComponent(); ((Graphic)val3).color = new Color(0.2f, 0.2f, 0.2f, 0.8f); ((Graphic)val3).raycastTarget = true; InputField val4 = val2.AddComponent(); ((Selectable)val4).targetGraphic = (Graphic)(object)val3; GameObject val5 = new GameObject("Text"); val5.transform.SetParent(val2.transform, false); Text val6 = val5.AddComponent(); Font val7 = Resources.GetBuiltinResource("Arial.ttf"); if ((Object)(object)val7 == (Object)null) { Text val8 = Object.FindObjectOfType(); if ((Object)(object)val8 != (Object)null) { val7 = val8.font; } } val6.font = val7; val6.fontSize = 28; ((Graphic)val6).color = Color.white; val6.alignment = (TextAnchor)3; ((Graphic)val6).raycastTarget = false; val4.textComponent = val6; GameObject val9 = new GameObject("Placeholder"); val9.transform.SetParent(val2.transform, false); Text val10 = val9.AddComponent(); val10.text = "输入..."; val10.font = val7; val10.fontSize = 24; ((Graphic)val10).color = Color.gray; val10.alignment = (TextAnchor)3; val4.placeholder = (Graphic)(object)val10; val2.transform.SetParent((Transform)(object)parent, false); NativeInput ni = new NativeInput(); ni.gameObject = val2; ni.inputField = val4; ni.rectTransform = val2.GetComponent(); ni.rectTransform.anchorMin = new Vector2(0.5f, 0.5f); ni.rectTransform.anchorMax = new Vector2(0.5f, 0.5f); ni.rectTransform.pivot = new Vector2(0.5f, 0.5f); ni.rectTransform.anchoredPosition = Vector2.zero; ni.rectTransform.sizeDelta = new Vector2(300f, 60f); ((UnityEventBase)val4.onValueChanged).RemoveAllListeners(); ((UnityEvent)(object)val4.onValueChanged).AddListener((UnityAction)delegate(string val) { ni.OnTextChanged?.Invoke(val); }); DragHandler dragHandler = val2.AddComponent(); ((Behaviour)dragHandler).enabled = false; AllInstances.Add(ni); NativeUIEventDispatcher.RegisterControl(ni); return ni; } public void SetText(string text) { inputField.text = text; } public string GetText() { return inputField.text; } public void SetPosition(Vector2 pos) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) rectTransform.anchoredPosition = pos; } public Vector2 GetPosition() { //IL_0006: Unknown result type (might be due to invalid IL or missing references) return rectTransform.anchoredPosition; } public void SetSize(float w, float h) { //IL_0008: Unknown result type (might be due to invalid IL or missing references) rectTransform.sizeDelta = new Vector2(w, h); } public Vector2 GetSize() { //IL_0006: Unknown result type (might be due to invalid IL or missing references) return rectTransform.sizeDelta; } public void SetDraggable(bool draggable) { DragHandler component = gameObject.GetComponent(); if ((Object)(object)component != (Object)null) { ((Behaviour)component).enabled = draggable; } } public bool IsDraggable() { DragHandler component = gameObject.GetComponent(); return (Object)(object)component != (Object)null && ((Behaviour)component).enabled; } public void AddTextChangedListener(Action listener) { OnTextChanged += listener; } public void RemoveTextChangedListener(Action listener) { OnTextChanged -= listener; } public void Show() { gameObject.SetActive(true); } public void Hide() { gameObject.SetActive(false); } public void Destroy() { AllInstances.Remove(this); Object.Destroy((Object)(object)gameObject); } } public class NativeLabel { public static List AllInstances = new List(); public GameObject gameObject { get; private set; } public RectTransform rectTransform { get; private set; } public Text textComponent { get; private set; } public static NativeLabel Create(RectTransform parent = null) { //IL_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_0151: Unknown result type (might be due to invalid IL or missing references) //IL_016c: Unknown result type (might be due to invalid IL or missing references) //IL_0187: Unknown result type (might be due to invalid IL or missing references) //IL_0198: Unknown result type (might be due to invalid IL or missing references) //IL_01b3: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)parent == (Object)null) { parent = UIParent.GetDefaultParent(); } GameObject val = PrefabMenuObjects.Get("StandardLabel"); if ((Object)(object)val == (Object)null) { Debug.LogError((object)"[NativeLabel] 无法获取 StandardLabel 预制体"); return null; } GameObject val2 = Object.Instantiate(val); if ((Object)(object)parent != (Object)null) { val2.transform.SetParent((Transform)(object)parent, false); } ((Object)val2).name = "NativeLabel"; NativeLabel nativeLabel = new NativeLabel(); nativeLabel.gameObject = val2; nativeLabel.rectTransform = val2.GetComponent(); nativeLabel.textComponent = val2.GetComponent(); if ((Object)(object)nativeLabel.textComponent != (Object)null) { ((Graphic)nativeLabel.textComponent).color = Color.white; nativeLabel.textComponent.fontSize = 30; if ((Object)(object)nativeLabel.textComponent.font == (Object)null) { Font val3 = Resources.GetBuiltinResource("Arial.ttf"); if ((Object)(object)val3 == (Object)null) { Text val4 = Object.FindObjectOfType(); if ((Object)(object)val4 != (Object)null) { val3 = val4.font; } } nativeLabel.textComponent.font = val3; } } if ((Object)(object)nativeLabel.rectTransform != (Object)null) { nativeLabel.rectTransform.anchorMin = new Vector2(0.5f, 0.5f); nativeLabel.rectTransform.anchorMax = new Vector2(0.5f, 0.5f); nativeLabel.rectTransform.pivot = new Vector2(0.5f, 0.5f); nativeLabel.rectTransform.anchoredPosition = Vector2.zero; nativeLabel.rectTransform.sizeDelta = new Vector2(400f, 60f); } CanvasGroup val5 = val2.GetComponent(); if ((Object)(object)val5 == (Object)null) { val5 = val2.AddComponent(); } val5.alpha = 1f; val5.interactable = false; val5.blocksRaycasts = true; if ((Object)(object)nativeLabel.textComponent != (Object)null) { ((Graphic)nativeLabel.textComponent).raycastTarget = true; } AutoLocalizeTextUI[] components = val2.GetComponents(); AutoLocalizeTextUI[] array = components; foreach (AutoLocalizeTextUI val6 in array) { Object.Destroy((Object)(object)val6); } DragHandler dragHandler = val2.AddComponent(); ((Behaviour)dragHandler).enabled = false; val2.SetActive(true); AllInstances.Add(nativeLabel); return nativeLabel; } public void SetDraggable(bool draggable) { DragHandler component = gameObject.GetComponent(); if ((Object)(object)component != (Object)null) { ((Behaviour)component).enabled = draggable; } } public bool IsDraggable() { DragHandler component = gameObject.GetComponent(); return (Object)(object)component != (Object)null && ((Behaviour)component).enabled; } public void SetText(string text) { if ((Object)(object)textComponent != (Object)null) { textComponent.text = text; } } public string GetText() { Text obj = textComponent; return ((obj != null) ? obj.text : null) ?? ""; } public void SetFontSize(int size) { if ((Object)(object)textComponent != (Object)null) { textComponent.fontSize = size; } } public void SetColor(Color color) { //IL_0017: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)textComponent != (Object)null) { ((Graphic)textComponent).color = color; } } public void SetFont(Font font) { if ((Object)(object)textComponent != (Object)null) { textComponent.font = font; } } public void SetAlignment(TextAnchor alignment) { //IL_0017: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)textComponent != (Object)null) { textComponent.alignment = alignment; } } public void SetPosition(Vector2 anchoredPosition) { //IL_0017: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)rectTransform != (Object)null) { rectTransform.anchoredPosition = anchoredPosition; } } public Vector2 GetPosition() { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Unknown result type (might be due to invalid IL or missing references) RectTransform obj = rectTransform; return (obj != null) ? obj.anchoredPosition : Vector2.zero; } public void SetSize(float width, float height) { //IL_0019: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)rectTransform != (Object)null) { rectTransform.sizeDelta = new Vector2(width, height); } } public Vector2 GetSize() { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Unknown result type (might be due to invalid IL or missing references) RectTransform obj = rectTransform; return (obj != null) ? obj.sizeDelta : Vector2.zero; } public void Show() { gameObject.SetActive(true); } public void Hide() { gameObject.SetActive(false); } public void Destroy() { AllInstances.Remove(this); Object.Destroy((Object)(object)gameObject); } } public class NativeOption { private class OptionValueWatcher : MonoBehaviour { private NativeOption opt; private int lastIndex = -1; public void Init(NativeOption owner) { opt = owner; if (opt.selectedIndexField != null) { lastIndex = (int)opt.selectedIndexField.GetValue(opt.nativeOptionComponent); } else { lastIndex = opt.currentIndex; } } private void Update() { if (opt == null || (Object)(object)opt.nativeOptionComponent == (Object)null || opt.selectedIndexField == null) { return; } int num = (int)opt.selectedIndexField.GetValue(opt.nativeOptionComponent); if (num != lastIndex) { lastIndex = num; opt.currentIndex = num; opt.OnOptionChanged?.Invoke(num); if ((Object)(object)opt.valueText != (Object)null && opt.options != null && num >= 0 && num < opt.options.Length) { opt.valueText.text = opt.options[num]; } } } } public static List AllInstances = new List(); private string[] options; private int currentIndex; private FieldInfo selectedIndexField; private FieldInfo optionListField; private string _cachedLabel = ""; private static UIManager _uiManager; private bool _cleaned = false; public GameObject gameObject { get; private set; } public RectTransform rectTransform { get; private set; } public Component nativeOptionComponent { get; private set; } public Text labelText { get; private set; } public Text valueText { get; private set; } public Text descText { get; private set; } public event Action OnOptionChanged; private static UIManager GetUIManager() { if ((Object)(object)_uiManager == (Object)null) { _uiManager = UIManager.instance; } return _uiManager; } private void RefreshUI() { if ((Object)(object)labelText != (Object)null && !string.IsNullOrEmpty(_cachedLabel)) { labelText.text = _cachedLabel; } if ((Object)(object)valueText != (Object)null && options != null && currentIndex >= 0 && currentIndex < options.Length) { valueText.text = options[currentIndex]; } if ((Object)(object)nativeOptionComponent != (Object)null && selectedIndexField != null) { selectedIndexField.SetValue(nativeOptionComponent, currentIndex); } Canvas.ForceUpdateCanvases(); } private void PurgeAllNonEssentialComponents() { HashSet keepTypes; if (!_cleaned) { _cleaned = true; keepTypes = new HashSet { typeof(RectTransform), typeof(CanvasGroup), typeof(Text), typeof(Image), typeof(CanvasRenderer), typeof(MenuOptionHorizontal), typeof(OptionValueWatcher), typeof(DragHandler), typeof(MenuButton) }; Clean(gameObject, ((Object)gameObject).name); } void Clean(GameObject obj, string parentPath) { //IL_007f: Unknown result type (might be due to invalid IL or missing references) //IL_0086: Expected O, but got Unknown string parentPath2 = parentPath + "/" + ((Object)obj).name; Component[] components = obj.GetComponents(); Component[] array = components; foreach (Component val in array) { if (!((Object)(object)val == (Object)null)) { Type type = ((object)val).GetType(); if (!keepTypes.Contains(type)) { Object.DestroyImmediate((Object)(object)val); } } } foreach (Transform item in obj.transform) { Transform val2 = item; Clean(((Component)val2).gameObject, parentPath2); } } } private string SanitizeText(string text) { return text?.Trim().Replace("#", "") ?? ""; } public static NativeOption Create(RectTransform parent = null) { //IL_00c7: Unknown result type (might be due to invalid IL or missing references) //IL_00e2: Unknown result type (might be due to invalid IL or missing references) //IL_00fd: Unknown result type (might be due to invalid IL or missing references) //IL_010e: Unknown result type (might be due to invalid IL or missing references) //IL_0129: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)parent == (Object)null) { parent = UIParent.GetDefaultParent(); } GameObject val = PrefabMenuObjects.Get("Option"); if ((Object)(object)val == (Object)null) { Debug.LogError((object)"[NativeOption] 无法获取 Option 预制体"); return null; } GameObject val2 = Object.Instantiate(val); if ((Object)(object)parent != (Object)null) { val2.transform.SetParent((Transform)(object)parent, false); } ((Object)val2).name = "NativeOption"; NativeOption nativeOption = new NativeOption(); nativeOption.gameObject = val2; nativeOption.rectTransform = val2.GetComponent(); if ((Object)(object)nativeOption.rectTransform == (Object)null) { Debug.LogError((object)"[NativeOption] 预制体缺少 RectTransform"); Object.Destroy((Object)(object)val2); return null; } nativeOption.rectTransform.anchorMin = new Vector2(0.5f, 0.5f); nativeOption.rectTransform.anchorMax = new Vector2(0.5f, 0.5f); nativeOption.rectTransform.pivot = new Vector2(0.5f, 0.5f); nativeOption.rectTransform.anchoredPosition = Vector2.zero; nativeOption.rectTransform.sizeDelta = new Vector2(600f, 80f); CanvasGroup val3 = val2.GetComponent(); if ((Object)(object)val3 == (Object)null) { val3 = val2.AddComponent(); } val3.alpha = 1f; val3.interactable = true; val3.blocksRaycasts = true; nativeOption.nativeOptionComponent = val2.GetComponent("MenuOptionHorizontal"); if ((Object)(object)nativeOption.nativeOptionComponent == (Object)null) { Debug.LogError((object)"[NativeOption] 预制体没有 MenuOptionHorizontal 组件"); Object.Destroy((Object)(object)val2); return null; } nativeOption.nativeOptionComponent.gameObject.SetActive(false); AutoLocalizeTextUI[] componentsInChildren = val2.GetComponentsInChildren(true); AutoLocalizeTextUI[] array = componentsInChildren; foreach (AutoLocalizeTextUI val4 in array) { Object.DestroyImmediate((Object)(object)val4); } StartGameEventTrigger[] componentsInChildren2 = val2.GetComponentsInChildren(true); StartGameEventTrigger[] array2 = componentsInChildren2; foreach (StartGameEventTrigger val5 in array2) { Object.DestroyImmediate((Object)(object)val5); } EventTrigger[] componentsInChildren3 = val2.GetComponentsInChildren(true); EventTrigger[] array3 = componentsInChildren3; foreach (EventTrigger val6 in array3) { if ((Object)(object)((Component)val6).gameObject != (Object)(object)nativeOption.nativeOptionComponent.gameObject) { Object.DestroyImmediate((Object)(object)val6); } } Text[] componentsInChildren4 = val2.GetComponentsInChildren(true); Text[] array4 = componentsInChildren4; foreach (Text val7 in array4) { if ((Object)(object)val7 != (Object)null) { val7.text = ""; } } nativeOption.nativeOptionComponent.gameObject.SetActive(true); Transform obj = val2.transform.Find("Menu Option Label"); nativeOption.labelText = ((obj != null) ? ((Component)obj).GetComponent() : null); Transform obj2 = val2.transform.Find("Menu Option Text"); nativeOption.valueText = ((obj2 != null) ? ((Component)obj2).GetComponent() : null); Transform obj3 = val2.transform.Find("Description"); nativeOption.descText = ((obj3 != null) ? ((Component)obj3).GetComponent() : null); if ((Object)(object)nativeOption.labelText == (Object)null || (Object)(object)nativeOption.valueText == (Object)null) { Debug.LogError((object)"[NativeOption] 无法找到必要的 Text 组件"); Object.Destroy((Object)(object)val2); return null; } Type type = ((object)nativeOption.nativeOptionComponent).GetType(); nativeOption.optionListField = type.GetField("optionList"); nativeOption.selectedIndexField = type.GetField("selectedOptionIndex"); FieldInfo field = type.GetField("cancelAction"); if (field != null) { field.SetValue(nativeOption.nativeOptionComponent, (object)(CancelAction)0); } string[] value = new string[2] { "关", "开" }; if (nativeOption.optionListField != null) { nativeOption.optionListField.SetValue(nativeOption.nativeOptionComponent, value); } if (nativeOption.selectedIndexField != null) { nativeOption.selectedIndexField.SetValue(nativeOption.nativeOptionComponent, 0); } nativeOption.options = value; nativeOption.currentIndex = 0; nativeOption.UpdateValueText(); OptionValueWatcher optionValueWatcher = val2.AddComponent(); optionValueWatcher.Init(nativeOption); DragHandler dragHandler = val2.AddComponent(); ((Behaviour)dragHandler).enabled = false; nativeOption.PurgeAllNonEssentialComponents(); nativeOption.RefreshUI(); val2.SetActive(true); Canvas.ForceUpdateCanvases(); AllInstances.Add(nativeOption); NativeUIEventDispatcher.RegisterControl(nativeOption); return nativeOption; } private void UpdateValueText() { if ((Object)(object)valueText != (Object)null && options != null && currentIndex >= 0 && currentIndex < options.Length) { valueText.text = options[currentIndex]; } if ((Object)(object)nativeOptionComponent != (Object)null && selectedIndexField != null) { selectedIndexField.SetValue(nativeOptionComponent, currentIndex); } } public void SetLabel(string text) { _cachedLabel = SanitizeText(text); if ((Object)(object)labelText != (Object)null) { labelText.text = _cachedLabel; } RefreshUI(); } public string GetLabel() { Text obj = labelText; return ((obj != null) ? obj.text : null) ?? ""; } public void SetDescription(string text) { if ((Object)(object)descText != (Object)null) { descText.text = SanitizeText(text); } RefreshUI(); } public string GetDescription() { Text obj = descText; return ((obj != null) ? obj.text : null) ?? ""; } public void SetOptions(string[] newOptions, int defaultIndex = 0) { if (newOptions != null) { for (int i = 0; i < newOptions.Length; i++) { newOptions[i] = SanitizeText(newOptions[i]); } } options = newOptions; currentIndex = Mathf.Clamp(defaultIndex, 0, options.Length - 1); UpdateValueText(); RefreshUI(); if ((Object)(object)nativeOptionComponent != (Object)null && optionListField != null) { optionListField.SetValue(nativeOptionComponent, options); } } public string[] GetOptions() { return options; } public int GetCurrentIndex() { return currentIndex; } public string GetCurrentValue() { return (options != null && currentIndex >= 0 && currentIndex < options.Length) ? options[currentIndex] : ""; } public void SetValueWithoutNotify(int index) { if (options != null && index >= 0 && index < options.Length) { currentIndex = index; UpdateValueText(); RefreshUI(); } } public void AddValueChangedListener(Action listener) { OnOptionChanged += listener; } public void RemoveValueChangedListener(Action listener) { OnOptionChanged -= listener; } public void SetDraggable(bool draggable) { GameObject obj = gameObject; DragHandler dragHandler = ((obj != null) ? obj.GetComponent() : null); if ((Object)(object)dragHandler != (Object)null) { ((Behaviour)dragHandler).enabled = draggable; } } public bool IsDraggable() { GameObject obj = gameObject; DragHandler dragHandler = ((obj != null) ? obj.GetComponent() : null); return (Object)(object)dragHandler != (Object)null && ((Behaviour)dragHandler).enabled; } public void SetPosition(Vector2 pos) { //IL_0017: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)rectTransform != (Object)null) { rectTransform.anchoredPosition = pos; } } public Vector2 GetPosition() { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Unknown result type (might be due to invalid IL or missing references) RectTransform obj = rectTransform; return (obj != null) ? obj.anchoredPosition : Vector2.zero; } public void SetSize(float width, float height) { //IL_0019: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)rectTransform != (Object)null) { rectTransform.sizeDelta = new Vector2(width, height); } } public Vector2 GetSize() { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Unknown result type (might be due to invalid IL or missing references) RectTransform obj = rectTransform; return (obj != null) ? obj.sizeDelta : Vector2.zero; } public void Show() { GameObject obj = gameObject; if (obj != null) { obj.SetActive(true); } } public void Hide() { GameObject obj = gameObject; if (obj != null) { obj.SetActive(false); } } public void Destroy() { AllInstances.Remove(this); if ((Object)(object)gameObject != (Object)null) { Object.Destroy((Object)(object)gameObject); } } } public class NativePage { public static List AllInstances = new List(); public GameObject gameObject { get; private set; } public RectTransform rectTransform { get; private set; } public CanvasGroup canvasGroup { get; private set; } public bool isShowing { get; private set; } public MenuButton backButton { get; private set; } public Text titleText { get; private set; } public NativePage(string name, RectTransform parent = null, bool addBackButton = true, string title = null) { //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Expected O, but got Unknown //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_007f: Unknown result type (might be due to invalid IL or missing references) //IL_0090: Unknown result type (might be due to invalid IL or missing references) //IL_00a1: Unknown result type (might be due to invalid IL or missing references) //IL_010d: Unknown result type (might be due to invalid IL or missing references) //IL_0113: Expected O, but got Unknown //IL_013f: Unknown result type (might be due to invalid IL or missing references) //IL_0156: Unknown result type (might be due to invalid IL or missing references) //IL_016d: Unknown result type (might be due to invalid IL or missing references) //IL_0184: Unknown result type (might be due to invalid IL or missing references) //IL_019b: Unknown result type (might be due to invalid IL or missing references) //IL_01e7: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)parent == (Object)null) { parent = UIParent.GetDefaultParent(); } if ((Object)(object)parent == (Object)null) { Debug.LogError((object)"[NativePage] 无法获取有效的父物体"); return; } gameObject = new GameObject(name); gameObject.transform.SetParent((Transform)(object)parent, false); rectTransform = gameObject.AddComponent(); rectTransform.anchorMin = Vector2.zero; rectTransform.anchorMax = Vector2.one; rectTransform.sizeDelta = Vector2.zero; rectTransform.anchoredPosition = Vector2.zero; canvasGroup = gameObject.AddComponent(); canvasGroup.alpha = 0f; canvasGroup.interactable = false; canvasGroup.blocksRaycasts = false; gameObject.SetActive(false); if (!string.IsNullOrEmpty(title)) { GameObject val = new GameObject("Title"); val.transform.SetParent(gameObject.transform, false); RectTransform val2 = val.AddComponent(); val2.anchorMin = new Vector2(0.5f, 1f); val2.anchorMax = new Vector2(0.5f, 1f); val2.pivot = new Vector2(0.5f, 1f); val2.anchoredPosition = new Vector2(0f, -40f); val2.sizeDelta = new Vector2(600f, 60f); titleText = val.AddComponent(); titleText.text = title; titleText.font = GetDefaultFont(); titleText.fontSize = 36; ((Graphic)titleText).color = Color.white; titleText.alignment = (TextAnchor)4; } if (addBackButton) { CreateBackButton(); } AllInstances.Add(this); isShowing = false; } private void CreateBackButton() { //IL_0138: Unknown result type (might be due to invalid IL or missing references) //IL_013f: Expected O, but got Unknown //IL_0158: Unknown result type (might be due to invalid IL or missing references) //IL_0168: Unknown result type (might be due to invalid IL or missing references) //IL_016f: Expected O, but got Unknown //IL_018f: Unknown result type (might be due to invalid IL or missing references) //IL_01a5: Unknown result type (might be due to invalid IL or missing references) //IL_01b2: Unknown result type (might be due to invalid IL or missing references) //IL_01bf: Unknown result type (might be due to invalid IL or missing references) //IL_01cf: Unknown result type (might be due to invalid IL or missing references) //IL_01d6: Expected O, but got Unknown //IL_021b: Unknown result type (might be due to invalid IL or missing references) //IL_023a: Unknown result type (might be due to invalid IL or missing references) //IL_0247: Unknown result type (might be due to invalid IL or missing references) //IL_0254: Unknown result type (might be due to invalid IL or missing references) //IL_02ad: Unknown result type (might be due to invalid IL or missing references) //IL_02c3: Unknown result type (might be due to invalid IL or missing references) //IL_02d9: Unknown result type (might be due to invalid IL or missing references) //IL_02ef: Unknown result type (might be due to invalid IL or missing references) UIManager instance = UIManager.instance; MenuButton val = null; if ((Object)(object)instance != (Object)null && (Object)(object)instance.playModeMenuScreen != (Object)null) { Transform val2 = ((Component)instance.playModeMenuScreen).transform.Find("Controls"); if ((Object)(object)val2 != (Object)null) { Transform obj = val2.Find("ApplyButton"); val = ((obj != null) ? ((Component)obj).GetComponent() : null); } } if ((Object)(object)val != (Object)null) { backButton = Object.Instantiate(val); ((Object)backButton).name = "BackButton"; Text componentInChildren = ((Component)backButton).GetComponentInChildren(); if ((Object)(object)componentInChildren != (Object)null) { componentInChildren.text = "返回"; } ((UnityEventBase)backButton.OnSubmitPressed).RemoveAllListeners(); ((MenuSelectable)backButton).playSubmitSound = false; FieldInfo field = typeof(MenuSelectable).GetField("uiAudioPlayer", BindingFlags.Instance | BindingFlags.NonPublic); if (field != null && (Object)(object)instance?.uiAudioPlayer != (Object)null) { field.SetValue(backButton, instance.uiAudioPlayer); } } else { GameObject val3 = new GameObject("BackButton"); backButton = val3.AddComponent(); Image val4 = val3.AddComponent(); ((Graphic)val4).color = Color.gray; GameObject val5 = new GameObject("Background"); val5.transform.SetParent(val3.transform, false); Image val6 = val5.AddComponent(); ((Graphic)val6).color = Color.gray; RectTransform component = val5.GetComponent(); component.anchorMin = Vector2.zero; component.anchorMax = Vector2.one; component.sizeDelta = Vector2.zero; GameObject val7 = new GameObject("Text"); val7.transform.SetParent(val3.transform, false); Text val8 = val7.AddComponent(); val8.text = "返回"; val8.font = GetDefaultFont(); val8.fontSize = 24; ((Graphic)val8).color = Color.white; val8.alignment = (TextAnchor)4; RectTransform component2 = ((Component)val8).GetComponent(); component2.anchorMin = Vector2.zero; component2.anchorMax = Vector2.one; component2.sizeDelta = Vector2.zero; ((Selectable)backButton).interactable = true; ((MenuSelectable)backButton).playSubmitSound = false; } ((Component)backButton).transform.SetParent(gameObject.transform, false); RectTransform component3 = ((Component)backButton).GetComponent(); component3.anchorMin = new Vector2(0.5f, 0f); component3.anchorMax = new Vector2(0.5f, 0f); component3.anchoredPosition = new Vector2(0f, 50f); component3.sizeDelta = new Vector2(200f, 60f); } private Font GetDefaultFont() { Font val = Resources.GetBuiltinResource("Arial.ttf"); if ((Object)(object)val == (Object)null) { Text val2 = Object.FindObjectOfType(); if ((Object)(object)val2 != (Object)null) { val = val2.font; } } return val; } public void Show(bool selectFirst = true) { if (!((Object)(object)gameObject == (Object)null)) { gameObject.SetActive(true); canvasGroup.alpha = 1f; canvasGroup.interactable = true; canvasGroup.blocksRaycasts = true; isShowing = true; if (selectFirst && (Object)(object)backButton != (Object)null && ((Component)backButton).gameObject.activeInHierarchy) { EventSystem.current.SetSelectedGameObject(((Component)backButton).gameObject); } } } public void Hide() { if (!((Object)(object)gameObject == (Object)null)) { canvasGroup.alpha = 0f; canvasGroup.interactable = false; canvasGroup.blocksRaycasts = false; gameObject.SetActive(false); isShowing = false; } } public void SetBackAction(UnityAction action) { if ((Object)(object)backButton != (Object)null) { ((UnityEventBase)backButton.OnSubmitPressed).RemoveAllListeners(); if (action != null) { backButton.OnSubmitPressed.AddListener(action); } } } public void AddChild(GameObject child) { if (!((Object)(object)child == (Object)null)) { child.transform.SetParent(gameObject.transform, false); } } public void Destroy() { AllInstances.Remove(this); if ((Object)(object)gameObject != (Object)null) { Object.Destroy((Object)(object)gameObject); } } } public class NativeSlider { public static List AllInstances = new List(); private RectTransform sliderRect; private RectTransform labelRect; private RectTransform valueRect; private float minValue; private float maxValue; private bool wholeNumbers; private float sliderXOffset = 0f; private float sliderWidthOverride = 0f; private float labelXOffset = 0f; private float valueXOffset = 0f; private Vector2 originalSliderPos; private Vector2 originalLabelPos; private Vector2 originalValuePos; private float originalSliderWidth; private bool hasRecordedOriginal = false; public GameObject gameObject { get; private set; } public RectTransform rectTransform { get; private set; } public Slider slider { get; private set; } public Text labelText { get; private set; } public Text valueText { get; private set; } public float Value { get { return ((Object)(object)slider != (Object)null) ? slider.value : 0f; } set { if ((Object)(object)slider != (Object)null) { slider.value = value; } } } public event Action OnValueChanged; public static NativeSlider Create(RectTransform parent = null) { //IL_03a0: Unknown result type (might be due to invalid IL or missing references) //IL_03a5: Unknown result type (might be due to invalid IL or missing references) //IL_03bb: Unknown result type (might be due to invalid IL or missing references) //IL_03f3: Unknown result type (might be due to invalid IL or missing references) //IL_03f8: Unknown result type (might be due to invalid IL or missing references) //IL_0425: Unknown result type (might be due to invalid IL or missing references) //IL_042a: Unknown result type (might be due to invalid IL or missing references) //IL_04d2: Unknown result type (might be due to invalid IL or missing references) //IL_04f2: Unknown result type (might be due to invalid IL or missing references) //IL_0512: Unknown result type (might be due to invalid IL or missing references) //IL_0528: Unknown result type (might be due to invalid IL or missing references) //IL_0548: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)parent == (Object)null) { parent = UIParent.GetDefaultParent(); } GameObject val2 = PrefabMenuObjects.Get("Slider"); if ((Object)(object)val2 == (Object)null) { Debug.LogError((object)"[NativeSlider] 无法获取 Slider 预制体"); return null; } GameObject val3 = Object.Instantiate(val2); if ((Object)(object)parent != (Object)null) { val3.transform.SetParent((Transform)(object)parent, false); } ((Object)val3).name = "NativeSlider"; NativeSlider ns = new NativeSlider(); ns.gameObject = val3; ns.rectTransform = val3.GetComponent(); if ((Object)(object)ns.rectTransform == (Object)null) { Debug.LogError((object)"[NativeSlider] 预制体缺少 RectTransform"); Object.Destroy((Object)(object)val3); return null; } Component component = val3.GetComponent("MenuSlider"); if ((Object)(object)component != (Object)null) { Object.DestroyImmediate((Object)(object)component); } Component component2 = val3.GetComponent("MenuAudioSlider"); if ((Object)(object)component2 != (Object)null) { Object.DestroyImmediate((Object)(object)component2); } Component[] componentsInChildren = val3.GetComponentsInChildren(true); Component[] array = componentsInChildren; foreach (Component val4 in array) { if ((Object)(object)val4 != (Object)null && (((object)val4).GetType().Name.Contains("Audio") || ((object)val4).GetType().Name.Contains("Menu"))) { Object.DestroyImmediate((Object)(object)val4); } } AutoLocalizeTextUI[] componentsInChildren2 = val3.GetComponentsInChildren(true); AutoLocalizeTextUI[] array2 = componentsInChildren2; foreach (AutoLocalizeTextUI val5 in array2) { Object.DestroyImmediate((Object)(object)val5); } EventTrigger[] componentsInChildren3 = val3.GetComponentsInChildren(true); EventTrigger[] array3 = componentsInChildren3; foreach (EventTrigger val6 in array3) { Object.DestroyImmediate((Object)(object)val6); } Text[] componentsInChildren4 = val3.GetComponentsInChildren(true); Text[] array4 = componentsInChildren4; foreach (Text val7 in array4) { val7.text = ""; } NativeSlider nativeSlider = ns; Transform obj = val3.transform.Find("Menu Option Label"); nativeSlider.labelText = ((obj != null) ? ((Component)obj).GetComponent() : null); if ((Object)(object)ns.labelText == (Object)null) { Text[] componentsInChildren5 = val3.GetComponentsInChildren(); Text[] array5 = componentsInChildren5; foreach (Text val8 in array5) { if ((Object)(object)val8 != (Object)(object)ns.valueText) { ns.labelText = val8; break; } } } if ((Object)(object)ns.labelText != (Object)null) { ns.labelRect = ((Graphic)ns.labelText).rectTransform; } ns.slider = val3.GetComponentInChildren(); if ((Object)(object)ns.slider != (Object)null) { ns.sliderRect = ((Component)ns.slider).GetComponent(); } ns.valueText = ns.FindValueText(val3.transform); if ((Object)(object)ns.valueText != (Object)null) { ns.valueRect = ((Graphic)ns.valueText).rectTransform; } if ((Object)(object)ns.sliderRect != (Object)null) { ns.originalSliderPos = ns.sliderRect.anchoredPosition; ns.originalSliderWidth = ns.sliderRect.sizeDelta.x; } if ((Object)(object)ns.labelRect != (Object)null) { ns.originalLabelPos = ns.labelRect.anchoredPosition; } if ((Object)(object)ns.valueRect != (Object)null) { ns.originalValuePos = ns.valueRect.anchoredPosition; } ns.hasRecordedOriginal = true; if ((Object)(object)ns.slider != (Object)null) { ((UnityEventBase)ns.slider.onValueChanged).RemoveAllListeners(); ClearUnityEventListeners((UnityEventBase)(object)ns.slider.onValueChanged); ((UnityEvent)(object)ns.slider.onValueChanged).AddListener((UnityAction)delegate(float val) { ns.UpdateValueDisplay(val); ns.OnValueChanged?.Invoke(val); }); } if ((Object)(object)ns.rectTransform != (Object)null) { ns.rectTransform.anchorMin = new Vector2(0.5f, 0.5f); ns.rectTransform.anchorMax = new Vector2(0.5f, 0.5f); ns.rectTransform.pivot = new Vector2(0.5f, 0.5f); ns.rectTransform.anchoredPosition = Vector2.zero; ns.rectTransform.sizeDelta = new Vector2(600f, 60f); } DragHandler dragHandler = val3.AddComponent(); ((Behaviour)dragHandler).enabled = false; ns.ApplyOffsets(); if ((Object)(object)ns.slider != (Object)null) { ns.minValue = ns.slider.minValue; ns.maxValue = ns.slider.maxValue; ns.wholeNumbers = ns.slider.wholeNumbers; ns.UpdateValueDisplay(ns.slider.value); } val3.SetActive(true); AllInstances.Add(ns); NativeUIEventDispatcher.RegisterControl(ns); return ns; } private static void ClearUnityEventListeners(UnityEventBase unityEvent) { if (unityEvent != null) { FieldInfo field = typeof(UnityEventBase).GetField("m_Calls", BindingFlags.Instance | BindingFlags.NonPublic); if (field != null) { object value = field.GetValue(unityEvent); (value?.GetType().GetMethod("Clear"))?.Invoke(value, null); } } } private Text FindValueText(Transform root) { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Expected O, but got Unknown foreach (Transform item in root) { Transform val = item; if (((Object)val).name.EndsWith("Value") || ((Object)val).name.Contains("Value")) { Text component = ((Component)val).GetComponent(); if ((Object)(object)component != (Object)null) { return component; } } Text val2 = FindValueText(val); if ((Object)(object)val2 != (Object)null) { return val2; } } return null; } private void UpdateValueDisplay(float val) { if (!((Object)(object)valueText == (Object)null)) { if (wholeNumbers) { valueText.text = val.ToString("F0"); } else { valueText.text = val.ToString("F1"); } } } private void ApplyOffsets() { //IL_0075: Unknown result type (might be due to invalid IL or missing references) //IL_0085: Unknown result type (might be due to invalid IL or missing references) //IL_008a: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: Unknown result type (might be due to invalid IL or missing references) //IL_00be: Unknown result type (might be due to invalid IL or missing references) //IL_00c3: Unknown result type (might be due to invalid IL or missing references) if (!hasRecordedOriginal) { return; } if ((Object)(object)sliderRect != (Object)null) { if (sliderWidthOverride > 0f) { sliderRect.SetSizeWithCurrentAnchors((Axis)0, sliderWidthOverride); } else { sliderRect.SetSizeWithCurrentAnchors((Axis)0, originalSliderWidth); } } if ((Object)(object)labelRect != (Object)null) { labelRect.anchoredPosition = originalLabelPos + new Vector2(labelXOffset, 0f); } if ((Object)(object)valueRect != (Object)null) { valueRect.anchoredPosition = originalValuePos + new Vector2(valueXOffset, 0f); } } public void SetMinMax(float min, float max, bool whole = true) { minValue = min; maxValue = max; wholeNumbers = whole; if ((Object)(object)slider != (Object)null) { slider.minValue = min; slider.maxValue = max; slider.wholeNumbers = whole; } } public void SetLabel(string text) { //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Expected O, but got Unknown //IL_00aa: Unknown result type (might be due to invalid IL or missing references) //IL_00af: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)labelText != (Object)null) { labelText.text = text; } else { GameObject val = new GameObject("Label"); val.transform.SetParent(gameObject.transform, false); labelText = val.AddComponent(); labelText.text = text; labelText.font = Resources.GetBuiltinResource("Arial.ttf"); labelText.fontSize = 30; labelText.alignment = (TextAnchor)3; labelRect = ((Graphic)labelText).rectTransform; originalLabelPos = labelRect.anchoredPosition; } ApplyOffsets(); } public string GetLabel() { Text obj = labelText; return ((obj != null) ? obj.text : null) ?? ""; } public void AddValueChangedListener(Action listener) { OnValueChanged += listener; } public void RemoveValueChangedListener(Action listener) { OnValueChanged -= listener; } public void SetSliderXOffset(float offset) { sliderXOffset = offset; ApplyOffsets(); } public float GetSliderXOffset() { return sliderXOffset; } public void SetSliderWidth(float width) { sliderWidthOverride = width; ApplyOffsets(); } public float GetSliderWidth() { return sliderWidthOverride; } public void SetLabelXOffset(float offset) { labelXOffset = offset; ApplyOffsets(); } public float GetLabelXOffset() { return labelXOffset; } public void SetValueXOffset(float offset) { valueXOffset = offset; ApplyOffsets(); } public float GetValueXOffset() { return valueXOffset; } public void SetDraggable(bool draggable) { DragHandler component = gameObject.GetComponent(); if ((Object)(object)component != (Object)null) { ((Behaviour)component).enabled = draggable; } } public bool IsDraggable() { DragHandler component = gameObject.GetComponent(); return (Object)(object)component != (Object)null && ((Behaviour)component).enabled; } public void SetPosition(Vector2 pos) { //IL_0017: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)rectTransform != (Object)null) { rectTransform.anchoredPosition = pos; } } public Vector2 GetPosition() { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Unknown result type (might be due to invalid IL or missing references) RectTransform obj = rectTransform; return (obj != null) ? obj.anchoredPosition : Vector2.zero; } public void SetSize(float w, float h) { //IL_0019: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)rectTransform != (Object)null) { rectTransform.sizeDelta = new Vector2(w, h); } } public Vector2 GetSize() { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Unknown result type (might be due to invalid IL or missing references) RectTransform obj = rectTransform; return (obj != null) ? obj.sizeDelta : Vector2.zero; } public void Show() { gameObject.SetActive(true); } public void Hide() { gameObject.SetActive(false); } public void Destroy() { AllInstances.Remove(this); Object.Destroy((Object)(object)gameObject); } } public enum NativeUIEventType { Click, ValueChanged, OptionChanged } public class NativeUIEventArgs : EventArgs { public string ControlName { get; set; } public string ControlType { get; set; } public NativeUIEventType EventType { get; set; } public object Value { get; set; } public object Source { get; set; } } public static class NativeUIEventDispatcher { public static event EventHandler OnNativeUIEvent; public static void RegisterControl(NativeButton btn) { //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Expected O, but got Unknown if (btn != null) { btn.OnClick += (UnityAction)delegate { NativeUIEventDispatcher.OnNativeUIEvent?.Invoke(null, new NativeUIEventArgs { ControlName = ((Object)btn.gameObject).name, ControlType = "Button", EventType = NativeUIEventType.Click, Source = btn }); }; } } public static void RegisterControl(NativeSlider slider) { if (slider != null) { slider.OnValueChanged += delegate(float val) { NativeUIEventDispatcher.OnNativeUIEvent?.Invoke(null, new NativeUIEventArgs { ControlName = ((Object)slider.gameObject).name, ControlType = "Slider", EventType = NativeUIEventType.ValueChanged, Value = val, Source = slider }); }; } } public static void RegisterControl(NativeOption opt) { if (opt != null) { opt.OnOptionChanged += delegate(int idx) { NativeUIEventDispatcher.OnNativeUIEvent?.Invoke(null, new NativeUIEventArgs { ControlName = ((Object)opt.gameObject).name, ControlType = "Option", EventType = NativeUIEventType.OptionChanged, Value = idx, Source = opt }); }; } } public static void RegisterControl(NativeInput inp) { if (inp != null) { inp.OnTextChanged += delegate(string text) { NativeUIEventDispatcher.OnNativeUIEvent?.Invoke(null, new NativeUIEventArgs { ControlName = ((Object)inp.gameObject).name, ControlType = "Input", EventType = NativeUIEventType.ValueChanged, Value = text, Source = inp }); }; } } public static void Initialize() { } } [BepInPlugin("YourName.NativeUIMaker", "Native UI Maker", "1.0.0")] public class NativeUIMakerMod : BaseUnityPlugin { [CompilerGenerated] private sealed class d__14 : IEnumerator, IDisposable, IEnumerator { private int <>1__state; private object <>2__current; public NativeUIMakerMod <>4__this; private UIManager 5__1; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__14(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { 5__1 = null; <>1__state = -2; } private bool MoveNext() { switch (<>1__state) { default: return false; case 0: <>1__state = -1; <>4__this._isScanning = true; Debug.Log((object)"[NativeUIMaker] 开始扫描 PlayModeMenuScreen..."); 5__1 = Object.FindObjectOfType(); if ((Object)(object)5__1 == (Object)null || (Object)(object)5__1.playModeMenuScreen == (Object)null) { Debug.LogError((object)"[NativeUIMaker] 无法找到 PlayModeMenuScreen,扫描取消"); <>4__this._isScanning = false; return false; } <>4__this._scanner.SetCustomRoot(((Component)5__1.playModeMenuScreen).transform); File.WriteAllText(GetLogPath(), ""); break; case 1: <>1__state = -1; break; } if (<>4__this._scanner.ScanNext()) { <>2__current = null; <>1__state = 1; return true; } Debug.Log((object)("[NativeUIMaker] 扫描完成!日志保存至: " + GetLogPath())); <>4__this._isScanning = false; return false; } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } [CompilerGenerated] private sealed class d__12 : IEnumerator, IDisposable, IEnumerator { private int <>1__state; private object <>2__current; public NativeUIMakerMod <>4__this; private UIManager 5__1; private bool 5__2; private DebugWindow 5__3; private FieldInfo 5__4; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__12(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { 5__1 = null; 5__3 = null; 5__4 = null; <>1__state = -2; } private bool MoveNext() { switch (<>1__state) { default: return false; case 0: <>1__state = -1; 5__1 = null; goto IL_0061; case 1: <>1__state = -1; goto IL_0061; case 2: <>1__state = -1; goto IL_008c; case 3: { <>1__state = -1; PrefabMenuObjects.Initialize(); DebugWindow.Create(); 5__2 = Type.GetType("MenuChanger.MenuChangerMod, MenuChanger") != null; if (5__2) { 5__3 = DebugWindow.Instance; if ((Object)(object)5__3 != (Object)null) { 5__4 = typeof(DebugWindow).GetField("_showWindow", BindingFlags.Instance | BindingFlags.NonPublic); if (5__4 != null) { 5__4.SetValue(5__3, false); } 5__4 = null; } Debug.Log((object)"[NativeUIMaker] 检测到 MenuChanger 模组,调试窗口已创建但默认隐藏,可按 F9 打开。"); 5__3 = null; } else { Debug.Log((object)"[NativeUIMaker] 未检测到 MenuChanger 模组,调试窗口默认显示。"); } <>4__this._scanner = new UIScanner(); <>4__this._scanner.OnScanCompleted += delegate(GameObject go, string info) { string fullPath = <>4__this.GetFullPath(go.transform); Debug.Log((object)("[NativeUIMaker] 已扫描: " + fullPath)); File.AppendAllText(GetLogPath(), info); }; Debug.Log((object)("[NativeUIMaker] 初始化完成,插件目录: " + PluginDirectory + ",按 F9 打开调试窗口")); return false; } IL_0061: if ((Object)(object)5__1 == (Object)null) { 5__1 = Object.FindObjectOfType(); <>2__current = null; <>1__state = 1; return true; } goto IL_008c; IL_008c: if ((Object)(object)5__1.UICanvas == (Object)null) { <>2__current = null; <>1__state = 2; return true; } <>2__current = null; <>1__state = 3; return true; } } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } private UIScanner _scanner; private bool _isScanning = false; public static NativeUIMakerMod Instance { get; private set; } public static string PluginDirectory { get; private set; } private void Awake() { Instance = this; PluginDirectory = Path.GetDirectoryName(((BaseUnityPlugin)this).Info.Location); SceneManager.sceneLoaded += OnSceneLoaded; } private void OnSceneLoaded(Scene scene, LoadSceneMode mode) { if (((Scene)(ref scene)).name == "Menu_Title") { ((MonoBehaviour)this).StartCoroutine(InitializeWhenReady()); } } [IteratorStateMachine(typeof(d__12))] private IEnumerator InitializeWhenReady() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__12(0) { <>4__this = this }; } private void Update() { if (Input.GetKeyDown((KeyCode)285) && !_isScanning && _scanner != null) { ((MonoBehaviour)this).StartCoroutine(AutoScanAll()); } } [IteratorStateMachine(typeof(d__14))] private IEnumerator AutoScanAll() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__14(0) { <>4__this = this }; } private string GetFullPath(Transform t) { if ((Object)(object)t == (Object)null) { return ""; } StringBuilder stringBuilder = new StringBuilder(); while ((Object)(object)t != (Object)null) { stringBuilder.Insert(0, ((Object)t).name); t = t.parent; if ((Object)(object)t != (Object)null) { stringBuilder.Insert(0, "/"); } } return stringBuilder.ToString(); } private static string GetLogPath() { return Path.Combine(Paths.BepInExRootPath, "NativeUIMaker_log.txt"); } private void OnDestroy() { SceneManager.sceneLoaded -= OnSceneLoaded; } } public static class PrefabMenuObjects { private static Dictionary _prefabs = new Dictionary(); private static bool _initialized = false; public static void Initialize() { //IL_04c2: Unknown result type (might be due to invalid IL or missing references) //IL_04c9: Expected O, but got Unknown //IL_0585: Unknown result type (might be due to invalid IL or missing references) //IL_058c: Expected O, but got Unknown //IL_0648: Unknown result type (might be due to invalid IL or missing references) //IL_064f: Expected O, but got Unknown if (_initialized) { return; } _initialized = true; UIManager val = null; while ((Object)(object)val == (Object)null) { val = Object.FindObjectOfType(); } if ((Object)(object)val == (Object)null) { Debug.LogError((object)"[PrefabMenuObjects] 无法找到 UIManager,使用后备"); CreateFallbackPrefabs(); CreateFallbackSliderPrefab(); CreateFallbackOptionPrefab(); return; } MenuButton val2 = null; if ((Object)(object)val.playModeMenuScreen != (Object)null) { Transform val3 = ((Component)val.playModeMenuScreen).transform.Find("Content"); if ((Object)(object)val3 != (Object)null) { Transform obj = val3.Find("NormalButton"); val2 = ((obj != null) ? ((Component)obj).GetComponent() : null); if ((Object)(object)val2 == (Object)null) { Transform obj2 = val3.Find("SteelButton"); val2 = ((obj2 != null) ? ((Component)obj2).GetComponent() : null); } if ((Object)(object)val2 == (Object)null) { Transform obj3 = val3.Find("GGButton"); val2 = ((obj3 != null) ? ((Component)obj3).GetComponent() : null); } } } if ((Object)(object)val2 != (Object)null) { RegisterPrefab("IconButton", ((Component)val2).gameObject); } else { Debug.LogWarning((object)"[PrefabMenuObjects] 未找到 IconButton,使用后备"); } MenuButton val4 = null; if ((Object)(object)val.optionsMenuScreen != (Object)null) { Transform obj4 = ((Component)val.optionsMenuScreen).transform.Find("Content/GameOptions/GameOptionsButton"); val4 = ((obj4 != null) ? ((Component)obj4).GetComponent() : null); if ((Object)(object)val4 == (Object)null) { Transform obj5 = ((Component)val.optionsMenuScreen).transform.Find("Content/GameOptions/Button"); val4 = ((obj5 != null) ? ((Component)obj5).GetComponent() : null); } if ((Object)(object)val4 == (Object)null) { val4 = ((Component)val.optionsMenuScreen).GetComponentInChildren(); } } if ((Object)(object)val4 == (Object)null && (Object)(object)val.mainMenuButtons != (Object)null) { Transform obj6 = ((Component)val.mainMenuButtons).transform.Find("StartGameButton"); val4 = ((obj6 != null) ? ((Component)obj6).GetComponent() : null); } if ((Object)(object)val4 != (Object)null) { RegisterPrefab("TextButton", ((Component)val4).gameObject); } else { Debug.LogWarning((object)"[PrefabMenuObjects] 未找到 TextButton,使用后备"); } MenuButton val5 = null; if ((Object)(object)val.optionsMenuScreen != (Object)null) { Transform obj7 = ((Component)val.optionsMenuScreen).transform.Find("Controls/ApplyButton"); val5 = ((obj7 != null) ? ((Component)obj7).GetComponent() : null); } if ((Object)(object)val5 != (Object)null) { RegisterPrefab("SmallButton", ((Component)val5).gameObject); } else if ((Object)(object)val4 != (Object)null) { RegisterPrefab("SmallButton", ((Component)val4).gameObject); } else { Debug.LogWarning((object)"[PrefabMenuObjects] 未找到 SmallButton,使用后备"); } if (!_prefabs.ContainsKey("IconButton") || !_prefabs.ContainsKey("TextButton") || !_prefabs.ContainsKey("SmallButton")) { CreateFallbackPrefabs(); } Text val6 = null; if ((Object)(object)val.optionsMenuScreen != (Object)null) { Transform val7 = ((Component)val.optionsMenuScreen).transform.Find("Title"); if ((Object)(object)val7 != (Object)null) { val6 = ((Component)val7).GetComponent(); } } if ((Object)(object)val6 == (Object)null && (Object)(object)val.mainMenuScreen != (Object)null) { Transform val8 = ((Component)val.mainMenuScreen).transform.Find("Title"); if ((Object)(object)val8 != (Object)null) { val6 = ((Component)val8).GetComponent(); } } if ((Object)(object)val6 != (Object)null) { RegisterPrefab("StandardLabel", ((Component)val6).gameObject); } else { CreateFallbackLabelPrefab(); } GameObject val9 = null; if ((Object)(object)val.audioMenuScreen != (Object)null) { Transform val10 = ((Component)val.audioMenuScreen).transform.Find("Content/MasterVolume/MasterSlider"); if ((Object)(object)val10 != (Object)null) { val9 = ((Component)val10).gameObject; } } if ((Object)(object)val9 != (Object)null) { RegisterPrefab("Slider", val9); } else { CreateFallbackSliderPrefab(); } GameObject val11 = null; if ((Object)(object)val.gamepadMenuScreen != (Object)null) { Transform val12 = ((Component)val.gamepadMenuScreen).transform.Find("Controls/RumbleSetting"); if ((Object)(object)val12 != (Object)null) { Transform val13 = val12.Find("RumblePopupOption"); if ((Object)(object)val13 != (Object)null) { val11 = ((Component)val13).gameObject; } } } if ((Object)(object)val11 == (Object)null && (Object)(object)val.gameOptionsMenuScreen != (Object)null) { Transform val14 = ((Component)val.gameOptionsMenuScreen).transform.Find("Content"); if ((Object)(object)val14 != (Object)null) { foreach (Transform item in val14) { Transform val15 = item; if ((Object)(object)val15.Find("Menu Option Label") != (Object)null && (Object)(object)val15.Find("Menu Option Text") != (Object)null) { val11 = ((Component)val15).gameObject; break; } } } } if ((Object)(object)val11 == (Object)null && (Object)(object)val.videoMenuScreen != (Object)null) { Transform val16 = ((Component)val.videoMenuScreen).transform.Find("Content"); if ((Object)(object)val16 != (Object)null) { foreach (Transform item2 in val16) { Transform val17 = item2; if ((Object)(object)val17.Find("Menu Option Label") != (Object)null && (Object)(object)val17.Find("Menu Option Text") != (Object)null) { val11 = ((Component)val17).gameObject; break; } } } } if ((Object)(object)val11 == (Object)null && (Object)(object)val.audioMenuScreen != (Object)null) { Transform val18 = ((Component)val.audioMenuScreen).transform.Find("Content"); if ((Object)(object)val18 != (Object)null) { foreach (Transform item3 in val18) { Transform val19 = item3; if ((Object)(object)val19.Find("Menu Option Label") != (Object)null && (Object)(object)val19.Find("Menu Option Text") != (Object)null) { val11 = ((Component)val19).gameObject; break; } } } } if ((Object)(object)val11 != (Object)null) { RegisterPrefab("Option", val11); } else { CreateFallbackOptionPrefab(); } } private static void CreateFallbackPrefabs() { CreateFallbackButton("IconButton"); CreateFallbackButton("TextButton"); CreateFallbackButton("SmallButton"); } private static void CreateFallbackButton(string key) { //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Expected O, but got Unknown //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Expected O, but got Unknown //IL_00ae: Unknown result type (might be due to invalid IL or missing references) //IL_00ca: Unknown result type (might be due to invalid IL or missing references) //IL_00ec: Unknown result type (might be due to invalid IL or missing references) //IL_00f3: Expected O, but got Unknown //IL_0112: Unknown result type (might be due to invalid IL or missing references) GameObject val = new GameObject("Fallback" + key); val.SetActive(false); MenuButton val2 = val.AddComponent(); Image val3 = val.AddComponent(); ((Graphic)val3).color = Color.gray; RectTransform component = val.GetComponent(); component.sizeDelta = new Vector2(200f, 80f); GameObject val4 = new GameObject("Text"); val4.transform.SetParent(val.transform, false); Text val5 = val4.AddComponent(); val5.text = "Button"; val5.font = Resources.GetBuiltinResource("Arial.ttf"); val5.fontSize = 30; val5.alignment = (TextAnchor)4; ((Graphic)val5).color = Color.white; ((Component)val5).GetComponent().sizeDelta = new Vector2(200f, 80f); if (key == "IconButton") { GameObject val6 = new GameObject("Image"); val6.transform.SetParent(val.transform, false); Image val7 = val6.AddComponent(); ((Graphic)val7).color = Color.white; } RegisterPrefab(key, val); Debug.LogWarning((object)("[PrefabMenuObjects] 使用后备按钮预制体: " + key)); } private static void CreateFallbackLabelPrefab() { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Expected O, but got Unknown //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Unknown result type (might be due to invalid IL or missing references) GameObject val = new GameObject("FallbackLabel"); val.SetActive(false); Text val2 = val.AddComponent(); val2.text = "Label"; val2.font = Resources.GetBuiltinResource("Arial.ttf"); val2.fontSize = 30; ((Graphic)val2).color = Color.white; val2.alignment = (TextAnchor)4; RectTransform component = val.GetComponent(); component.sizeDelta = new Vector2(400f, 60f); RegisterPrefab("StandardLabel", val); Debug.LogWarning((object)"[PrefabMenuObjects] 使用后备标签预制体"); } private static void CreateFallbackSliderPrefab() { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Expected O, but got Unknown //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Expected O, but got Unknown //IL_006b: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Expected O, but got Unknown GameObject val = new GameObject("FallbackSlider"); val.SetActive(false); Slider val2 = val.AddComponent(); GameObject val3 = new GameObject("Menu Option Label"); val3.transform.SetParent(val.transform, false); Text val4 = val3.AddComponent(); val4.text = "Label"; val4.font = Resources.GetBuiltinResource("Arial.ttf"); val4.fontSize = 30; GameObject val5 = new GameObject("Value"); val5.transform.SetParent(val.transform, false); Text val6 = val5.AddComponent(); val6.text = "0"; val6.font = Resources.GetBuiltinResource("Arial.ttf"); val6.fontSize = 24; RegisterPrefab("Slider", val); Debug.LogWarning((object)"[PrefabMenuObjects] 使用后备滑块预制体"); } private static void CreateFallbackOptionPrefab() { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Expected O, but got Unknown //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Expected O, but got Unknown //IL_0095: Unknown result type (might be due to invalid IL or missing references) //IL_009c: Expected O, but got Unknown //IL_00f0: Unknown result type (might be due to invalid IL or missing references) //IL_00f7: Expected O, but got Unknown //IL_013f: Unknown result type (might be due to invalid IL or missing references) GameObject val = new GameObject("FallbackOption"); val.SetActive(false); RectTransform val2 = val.AddComponent(); val2.sizeDelta = new Vector2(600f, 80f); MenuButton val3 = val.AddComponent(); GameObject val4 = new GameObject("Menu Option Label"); val4.transform.SetParent(val.transform, false); Text val5 = val4.AddComponent(); val5.text = "标签"; val5.font = Resources.GetBuiltinResource("Arial.ttf"); val5.fontSize = 30; val5.alignment = (TextAnchor)3; GameObject val6 = new GameObject("Menu Option Text"); val6.transform.SetParent(val.transform, false); Text val7 = val6.AddComponent(); val7.text = "值"; val7.font = Resources.GetBuiltinResource("Arial.ttf"); val7.fontSize = 28; val7.alignment = (TextAnchor)5; GameObject val8 = new GameObject("Description"); val8.transform.SetParent(val.transform, false); Text val9 = val8.AddComponent(); val9.text = "描述"; val9.font = Resources.GetBuiltinResource("Arial.ttf"); val9.fontSize = 24; ((Graphic)val9).color = Color.gray; RegisterPrefab("Option", val); Debug.LogWarning((object)"[PrefabMenuObjects] 使用后备选项行预制体"); } private static void RegisterPrefab(string key, GameObject source) { if (!((Object)(object)source == (Object)null)) { GameObject val = Object.Instantiate(source); ((Object)val).name = "Prefab_" + key; val.SetActive(false); Object.DontDestroyOnLoad((Object)(object)val); _prefabs[key] = val; } } public static GameObject Get(string key) { if (_prefabs.TryGetValue(key, out var value)) { return Object.Instantiate(value); } Debug.LogError((object)("[PrefabMenuObjects] 预制体 " + key + " 不存在")); return null; } } public static class UILocale { private static bool? _forceChinese; private static readonly Dictionary EnglishTranslations; private static readonly Dictionary ControlTextTranslations; private static readonly Dictionary ChineseToEnglish; private static readonly Dictionary EnglishToChinese; public static bool IsChinese { get { if (_forceChinese.HasValue) { return _forceChinese.Value; } return DetectChinese(); } } static UILocale() { _forceChinese = null; EnglishTranslations = new Dictionary(); ControlTextTranslations = new Dictionary { { "经典模式", "Classic" }, { "钢魂模式", "Steel" }, { "随机模式", "Random" }, { "房间随机", "Room" }, { "物品随机", "Item" }, { "陷阱随机", "Trap" }, { "怪物随机", "Enemy" }, { "详细设置", "Detail" }, { "返回模式选择", "Back" }, { "确认并开始游戏", "Start" }, { "上劈", "Up" }, { "左劈", "Left" }, { "右劈", "Right" }, { "下劈 (默认)", "Down" }, { "开", "On" }, { "关", "Off" }, { "重置种子世界", "Reset Seed" }, { "技能随机模式", "Skill Mode" }, { "总随机", "Total" }, { "分类随机", "Type" }, { "开局物品数量", "Items" }, { "技能总数量(0-13)", "Total Skills" }, { "垂直技能(0-5)", "Vertical" }, { "水平技能(0-4)", "Horizontal" }, { "特殊技能(0-4)", "Special" }, { "攻击技能(0-5)", "Attack" }, { "游戏模式", "Mode" }, { "彻底疯狂", "Crazy" }, { "纹章诅咒", "Crest" }, { "全随机模式", "FullRand" }, { "丝之心、疾跑和上冲", "SilkDashUp" }, { "显示完成度", "Completion" }, { "应用种子", "Apply Seed" }, { "显示场景名", "Show Scene" }, { "显示种子", "Show Seed" }, { "陷阱难度", "Trap Diff" }, { "初猎", "Easy" }, { "专注", "Normal" }, { "满溢", "Hard" }, { "陷阱生命化", "Trap Life" }, { "重置冰冻黑名单", "Reset Frost" }, { "重置商店记录", "Reset Shop" }, { "重置捡拾记录", "Reset Pickup" }, { "随机缩放开关", "Rand Scale" }, { "缩放最小值", "Min Scale" }, { "缩放最大值", "Max Scale" }, { "分裂选择:", "Split:" }, { "疾风步", "Swift" }, { "飞针", "Harpoon" }, { "流浪者披风", "Cloak" }, { "回血", "Heal" }, { "劈方向", "Slash" }, { "爬墙", "WallClimb" }, { "警告:重置后当前种子世界将重新生成,所有拾取点会重生,技能触发器也会重置。", "Warning: Reset world!" }, { "总体|垂直、水平、特殊、攻击", "Total|Vert,Hor,Spec,Atk" }, { "输入种子", "Enter Seed" }, { "房间种子", "Room Seed" }, { "当前物品种子:", "Curr Item Seed:" }, { "货币首次保底:", "First Pity:" }, { "货币二次保底:", "Second Pity:" }, { "丝矛保底次数:", "SilkSpear Pity:" }, { "开局相关设置", "Startup Settings" }, { "技能分类随机", "Skill Type Random" }, { "辅助设置", "Aux Settings" }, { "物品随机设置", "Item Random Settings" }, { "物品随机池", "Item Pool" }, { "纹章、技能、遗物类型开关", "Toggle Crests, Skills, Relics" }, { "起始地点", "Start Location" }, { "暂未实现", "Not Yet" }, { "诅咒选项", "Curse Options" }, { "纹章诅咒等", "Crest Curses etc." }, { "重复物品", "Repeat Items" }, { "配置各类物品最大获得次数", "Configure Max Dupes" }, { "花费随机化", "Cost Random" }, { "虚拟奖励池: 无限/有限", "Virtual Reward: Infinite/Limited" }, { "商店随机: 已启用", "Shop Random: Enabled" }, { "捡拾随机: 已启用", "Pickup Random: Enabled" }, { "物品随机池类型", "Item Pool Types" }, { "纹章", "Crests" }, { "技能", "Skills" }, { "遗物", "Relics" }, { "重复物品数量配置", "Repeat Limit Config" }, { "起始地点(暂未实现)", "Start Location (WIP)" }, { "全随机模式分裂:上劈、左劈、右劈、冲刺左/右、飞针左/右、漂浮左/右、壁跳左/右、回血", "Full Random splits:Up/Left/Right Slash,Dash L/R,Harpoon L/R,Float L/R,WallJump L/R,Heal" }, { "陷阱池:暗雷、跳跳乐、尖刺类、天花板障碍等", "Trap Pool: Dark Mines, Platforming, Spikes, Ceiling Hazards..." }, { "血量调整:所有怪物血量与原始一致", "HP: All enemies have original HP" }, { "禁用场景列表 (只读):Belltown_04, Bellshrine, Bone_East_Umbrella, Room_Pinstress ...", "Disabled Rooms (Read-only): ..." }, { "纹章随机", "Crest Random" }, { "技能类物品", "Skill Items" }, { "遗物随机", "Relic Random" }, { "疾风步 飞针 流浪者披风 回血 劈方向 爬墙", "SwiftStep Harpoon Wan's Cloak Heal SlashDirect Walljump" }, { "返回主页面", "Back to Main" }, { "应用", "Apply" }, { "返回", "Back" }, { "确认并开始游戏\n", "Start" }, { "开\n", "On\n" }, { "关\n", "Off\n" }, { "房间随机\n", "Room\n" }, { "物品随机\n", "Item\n" }, { "陷阱随机\n", "Trap\n" }, { "怪物随机\n", "Enemy\n" }, { "随机种子:\n", "Seed:\n" }, { "房间种子:", "Room Seed:" }, { "第一次保底次数 (默认30)", "First pity count (default 30)" }, { "第二次保底次数 (默认1000)", "Second pity count (default 1000)" }, { "丝矛保底触发次数 (默认10)", "SilkSpear pity trigger (default 10)" } }; ChineseToEnglish = new Dictionary(); EnglishToChinese = new Dictionary(); Dictionary dictionary = new Dictionary { { "NativeUIMaker 调试窗口", "UI Debug" }, { "=== 创建新按钮 ===", "=== New Button ===" }, { "选择按钮样式:", "Style:" }, { "图标按钮", "Icon" }, { "纯文字按钮", "Text" }, { "小型按钮", "Small" }, { "图标文件路径 (绝对或相对路径,留空则不设置):", "Icon Path:" }, { "切换文字序列(逗号分隔):", "Toggle Texts:" }, { "创建 {0}", "Create {0}" }, { "新按钮", "NewBtn" }, { "可编辑描述", "Desc" }, { "按钮被点击", "Clicked" }, { "=== 已创建的按钮 ===", "=== Buttons ===" }, { "编辑按钮: {0}", "Edit Btn: {0}" }, { "标题:", "Title:" }, { "描述:", "Desc:" }, { "位置 (x, y):", "Pos XY:" }, { "尺寸 (宽, 高):", "Size WH:" }, { "图标偏移 (x, y):", "Icon Offset:" }, { "应用图标偏移", "Apply Icon" }, { "标题文字偏移 (x, y):", "Title Offset:" }, { "应用标题偏移", "Apply Title" }, { "描述文字偏移 (x, y):", "Desc Offset:" }, { "应用描述偏移", "Apply Desc" }, { "允许拖拽 (按住鼠标左键拖动)", "Draggable" }, { "设置切换文字序列(逗号分隔):", "Set Toggle Texts:" }, { "应用切换序列", "Apply Toggle" }, { "应用更改", "Apply" }, { "删除此控件", "Delete" }, { "=== 创建新标签 ===", "=== New Label ===" }, { "创建文本标签 (StandardLabel)", "Create Label" }, { "新标签", "NewLabel" }, { "=== 已创建的标签 ===", "=== Labels ===" }, { "编辑标签: {0}", "Edit Label: {0}" }, { "文本:", "Text:" }, { "字体大小:", "Font Size:" }, { "颜色 (R,G,B):", "Color RGB:" }, { "固定到当前页面", "Pin to Current Page" }, { "=== 创建新滑块 ===", "=== New Slider ===" }, { "创建滑块 (NativeSlider)", "Create Slider" }, { "新滑块", "NewSlider" }, { "滑块 {0}: {1} 当前值={2}", "Slider {0}: {1} val={2}" }, { "未命名", "Unnamed" }, { "编辑滑块: {0}", "Edit Slider: {0}" }, { "当前值: {0}", "Val: {0}" }, { "标签:", "Label:" }, { "滑块 X 偏移:", "Slider X Off:" }, { "滑块宽度 (0=原生):", "Slider Width:" }, { "标签 X 偏移:", "Label X Off:" }, { "数值 X 偏移:", "Value X Off:" }, { "最小值: {0}", "Min: {0}" }, { "最大值: {0}", "Max: {0}" }, { "整数步进:", "Int Step:" }, { "=== 创建新选项行 (无滑块) ===", "=== New Option ===" }, { "创建选项行 (NativeOption)", "Create Option" }, { "新选项", "NewOpt" }, { "这是描述文字", "Desc text" }, { "选项 {0}: {1} 当前值={2}", "Opt {0}: {1} val={2}" }, { "编辑选项行: {0}", "Edit Opt: {0}" }, { "选项列表 (用逗号分隔):", "Options:" }, { "当前选中: {0} (索引 {1})", "Selected: {0} (idx {1})" }, { "上一个", "Prev" }, { "下一个", "Next" }, { "=== 创建新箭头 ===", "=== New Arrow ===" }, { "左箭头", "Left" }, { "右箭头", "Right" }, { "上箭头", "Up" }, { "下箭头", "Down" }, { "=== 已创建的箭头 ===", "=== Arrows ===" }, { "箭头 {0}: {1} 位置={2}", "Arrow {0}: {1} pos={2}" }, { "编辑箭头: {0}", "Edit Arrow: {0}" }, { "方向:", "Dir:" }, { "左", "L" }, { "右", "R" }, { "上", "U" }, { "下", "D" }, { "播放动画 (闪烁)", "Flash" }, { "可点击 (添加按钮)", "Clickable" }, { "=== 创建新输入框 ===", "=== New Input ===" }, { "创建输入框", "Create Input" }, { "=== 已创建的输入框 ===", "=== Inputs ===" }, { "输入框 {0}: {1}", "Input {0}: {1}" }, { "编辑输入框", "Edit Input" }, { "文本内容:", "Text:" }, { "占位符:", "Placeholder:" }, { "输入...", "Enter..." }, { "扫描外部控件", "Scan External" }, { "保存配置", "Save Config" }, { "加载配置", "Load Config" }, { "点击“扫描外部控件”以发现其他模组创建的UI元素。", "Click Scan to find UI from other mods." }, { "外部按钮", "Ext Btns" }, { "外部标签", "Ext Labels" }, { "外部滑块", "Ext Sliders" }, { "外部选项行", "Ext Options" }, { "外部箭头", "Ext Arrows" }, { "外部输入框", "Ext Inputs" }, { "页面管理", "Page Mgmt" }, { "可用页面:", "Pages:" }, { "页面 {0}: {1}", "Page {0}: {1}" }, { "当前页面: {0} 包含控件: {1}", "Curr: {0} ({1} ctls)" }, { "保存页面配置", "Save Page" }, { "加载页面配置", "Load Page" }, { "刷新", "Refresh" }, { "页面内控件列表:", "Page Controls:" }, { "位置", "Pos" }, { "隐藏窗口", "Hide" }, { "本地控件", "Local" }, { "外部控件", "External" }, { "CN", "CN" }, { "EN", "EN" }, { "Auto", "Auto" }, { "创建目标:", "Target:" }, { "全局画布 (独立于页面)", "Global Canvas" }, { "全局画布", "Global" }, { "当前:", "Curr:" }, { "未选中任何控件", "No sel" }, { "控件已被销毁", "Destroyed" }, { "选项1", "Opt1" }, { "选项2", "Opt2" }, { "按钮 {0}: {1}", "Btn {0}: {1}" }, { "标签 {0}: {1}", "Label {0}: {1}" }, { "箭头被点击", "Arrow clicked" }, { "应用", "Apply" }, { "关闭", "Close" }, { "技能类物品", "Skill Items" }, { "遗物", "Relic" }, { "其他物品", "Other Items" }, { "上劈", "Up Slash" }, { "左劈", "Left Slash" }, { "右劈", "Right Slash" }, { "冲刺左", "Dash Left" }, { "冲刺右", "Dash Right" }, { "飞针左", "Harpoon Left" }, { "飞针右", "Harpoon Right" }, { "漂浮左", "Float Left" }, { "漂浮右", "Float Right" }, { "壁跳左", "Wall Jump Left" }, { "壁跳右", "Wall Jump Right" }, { "丝之矛", "Needle Throw" }, { "灵丝风暴", "Thread Sphere" }, { "丝刃标", "Silk Charge" }, { "符文之怒", "Silk Bomb" }, { "苍白之爪", "Silk Boss Needle" }, { "丝忆弦针", "Needolin" }, { "格挡", "Parry" }, { "深邃挽歌", "Needolin Memory" }, { "幻兽歌", "Fast Travel" }, { "风铃摇", "Eva Heal" }, { "雪绒披风", "Double Jump" }, { "灵丝升腾", "Super Jump" }, { "蛛攀术", "Wall Climb" }, { "蓄力斩", "Charge Slash" }, { "面具碎片", "Heart Piece" }, { "丝轴碎片", "Spool Part" }, { "丝线恢复上限+1", "Max Silk Regen +1" }, { "纹章槽位解锁器", "Crest Slot Unlocker" } }; foreach (KeyValuePair item in dictionary) { if (!EnglishTranslations.ContainsKey(item.Key)) { EnglishTranslations.Add(item.Key, item.Value); } else { Debug.LogWarning((object)("[UILocale] Duplicate key ignored: " + item.Key)); } } foreach (KeyValuePair controlTextTranslation in ControlTextTranslations) { string key = controlTextTranslation.Key; string value = controlTextTranslation.Value; if (!ChineseToEnglish.ContainsKey(key)) { ChineseToEnglish.Add(key, value); } if (!EnglishToChinese.ContainsKey(value)) { EnglishToChinese.Add(value, key); } } } public static void SetForceChinese(bool? forceChinese) { _forceChinese = forceChinese; } public static string Get(string chineseText) { if (string.IsNullOrEmpty(chineseText)) { return chineseText; } if (IsChinese) { return chineseText; } string value; return EnglishTranslations.TryGetValue(chineseText, out value) ? value : chineseText; } public static void TranslateControlConfig(UIControlConfig cfg) { if (cfg == null) { return; } if (IsChinese) { if (!string.IsNullOrEmpty(cfg.title)) { cfg.title = TranslateFromEnglish(cfg.title); } if (!string.IsNullOrEmpty(cfg.description)) { cfg.description = TranslateFromEnglish(cfg.description); } if (!string.IsNullOrEmpty(cfg.labelText)) { cfg.labelText = TranslateFromEnglish(cfg.labelText); } if (cfg.toggleTexts != null) { for (int i = 0; i < cfg.toggleTexts.Length; i++) { cfg.toggleTexts[i] = TranslateFromEnglish(cfg.toggleTexts[i]); } } if (cfg.options != null) { for (int j = 0; j < cfg.options.Length; j++) { cfg.options[j] = TranslateFromEnglish(cfg.options[j]); } } if (!string.IsNullOrEmpty(cfg.inputText)) { cfg.inputText = TranslateFromEnglish(cfg.inputText); } if (!string.IsNullOrEmpty(cfg.placeholderText)) { cfg.placeholderText = TranslateFromEnglish(cfg.placeholderText); } return; } if (!string.IsNullOrEmpty(cfg.title)) { cfg.title = TranslateFromChinese(cfg.title); } if (!string.IsNullOrEmpty(cfg.description)) { cfg.description = TranslateFromChinese(cfg.description); } if (!string.IsNullOrEmpty(cfg.labelText)) { cfg.labelText = TranslateFromChinese(cfg.labelText); } if (cfg.toggleTexts != null) { for (int k = 0; k < cfg.toggleTexts.Length; k++) { cfg.toggleTexts[k] = TranslateFromChinese(cfg.toggleTexts[k]); } } if (cfg.options != null) { for (int l = 0; l < cfg.options.Length; l++) { cfg.options[l] = TranslateFromChinese(cfg.options[l]); } } if (!string.IsNullOrEmpty(cfg.inputText)) { cfg.inputText = TranslateFromChinese(cfg.inputText); } if (!string.IsNullOrEmpty(cfg.placeholderText)) { cfg.placeholderText = TranslateFromChinese(cfg.placeholderText); } } private static string TranslateFromChinese(string chinese) { if (string.IsNullOrEmpty(chinese)) { return chinese; } if (ChineseToEnglish.TryGetValue(chinese, out var value)) { return value; } string text = chinese.TrimEnd(new char[1] { '\n' }); if (text != chinese && ChineseToEnglish.TryGetValue(text, out value)) { return value + (chinese.EndsWith("\n") ? "\n" : ""); } return chinese; } private static string TranslateFromEnglish(string english) { if (string.IsNullOrEmpty(english)) { return english; } if (EnglishToChinese.TryGetValue(english, out var value)) { return value; } string text = english.TrimEnd(new char[1] { '\n' }); if (text != english && EnglishToChinese.TryGetValue(text, out value)) { return value + (english.EndsWith("\n") ? "\n" : ""); } return english; } private static bool DetectChinese() { try { Type type = Type.GetType("FontManager, Assembly-CSharp"); if (type != null) { FieldInfo field = type.GetField("_currentLanguage", BindingFlags.Static | BindingFlags.NonPublic); if (field != null) { object value = field.GetValue(null); if (value != null) { string text = value.ToString().ToUpper(); if (text == "ZH" || text == "ZH_TW") { return true; } } } } } catch { } try { GameSettings val = GameManager.instance?.gameSettings; if (val != null) { FieldInfo field2 = ((object)val).GetType().GetField("language", BindingFlags.Instance | BindingFlags.Public); if (field2 != null) { object value2 = field2.GetValue(val); if (value2 != null) { string text2 = value2.ToString().ToUpper(); if (text2 == "ZH" || text2 == "ZH_TW") { return true; } } } } } catch { } return false; } } public static class UIManagerEx { [Serializable] [CompilerGenerated] private sealed class <>c { public static readonly <>c <>9 = new <>c(); public static Func <>9__7_0; public static Func <>9__7_1; public static Func <>9__10_0; public static UnityAction <>9__16_0; internal string b__7_0(UIControlConfig c) { return c.page; } internal bool b__7_1(string p) { return !string.IsNullOrEmpty(p); } internal bool b__10_0(NativePage p) { return p.isShowing; } internal void b__16_0() { Debug.Log((object)"箭头被点击"); } } public static bool IsUIReady { get; private set; } public static event Action OnUIReady; public static void InitializeUI(string configPath) { if (IsUIReady) { return; } if (string.IsNullOrEmpty(configPath) || !File.Exists(configPath)) { Debug.LogError((object)("[UIManagerEx] 配置文件不存在: " + configPath)); return; } string text = File.ReadAllText(configPath); ConfigData configData = JsonConvert.DeserializeObject(text); if (configData == null || configData.controls == null) { Debug.LogError((object)"[UIManagerEx] 配置文件无效"); return; } foreach (UIControlConfig control in configData.controls) { UILocale.TranslateControlConfig(control); } RectTransform defaultParent = UIParent.GetDefaultParent(); if ((Object)(object)defaultParent == (Object)null) { Debug.LogError((object)"[UIManagerEx] 无法获取父物体"); return; } List list = (from c in configData.controls select c.page into p where !string.IsNullOrEmpty(p) select p).Distinct().ToList(); foreach (string pageName in list) { if (!NativePage.AllInstances.Any((NativePage p) => ((Object)p.gameObject).name == pageName)) { Debug.Log((object)("[UIManagerEx] 创建页面: " + pageName)); NativePage nativePage = new NativePage(pageName, defaultParent, addBackButton: false); nativePage.Hide(); } } foreach (UIControlConfig cfg in configData.controls) { if (!string.IsNullOrEmpty(cfg.page)) { NativePage nativePage2 = NativePage.AllInstances.FirstOrDefault((NativePage p) => ((Object)p.gameObject).name == cfg.page); if (nativePage2 == null) { Debug.LogError((object)("[UIManagerEx] 页面 " + cfg.page + " 不存在,控件 " + cfg.name + " 创建失败")); } else { CreateControl(cfg, nativePage2.gameObject.transform); } } } Canvas.ForceUpdateCanvases(); foreach (NativePage allInstance in NativePage.AllInstances) { allInstance.Hide(); } NativeUIEventDispatcher.Initialize(); IsUIReady = true; UIManagerEx.OnUIReady?.Invoke(); Debug.Log((object)"[UIManagerEx] UI 初始化完成,所有页面已隐藏"); } public static void ShowPage(string pageName) { NativePage nativePage = NativePage.AllInstances.FirstOrDefault((NativePage p) => ((Object)p.gameObject).name == pageName); if (nativePage == null) { Debug.LogError((object)("[UIManagerEx] 页面 " + pageName + " 不存在")); return; } foreach (NativePage allInstance in NativePage.AllInstances) { if (allInstance != nativePage) { allInstance.Hide(); } } nativePage.Show(); } public static void HidePage(string pageName) { NativePage.AllInstances.FirstOrDefault((NativePage p) => ((Object)p.gameObject).name == pageName)?.Hide(); } public static NativePage GetCurrentPage() { return NativePage.AllInstances.FirstOrDefault((NativePage p) => p.isShowing); } private static void CreateControl(UIControlConfig cfg, Transform parent) { RectTransform component = ((Component)parent).GetComponent(); if ((Object)(object)component == (Object)null) { return; } switch (cfg.type) { case "Button": { NativeButton nativeButton = NativeButton.Create(component, (ButtonStyle)cfg.style); if (nativeButton != null) { ((Object)nativeButton.gameObject).name = cfg.name; ApplyButtonConfig(nativeButton, cfg); } break; } case "Label": { NativeLabel nativeLabel = NativeLabel.Create(component); if (nativeLabel != null) { ((Object)nativeLabel.gameObject).name = cfg.name; ApplyLabelConfig(nativeLabel, cfg); } break; } case "Slider": { NativeSlider nativeSlider = NativeSlider.Create(component); if (nativeSlider != null) { ((Object)nativeSlider.gameObject).name = cfg.name; ApplySliderConfig(nativeSlider, cfg); } break; } case "Option": { NativeOption nativeOption = NativeOption.Create(component); if (nativeOption != null) { ((Object)nativeOption.gameObject).name = cfg.name; ApplyOptionConfig(nativeOption, cfg); } break; } case "Arrow": { NativeArrow nativeArrow = NativeArrow.Create(component, (NativeArrow.Direction)cfg.direction); if (nativeArrow != null) { ((Object)nativeArrow.gameObject).name = cfg.name; ApplyArrowConfig(nativeArrow, cfg); } break; } case "Input": { NativeInput nativeInput = NativeInput.Create(component); if (nativeInput != null) { ((Object)nativeInput.gameObject).name = cfg.name; ApplyInputConfig(nativeInput, cfg); } break; } } } private static void ApplyButtonConfig(NativeButton btn, UIControlConfig cfg) { //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_0082: Unknown result type (might be due to invalid IL or missing references) //IL_008f: Unknown result type (might be due to invalid IL or missing references) //IL_009c: Unknown result type (might be due to invalid IL or missing references) btn.SetPosition(cfg.position); btn.SetSize(cfg.size.x, cfg.size.y); if (!string.IsNullOrEmpty(cfg.title)) { btn.SetTitle(cfg.title.Trim()); } if (!string.IsNullOrEmpty(cfg.description)) { btn.SetDescription(cfg.description.Trim()); } btn.SetDraggable(cfg.draggable); btn.SetIconOffset(cfg.iconOffset); btn.SetTitleOffset(cfg.titleOffset); btn.SetDescOffset(cfg.descOffset); if (cfg.toggleTexts != null && cfg.toggleTexts.Length != 0) { btn.SetToggleTexts(cfg.toggleTexts); if (cfg.toggleIndex >= 0 && cfg.toggleIndex < cfg.toggleTexts.Length) { btn.SetToggleIndex(cfg.toggleIndex); } } } private static void ApplyLabelConfig(NativeLabel lbl, UIControlConfig cfg) { //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Unknown result type (might be due to invalid IL or missing references) lbl.SetPosition(cfg.position); lbl.SetSize(cfg.size.x, cfg.size.y); if (!string.IsNullOrEmpty(cfg.labelText)) { lbl.SetText(cfg.labelText.Trim()); } if (cfg.fontSize > 0) { lbl.SetFontSize(cfg.fontSize); } lbl.SetColor(cfg.color); lbl.SetDraggable(cfg.draggable); } private static void ApplySliderConfig(NativeSlider sld, UIControlConfig cfg) { //IL_0003: Unknown result type (might be due to invalid IL or missing references) sld.SetPosition(cfg.position); sld.SetSize(cfg.size.x, cfg.size.y); if (!string.IsNullOrEmpty(cfg.labelText)) { sld.SetLabel(cfg.labelText.Trim()); } sld.SetMinMax(cfg.minValue, cfg.maxValue, cfg.wholeNumbers); sld.Value = cfg.value; sld.SetDraggable(cfg.draggable); sld.SetSliderXOffset(cfg.sliderXOffset); sld.SetSliderWidth(cfg.sliderWidth); sld.SetLabelXOffset(cfg.labelXOffset); sld.SetValueXOffset(cfg.valueXOffset); } private static void ApplyOptionConfig(NativeOption opt, UIControlConfig cfg) { //IL_0003: Unknown result type (might be due to invalid IL or missing references) opt.SetPosition(cfg.position); opt.SetSize(cfg.size.x, cfg.size.y); if (!string.IsNullOrEmpty(cfg.labelText)) { opt.SetLabel(cfg.labelText.Trim()); } if (!string.IsNullOrEmpty(cfg.description)) { opt.SetDescription(cfg.description.Trim()); } if (cfg.options != null && cfg.options.Length != 0) { opt.SetOptions(cfg.options, cfg.optionIndex); } opt.SetDraggable(cfg.draggable); } private static void ApplyArrowConfig(NativeArrow arr, UIControlConfig cfg) { //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Expected O, but got Unknown arr.SetPosition(cfg.position); arr.SetSize(cfg.size.x, cfg.size.y); bool clickable = cfg.clickable; object obj = <>c.<>9__16_0; if (obj == null) { UnityAction val = delegate { Debug.Log((object)"箭头被点击"); }; <>c.<>9__16_0 = val; obj = (object)val; } arr.SetClickable(clickable, (UnityAction)obj); arr.SetDraggable(cfg.draggable); } private static void ApplyInputConfig(NativeInput inp, UIControlConfig cfg) { //IL_0003: Unknown result type (might be due to invalid IL or missing references) inp.SetPosition(cfg.position); inp.SetSize(cfg.size.x, cfg.size.y); inp.SetText(cfg.inputText); Graphic placeholder = inp.inputField.placeholder; Text val = (Text)(object)((placeholder is Text) ? placeholder : null); if ((Object)(object)val != (Object)null) { val.text = cfg.placeholderText; } } } public static class UIParent { private class CoroutineRunner : MonoBehaviour { public void Run(IEnumerator routine) { ((MonoBehaviour)this).StartCoroutine(routine); } } [CompilerGenerated] private sealed class d__4 : IEnumerator, IDisposable, IEnumerator { private int <>1__state; private object <>2__current; public GameObject tempGo; private float 5__1; private RectTransform 5__2; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__4(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { 5__2 = null; <>1__state = -2; } private bool MoveNext() { int num = <>1__state; if (num != 0) { if (num != 1) { return false; } <>1__state = -1; 5__2 = TryGetDefaultParent(); if ((Object)(object)5__2 != (Object)null) { _defaultParent = 5__2; goto IL_0099; } 5__1 -= Time.deltaTime; 5__2 = null; } else { <>1__state = -1; 5__1 = 3f; } if (5__1 > 0f) { <>2__current = null; <>1__state = 1; return true; } goto IL_0099; IL_0099: _isSearching = false; if ((Object)(object)tempGo != (Object)null) { Object.Destroy((Object)(object)tempGo); } return false; } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } private static RectTransform _defaultParent; private static bool _isSearching; public static RectTransform GetDefaultParent() { //IL_0090: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Expected O, but got Unknown if ((Object)(object)_defaultParent != (Object)null && (Object)(object)((Component)_defaultParent).gameObject != (Object)null) { return _defaultParent; } RectTransform val = TryGetDefaultParent(); if ((Object)(object)val != (Object)null) { _defaultParent = val; return val; } if (!_isSearching) { _isSearching = true; if ((Object)(object)NativeUIMakerMod.Instance != (Object)null) { ((MonoBehaviour)NativeUIMakerMod.Instance).StartCoroutine(DelayedSearch()); } else { GameObject val2 = new GameObject("UIParentTemp"); Object.DontDestroyOnLoad((Object)(object)val2); val2.AddComponent().Run(DelayedSearch(val2)); } } Canvas val3 = Object.FindObjectOfType(); if ((Object)(object)val3 != (Object)null) { Transform transform = ((Component)val3).transform; return (RectTransform)(object)((transform is RectTransform) ? transform : null); } Debug.LogError((object)"[UIParent] 无法获取有效的 UI 父物体,控件将不可见!"); return null; } private static RectTransform TryGetDefaultParent() { if ((Object)(object)UIManager.instance != (Object)null && (Object)(object)UIManager.instance.UICanvas != (Object)null) { Transform transform = ((Component)UIManager.instance.UICanvas).transform; return (RectTransform)(object)((transform is RectTransform) ? transform : null); } Canvas val = Object.FindObjectOfType(); if ((Object)(object)val != (Object)null) { Transform transform2 = ((Component)val).transform; return (RectTransform)(object)((transform2 is RectTransform) ? transform2 : null); } return null; } [IteratorStateMachine(typeof(d__4))] private static IEnumerator DelayedSearch(GameObject tempGo = null) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__4(0) { tempGo = tempGo }; } public static void EnsureVisible(RectTransform rt, Vector2? anchoredPosition = null, Vector2? sizeDelta = null) { //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0092: Unknown result type (might be due to invalid IL or missing references) //IL_0089: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)rt == (Object)null)) { rt.anchorMin = new Vector2(0.5f, 0.5f); rt.anchorMax = new Vector2(0.5f, 0.5f); rt.pivot = new Vector2(0.5f, 0.5f); rt.anchoredPosition = (Vector2)(((??)anchoredPosition) ?? Vector2.zero); rt.sizeDelta = (Vector2)(((??)sizeDelta) ?? new Vector2(600f, 80f)); } } public static void AttachAndEnsureVisible(GameObject obj, Vector2? position = null, Vector2? size = null) { if ((Object)(object)obj == (Object)null) { return; } RectTransform component = obj.GetComponent(); if (!((Object)(object)component == (Object)null)) { RectTransform defaultParent = GetDefaultParent(); if ((Object)(object)defaultParent != (Object)null) { ((Transform)component).SetParent((Transform)(object)defaultParent, false); } EnsureVisible(component, position, size); } } } public class UIScanner { private List _targets; private int _currentIndex = 0; private bool _initialized = false; private Transform _customRoot = null; private static readonly BindingFlags _allFlags = BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic; public event Action OnScanCompleted; public UIScanner() { _targets = new List(); } public void SetCustomRoot(Transform root) { _customRoot = root; _initialized = false; _targets.Clear(); _currentIndex = 0; } private void EnsureTargets() { if (_initialized) { return; } _initialized = true; if ((Object)(object)_customRoot != (Object)null) { CollectAllGameObjects(_customRoot, _targets); Debug.Log((object)$"[UIScanner] 共收集到 {_targets.Count} 个 UI 元素(自定义根: {((Object)_customRoot).name})"); return; } Canvas val = UIManager.instance?.UICanvas; if ((Object)(object)val == (Object)null) { Debug.LogError((object)"[UIScanner] 无法获取 UICanvas"); return; } CollectAllGameObjects(((Component)val).transform, _targets); Debug.Log((object)$"[UIScanner] 共收集到 {_targets.Count} 个 UI 元素"); } private void CollectAllGameObjects(Transform parent, List list) { //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Expected O, but got Unknown list.Add(((Component)parent).gameObject); foreach (Transform item in parent) { Transform parent2 = item; CollectAllGameObjects(parent2, list); } } public bool ScanNext() { EnsureTargets(); if (_currentIndex >= _targets.Count) { return false; } GameObject val = _targets[_currentIndex]; string arg = ScanGameObjectDeep(val); this.OnScanCompleted?.Invoke(val, arg); _currentIndex++; return true; } private string ScanGameObjectDeep(GameObject go) { //IL_0149: Unknown result type (might be due to invalid IL or missing references) //IL_0150: Expected O, but got Unknown StringBuilder stringBuilder = new StringBuilder(); stringBuilder.AppendLine($"\n========== [{_currentIndex + 1}/{_targets.Count}] {GetFullPath(go.transform)} =========="); stringBuilder.AppendLine($"Active: {go.activeSelf} | Layer: {go.layer} | Tag: {go.tag}"); Component[] components = go.GetComponents(); stringBuilder.AppendLine($"Components ({components.Length}):"); Component[] array = components; foreach (Component val in array) { if ((Object)(object)val == (Object)null) { stringBuilder.AppendLine(" - (null component)"); continue; } stringBuilder.AppendLine(" - " + ((object)val).GetType().FullName); DumpAllFields(val, stringBuilder, " "); DumpSpecialComponents(val, stringBuilder); } if (go.transform.childCount > 0) { stringBuilder.AppendLine($"Direct children ({go.transform.childCount}):"); foreach (Transform item in go.transform) { Transform val2 = item; stringBuilder.AppendLine(" - " + ((Object)val2).name + " (Path: " + GetFullPath(val2) + ")"); } } stringBuilder.AppendLine(); return stringBuilder.ToString(); } private void DumpAllFields(Component comp, StringBuilder sb, string indent) { Type type = ((object)comp).GetType(); FieldInfo[] fields = type.GetFields(_allFlags); if (fields.Length == 0) { sb.AppendLine(indent + "(No fields accessible)"); return; } FieldInfo[] array = fields; foreach (FieldInfo fieldInfo in array) { if (!fieldInfo.IsStatic || !fieldInfo.IsLiteral) { try { object value = fieldInfo.GetValue(comp); string text = FormatFieldValue(value); sb.AppendLine(indent + fieldInfo.Name + " = " + text); } catch (Exception ex) { sb.AppendLine(indent + fieldInfo.Name + " = "); } } } } private string FormatFieldValue(object value) { //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Unknown result type (might be due to invalid IL or missing references) //IL_0081: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_0094: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: Unknown result type (might be due to invalid IL or missing references) //IL_00d0: Unknown result type (might be due to invalid IL or missing references) //IL_00d5: Unknown result type (might be due to invalid IL or missing references) //IL_00e4: Unknown result type (might be due to invalid IL or missing references) //IL_00f3: Unknown result type (might be due to invalid IL or missing references) //IL_0102: Unknown result type (might be due to invalid IL or missing references) //IL_0111: Unknown result type (might be due to invalid IL or missing references) //IL_0142: Unknown result type (might be due to invalid IL or missing references) //IL_0147: Unknown result type (might be due to invalid IL or missing references) //IL_01b4: Unknown result type (might be due to invalid IL or missing references) //IL_01bb: Expected O, but got Unknown //IL_0214: Unknown result type (might be due to invalid IL or missing references) //IL_021b: Expected O, but got Unknown //IL_0251: Unknown result type (might be due to invalid IL or missing references) //IL_0258: Expected O, but got Unknown //IL_0290: Unknown result type (might be due to invalid IL or missing references) //IL_0297: Expected O, but got Unknown if (value == null) { return "null"; } Type type = value.GetType(); if (type == typeof(Vector2)) { Vector2 val = (Vector2)value; return $"({val.x:F2}, {val.y:F2})"; } if (type == typeof(Vector3)) { Vector3 val2 = (Vector3)value; return $"({val2.x:F2}, {val2.y:F2}, {val2.z:F2})"; } if (type == typeof(Color)) { Color val3 = (Color)value; return $"RGBA({val3.r:F2}, {val3.g:F2}, {val3.b:F2}, {val3.a:F2})"; } if (type == typeof(Rect)) { Rect val4 = (Rect)value; return $"x:{((Rect)(ref val4)).x:F1} y:{((Rect)(ref val4)).y:F1} w:{((Rect)(ref val4)).width:F1} h:{((Rect)(ref val4)).height:F1}"; } if (type == typeof(Sprite)) { Sprite val5 = (Sprite)value; object result; if (!((Object)(object)val5 != (Object)null)) { result = "null"; } else { string name = ((Object)val5).name; Texture2D texture = val5.texture; result = name + " (Texture: " + ((texture != null) ? ((Object)texture).name : null) + ")"; } return (string)result; } if (type == typeof(Font)) { Font val6 = (Font)value; return ((val6 != null) ? ((Object)val6).name : null) ?? "null"; } if (type == typeof(Transform)) { Transform val7 = (Transform)value; return ((Object)(object)val7 != (Object)null) ? GetFullPath(val7) : "null"; } if (type == typeof(GameObject)) { GameObject val8 = (GameObject)value; return ((Object)(object)val8 != (Object)null) ? GetFullPath(val8.transform) : "null"; } if (value is Delegate @delegate) { return "Delegate: " + @delegate.Method?.DeclaringType?.Name + "." + @delegate.Method?.Name; } if (type.IsArray) { Array array = (Array)value; return $"[{array.Length}] items"; } if (type.IsGenericType && type.GetGenericTypeDefinition() == typeof(List<>)) { return $"List (Count: {(object?)((dynamic)value).Count})"; } string text = value.ToString(); if (text.Length > 200) { text = text.Substring(0, 200) + "..."; } return text; } private void DumpSpecialComponents(Component comp, StringBuilder sb) { //IL_01aa: Unknown result type (might be due to invalid IL or missing references) //IL_01c6: Unknown result type (might be due to invalid IL or missing references) //IL_01e2: Unknown result type (might be due to invalid IL or missing references) //IL_01ed: Unknown result type (might be due to invalid IL or missing references) //IL_0209: Unknown result type (might be due to invalid IL or missing references) //IL_0225: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_0079: Unknown result type (might be due to invalid IL or missing references) //IL_0095: Unknown result type (might be due to invalid IL or missing references) //IL_0257: Unknown result type (might be due to invalid IL or missing references) //IL_0135: Unknown result type (might be due to invalid IL or missing references) //IL_0140: Unknown result type (might be due to invalid IL or missing references) //IL_015c: Unknown result type (might be due to invalid IL or missing references) //IL_02d9: Unknown result type (might be due to invalid IL or missing references) //IL_0435: Unknown result type (might be due to invalid IL or missing references) //IL_0484: Unknown result type (might be due to invalid IL or missing references) //IL_03a8: Unknown result type (might be due to invalid IL or missing references) //IL_03ad: Unknown result type (might be due to invalid IL or missing references) //IL_0506: Unknown result type (might be due to invalid IL or missing references) Type type = ((object)comp).GetType(); Text val = (Text)(object)((comp is Text) ? comp : null); if (val != null) { sb.AppendLine(" >>> Text Content: \"" + val.text + "\""); Font font = val.font; sb.AppendLine($" >>> Font: {((font != null) ? ((Object)font).name : null)}, FontSize: {val.fontSize}, Style: {val.fontStyle}"); sb.AppendLine($" >>> Color: {((Graphic)val).color}"); sb.AppendLine($" >>> Alignment: {val.alignment}, LineSpacing: {val.lineSpacing}"); sb.AppendLine($" >>> BestFit: {val.resizeTextForBestFit}, Min/Max: {val.resizeTextMinSize}/{val.resizeTextMaxSize}"); } Image val2 = (Image)(object)((comp is Image) ? comp : null); if (val2 != null) { sb.AppendLine(" >>> Sprite: " + (((Object)(object)val2.sprite != (Object)null) ? ((Object)val2.sprite).name : "null")); sb.AppendLine($" >>> Image Type: {val2.type}, Fill Method: {val2.fillMethod}"); sb.AppendLine($" >>> Color: {((Graphic)val2).color}"); sb.AppendLine($" >>> Raycast Target: {((Graphic)val2).raycastTarget}"); } RectTransform val3 = (RectTransform)(object)((comp is RectTransform) ? comp : null); if (val3 != null) { sb.AppendLine($" >>> anchoredPosition: {val3.anchoredPosition}"); sb.AppendLine($" >>> sizeDelta: {val3.sizeDelta}"); sb.AppendLine($" >>> anchorMin: {val3.anchorMin}, anchorMax: {val3.anchorMax}"); sb.AppendLine($" >>> pivot: {val3.pivot}"); sb.AppendLine($" >>> localScale: {((Transform)val3).localScale}"); } MenuSelectable val4 = (MenuSelectable)(object)((comp is MenuSelectable) ? comp : null); if (val4 != null) { sb.AppendLine($" >>> CancelAction: {val4.cancelAction}"); sb.AppendLine($" >>> Interactable: {((Selectable)val4).interactable}"); if ((Object)(object)val4.selectHighlight != (Object)null) { sb.AppendLine(" >>> Highlight Animator: " + ((Object)val4.selectHighlight).name); } } MenuButton val5 = (MenuButton)(object)((comp is MenuButton) ? comp : null); if (val5 != null) { sb.AppendLine($" >>> ButtonType: {val5.buttonType}"); sb.AppendLine(" >>> FlashEffect: " + (((Object)(object)val5.flashEffect != (Object)null) ? ((Object)val5.flashEffect).name : "null")); if (val5.OnSubmitPressed != null && ((UnityEventBase)val5.OnSubmitPressed).GetPersistentEventCount() > 0) { sb.AppendLine($" >>> OnSubmitPressed listeners: {((UnityEventBase)val5.OnSubmitPressed).GetPersistentEventCount()}"); } } Animator val6 = (Animator)(object)((comp is Animator) ? comp : null); if (val6 != null) { RuntimeAnimatorController runtimeAnimatorController = val6.runtimeAnimatorController; sb.AppendLine(" >>> Runtime Animator Controller: " + ((runtimeAnimatorController != null) ? ((Object)runtimeAnimatorController).name : null)); AnimatorStateInfo currentAnimatorStateInfo = val6.GetCurrentAnimatorStateInfo(0); sb.AppendLine($" >>> Current state: {((AnimatorStateInfo)(ref currentAnimatorStateInfo)).fullPathHash}"); } Slider val7 = (Slider)(object)((comp is Slider) ? comp : null); if (val7 != null) { sb.AppendLine($" >>> Value: {val7.value}, Min: {val7.minValue}, Max: {val7.maxValue}"); sb.AppendLine($" >>> Whole Numbers: {val7.wholeNumbers}"); sb.AppendLine($" >>> Direction: {val7.direction}"); } Toggle val8 = (Toggle)(object)((comp is Toggle) ? comp : null); if (val8 != null) { sb.AppendLine($" >>> IsOn: {val8.isOn}"); sb.AppendLine($" >>> Toggle Transition: {val8.toggleTransition}"); } InputField val9 = (InputField)(object)((comp is InputField) ? comp : null); if (val9 != null) { sb.AppendLine(" >>> Text: \"" + val9.text + "\""); sb.AppendLine(" >>> Placeholder: " + (((Object)(object)val9.placeholder != (Object)null) ? ((object)val9.placeholder).ToString() : "null")); sb.AppendLine($" >>> ContentType: {val9.contentType}, CharacterLimit: {val9.characterLimit}"); } } private string GetFullPath(Transform t) { if ((Object)(object)t == (Object)null) { return ""; } List list = new List(); while ((Object)(object)t != (Object)null) { list.Insert(0, ((Object)t).name); t = t.parent; } return string.Join("/", list); } } }