using System; using System.Collections.Generic; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using System.Text; using BepInEx; using BepInEx.Configuration; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: AssemblyTitle("MoreUIPanel")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("MoreUIPanel")] [assembly: AssemblyCopyright("Copyright © 2026")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("61df5c61-4524-4ad1-bcae-08468af2cb03")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")] [assembly: AssemblyVersion("1.0.0.0")] namespace MoreUIPanel; [BepInPlugin("cn_xc.MoreUIPanel", "MoreUIPanel", "0.1.0")] public class Plugin : BaseUnityPlugin { private static readonly Dictionary> _customLines = new Dictionary>(); private ConfigEntry _enabled; private ConfigEntry _fontSize; private ConfigEntry _offsetX; private ConfigEntry _offsetY; private ConfigEntry _opacityPercent; private ConfigEntry _refreshInterval; private float _refreshTimer; private string _displayText = string.Empty; private readonly StringBuilder _builder = new StringBuilder(256); private GUIStyle _style; public static bool Visible { get; set; } = true; public static void RegisterLine(string key, Func textProvider) { if (!string.IsNullOrEmpty(key) && textProvider != null) { lock (_customLines) { _customLines[key] = textProvider; } } } public static void UnregisterLine(string key) { if (!string.IsNullOrEmpty(key)) { lock (_customLines) { _customLines.Remove(key); } } } private void Awake() { //IL_0048: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Expected O, but got Unknown //IL_0082: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Expected O, but got Unknown //IL_00bc: Unknown result type (might be due to invalid IL or missing references) //IL_00c6: Expected O, but got Unknown //IL_00f0: Unknown result type (might be due to invalid IL or missing references) //IL_00fa: Expected O, but got Unknown //IL_012e: Unknown result type (might be due to invalid IL or missing references) //IL_0138: Expected O, but got Unknown _enabled = ((BaseUnityPlugin)this).Config.Bind("General", "Enabled", true, "启用面板 / Enable the panel"); _fontSize = ((BaseUnityPlugin)this).Config.Bind("General", "FontSize", 20, new ConfigDescription("字体大小 (10-28) / Font size", (AcceptableValueBase)(object)new AcceptableValueRange(10, 28), Array.Empty())); _offsetX = ((BaseUnityPlugin)this).Config.Bind("General", "OffsetX", 0, new ConfigDescription("水平偏移 (-600~600) / Horizontal offset", (AcceptableValueBase)(object)new AcceptableValueRange(-600, 600), Array.Empty())); _offsetY = ((BaseUnityPlugin)this).Config.Bind("General", "OffsetY", 0, new ConfigDescription("垂直偏移 (-600~600) / Vertical offset", (AcceptableValueBase)(object)new AcceptableValueRange(-600, 600), Array.Empty())); _opacityPercent = ((BaseUnityPlugin)this).Config.Bind("General", "OpacityPercent", 70, new ConfigDescription("文字透明度百分比 (1-100) / Text opacity percentage", (AcceptableValueBase)(object)new AcceptableValueRange(1, 100), Array.Empty())); _refreshInterval = ((BaseUnityPlugin)this).Config.Bind("General", "RefreshIntervalSeconds", 1.5f, new ConfigDescription("刷新间隔 (0.1~10秒) / Refresh interval", (AcceptableValueBase)(object)new AcceptableValueRange(0.1f, 10f), Array.Empty())); ((BaseUnityPlugin)this).Logger.LogInfo((object)"MoreUIPanel loaded — use Plugin.RegisterLine(key, provider) to add custom lines."); } private void Update() { if (_enabled.Value) { _refreshTimer += Time.deltaTime; if (_refreshTimer >= Mathf.Max(0.1f, _refreshInterval.Value)) { _refreshTimer = 0f; RefreshDisplayText(); } } } private void RefreshDisplayText() { _builder.Clear(); lock (_customLines) { foreach (KeyValuePair> customLine in _customLines) { try { string value = customLine.Value?.Invoke(); if (!string.IsNullOrWhiteSpace(value)) { if (_builder.Length > 0) { _builder.Append('\n'); } _builder.Append(value); } } catch { } } } _displayText = _builder.ToString(); } private void OnGUI() { //IL_00c1: Unknown result type (might be due to invalid IL or missing references) //IL_00fc: Unknown result type (might be due to invalid IL or missing references) //IL_010b: Expected O, but got Unknown //IL_0123: 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_004e: 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_005e: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Unknown result type (might be due to invalid IL or missing references) //IL_0073: Expected O, but got Unknown if (_enabled.Value && Visible && !string.IsNullOrEmpty(_displayText)) { if (_style == null) { _style = new GUIStyle(GUI.skin.label) { fontStyle = (FontStyle)1, alignment = (TextAnchor)6, wordWrap = false, richText = true }; } _style.fontSize = _fontSize.Value; float num = (float)Mathf.Clamp(_opacityPercent.Value, 1, 100) / 100f; _style.normal.textColor = new Color(1f, 1f, 1f, num); int num2 = 10 + _offsetX.Value; int num3 = Screen.height - 10 + _offsetY.Value; float num4 = _style.CalcHeight(new GUIContent(_displayText), 400f); float num5 = 400f; Rect val = default(Rect); ((Rect)(ref val))..ctor((float)num2, (float)num3 - num4, num5, num4); GUI.Label(val, _displayText, _style); } } }