Please disclose if any significant portion of your mod was created using AI tools by adding the 'AI Generated' category. Failing to do so may result in the mod being removed from Thunderstore.
Decompiled source of NativeUIMaker v0.0.3
BepInEx/plugins/NativeUIMaker.dll
Decompiled a month ago
The result has been truncated due to the large size, download it to view full contents!
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<UIControlConfig> controls = new List<UIControlConfig>(); } public class DebugWindow : MonoBehaviour { [Serializable] [CompilerGenerated] private sealed class <>c { public static readonly <>c <>9 = new <>c(); public static Func<NativePage, bool> <>9__79_0; public static Func<string, string> <>9__82_0; public static UnityAction <>9__82_1; public static UnityAction <>9__87_0; public static Predicate<NativeButton> <>9__97_0; public static Predicate<NativeLabel> <>9__98_0; public static Predicate<NativeSlider> <>9__99_0; public static Predicate<NativeOption> <>9__100_0; public static Predicate<NativeArrow> <>9__101_0; public static Predicate<NativeInput> <>9__102_0; public static Func<string, string> <>9__104_0; public static Func<string, string> <>9__107_0; public static UnityAction <>9__108_0; public static UnityAction <>9__118_0; public static Predicate<NativeButton> <>9__120_0; public static Predicate<NativeLabel> <>9__120_1; public static Predicate<NativeSlider> <>9__120_2; public static Predicate<NativeOption> <>9__120_3; public static Predicate<NativeArrow> <>9__120_4; public static Predicate<NativeInput> <>9__120_5; public static Predicate<NativeButton> <>9__123_0; public static UnityAction <>9__126_7; internal bool <RefreshPageDropdownList>b__79_0(NativePage p) { return p != null; } internal string <DrawCreateButtonSection>b__82_0(string s) { return s.Trim(); } internal void <DrawCreateButtonSection>b__82_1() { Debug.Log((object)UILocale.Get("按钮被点击")); } internal void <CreateArrow>b__87_0() { Debug.Log((object)UILocale.Get("箭头被点击")); } internal bool <DrawExternalButtonsList>b__97_0(NativeButton b) { return b == null || (Object)(object)b.gameObject == (Object)null; } internal bool <DrawExternalLabelsList>b__98_0(NativeLabel l) { return l == null || (Object)(object)l.gameObject == (Object)null; } internal bool <DrawExternalSlidersList>b__99_0(NativeSlider s) { return s == null || (Object)(object)s.gameObject == (Object)null; } internal bool <DrawExternalOptionsList>b__100_0(NativeOption o) { return o == null || (Object)(object)o.gameObject == (Object)null; } internal bool <DrawExternalArrowsList>b__101_0(NativeArrow a) { return a == null || (Object)(object)a.gameObject == (Object)null; } internal bool <DrawExternalInputsList>b__102_0(NativeInput i) { return i == null || (Object)(object)i.gameObject == (Object)null; } internal string <DrawButtonEditor>b__104_0(string s) { return s.Trim(); } internal string <DrawOptionEditor>b__107_0(string s) { return s.Trim(); } internal void <DrawArrowEditor>b__108_0() { Debug.Log((object)UILocale.Get("箭头被点击")); } internal void <ApplyConfigToControlInPage>b__118_0() { Debug.Log((object)UILocale.Get("箭头被点击")); } internal bool <CleanInvalidControls>b__120_0(NativeButton b) { return b == null || (Object)(object)b.gameObject == (Object)null; } internal bool <CleanInvalidControls>b__120_1(NativeLabel l) { return l == null || (Object)(object)l.gameObject == (Object)null; } internal bool <CleanInvalidControls>b__120_2(NativeSlider s) { return s == null || (Object)(object)s.gameObject == (Object)null; } internal bool <CleanInvalidControls>b__120_3(NativeOption o) { return o == null || (Object)(object)o.gameObject == (Object)null; } internal bool <CleanInvalidControls>b__120_4(NativeArrow a) { return a == null || (Object)(object)a.gameObject == (Object)null; } internal bool <CleanInvalidControls>b__120_5(NativeInput i) { return i == null || (Object)(object)i.gameObject == (Object)null; } internal bool <SaveConfigToFile>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 <LoadConfigFromFile>b__126_7() { Debug.Log((object)UILocale.Get("箭头被点击")); } } [CompilerGenerated] private sealed class <>c__DisplayClass123_0 { public NativeButton btn; internal bool <SaveConfigToFile>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<NativeButton> _allButtons = new List<NativeButton>(); private List<NativeLabel> _allLabels = new List<NativeLabel>(); private List<NativeSlider> _allSliders = new List<NativeSlider>(); private List<NativeOption> _allOptions = new List<NativeOption>(); private List<NativeArrow> _allArrows = new List<NativeArrow>(); private List<NativeInput> _allInputs = new List<NativeInput>(); 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<NativeButton> _externalButtons = new List<NativeButton>(); private List<NativeLabel> _externalLabels = new List<NativeLabel>(); private List<NativeSlider> _externalSliders = new List<NativeSlider>(); private List<NativeOption> _externalOptions = new List<NativeOption>(); private List<NativeArrow> _externalArrows = new List<NativeArrow>(); private List<NativeInput> _externalInputs = new List<NativeInput>(); private bool _externalScanned = false; private List<NativePage> _allPages = new List<NativePage>(); private NativePage _selectedPage = null; private List<UIControlConfig> _pageControlsCache = new List<UIControlConfig>(); 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<DebugWindow>(); 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<GUILayoutOption>()); GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>()); 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<GUILayoutOption>()); 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<GUILayoutOption>()); if (GUILayout.Button(UILocale.Get("隐藏窗口"), Array.Empty<GUILayoutOption>())) { _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<NativePage> 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<GUILayoutOption>()); 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<NativePage> 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<GUILayoutOption>()); } else { GUILayout.Label(UILocale.Get("当前:") + " " + UILocale.Get("全局画布"), Array.Empty<GUILayoutOption>()); } 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<GUILayoutOption>()); GUILayout.Label(UILocale.Get("选择按钮样式:"), Array.Empty<GUILayoutOption>()); _selectedCreateStyle = (ButtonStyle)GUILayout.Toolbar((int)_selectedCreateStyle, new string[3] { UILocale.Get("图标按钮"), UILocale.Get("纯文字按钮"), UILocale.Get("小型按钮") }, Array.Empty<GUILayoutOption>()); if (_selectedCreateStyle == ButtonStyle.IconButton) { GUILayout.Label(UILocale.Get("图标文件路径 (绝对或相对路径,留空则不设置):"), Array.Empty<GUILayoutOption>()); _iconPathInput = GUILayout.TextField(_iconPathInput, Array.Empty<GUILayoutOption>()); } GUILayout.Label(UILocale.Get("切换文字序列(逗号分隔):"), Array.Empty<GUILayoutOption>()); _toggleTextsInput = GUILayout.TextField(_toggleTextsInput, Array.Empty<GUILayoutOption>()); if (!GUILayout.Button(string.Format(UILocale.Get("创建 {0}"), _styleNames[(int)_selectedCreateStyle]), Array.Empty<GUILayoutOption>())) { 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<GUILayoutOption>()); if (GUILayout.Button(UILocale.Get("创建文本标签 (StandardLabel)"), Array.Empty<GUILayoutOption>())) { 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<GUILayoutOption>()); if (GUILayout.Button(UILocale.Get("创建滑块 (NativeSlider)"), Array.Empty<GUILayoutOption>())) { 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<GUILayoutOption>()); if (GUILayout.Button(UILocale.Get("创建选项行 (NativeOption)"), Array.Empty<GUILayoutOption>())) { 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<GUILayoutOption>()); GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>()); if (GUILayout.Button(UILocale.Get("左箭头"), Array.Empty<GUILayoutOption>())) { CreateArrow(NativeArrow.Direction.Left); } if (GUILayout.Button(UILocale.Get("右箭头"), Array.Empty<GUILayoutOption>())) { CreateArrow(NativeArrow.Direction.Right); } if (GUILayout.Button(UILocale.Get("上箭头"), Array.Empty<GUILayoutOption>())) { CreateArrow(NativeArrow.Direction.Up); } if (GUILayout.Button(UILocale.Get("下箭头"), Array.Empty<GUILayoutOption>())) { 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<GUILayoutOption>()); if (GUILayout.Button(UILocale.Get("创建输入框"), Array.Empty<GUILayoutOption>())) { 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<GUILayoutOption>()); 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<GUILayoutOption>())) { _selectedControl = nativeButton; UpdateEditFieldsFromControl(); } } } private void DrawLocalLabelsList() { GUILayout.Label(UILocale.Get("=== 已创建的标签 ==="), Array.Empty<GUILayoutOption>()); 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<GUILayoutOption>())) { _selectedControl = nativeLabel; UpdateEditFieldsFromControl(); } } } private void DrawLocalSlidersList() { GUILayout.Label(UILocale.Get("=== 已创建的滑块 ==="), Array.Empty<GUILayoutOption>()); 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<GUILayoutOption>())) { _selectedControl = nativeSlider; UpdateEditFieldsFromControl(); } } } private void DrawLocalOptionsList() { GUILayout.Label(UILocale.Get("=== 已创建的选项行 ==="), Array.Empty<GUILayoutOption>()); 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<GUILayoutOption>())) { _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<GUILayoutOption>()); 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<GUILayoutOption>())) { _selectedControl = nativeArrow; UpdateEditFieldsFromControl(); } } } private void DrawLocalInputsList() { GUILayout.Label(UILocale.Get("=== 已创建的输入框 ==="), Array.Empty<GUILayoutOption>()); 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<GUILayoutOption>())) { _selectedControl = nativeInput; UpdateEditFieldsFromControl(); } } } private void DrawExternalControlsTab() { GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>()); 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<GUILayoutOption>()); 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<GUILayoutOption>()); 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<GUILayoutOption>())) { _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<GUILayoutOption>()); 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<GUILayoutOption>())) { _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<GUILayoutOption>()); 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<GUILayoutOption>())) { _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<GUILayoutOption>()); 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<GUILayoutOption>())) { _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<GUILayoutOption>()); 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<GUILayoutOption>())) { _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<GUILayoutOption>()); 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<GUILayoutOption>())) { _selectedControl = nativeInput; UpdateEditFieldsFromControl(); } } } private void DrawUnifiedEditor() { if (_selectedControl == null) { GUILayout.Label(UILocale.Get("未选中任何控件"), Array.Empty<GUILayoutOption>()); 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<GUILayoutOption>()); return; } GUILayout.BeginVertical(GUIStyle.op_Implicit("box"), Array.Empty<GUILayoutOption>()); 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<GUILayoutOption>()); 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<GUILayoutOption>()); return; } GUILayout.Label(string.Format(UILocale.Get("编辑按钮: {0}"), btn.GetTitle()), Array.Empty<GUILayoutOption>()); GUILayout.Label(UILocale.Get("标题:"), Array.Empty<GUILayoutOption>()); _editTitle = GUILayout.TextField(_editTitle, Array.Empty<GUILayoutOption>()); GUILayout.Label(UILocale.Get("描述:"), Array.Empty<GUILayoutOption>()); _editDesc = GUILayout.TextField(_editDesc, Array.Empty<GUILayoutOption>()); GUILayout.Label(UILocale.Get("位置 (x, y):"), Array.Empty<GUILayoutOption>()); string s2 = GUILayout.TextField(_editPos.x.ToString(), Array.Empty<GUILayoutOption>()); string s3 = GUILayout.TextField(_editPos.y.ToString(), Array.Empty<GUILayoutOption>()); float.TryParse(s2, out _editPos.x); float.TryParse(s3, out _editPos.y); GUILayout.Label(UILocale.Get("尺寸 (宽, 高):"), Array.Empty<GUILayoutOption>()); string s4 = GUILayout.TextField(_editSize.x.ToString(), Array.Empty<GUILayoutOption>()); string s5 = GUILayout.TextField(_editSize.y.ToString(), Array.Empty<GUILayoutOption>()); float.TryParse(s4, out _editSize.x); float.TryParse(s5, out _editSize.y); if (btn.HasIcon()) { GUILayout.Label(UILocale.Get("图标偏移 (x, y):"), Array.Empty<GUILayoutOption>()); string s6 = GUILayout.TextField(_editIconOffset.x.ToString(), Array.Empty<GUILayoutOption>()); string s7 = GUILayout.TextField(_editIconOffset.y.ToString(), Array.Empty<GUILayoutOption>()); float.TryParse(s6, out _editIconOffset.x); float.TryParse(s7, out _editIconOffset.y); if (GUILayout.Button(UILocale.Get("应用图标偏移"), Array.Empty<GUILayoutOption>())) { btn.SetIconOffset(_editIconOffset); } } GUILayout.Label(UILocale.Get("标题文字偏移 (x, y):"), Array.Empty<GUILayoutOption>()); string s8 = GUILayout.TextField(_editTitleOffset.x.ToString(), Array.Empty<GUILayoutOption>()); string s9 = GUILayout.TextField(_editTitleOffset.y.ToString(), Array.Empty<GUILayoutOption>()); float.TryParse(s8, out _editTitleOffset.x); float.TryParse(s9, out _editTitleOffset.y); if (GUILayout.Button(UILocale.Get("应用标题偏移"), Array.Empty<GUILayoutOption>())) { btn.SetTitleOffset(_editTitleOffset); } GUILayout.Label(UILocale.Get("描述文字偏移 (x, y):"), Array.Empty<GUILayoutOption>()); string s10 = GUILayout.TextField(_editDescOffset.x.ToString(), Array.Empty<GUILayoutOption>()); string s11 = GUILayout.TextField(_editDescOffset.y.ToString(), Array.Empty<GUILayoutOption>()); float.TryParse(s10, out _editDescOffset.x); float.TryParse(s11, out _editDescOffset.y); if (GUILayout.Button(UILocale.Get("应用描述偏移"), Array.Empty<GUILayoutOption>())) { btn.SetDescOffset(_editDescOffset); } bool flag = btn.IsDraggable(); bool flag2 = GUILayout.Toggle(flag, UILocale.Get("允许拖拽 (按住鼠标左键拖动)"), Array.Empty<GUILayoutOption>()); if (flag2 != flag) { btn.SetDraggable(flag2); } GUILayout.Label(UILocale.Get("设置切换文字序列(逗号分隔):"), Array.Empty<GUILayoutOption>()); _editToggleTextsInput = GUILayout.TextField(_editToggleTextsInput, Array.Empty<GUILayoutOption>()); if (GUILayout.Button(UILocale.Get("应用切换序列"), Array.Empty<GUILayoutOption>())) { 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<GUILayoutOption>())) { 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<GUILayoutOption>())) { 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<GUILayoutOption>()); return; } GUILayout.Label(string.Format(UILocale.Get("编辑标签: {0}"), lbl.GetText()), Array.Empty<GUILayoutOption>()); GUILayout.Label(UILocale.Get("文本:"), Array.Empty<GUILayoutOption>()); _editLabelText = GUILayout.TextField(_editLabelText, Array.Empty<GUILayoutOption>()); GUILayout.Label(UILocale.Get("位置 (x, y):"), Array.Empty<GUILayoutOption>()); string s = GUILayout.TextField(_editPos.x.ToString(), Array.Empty<GUILayoutOption>()); string s2 = GUILayout.TextField(_editPos.y.ToString(), Array.Empty<GUILayoutOption>()); float.TryParse(s, out _editPos.x); float.TryParse(s2, out _editPos.y); GUILayout.Label(UILocale.Get("尺寸 (宽, 高):"), Array.Empty<GUILayoutOption>()); string s3 = GUILayout.TextField(_editSize.x.ToString(), Array.Empty<GUILayoutOption>()); string s4 = GUILayout.TextField(_editSize.y.ToString(), Array.Empty<GUILayoutOption>()); float.TryParse(s3, out _editSize.x); float.TryParse(s4, out _editSize.y); GUILayout.Label(UILocale.Get("字体大小:"), Array.Empty<GUILayoutOption>()); string s5 = GUILayout.TextField(_editFontSize.ToString(), Array.Empty<GUILayoutOption>()); int.TryParse(s5, out _editFontSize); GUILayout.Label(UILocale.Get("颜色 (R,G,B):"), Array.Empty<GUILayoutOption>()); string text = GUILayout.TextField($"{_editColor.r:F2},{_editColor.g:F2},{_editColor.b:F2}", Array.Empty<GUILayoutOption>()); 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<GUILayoutOption>()); if (flag2 != flag) { lbl.SetDraggable(flag2); } if (GUILayout.Button(UILocale.Get("应用更改"), Array.Empty<GUILayoutOption>())) { 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<GUILayoutOption>())) { 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<GUILayoutOption>()); return; } GUILayout.Label(string.Format(UILocale.Get("编辑滑块: {0}"), sld.GetLabel()), Array.Empty<GUILayoutOption>()); GUILayout.Label(UILocale.Get("标签:"), Array.Empty<GUILayoutOption>()); _editSliderLabel = GUILayout.TextField(_editSliderLabel, Array.Empty<GUILayoutOption>()); GUILayout.Label(UILocale.Get("位置 (x, y):"), Array.Empty<GUILayoutOption>()); string s = GUILayout.TextField(_editPos.x.ToString(), Array.Empty<GUILayoutOption>()); string s2 = GUILayout.TextField(_editPos.y.ToString(), Array.Empty<GUILayoutOption>()); float.TryParse(s, out _editPos.x); float.TryParse(s2, out _editPos.y); GUILayout.Label(UILocale.Get("尺寸 (宽, 高):"), Array.Empty<GUILayoutOption>()); string s3 = GUILayout.TextField(_editSize.x.ToString(), Array.Empty<GUILayoutOption>()); string s4 = GUILayout.TextField(_editSize.y.ToString(), Array.Empty<GUILayoutOption>()); float.TryParse(s3, out _editSize.x); float.TryParse(s4, out _editSize.y); GUILayout.Label(UILocale.Get("滑块 X 偏移:"), Array.Empty<GUILayoutOption>()); string s5 = GUILayout.TextField(_editSliderXOffset.ToString(), Array.Empty<GUILayoutOption>()); float.TryParse(s5, out _editSliderXOffset); GUILayout.Label(UILocale.Get("滑块宽度 (0=原生):"), Array.Empty<GUILayoutOption>()); string s6 = GUILayout.TextField(_editSliderWidth.ToString(), Array.Empty<GUILayoutOption>()); float.TryParse(s6, out _editSliderWidth); GUILayout.Label(UILocale.Get("标签 X 偏移:"), Array.Empty<GUILayoutOption>()); string s7 = GUILayout.TextField(_editLabelXOffset.ToString(), Array.Empty<GUILayoutOption>()); float.TryParse(s7, out _editLabelXOffset); GUILayout.Label(UILocale.Get("数值 X 偏移:"), Array.Empty<GUILayoutOption>()); string s8 = GUILayout.TextField(_editValueXOffset.ToString(), Array.Empty<GUILayoutOption>()); float.TryParse(s8, out _editValueXOffset); GUILayout.Label(string.Format(UILocale.Get("最小值: {0}"), _editSliderMin), Array.Empty<GUILayoutOption>()); string s9 = GUILayout.TextField(_editSliderMin.ToString(), Array.Empty<GUILayoutOption>()); float.TryParse(s9, out _editSliderMin); GUILayout.Label(string.Format(UILocale.Get("最大值: {0}"), _editSliderMax), Array.Empty<GUILayoutOption>()); string s10 = GUILayout.TextField(_editSliderMax.ToString(), Array.Empty<GUILayoutOption>()); float.TryParse(s10, out _editSliderMax); GUILayout.Label(string.Format(UILocale.Get("当前值: {0}"), _editSliderValue), Array.Empty<GUILayoutOption>()); string s11 = GUILayout.TextField(_editSliderValue.ToString(), Array.Empty<GUILayoutOption>()); float.TryParse(s11, out _editSliderValue); _editSliderWhole = GUILayout.Toggle(_editSliderWhole, UILocale.Get("整数步进"), Array.Empty<GUILayoutOption>()); bool flag = sld.IsDraggable(); bool flag2 = GUILayout.Toggle(flag, UILocale.Get("允许拖拽 (按住鼠标左键拖动)"), Array.Empty<GUILayoutOption>()); if (flag2 != flag) { sld.SetDraggable(flag2); } if (GUILayout.Button(UILocale.Get("应用更改"), Array.Empty<GUILayoutOption>())) { 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<GUILayoutOption>())) { 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<GUILayoutOption>()); return; } GUILayout.Label(string.Format(UILocale.Get("编辑选项行: {0}"), opt.GetLabel()), Array.Empty<GUILayoutOption>()); GUILayout.Label(UILocale.Get("标签:"), Array.Empty<GUILayoutOption>()); _editOptionLabel = GUILayout.TextField(_editOptionLabel, Array.Empty<GUILayoutOption>()); GUILayout.Label(UILocale.Get("描述:"), Array.Empty<GUILayoutOption>()); _editOptionDesc = GUILayout.TextField(_editOptionDesc, Array.Empty<GUILayoutOption>()); GUILayout.Label(UILocale.Get("位置 (x, y):"), Array.Empty<GUILayoutOption>()); string s2 = GUILayout.TextField(_editPos.x.ToString(), Array.Empty<GUILayoutOption>()); string s3 = GUILayout.TextField(_editPos.y.ToString(), Array.Empty<GUILayoutOption>()); float.TryParse(s2, out _editPos.x); float.TryParse(s3, out _editPos.y); GUILayout.Label(UILocale.Get("尺寸 (宽, 高):"), Array.Empty<GUILayoutOption>()); string s4 = GUILayout.TextField(_editSize.x.ToString(), Array.Empty<GUILayoutOption>()); string s5 = GUILayout.TextField(_editSize.y.ToString(), Array.Empty<GUILayoutOption>()); float.TryParse(s4, out _editSize.x); float.TryParse(s5, out _editSize.y); GUILayout.Label(UILocale.Get("选项列表 (用逗号分隔):"), Array.Empty<GUILayoutOption>()); string text = ((_editOptionOptions != null) ? string.Join(",", _editOptionOptions) : ""); string text2 = GUILayout.TextField(text, Array.Empty<GUILayoutOption>()); 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<GUILayoutOption>()); GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>()); if (GUILayout.Button(UILocale.Get("上一个"), Array.Empty<GUILayoutOption>())) { _editOptionIndex = (_editOptionIndex - 1 + _editOptionOptions.Length) % _editOptionOptions.Length; } if (GUILayout.Button(UILocale.Get("下一个"), Array.Empty<GUILayoutOption>())) { _editOptionIndex = (_editOptionIndex + 1) % _editOptionOptions.Length; } GUILayout.EndHorizontal(); } bool flag = opt.IsDraggable(); bool flag2 = GUILayout.Toggle(flag, UILocale.Get("允许拖拽 (按住鼠标左键拖动)"), Array.Empty<GUILayoutOption>()); if (flag2 != flag) { opt.SetDraggable(flag2); } if (GUILayout.Button(UILocale.Get("应用更改"), Array.Empty<GUILayoutOption>())) { 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<GUILayoutOption>())) { 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<GUILayoutOption>()); return; } GUILayout.Label(string.Format(UILocale.Get("编辑箭头: {0}"), arr.GetDirection()), Array.Empty<GUILayoutOption>()); GUILayout.Label(UILocale.Get("位置 (x, y):"), Array.Empty<GUILayoutOption>()); string s = GUILayout.TextField(_editPos.x.ToString(), Array.Empty<GUILayoutOption>()); string s2 = GUILayout.TextField(_editPos.y.ToString(), Array.Empty<GUILayoutOption>()); float.TryParse(s, out _editPos.x); float.TryParse(s2, out _editPos.y); GUILayout.Label(UILocale.Get("尺寸 (宽, 高):"), Array.Empty<GUILayoutOption>()); string s3 = GUILayout.TextField(_editSize.x.ToString(), Array.Empty<GUILayoutOption>()); string s4 = GUILayout.TextField(_editSize.y.ToString(), Array.Empty<GUILayoutOption>()); float.TryParse(s3, out _editSize.x); float.TryParse(s4, out _editSize.y); _editArrowClickable = GUILayout.Toggle(_editArrowClickable, UILocale.Get("可点击 (添加按钮)"), Array.Empty<GUILayoutOption>()); _editArrowDraggable = GUILayout.Toggle(_editArrowDraggable, UILocale.Get("允许拖拽 (按住鼠标左键拖动)"), Array.Empty<GUILayoutOption>()); if (GUILayout.Button(UILocale.Get("应用更改"), Array.Empty<GUILayoutOption>())) { 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<GUILayoutOption>())) { 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<GUILayoutOption>()); return; } GUILayout.Label(UILocale.Get("编辑输入框"), Array.Empty<GUILayoutOption>()); GUILayout.Label(UILocale.Get("文本内容:"), Array.Empty<GUILayoutOption>()); _editInputText = GUILayout.TextField(_editInputText, Array.Empty<GUILayoutOption>()); GUILayout.Label(UILocale.Get("占位符:"), Array.Empty<GUILayoutOption>()); _editInputPlaceholder = GUILayout.TextField(_editInputPlaceholder, Array.Empty<GUILayoutOption>()); GUILayout.Label(UILocale.Get("位置 (x, y):"), Array.Empty<GUILayoutOption>()); string s = GUILayout.TextField(_editPos.x.ToString(), Array.Empty<GUILayoutOption>()); string s2 = GUILayout.TextField(_editPos.y.ToString(), Array.Empty<GUILayoutOption>()); float.TryParse(s, out _editPos.x); float.TryParse(s2, out _editPos.y); GUILayout.Label(UILocale.Get("尺寸 (宽, 高):"), Array.Empty<GUILayoutOption>()); string s3 = GUILayout.TextField(_editSize.x.ToString(), Array.Empty<GUILayoutOption>()); string s4 = GUILayout.TextField(_editSize.y.ToString(), Array.Empty<GUILayoutOption>()); 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<GUILayoutOption>()); if (flag2 != flag) { inp.SetDraggable(flag2); } if (GUILayout.Button(UILocale.Get("应用更改"), Array.Empty<GUILayoutOption>())) { 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<GUILayoutOption>())) { 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<GUILayoutOption>()); 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<GUILayoutOption>())) { _selectedPage = nativePage; RefreshPageControlsCache(); } } if (_selectedPage == null) { return; } GUILayout.Label(string.Format(UILocale.Get("当前页面: {0} 包含控件: {1}"), ((Object)_selectedPage.gameObject).name, _pageControlsCache.Count), Array.Empty<GUILayoutOption>()); GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>()); if (GUILayout.Button(UILocale.Get("保存页面配置"), Array.Empty<GUILayoutOption>())) { SavePageConfig(); } if (GUILayout.Button(UILocale.Get("加载页面配置"), Array.Empty<GUILayoutOption>())) { LoadPageConfig(); } if (GUILayout.Button(UILocale.Get("刷新"), Array.Empty<GUILayoutOption>())) { RefreshPageControlsCache(); } GUILayout.EndHorizontal(); GUILayout.Label(UILocale.Get("页面内控件列表:"), Array.Empty<GUILayoutOption>()); 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<GUILayoutOption>()); } } private void RefreshPageControlsCache() { if (_selectedPage != null) { _pageControlsCache.Clear(); AddIfChild<NativeButton>(NativeButton.AllInstances); AddIfChild<NativeLabel>(NativeLabel.AllInstances); AddIfChild<NativeSlider>(NativeSlider.AllInstances); AddIfChild<NativeOption>(NativeOption.AllInstances); AddIfChild<NativeArrow>(NativeArrow.AllInstances); AddIfChild<NativeInput>(NativeInput.AllInstances); } void AddIfChild<T>(List<T> 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<ConfigData>(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<NativeButton>(); 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<NativeLabel>(); 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<NativeSlider>(); 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<NativeOption>(); 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<NativeArrow>(); 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<NativeInput>(); 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<T>(List<T> list) where T : class { if (list == null) { return; } Dictionary<string, int> dictionary = new Dictionary<string, int>(); List<GameObject> list2 = new List<GameObject>(); 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<string, int> dictionary2 = new Dictionary<string, int>(); 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<T>(List<T> 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<ConfigData>(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)) {