Decompiled source of JukeboxLimbusCompany v3.0.0
BepInEx/plugins/Claude-JukeboxLimbusCompany/JukeboxLimbusCompany.dll
Decompiled a day 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.Globalization; using System.IO; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Text; using System.Text.RegularExpressions; using BepInEx; using BepInEx.Bootstrap; using BepInEx.Logging; using Jukebox.Components; using Jukebox.LimbusCompany; using Jukebox.UI.Subtitles; using Jukebox.UI.Windows; using JukeboxCore.Playback; using JukeboxCore.Songs.Models; using JukeboxCore.Subtitles; using JukeboxCore.Utils; using Microsoft.CodeAnalysis; using Newtonsoft.Json; using Newtonsoft.Json.Linq; using TMPro; using TagLib; using UnityEngine; using UnityEngine.AddressableAssets; using UnityEngine.EventSystems; using UnityEngine.Events; using UnityEngine.InputSystem; using UnityEngine.InputSystem.Controls; using UnityEngine.InputSystem.UI; using UnityEngine.InputSystem.Utilities; using UnityEngine.Networking; using UnityEngine.SceneManagement; using UnityEngine.TextCore; using UnityEngine.UI; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyVersion("0.0.0.0")] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [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 Jukebox.LimbusCompany { public static class LimbusCompanyFonts { private static TMP_FontAsset _cached; private static TMP_FontAsset _latin; public static TMP_FontAsset ResolveLatin() { //IL_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00ac: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)_latin != (Object)null) { return _latin; } TMP_FontAsset val = null; TMP_FontAsset val2 = null; TMP_FontAsset[] array = Resources.FindObjectsOfTypeAll<TMP_FontAsset>(); foreach (TMP_FontAsset val3 in array) { if (!((Object)(object)val3 == (Object)null)) { if (val == null) { val = val3; } string text = ((Object)val3).name ?? string.Empty; if (text.IndexOf("vcr", StringComparison.OrdinalIgnoreCase) >= 0 || text.IndexOf("ultrakill", StringComparison.OrdinalIgnoreCase) >= 0 || text.IndexOf("osd", StringComparison.OrdinalIgnoreCase) >= 0) { val2 = val3; break; } } } if ((Object)(object)val2 != (Object)null) { _latin = val2; return _latin; } try { TMP_FontAsset val4 = Addressables.LoadAssetAsync<TMP_FontAsset>((object)"Assets/Jukebox/Fonts/VCR_OSD_MONO.asset").WaitForCompletion(); if ((Object)(object)val4 != (Object)null) { _latin = val4; ManualLogSource log = LimbusCompanyLyrics.Log; if (log != null) { log.LogInfo((object)"LimbusCompany 英文字体: VCR_OSD_MONO (ULTRAKILL)"); } return _latin; } } catch (Exception ex) { ManualLogSource log2 = LimbusCompanyLyrics.Log; if (log2 != null) { log2.LogWarning((object)("LimbusCompany 加载 ULTRAKILL 字体失败: " + ex.Message)); } } SubtitlesPanel val5 = Object.FindObjectOfType<SubtitlesPanel>(); if ((Object)(object)val5 != (Object)null && (Object)(object)val5.text != (Object)null && (Object)(object)val5.text.font != (Object)null) { _latin = val5.text.font; return _latin; } _latin = val ?? TMP_Settings.defaultFontAsset; return _latin; } public static TMP_FontAsset MenuFont(string text) { if (!IsCjkText(text)) { return ResolveLatin(); } return Resolve(); } public static bool IsCjkText(string text) { if (string.IsNullOrEmpty(text)) { return false; } foreach (char c in text) { if ((c >= '⺀' && c <= '鿿') || (c >= '가' && c <= '\ud7af') || (c >= '豈' && c <= '\ufaff') || (c >= '\uff00' && c <= '\uffef')) { return true; } } return false; } public static TMP_FontAsset Resolve() { if ((Object)(object)_cached != (Object)null) { return _cached; } TMP_FontAsset val = FindGreycsontFont(); if ((Object)(object)val != (Object)null) { _cached = val; return _cached; } SubtitlesPanel val2 = Object.FindObjectOfType<SubtitlesPanel>(); if ((Object)(object)val2 != (Object)null && (Object)(object)val2.text != (Object)null && (Object)(object)val2.text.font != (Object)null) { _cached = val2.text.font; } if ((Object)(object)_cached == (Object)null && (Object)(object)TMP_Settings.defaultFontAsset != (Object)null && HasAsianGlyphs(TMP_Settings.defaultFontAsset)) { _cached = TMP_Settings.defaultFontAsset; } if ((Object)(object)_cached == (Object)null) { _cached = CreateSystemFont(); } if ((Object)(object)_cached == (Object)null) { _cached = TMP_Settings.defaultFontAsset; } return _cached; } private static TMP_FontAsset FindGreycsontFont() { //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) TMP_FontAsset val = null; TMP_FontAsset val2 = null; TMP_FontAsset val3 = null; try { TMP_FontAsset[] array = Resources.FindObjectsOfTypeAll<TMP_FontAsset>(); foreach (TMP_FontAsset val4 in array) { if ((Object)(object)val4 == (Object)null) { continue; } string text = ((Object)val4).name ?? string.Empty; string text2 = string.Empty; try { FaceInfo faceInfo = val4.faceInfo; text2 = ((FaceInfo)(ref faceInfo)).familyName ?? string.Empty; } catch (Exception) { } string text3 = (text + " " + text2).ToLowerInvariant(); if (text3.Contains("fusion pixel")) { if (val == null) { val = val4; } } else if (text3.Contains("unifont")) { if (val2 == null) { val2 = val4; } } else if ((text3.Contains("font1") || text3.Contains("font2")) && val3 == null) { val3 = val4; } } } catch (Exception ex2) { ManualLogSource log = LimbusCompanyLyrics.Log; if (log != null) { log.LogWarning((object)("查找 greycsont 字体失败: " + ex2.Message)); } } TMP_FontAsset val5 = val ?? val2 ?? val3; if ((Object)(object)val != (Object)null && (Object)(object)val2 != (Object)null && (Object)(object)val != (Object)(object)val2) { try { if (val.fallbackFontAssetTable == null) { val.fallbackFontAssetTable = new List<TMP_FontAsset>(); } if (!val.fallbackFontAssetTable.Contains(val2)) { val.fallbackFontAssetTable.Add(val2); } } catch (Exception) { } } if ((Object)(object)val5 != (Object)null) { ManualLogSource log2 = LimbusCompanyLyrics.Log; if (log2 != null) { log2.LogInfo((object)("LimbusCompany 非英文字体: greycsont " + ((Object)val5).name)); } } return val5; } private static TMP_FontAsset CreateSystemFont() { LimbusCompanyLyricsSettings settings = LimbusCompanyLyrics.Settings; string[] installed; try { installed = Font.GetOSInstalledFontNames(); } catch (Exception) { installed = Array.Empty<string>(); } string[] obj = new string[19] { settings?.FontFamily, "Yu Gothic UI", "Yu Gothic", "Microsoft YaHei UI", "Microsoft YaHei", "Noto Sans JP", "Noto Sans SC", "Noto Sans KR", "Noto Sans CJK JP", "Noto Sans CJK SC", "Noto Sans CJK KR", "Malgun Gothic", "等线 Light", "等线", "DengXian", "MS Gothic", "Meiryo", "Arial Unicode MS", "Segoe UI" }; TMP_FontAsset val = null; string[] array = obj; foreach (string text in array) { if (string.IsNullOrEmpty(text) || !ContainsName(installed, text)) { continue; } try { Font val2 = Font.CreateDynamicFontFromOSFont(text, 96); if ((Object)(object)val2 == (Object)null) { continue; } TMP_FontAsset val3 = TMP_FontAsset.CreateFontAsset(val2); if (!((Object)(object)val3 == (Object)null)) { ((Object)val3).name = "JukeboxLimbusCompany-" + text; if (HasAsianGlyphs(val3)) { LimbusCompanyLyrics.Log.LogInfo((object)("LimbusCompany 字体: " + text)); return val3; } if (val == null) { val = val3; } } } catch (Exception ex2) { LimbusCompanyLyrics.Log.LogWarning((object)("LimbusCompany 加载系统字体失败 (" + text + "): " + ex2.Message)); } } return val; } private static bool ContainsName(string[] installed, string name) { for (int i = 0; i < installed.Length; i++) { if (string.Equals(installed[i], name, StringComparison.OrdinalIgnoreCase)) { return true; } } return false; } private static bool HasAsianGlyphs(TMP_FontAsset font) { try { return font.HasCharacter('あ', true, false) && font.HasCharacter('中', true, false); } catch (Exception) { return false; } } } public class LimbusCompanyLocalization : MonoBehaviour { private static readonly Color Gold = new Color(0.776f, 0.635f, 0.29f, 1f); private static readonly Color Bone = new Color(0.937f, 0.902f, 0.812f, 1f); private static readonly Color PanelBg = new Color(0.04f, 0.04f, 0.05f, 0.97f); private JukeboxMenuWindow _menu; private RectTransform _canvas; private GameObject _languageButton; private TextMeshProUGUI _languageText; private GameObject _settingsButton; private TextMeshProUGUI _settingsText; private GameObject _panel; private bool _panelOpen; private bool _rebuildPending; private int _page; private int _motionSubPage; private int _presetPage; private TextMeshProUGUI _presetStatusText; private TMP_InputField _presetNameInput; private const int PresetsPerPage = 8; private RectTransform _standaloneHost; private float _nextMenuScan; private bool _failed; private static readonly string[] Modes = new string[5] { "strict", "auto", "mirror", "below", "custom" }; private static readonly string[] Anchors = new string[10] { "random", "top-left", "top", "top-right", "left", "center", "right", "bottom-left", "bottom", "bottom-right" }; private static readonly string[] GradientModes = new string[3] { "range", "fixed2", "multi" }; private static readonly string[] VisualizerPositions = new string[5] { "bottom", "top", "left", "right", "edge" }; private static LimbusCompanyLyricsSettings S => LimbusCompanyLyrics.Settings; public bool StandaloneOpen { get { if ((Object)(object)_standaloneHost != (Object)null) { return _panelOpen; } return false; } } private void Update() { if (_failed) { return; } try { if ((Object)(object)_standaloneHost != (Object)null) { if (_rebuildPending) { _rebuildPending = false; if (_panelOpen) { RebuildPanel(); } } return; } if ((Object)(object)_menu == (Object)null) { if (Time.unscaledTime < _nextMenuScan) { return; } _nextMenuScan = Time.unscaledTime + 1f; EnsureMenu(); } if ((Object)(object)_canvas == (Object)null) { return; } EnsureButtons(); UpdateVisibility(); if (_rebuildPending) { _rebuildPending = false; if (_panelOpen) { RebuildPanel(); } } UpdateButtonLabels(); } catch (Exception arg) { _failed = true; LimbusCompanyLyrics.Log.LogError((object)$"LimbusCompany UI 异常: {arg}"); } } private static bool IsChinese() { LimbusCompanyLyricsSettings settings = LimbusCompanyLyrics.Settings; if (settings != null) { return settings.Language == "zh"; } return false; } private static string L(string en, string zh) { if (!IsChinese()) { return en; } return zh; } private static TMP_FontAsset MenuFont(string text) { return LimbusCompanyFonts.MenuFont(text); } private void EnsureMenu() { //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)_menu != (Object)null) { return; } JukeboxMenuWindow[] array = Resources.FindObjectsOfTypeAll<JukeboxMenuWindow>(); foreach (JukeboxMenuWindow val in array) { if ((Object)(object)val == (Object)null) { continue; } Scene scene = ((Component)val).gameObject.scene; if (((Scene)(ref scene)).IsValid()) { _menu = val; ref RectTransform canvas = ref _canvas; Transform parent = ((Component)val).transform.parent; canvas = (RectTransform)(object)((parent is RectTransform) ? parent : null); if ((Object)(object)_canvas == (Object)null) { Canvas componentInParent = ((Component)val).GetComponentInParent<Canvas>(); _canvas = (RectTransform)(((Object)(object)componentInParent != (Object)null) ? /*isinst with value type is only supported in some contexts*/: null); } break; } } } private GameObject CreateButton(string name, Vector2 position, Vector2 size, Action onClick, out TextMeshProUGUI text) { //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Expected O, but got Unknown //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Unknown result type (might be due to invalid IL or missing references) //IL_0083: 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_00a2: Unknown result type (might be due to invalid IL or missing references) //IL_00b6: Unknown result type (might be due to invalid IL or missing references) //IL_00d9: Unknown result type (might be due to invalid IL or missing references) //IL_00e3: Expected O, but got Unknown //IL_00fb: Unknown result type (might be due to invalid IL or missing references) //IL_0102: Expected O, but got Unknown //IL_0112: Unknown result type (might be due to invalid IL or missing references) //IL_011d: Unknown result type (might be due to invalid IL or missing references) //IL_0128: Unknown result type (might be due to invalid IL or missing references) //IL_0132: Unknown result type (might be due to invalid IL or missing references) //IL_0190: Unknown result type (might be due to invalid IL or missing references) GameObject val = new GameObject(name, new Type[1] { typeof(RectTransform) }); RectTransform component = val.GetComponent<RectTransform>(); ((Transform)component).SetParent((Transform)(object)_canvas, false); component.anchorMin = new Vector2(1f, 1f); component.anchorMax = new Vector2(1f, 1f); component.pivot = new Vector2(1f, 1f); component.anchoredPosition = position; component.sizeDelta = size; Image val2 = val.AddComponent<Image>(); ((Graphic)val2).color = PanelBg; Outline obj = val.AddComponent<Outline>(); ((Shadow)obj).effectColor = Gold; ((Shadow)obj).effectDistance = new Vector2(1f, -1f); Button obj2 = val.AddComponent<Button>(); ((Selectable)obj2).targetGraphic = (Graphic)(object)val2; ((UnityEvent)obj2.onClick).AddListener((UnityAction)delegate { onClick(); }); GameObject val3 = new GameObject("Label", new Type[1] { typeof(RectTransform) }); RectTransform component2 = val3.GetComponent<RectTransform>(); ((Transform)component2).SetParent((Transform)(object)component, false); component2.anchorMin = Vector2.zero; component2.anchorMax = Vector2.one; component2.offsetMin = Vector2.zero; component2.offsetMax = Vector2.zero; text = val3.AddComponent<TextMeshProUGUI>(); ((TMP_Text)text).font = MenuFont(string.Empty); ((TMP_Text)text).fontSize = 15f; ((TMP_Text)text).alignment = (TextAlignmentOptions)514; ((TMP_Text)text).enableWordWrapping = false; ((TMP_Text)text).overflowMode = (TextOverflowModes)0; ((Graphic)text).raycastTarget = false; ((Graphic)text).color = Bone; return val; } private void EnsureButtons() { //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_008d: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)_languageButton == (Object)null) { _languageButton = CreateButton("LimbusLanguageButton", new Vector2(-16f, -16f), new Vector2(200f, 34f), ToggleLanguage, out _languageText); _languageButton.transform.SetAsLastSibling(); } if ((Object)(object)_settingsButton == (Object)null) { _settingsButton = CreateButton("LimbusSettingsButton", new Vector2(-224f, -16f), new Vector2(150f, 34f), TogglePanel, out _settingsText); _settingsButton.transform.SetAsLastSibling(); } } private void UpdateVisibility() { bool flag = (Object)(object)_menu != (Object)null && ((JukeboxWindow)_menu).IsOpened(); if ((Object)(object)_languageButton != (Object)null && _languageButton.activeSelf != flag) { _languageButton.SetActive(flag); } if ((Object)(object)_settingsButton != (Object)null && _settingsButton.activeSelf != flag) { _settingsButton.SetActive(flag); } if (!flag) { _panelOpen = false; } if ((Object)(object)_panel != (Object)null && _panel.activeSelf != (_panelOpen && flag)) { _panel.SetActive(_panelOpen && flag); } } private void UpdateButtonLabels() { if ((Object)(object)_languageText != (Object)null) { string text = (IsChinese() ? "LANGUAGE: 中文" : "LANGUAGE: ENGLISH"); if (((TMP_Text)_languageText).text != text) { ((TMP_Text)_languageText).font = MenuFont(text); ((TMP_Text)_languageText).text = text; } } if ((Object)(object)_settingsText != (Object)null) { string text2 = L("SETTINGS", "设置"); if (((TMP_Text)_settingsText).text != text2) { ((TMP_Text)_settingsText).font = MenuFont(text2); ((TMP_Text)_settingsText).text = text2; } } } private void ToggleLanguage() { LimbusCompanyLyrics.SetLanguage(IsChinese() ? "en" : "zh"); _rebuildPending = _panelOpen; UpdateButtonLabels(); } public void OpenStandalone(RectTransform host) { if (!((Object)(object)host == (Object)null)) { _standaloneHost = host; _panelOpen = true; RebuildPanel(); } } public void CloseStandalone() { _standaloneHost = null; _panelOpen = false; _rebuildPending = false; if ((Object)(object)_panel != (Object)null) { if (Object.op_Implicit((Object)(object)_panel)) { _panel.SetActive(false); } Object.Destroy((Object)(object)_panel); _panel = null; } } public void RefreshStandalone() { if ((Object)(object)_standaloneHost != (Object)null && _panelOpen) { RebuildPanel(); } } private void TogglePanel() { _panelOpen = !_panelOpen; if (_panelOpen) { RebuildPanel(); } else if ((Object)(object)_panel != (Object)null) { _panel.SetActive(false); } } private void RebuildPanel() { if ((Object)(object)_panel != (Object)null) { _panel.SetActive(false); Object.Destroy((Object)(object)_panel); } _panel = BuildPanel(); if (!((Object)(object)_panel == (Object)null)) { _panel.transform.SetAsLastSibling(); _panel.SetActive(true); } } private void SwitchPage(int page) { _page = page; _motionSubPage = 0; RebuildPanel(); } private GameObject BuildPanel() { //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_0089: Unknown result type (might be due to invalid IL or missing references) //IL_0094: Unknown result type (might be due to invalid IL or missing references) //IL_00a9: Unknown result type (might be due to invalid IL or missing references) //IL_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00b9: Unknown result type (might be due to invalid IL or missing references) //IL_00c3: Unknown result type (might be due to invalid IL or missing references) //IL_00ca: Unknown result type (might be due to invalid IL or missing references) //IL_00de: Unknown result type (might be due to invalid IL or missing references) //IL_0107: Unknown result type (might be due to invalid IL or missing references) //IL_0116: Unknown result type (might be due to invalid IL or missing references) //IL_013f: Unknown result type (might be due to invalid IL or missing references) //IL_014e: Unknown result type (might be due to invalid IL or missing references) //IL_0182: Unknown result type (might be due to invalid IL or missing references) //IL_0191: Unknown result type (might be due to invalid IL or missing references) //IL_01c7: Unknown result type (might be due to invalid IL or missing references) //IL_01d6: Unknown result type (might be due to invalid IL or missing references) //IL_020c: Unknown result type (might be due to invalid IL or missing references) //IL_021b: Unknown result type (might be due to invalid IL or missing references) //IL_0251: Unknown result type (might be due to invalid IL or missing references) //IL_0260: Unknown result type (might be due to invalid IL or missing references) //IL_0296: Unknown result type (might be due to invalid IL or missing references) //IL_02a5: Unknown result type (might be due to invalid IL or missing references) //IL_02db: Unknown result type (might be due to invalid IL or missing references) //IL_02ea: Unknown result type (might be due to invalid IL or missing references) //IL_15f6: Unknown result type (might be due to invalid IL or missing references) //IL_1605: Unknown result type (might be due to invalid IL or missing references) //IL_163b: Unknown result type (might be due to invalid IL or missing references) //IL_164a: Unknown result type (might be due to invalid IL or missing references) //IL_1661: Expected O, but got Unknown //IL_11d7: Unknown result type (might be due to invalid IL or missing references) //IL_11e6: Unknown result type (might be due to invalid IL or missing references) //IL_0bc2: Unknown result type (might be due to invalid IL or missing references) //IL_0bd1: Unknown result type (might be due to invalid IL or missing references) //IL_0f86: Unknown result type (might be due to invalid IL or missing references) //IL_0f95: Unknown result type (might be due to invalid IL or missing references) //IL_15a4: Unknown result type (might be due to invalid IL or missing references) //IL_15b3: Unknown result type (might be due to invalid IL or missing references) RectTransform val = (((Object)(object)_standaloneHost != (Object)null) ? _standaloneHost : _canvas); if ((Object)(object)val == (Object)null) { return null; } GameObject val2 = new GameObject("LimbusSettingsPanel", new Type[1] { typeof(RectTransform) }); RectTransform component = val2.GetComponent<RectTransform>(); ((Transform)component).SetParent((Transform)(object)val, false); component.anchorMin = new Vector2(0.5f, 0.5f); component.anchorMax = new Vector2(0.5f, 0.5f); component.pivot = new Vector2(0.5f, 0.5f); component.anchoredPosition = Vector2.zero; component.sizeDelta = new Vector2(560f, 660f); ((Graphic)val2.AddComponent<Image>()).color = PanelBg; Outline obj = val2.AddComponent<Outline>(); ((Shadow)obj).effectColor = Gold; ((Shadow)obj).effectDistance = new Vector2(1.5f, -1.5f); CreateLabel(component, "Title", L("LYRICS SETTINGS", "歌词设置"), new Vector2(0f, 296f), new Vector2(500f, 40f), 24f, (TextAlignmentOptions)514); CreateLabel(component, "Subtitle", "Jukebox LimbusCompany v2.0.0", new Vector2(0f, 270f), new Vector2(500f, 20f), 13f, (TextAlignmentOptions)514); CreateButtonAt(component, "TabLayout", L("LAYOUT", "位置"), new Vector2(-205f, 236f), new Vector2(80f, 28f), delegate { SwitchPage(0); }); CreateButtonAt(component, "TabText", L("TEXT", "文字"), new Vector2(-123f, 236f), new Vector2(80f, 28f), delegate { SwitchPage(1); }); CreateButtonAt(component, "TabMotion", L("MOTION", "动态"), new Vector2(-41f, 236f), new Vector2(80f, 28f), delegate { SwitchPage(2); }); CreateButtonAt(component, "TabTrans", L("TRANS", "翻译"), new Vector2(41f, 236f), new Vector2(80f, 28f), delegate { SwitchPage(3); }); CreateButtonAt(component, "TabVisual", L("VISUAL", "频谱"), new Vector2(123f, 236f), new Vector2(80f, 28f), delegate { SwitchPage(4); }); CreateButtonAt(component, "TabPresets", L("PRESET", "预设"), new Vector2(205f, 236f), new Vector2(80f, 28f), delegate { SwitchPage(5); }); float y = 188f; float step = ((_page == 4) ? 28f : 34f); if (_page == 0) { AddInputRow(component, ref y, step, L("X min (%)", "X 最小 (%)"), F(S.PosXMin), delegate(float v) { S.PosXMin = Mathf.Clamp(v, 0f, 100f); }); AddInputRow(component, ref y, step, L("X max (%)", "X 最大 (%)"), F(S.PosXMax), delegate(float v) { S.PosXMax = Mathf.Clamp(v, 0f, 100f); }); AddInputRow(component, ref y, step, L("Y min (%)", "Y 最小 (%)"), F(S.PosYMin), delegate(float v) { S.PosYMin = Mathf.Clamp(v, 0f, 100f); }); AddInputRow(component, ref y, step, L("Y max (%)", "Y 最大 (%)"), F(S.PosYMax), delegate(float v) { S.PosYMax = Mathf.Clamp(v, 0f, 100f); }); AddInputRow(component, ref y, step, L("Zoom (%)", "缩放 (%)"), F(S.Zoom), delegate(float v) { S.Zoom = Mathf.Clamp(v, 10f, 400f); }); AddInputRow(component, ref y, step, L("Angle min", "最小角度"), F(S.AngleMin), delegate(float v) { S.AngleMin = Mathf.Clamp(v, -180f, 180f); }); AddInputRow(component, ref y, step, L("Angle max", "最大角度"), F(S.AngleMax), delegate(float v) { S.AngleMax = Mathf.Clamp(v, -180f, 180f); }); AddInputRow(component, ref y, step, L("Delay (ms)", "延迟 (毫秒)"), F(S.Delay), delegate(float v) { S.Delay = Mathf.RoundToInt(Mathf.Clamp(v, 0f, 10000f)); }); AddInputRow(component, ref y, step, L("Anti-overlap window (s)", "防交错时间窗 (秒)"), F(S.AvoidWindow), delegate(float v) { S.AvoidWindow = Mathf.Clamp(v, 0f, 30f); }); AddInputRow(component, ref y, step, L("Anti-overlap gap (px)", "防交错间隔 (像素)"), F(S.AvoidGap), delegate(float v) { S.AvoidGap = Mathf.Clamp(v, 0f, 300f); }); AddInputRow(component, ref y, step, L("Lane step (% height)", "车道步长 (屏高%)"), F(S.AvoidStep), delegate(float v) { S.AvoidStep = Mathf.Clamp(v, 2f, 50f); }); AddValueRow(component, ref y, step, L("Position anchor", "固定位置"), AnchorText(S.PositionAnchor), delegate { S.PositionAnchor = NextAnchor(S.PositionAnchor); }); AddToggleRow(component, ref y, step, L("Random position", "随机位置"), () => S.RandomPosition, delegate { S.RandomPosition = !S.RandomPosition; }); AddToggleRow(component, ref y, step, L("Random angle", "随机旋转"), () => S.RandomAngle, delegate { S.RandomAngle = !S.RandomAngle; }); } else if (_page == 1) { AddTextRow(component, ref y, step, L("Text color", "文字颜色"), S.TextColor, delegate(string v) { S.TextColor = NormalizeColor(v, S.TextColor); }); AddInputRow(component, ref y, step, L("Font size", "字号"), F(S.FontSize), delegate(float v) { S.FontSize = Mathf.Clamp(v, 1f, 400f); }); AddInputRow(component, ref y, step, L("Spacing", "字距"), F(S.Spacing), delegate(float v) { S.Spacing = Mathf.Clamp(v, -50f, 100f); }); AddTextRow(component, ref y, step, L("Stroke color", "描边颜色"), S.StrokeColor, delegate(string v) { S.StrokeColor = NormalizeColor(v, S.StrokeColor); }); AddInputRow(component, ref y, step, L("Stroke width", "描边宽度"), F(S.StrokeWidth), delegate(float v) { S.StrokeWidth = Mathf.Clamp(v, 0f, 50f); }); AddTextRow(component, ref y, step, L("Glow color", "辉光颜色"), S.GlowColor, delegate(string v) { S.GlowColor = NormalizeColor(v, S.GlowColor); }); AddInputRow(component, ref y, step, L("Glow size", "辉光大小"), F(S.GlowSize), delegate(float v) { S.GlowSize = Mathf.Clamp(v, 0f, 100f); }); AddInputRow(component, ref y, step, L("Glow alpha", "辉光透明度"), F(S.GlowAlpha), delegate(float v) { S.GlowAlpha = Mathf.Clamp(v, 0f, 100f); }); AddToggleRow(component, ref y, step, L("Glow", "辉光"), () => S.GlowEnabled, delegate { S.GlowEnabled = !S.GlowEnabled; }); } else if (_page == 2) { if (_motionSubPage == 1) { AddToggleRow(component, ref y, step, L("Glitch filter", "故障滤镜"), () => S.GlitchEnabled, delegate { S.GlitchEnabled = !S.GlitchEnabled; }); AddInputRow(component, ref y, step, L("Glitch intensity (0-100)", "故障强度 (0-100)"), F(S.GlitchIntensity), delegate(float v) { S.GlitchIntensity = Mathf.Clamp(v, 0f, 100f); }); AddInputRow(component, ref y, step, L("Glitch strobe speed (0.1-5)", "故障频闪速度 (0.1-5)"), F(S.GlitchSpeed), delegate(float v) { S.GlitchSpeed = Mathf.Clamp(v, 0.1f, 5f); }); AddToggleRow(component, ref y, step, L("Glitch on parry / hitstop", "弹反/顿帧触发故障"), () => S.GlitchReactiveEnabled, delegate { S.GlitchReactiveEnabled = !S.GlitchReactiveEnabled; }); AddInputRow(component, ref y, step, L("Parry/hitstop glitch strength (0-100)", "弹反/顿帧故障强度 (0-100)"), F(S.GlitchReactiveStrength), delegate(float v) { S.GlitchReactiveStrength = Mathf.Clamp(v, 0f, 100f); }); AddInputRow(component, ref y, step, L("Parry/hitstop glitch duration (s)", "弹反/顿帧故障持续时间 (秒)"), F(S.GlitchReactiveDuration), delegate(float v) { S.GlitchReactiveDuration = Mathf.Clamp(v, 0.05f, 1f); }); CreateButtonAt(component, "GlitchTest", L("TEST TRIGGER", "预览触发"), new Vector2(0f, -54f), new Vector2(300f, 28f), delegate { LimbusCompanyLyrics.PreviewGlitch(S.GlitchReactiveStrength, S.GlitchReactiveDuration); }); } else { AddInputRow(component, ref y, step, L("Shake intensity", "抖动强度"), F(S.ShakeIntensity), delegate(float v) { S.ShakeIntensity = Mathf.Clamp(v, 0f, 50f); }); AddInputRow(component, ref y, step, L("Shake speed", "抖动速度"), F(S.ShakeSpeed), delegate(float v) { S.ShakeSpeed = Mathf.Clamp(v, 0.1f, 1000f); }); AddInputRow(component, ref y, step, L("Fade speed", "淡入速度"), F(S.FadeSpeed), delegate(float v) { S.FadeSpeed = Mathf.Clamp(v, 0.1f, 60f); }); AddInputRow(component, ref y, step, L("Rise speed", "上飘速度"), F(S.RiseSpeed), delegate(float v) { S.RiseSpeed = Mathf.Clamp(v, -200f, 200f); }); AddToggleRow(component, ref y, step, L("Typewriter", "逐字显示"), () => S.TypewriterEnabled, delegate { S.TypewriterEnabled = !S.TypewriterEnabled; }); AddInputRow(component, ref y, step, L("Chars per second", "每秒字数"), F(S.TypewriterSpeed), delegate(float v) { S.TypewriterSpeed = Mathf.Clamp(v, 1f, 200f); }); AddToggleRow(component, ref y, step, L("Perspective", "透视"), () => S.PerspectiveEnabled, delegate { S.PerspectiveEnabled = !S.PerspectiveEnabled; }); AddInputRow(component, ref y, step, L("Persp X", "透视 X"), F(S.PerspXStrength), delegate(float v) { S.PerspXStrength = Mathf.Clamp(v, -90f, 90f); }); AddInputRow(component, ref y, step, L("Persp Y", "透视 Y"), F(S.PerspYStrength), delegate(float v) { S.PerspYStrength = Mathf.Clamp(v, -90f, 90f); }); AddToggleRow(component, ref y, step, L("Lyrics enabled", "启用歌词层"), () => S.Enabled, delegate { S.Enabled = !S.Enabled; }); AddToggleRow(component, ref y, step, L("Replace original subtitles", "替换原版字幕"), () => S.ReplaceOriginal, delegate { S.ReplaceOriginal = !S.ReplaceOriginal; }); } CreateButtonAt(component, "MotionSubPage", (_motionSubPage == 1) ? L("BACK TO MOTION", "返回动态") : L("GLITCH SETTINGS", "故障设置"), new Vector2(0f, -196f), new Vector2(300f, 30f), delegate { _motionSubPage = ((_motionSubPage == 0) ? 1 : 0); RebuildPanel(); }); } else if (_page == 3) { AddToggleRow(component, ref y, step, L("Show translation line", "显示翻译歌词"), () => S.TranslationEnabled, delegate { S.TranslationEnabled = !S.TranslationEnabled; }); AddInputRow(component, ref y, step, L("Translation font size (0=auto)", "翻译字号 (0=自动)"), F(S.TranslationFontSize), delegate(float v) { S.TranslationFontSize = Mathf.Clamp(v, 0f, 400f); }); AddInputRow(component, ref y, step, L("Translation scale (auto)", "翻译字号比例 (自动)"), F(S.TranslationScale), delegate(float v) { S.TranslationScale = Mathf.Clamp(v, 0.1f, 3f); }); AddTextRow(component, ref y, step, L("Translation color", "翻译文字颜色"), S.TranslationColor, delegate(string v) { S.TranslationColor = NormalizeColor(v, S.TranslationColor); }); AddValueRow(component, ref y, step, L("Anti-overlap mode", "防交错方式"), ModeText(S.AntiOverlapMode), delegate { S.AntiOverlapMode = NextMode(S.AntiOverlapMode); }); AddInputRow(component, ref y, step, L("Custom offset X (px)", "自定义偏移 X (像素)"), F(S.CustomOffsetX), delegate(float v) { S.CustomOffsetX = Mathf.Clamp(v, -2000f, 2000f); }); AddInputRow(component, ref y, step, L("Custom offset Y (px)", "自定义偏移 Y (像素)"), F(S.CustomOffsetY), delegate(float v) { S.CustomOffsetY = Mathf.Clamp(v, -2000f, 2000f); }); ((TMP_Text)CreateLabelObject(component, "TransInfo", L("Add a sidecar SRT next to the track:\nTrack.zh.srt / Track.cn.srt / Track.ja.srt / Track.trans.srt\nModes: AUTO = lane avoidance, MIRROR = opposite point (x,y -> -x,-y), BELOW = under the main line, CUSTOM = main + offset.", "在音频旁再放一个同名翻译字幕:\nTrack.zh.srt / Track.cn.srt / Track.ja.srt / Track.trans.srt\n方式:自动=车道避让;镜像=对称点 (x,y -> -x,-y);下方=主歌词正下方;自定义=主歌词+偏移。"), new Vector2(0f, -208f), new Vector2(470f, 88f), 13f, (TextAlignmentOptions)257)).enableWordWrapping = true; } else if (_page == 4) { AddToggleRow(component, ref y, step, L("Audio visualizer", "音频可视化"), () => S.VisualizerEnabled, delegate { S.VisualizerEnabled = !S.VisualizerEnabled; }); AddInputRow(component, ref y, step, L("Wave size (x)", "波动大小 (倍)"), F(S.VisualizerAmplitude), delegate(float v) { S.VisualizerAmplitude = Mathf.Clamp(v, 0.1f, 5f); }); AddInputRow(component, ref y, step, L("Max extent (% screen, no cap)", "最大幅度 (屏幕%,无上限)"), F(S.VisualizerSize), delegate(float v) { S.VisualizerSize = Mathf.Max(1f, v); }); AddValueRow(component, ref y, step, L("Position", "显示位置"), VisualizerPositionText(S.VisualizerPosition), delegate { S.VisualizerPosition = NextVisualizerPosition(S.VisualizerPosition); }); AddInputRow(component, ref y, step, L("Bar density (8-512)", "频谱密度 (8-512)"), Mathf.RoundToInt((float)S.VisualizerBars).ToString(CultureInfo.InvariantCulture), delegate(float v) { S.VisualizerBars = Mathf.Clamp(Mathf.RoundToInt(v), 8, 512); }); AddInputRow(component, ref y, step, L("Gradient range (0-1)", "渐变范围 (0-1)"), F(S.VisualizerGradientRange), delegate(float v) { S.VisualizerGradientRange = Mathf.Clamp(v, 0f, 1f); }); AddInputRow(component, ref y, step, L("Gradient speed", "渐变强度 (速度)"), F(S.VisualizerGradientSpeed), delegate(float v) { S.VisualizerGradientSpeed = Mathf.Clamp(v, 0f, 2f); }); AddValueRow(component, ref y, step, L("Gradient mode", "渐变模式"), GradientModeText(S.VisualizerGradientMode), delegate { S.VisualizerGradientMode = NextGradientMode(S.VisualizerGradientMode); }); AddTextRow(component, ref y, step, L("Color A RGB", "颜色 A RGB"), S.VisualizerColorA, delegate(string v) { S.VisualizerColorA = NormalizeRgbText(v, S.VisualizerColorA); }); AddTextRow(component, ref y, step, L("Color B RGB", "颜色 B RGB"), S.VisualizerColorB, delegate(string v) { S.VisualizerColorB = NormalizeRgbText(v, S.VisualizerColorB); }); AddTextRow(component, ref y, step, L("Multi RGB (space separated)", "多色 RGB(空格分隔)"), S.VisualizerColors, delegate(string v) { S.VisualizerColors = NormalizeRgbList(v, S.VisualizerColors); }); AddToggleRow(component, ref y, step, L("X mirror", "X 轴镜像"), () => S.VisualizerMirrorX, delegate { S.VisualizerMirrorX = !S.VisualizerMirrorX; }); ((TMP_Text)CreateLabelObject(component, "VisInfo", L("Modes: FIXED 2 = A→B flow; RANGE = A↔B sweep; MULTI = RGB stops.\nRGB: R,G,B using ',' or ','. Multi colors are separated by spaces.\nRange 0 = solid A; Gradient speed = animation speed.", "模式:FIXED 2=双色流动;RANGE=双色来回;MULTI=多色色标。\nRGB 格式:R,G,B,用 , 或 , 分隔;多色之间用空格。\n渐变范围 0=颜色 A 单色;渐变强度=渐变速度。"), new Vector2(0f, -205f), new Vector2(480f, 82f), 11.5f, (TextAlignmentOptions)257)).enableWordWrapping = true; } else { BuildPresetsPage(component); } CreateButtonAt(component, "Reset", L("RESET PAGE", "重置本页"), new Vector2(-110f, -286f), new Vector2(180f, 36f), delegate { ResetCurrentPage(); SaveAndRefresh(); }); CreateButtonAt(component, "Close", L("CLOSE", "关闭"), new Vector2(110f, -286f), new Vector2(180f, 36f), delegate { _panelOpen = false; if ((Object)(object)_panel != (Object)null) { _panel.SetActive(false); } }); return val2; } private static string F(float value) { return value.ToString("0.###", CultureInfo.InvariantCulture); } private void AddInputRow(RectTransform parent, ref float y, float step, string label, string value, Action<float> apply) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_0057: 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) CreateLabel(parent, "Row", label, new Vector2(-140f, y), new Vector2(270f, 28f), 15f, (TextAlignmentOptions)513); CreateInput(parent, "Input", value, new Vector2(160f, y), new Vector2(180f, 28f), delegate(string text) { if (float.TryParse(text, NumberStyles.Float, CultureInfo.InvariantCulture, out var result)) { apply(result); LimbusCompanyLyrics.SaveAllSettings(); } else { _rebuildPending = _panelOpen; } }, delegate(string text) { if (float.TryParse(text, NumberStyles.Float, CultureInfo.InvariantCulture, out var result)) { apply(result); } }); y -= step; } private void AddTextRow(RectTransform parent, ref float y, float step, string label, string value, Action<string> apply) { //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) CreateLabel(parent, "Row", label, new Vector2(-140f, y), new Vector2(270f, 28f), 15f, (TextAlignmentOptions)513); CreateInput(parent, "Input", value, new Vector2(160f, y), new Vector2(180f, 28f), delegate(string text) { apply(text); LimbusCompanyLyrics.SaveAllSettings(); }); y -= step; } private void AddToggleRow(RectTransform parent, ref float y, float step, string label, Func<bool> getter, Action toggle) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_0070: Unknown result type (might be due to invalid IL or missing references) CreateLabel(parent, "Row", label, new Vector2(-140f, y), new Vector2(270f, 28f), 15f, (TextAlignmentOptions)513); CreateButtonAt(parent, "Value", BoolText(getter()), new Vector2(160f, y), new Vector2(180f, 28f), delegate { toggle(); SaveAndRefresh(); }); y -= step; } private void AddValueRow(RectTransform parent, ref float y, float step, string label, string value, Action next) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_0057: 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) CreateLabel(parent, "Row", label, new Vector2(-140f, y), new Vector2(270f, 28f), 15f, (TextAlignmentOptions)513); CreateButtonAt(parent, "Value", value, new Vector2(160f, y), new Vector2(180f, 28f), delegate { next(); SaveAndRefresh(); }); y -= step; } private static string NextMode(string mode) { int num = Array.IndexOf(Modes, LimbusCompanyLyricsSettings.NormalizeMode(mode)); if (num < 0) { num = 0; } return Modes[(num + 1) % Modes.Length]; } private static string ModeText(string mode) { return LimbusCompanyLyricsSettings.NormalizeMode(mode) switch { "strict" => L("STRICT", "分区"), "mirror" => L("MIRROR", "镜像"), "below" => L("BELOW", "下方"), "custom" => L("CUSTOM", "自定义"), _ => L("AUTO", "自动"), }; } private static string NextAnchor(string anchor) { int num = Array.IndexOf(Anchors, LimbusCompanyLyricsSettings.NormalizeAnchor(anchor)); if (num < 0) { num = 0; } return Anchors[(num + 1) % Anchors.Length]; } private static string AnchorText(string anchor) { return LimbusCompanyLyricsSettings.NormalizeAnchor(anchor) switch { "top-left" => L("TOP LEFT", "左上"), "top" => L("TOP", "上中"), "top-right" => L("TOP RIGHT", "右上"), "left" => L("LEFT", "左中"), "center" => L("CENTER", "居中"), "right" => L("RIGHT", "右中"), "bottom-left" => L("BOTTOM LEFT", "左下"), "bottom" => L("BOTTOM", "下中"), "bottom-right" => L("BOTTOM RIGHT", "右下"), _ => L("RANDOM", "全屏随机"), }; } private static string NextGradientMode(string mode) { int num = Array.IndexOf(GradientModes, LimbusCompanyLyricsSettings.NormalizeGradientMode(mode)); if (num < 0) { num = 0; } return GradientModes[(num + 1) % GradientModes.Length]; } private static string GradientModeText(string mode) { string text = LimbusCompanyLyricsSettings.NormalizeGradientMode(mode); if (!(text == "fixed2")) { if (text == "multi") { return L("MULTI RGB", "多色渐变"); } return L("RANGE x~y", "区间渐变"); } return L("FIXED 2", "固定双色"); } private static string NormalizeRgbText(string value, string fallback) { if (string.IsNullOrWhiteSpace(value)) { return fallback; } string[] array = value.Replace(',', ',').Split(','); if (array.Length >= 3 && int.TryParse(array[0].Trim(), NumberStyles.Integer, CultureInfo.InvariantCulture, out var result) && int.TryParse(array[1].Trim(), NumberStyles.Integer, CultureInfo.InvariantCulture, out var result2) && int.TryParse(array[2].Trim(), NumberStyles.Integer, CultureInfo.InvariantCulture, out var result3)) { result = Mathf.Clamp(result, 0, 255); result2 = Mathf.Clamp(result2, 0, 255); result3 = Mathf.Clamp(result3, 0, 255); return $"{result},{result2},{result3}"; } return fallback; } private static string NormalizeRgbList(string value, string fallback) { if (string.IsNullOrWhiteSpace(value)) { return fallback; } string[] array = value.Split(new char[4] { ' ', '\t', ';', '|' }, StringSplitOptions.RemoveEmptyEntries); List<string> list = new List<string>(); string[] array2 = array; for (int i = 0; i < array2.Length; i++) { string text = NormalizeRgbText(array2[i], null); if (!string.IsNullOrEmpty(text)) { list.Add(text); } } if (list.Count <= 0) { return fallback; } return string.Join(" ", list); } private static string NextVisualizerPosition(string position) { int num = Array.IndexOf(VisualizerPositions, LimbusCompanyLyricsSettings.NormalizePosition(position)); if (num < 0) { num = 0; } return VisualizerPositions[(num + 1) % VisualizerPositions.Length]; } private static string VisualizerPositionText(string position) { return LimbusCompanyLyricsSettings.NormalizePosition(position) switch { "top" => L("TOP", "顶部"), "left" => L("LEFT", "左侧"), "right" => L("RIGHT", "右侧"), "edge" => L("EDGE RING", "四周暗角"), _ => L("BOTTOM", "底部"), }; } private void CreateButtonAt(RectTransform parent, string name, string text, Vector2 position, Vector2 size, Action onClick) { //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_0041: 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_006b: Unknown result type (might be due to invalid IL or missing references) //IL_0076: Unknown result type (might be due to invalid IL or missing references) //IL_007e: 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_00a1: Unknown result type (might be due to invalid IL or missing references) //IL_00ab: Unknown result type (might be due to invalid IL or missing references) //IL_00b2: Unknown result type (might be due to invalid IL or missing references) //IL_00c6: Unknown result type (might be due to invalid IL or missing references) //IL_00e8: Unknown result type (might be due to invalid IL or missing references) //IL_00f2: Expected O, but got Unknown //IL_010a: Unknown result type (might be due to invalid IL or missing references) //IL_010f: 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_0129: Unknown result type (might be due to invalid IL or missing references) //IL_0134: Unknown result type (might be due to invalid IL or missing references) //IL_013e: Unknown result type (might be due to invalid IL or missing references) //IL_0185: Unknown result type (might be due to invalid IL or missing references) GameObject val = new GameObject(name, new Type[1] { typeof(RectTransform) }); RectTransform component = val.GetComponent<RectTransform>(); ((Transform)component).SetParent((Transform)(object)parent, false); component.anchorMin = new Vector2(0.5f, 0.5f); component.anchorMax = new Vector2(0.5f, 0.5f); component.pivot = new Vector2(0.5f, 0.5f); component.anchoredPosition = position; component.sizeDelta = size; Image val2 = val.AddComponent<Image>(); ((Graphic)val2).color = new Color(0.08f, 0.08f, 0.09f, 1f); Outline obj = val.AddComponent<Outline>(); ((Shadow)obj).effectColor = Gold; ((Shadow)obj).effectDistance = new Vector2(0.8f, -0.8f); Button obj2 = val.AddComponent<Button>(); ((Selectable)obj2).targetGraphic = (Graphic)(object)val2; ((UnityEvent)obj2.onClick).AddListener((UnityAction)delegate { onClick(); }); GameObject val3 = new GameObject("Label", new Type[1] { typeof(RectTransform) }); RectTransform component2 = val3.GetComponent<RectTransform>(); ((Transform)component2).SetParent((Transform)(object)component, false); component2.anchorMin = Vector2.zero; component2.anchorMax = Vector2.one; component2.offsetMin = Vector2.zero; component2.offsetMax = Vector2.zero; TextMeshProUGUI obj3 = val3.AddComponent<TextMeshProUGUI>(); ((TMP_Text)obj3).font = MenuFont(text); ((TMP_Text)obj3).fontSize = 15f; ((TMP_Text)obj3).alignment = (TextAlignmentOptions)514; ((TMP_Text)obj3).enableWordWrapping = false; ((TMP_Text)obj3).overflowMode = (TextOverflowModes)0; ((Graphic)obj3).raycastTarget = false; ((Graphic)obj3).color = Bone; ((TMP_Text)obj3).text = text; } private TMP_InputField CreateInput(RectTransform parent, string name, string value, Vector2 position, Vector2 size, Action<string> onEndEdit, Action<string> onValueChanged = null) { //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Expected O, but got Unknown //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_007f: Unknown result type (might be due to invalid IL or missing references) //IL_0087: Unknown result type (might be due to invalid IL or missing references) //IL_00aa: Unknown result type (might be due to invalid IL or missing references) //IL_00bb: Unknown result type (might be due to invalid IL or missing references) //IL_00cf: Unknown result type (might be due to invalid IL or missing references) //IL_00f1: Unknown result type (might be due to invalid IL or missing references) //IL_00f8: Expected O, but got Unknown //IL_010c: Unknown result type (might be due to invalid IL or missing references) //IL_0118: Unknown result type (might be due to invalid IL or missing references) //IL_012e: Unknown result type (might be due to invalid IL or missing references) //IL_0144: Unknown result type (might be due to invalid IL or missing references) //IL_01b6: Unknown result type (might be due to invalid IL or missing references) GameObject val = new GameObject(name, new Type[1] { typeof(RectTransform) }); RectTransform component = val.GetComponent<RectTransform>(); ((Transform)component).SetParent((Transform)(object)parent, false); component.anchorMin = new Vector2(0.5f, 0.5f); component.anchorMax = new Vector2(0.5f, 0.5f); component.pivot = new Vector2(0.5f, 0.5f); component.anchoredPosition = position; component.sizeDelta = size; Image val2 = val.AddComponent<Image>(); ((Graphic)val2).color = new Color(0.08f, 0.08f, 0.09f, 1f); Outline obj = val.AddComponent<Outline>(); ((Shadow)obj).effectColor = Gold; ((Shadow)obj).effectDistance = new Vector2(0.8f, -0.8f); GameObject val3 = new GameObject("Text", new Type[1] { typeof(RectTransform) }); RectTransform component2 = val3.GetComponent<RectTransform>(); ((Transform)component2).SetParent((Transform)(object)component, false); component2.anchorMin = Vector2.zero; component2.anchorMax = Vector2.one; component2.offsetMin = new Vector2(8f, 2f); component2.offsetMax = new Vector2(-8f, -2f); TextMeshProUGUI text = val3.AddComponent<TextMeshProUGUI>(); ((TMP_Text)text).font = MenuFont(value); ((TMP_Text)text).fontSize = 15f; ((TMP_Text)text).alignment = (TextAlignmentOptions)513; ((TMP_Text)text).enableWordWrapping = false; ((TMP_Text)text).overflowMode = (TextOverflowModes)0; ((Graphic)text).raycastTarget = false; ((Graphic)text).color = Bone; TMP_InputField obj2 = val.AddComponent<TMP_InputField>(); ((Selectable)obj2).targetGraphic = (Graphic)(object)val2; obj2.textComponent = (TMP_Text)(object)text; obj2.textViewport = component2; obj2.lineType = (LineType)0; obj2.text = value; ((UnityEvent<string>)(object)obj2.onEndEdit).AddListener((UnityAction<string>)delegate(string v) { onEndEdit(v); }); ((UnityEvent<string>)(object)obj2.onValueChanged).AddListener((UnityAction<string>)delegate(string v) { ((TMP_Text)text).font = MenuFont(v); onValueChanged?.Invoke(v); }); return obj2; } private static string NormalizeColor(string value, string fallback) { if (string.IsNullOrWhiteSpace(value)) { return fallback; } value = value.Trim().Replace(',', ','); if (value.Contains(",")) { string[] array = value.Split(','); if (array.Length >= 3 && int.TryParse(array[0].Trim(), NumberStyles.Integer, CultureInfo.InvariantCulture, out var result) && int.TryParse(array[1].Trim(), NumberStyles.Integer, CultureInfo.InvariantCulture, out var result2) && int.TryParse(array[2].Trim(), NumberStyles.Integer, CultureInfo.InvariantCulture, out var result3)) { result = Mathf.Clamp(result, 0, 255); result2 = Mathf.Clamp(result2, 0, 255); result3 = Mathf.Clamp(result3, 0, 255); return $"#{result:X2}{result2:X2}{result3:X2}"; } } if (!value.StartsWith("#")) { return "#" + value; } return value; } private static void CreateLabel(RectTransform parent, string name, string text, Vector2 position, Vector2 size, float fontSize, TextAlignmentOptions alignment) { //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_0004: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) CreateLabelObject(parent, name, text, position, size, fontSize, alignment); } private static TextMeshProUGUI CreateLabelObject(RectTransform parent, string name, string text, Vector2 position, Vector2 size, float fontSize, TextAlignmentOptions alignment) { //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Unknown result type (might be due to invalid IL or missing references) //IL_00ab: Unknown result type (might be due to invalid IL or missing references) GameObject val = new GameObject(name, new Type[1] { typeof(RectTransform) }); RectTransform component = val.GetComponent<RectTransform>(); ((Transform)component).SetParent((Transform)(object)parent, false); component.anchorMin = new Vector2(0.5f, 0.5f); component.anchorMax = new Vector2(0.5f, 0.5f); component.pivot = new Vector2(0.5f, 0.5f); component.anchoredPosition = position; component.sizeDelta = size; TextMeshProUGUI obj = val.AddComponent<TextMeshProUGUI>(); ((TMP_Text)obj).font = MenuFont(text); ((TMP_Text)obj).fontSize = fontSize; ((TMP_Text)obj).alignment = alignment; ((TMP_Text)obj).enableWordWrapping = false; ((TMP_Text)obj).overflowMode = (TextOverflowModes)0; ((Graphic)obj).raycastTarget = false; ((Graphic)obj).color = Bone; ((TMP_Text)obj).text = text; return obj; } private static string BoolText(bool value) { if (!IsChinese()) { if (!value) { return "OFF"; } return "ON"; } if (!value) { return "关"; } return "开"; } private void BuildPresetsPage(RectTransform rect) { //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_0073: Unknown result type (might be due to invalid IL or missing references) //IL_00c2: Unknown result type (might be due to invalid IL or missing references) //IL_00d1: Unknown result type (might be due to invalid IL or missing references) //IL_00fd: Unknown result type (might be due to invalid IL or missing references) //IL_010c: Unknown result type (might be due to invalid IL or missing references) //IL_014c: Unknown result type (might be due to invalid IL or missing references) //IL_015b: Unknown result type (might be due to invalid IL or missing references) //IL_035f: Unknown result type (might be due to invalid IL or missing references) //IL_036e: Unknown result type (might be due to invalid IL or missing references) //IL_028b: Unknown result type (might be due to invalid IL or missing references) //IL_029a: Unknown result type (might be due to invalid IL or missing references) //IL_02e2: Unknown result type (might be due to invalid IL or missing references) //IL_02f1: Unknown result type (might be due to invalid IL or missing references) //IL_031b: Unknown result type (might be due to invalid IL or missing references) //IL_032a: Unknown result type (might be due to invalid IL or missing references) //IL_0201: Unknown result type (might be due to invalid IL or missing references) //IL_0210: 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_0253: Unknown result type (might be due to invalid IL or missing references) LimbusCompanyPresets.Refresh(); List<string> names = LimbusCompanyPresets.Names; CreateLabel(rect, "PresetTitle", L("PRESETS", "预设"), new Vector2(0f, 200f), new Vector2(480f, 28f), 18f, (TextAlignmentOptions)514); _presetNameInput = CreateInput(rect, "PresetName", string.Empty, new Vector2(-70f, 160f), new Vector2(300f, 30f), delegate { }); CreateButtonAt(rect, "PresetSave", L("SAVE CURRENT", "保存当前"), new Vector2(190f, 160f), new Vector2(120f, 30f), SavePresetFromPanel); _presetStatusText = CreateLabelObject(rect, "PresetStatus", string.Empty, new Vector2(0f, 127f), new Vector2(480f, 24f), 12.5f, (TextAlignmentOptions)514); if (names.Count == 0) { CreateLabel(rect, "PresetEmpty", L("No presets yet. Type a name and click SAVE CURRENT.", "还没有预设。输入名称后点“保存当前”。"), new Vector2(0f, 50f), new Vector2(480f, 40f), 14f, (TextAlignmentOptions)514); } else { int num = Mathf.Max(1, (names.Count + 8 - 1) / 8); _presetPage = Mathf.Clamp(_presetPage, 0, num - 1); int num2 = _presetPage * 8; for (int num3 = 0; num3 < 8; num3++) { int num4 = num2 + num3; if (num4 >= names.Count) { break; } string presetName = names[num4]; float num5 = 84f - (float)num3 * 36f; CreateButtonAt(rect, "Preset", presetName, new Vector2(-40f, num5), new Vector2(380f, 30f), delegate { ApplyPresetFromPanel(presetName); }); CreateButtonAt(rect, "PresetDelete", L("DEL", "删除"), new Vector2(200f, num5), new Vector2(60f, 30f), delegate { DeletePresetFromPanel(presetName); }); } CreateButtonAt(rect, "PresetPrev", "<", new Vector2(-150f, -215f), new Vector2(100f, 28f), delegate { ChangePresetPage(-1); }); CreateLabel(rect, "PresetPage", _presetPage + 1 + " / " + num, new Vector2(0f, -215f), new Vector2(120f, 24f), 13f, (TextAlignmentOptions)514); CreateButtonAt(rect, "PresetNext", ">", new Vector2(150f, -215f), new Vector2(100f, 28f), delegate { ChangePresetPage(1); }); } ((TMP_Text)CreateLabelObject(rect, "PresetHint", L("Click a preset to apply; X deletes; saving with the same name overwrites.", "点击预设名称应用;X 删除;用相同名称保存会覆盖。"), new Vector2(0f, -252f), new Vector2(480f, 28f), 12f, (TextAlignmentOptions)514)).enableWordWrapping = true; } private void SavePresetFromPanel() { string text = (((Object)(object)_presetNameInput != (Object)null) ? _presetNameInput.text : string.Empty); if (string.IsNullOrWhiteSpace(text)) { SetPresetStatus(L("Enter a preset name.", "请输入预设名称。")); } else if (LimbusCompanyPresets.Save(text)) { _presetPage = 0; RebuildPanel(); } else { SetPresetStatus(L("Save failed.", "保存失败。")); } } private void ApplyPresetFromPanel(string name) { if (LimbusCompanyPresets.Apply(name)) { RebuildPanel(); } else { SetPresetStatus(L("Apply failed.", "应用失败。")); } } private void DeletePresetFromPanel(string name) { LimbusCompanyPresets.Delete(name); _presetPage = 0; RebuildPanel(); } private void ChangePresetPage(int delta) { LimbusCompanyPresets.Refresh(); int num = Mathf.Max(1, (LimbusCompanyPresets.Names.Count + 8 - 1) / 8); _presetPage = Mathf.Clamp(_presetPage + delta, 0, num - 1); RebuildPanel(); } private void SetPresetStatus(string text) { if (!((Object)(object)_presetStatusText == (Object)null)) { ((TMP_Text)_presetStatusText).font = MenuFont(text); ((TMP_Text)_presetStatusText).text = text; } } private void ResetCurrentPage() { LimbusCompanyLyricsSettings settings = LimbusCompanyLyrics.Settings; if (settings != null) { switch (_page) { case 0: ResetLayout(settings); break; case 1: ResetText(settings); break; case 2: ResetMotion(settings); break; case 3: ResetTranslation(settings); break; case 4: ResetVisualizer(settings); break; } } } private static void ResetLayout(LimbusCompanyLyricsSettings s) { s.PosXMin = 0f; s.PosXMax = 100f; s.PosYMin = 0f; s.PosYMax = 100f; s.PositionAnchor = "random"; s.RandomPosition = true; s.RandomAngle = true; s.Zoom = 100f; s.AngleMin = -10f; s.AngleMax = 10f; s.Delay = 0; s.AvoidWindow = 6f; s.AvoidGap = 30f; s.AvoidStep = 10f; } private static void ResetText(LimbusCompanyLyricsSettings s) { s.TextColor = "#fffeef"; s.StrokeColor = "#d8a523"; s.StrokeWidth = 0.6f; s.Spacing = 4f; s.GlowColor = "#d8a523"; s.GlowEnabled = true; s.GlowSize = 13f; s.GlowAlpha = 23f; s.FontSize = 40f; s.FontFamily = "等线 Light"; } private static void ResetMotion(LimbusCompanyLyricsSettings s) { s.ShakeIntensity = 1f; s.ShakeSpeed = 119f; s.FadeSpeed = 6f; s.RiseSpeed = 0f; s.TypewriterEnabled = false; s.TypewriterSpeed = 12f; s.PerspectiveEnabled = true; s.PerspXStrength = 10f; s.PerspYStrength = 0f; s.GlitchEnabled = false; s.GlitchIntensity = 35f; s.GlitchSpeed = 1f; s.GlitchReactiveEnabled = true; s.GlitchReactiveStrength = 70f; s.GlitchReactiveDuration = 0.15f; s.Enabled = true; s.ReplaceOriginal = true; } private static void ResetTranslation(LimbusCompanyLyricsSettings s) { s.TranslationEnabled = true; s.TranslationFontSize = 0f; s.TranslationScale = 0.75f; s.TranslationColor = "#d8d8d8"; s.AntiOverlapMode = "strict"; s.CustomOffsetX = 0f; s.CustomOffsetY = -140f; } private static void ResetVisualizer(LimbusCompanyLyricsSettings s) { s.VisualizerEnabled = false; s.VisualizerAmplitude = 1f; s.VisualizerSize = 50f; s.VisualizerPosition = "bottom"; s.VisualizerBars = 96; s.VisualizerGradientRange = 1f; s.VisualizerGradientSpeed = 0.08f; s.VisualizerGradientMode = "range"; s.VisualizerColorA = "216,165,35"; s.VisualizerColorB = "0,229,255"; s.VisualizerColors = "255,0,0 255,165,0 255,255,0 0,255,0 0,140,255 160,0,255"; s.VisualizerMirrorX = false; } private void SaveAndRefresh(bool rebuild = true) { LimbusCompanyLyrics.SaveAllSettings(); if (rebuild) { _rebuildPending = _panelOpen; } } } public static class LimbusCompanyLyrics { public const string Version = "2.0.0"; public static int GlitchPreviewToken; public static float GlitchPreviewStrength = 70f; public static float GlitchPreviewDuration = 0.5f; public static LimbusCompanyLyricsSettings Settings { get; private set; } public static ManualLogSource Log { get; private set; } public static string ConfigDirectory => Path.Combine(Paths.ConfigPath, "LimbusCompany"); public static bool SuppressOriginal { get { if (Settings != null && Settings.Enabled) { return Settings.ReplaceOriginal; } return false; } } public static event Action SettingsChanged; public static void PreviewGlitch(float strength, float duration) { GlitchPreviewStrength = Mathf.Clamp(strength, 0f, 100f); GlitchPreviewDuration = Mathf.Clamp(duration, 0.05f, 2f); GlitchPreviewToken++; } public static void Initialize() { try { Log = Logger.CreateLogSource("Jukebox LimbusCompany"); Settings = LimbusCompanyLyricsSettings.Load(ConfigDirectory); Log.LogInfo((object)("配置已加载: " + Path.Combine(ConfigDirectory, "lyric_config.json"))); try { if (!Chainloader.PluginInfos.ContainsKey("greycsont.ultrakill.fffffff")) { Log.LogWarning((object)"未检测到 Fffffff(greycsont-Fffffff)。它是必需的字库前置,部分字符可能无法显示。"); } if (Chainloader.PluginInfos.ContainsKey("dev.zeddevstuff.ustmanager")) { Log.LogInfo((object)"检测到 USTManager:F5 取代时会暂停/静音 MusicManager 下的多段 BGM 音源。"); } } catch (Exception) { } } catch (Exception arg) { Log.LogError((object)$"LimbusCompanyLyrics 读取配置失败,使用默认值: {arg}"); Settings = new LimbusCompanyLyricsSettings(); } } public static void Reload() { try { Settings = LimbusCompanyLyricsSettings.Load(ConfigDirectory); Log.LogInfo((object)"LimbusCompanyLyrics 配置已重新加载。"); } catch (Exception ex) { Log.LogWarning((object)("LimbusCompanyLyrics 重新加载配置失败: " + ex.Message)); } } public static void SetLanguage(string language) { if (Settings != null) { Settings.Language = LimbusCompanyLyricsSettings.NormalizeLanguage(language); SaveAllSettings(); } } public static void SaveAllSettings() { LimbusCompanyLyricsSettings settings = Settings; if (settings == null || string.IsNullOrEmpty(settings.FilePath) || !File.Exists(settings.FilePath)) { return; } try { JObject val = JObject.Parse(File.ReadAllText(settings.FilePath, Encoding.UTF8)); JToken obj = val["settings"]; object obj2 = ((object)((obj is JObject) ? obj : null)) ?? ((object)val); ((JObject)obj2)["language"] = JToken.op_Implicit(settings.Language); ((JObject)obj2)["bgm_track"] = JToken.op_Implicit(settings.BgmTrack); ((JObject)obj2)["bgm_key_toggle"] = JToken.op_Implicit(settings.BgmKeyToggle); ((JObject)obj2)["bgm_key_prev"] = JToken.op_Implicit(settings.BgmKeyPrev); ((JObject)obj2)["bgm_key_next"] = JToken.op_Implicit(settings.BgmKeyNext); ((JObject)obj2)["bgm_key_replace"] = JToken.op_Implicit(settings.BgmKeyReplace); ((JObject)obj2)["bgm_key_restore"] = JToken.op_Implicit(settings.BgmKeyRestore); ((JObject)obj2)["bgm_key_lyrics"] = JToken.op_Implicit(settings.BgmKeyLyrics); ((JObject)obj2)["bgm_key_now_playing"] = JToken.op_Implicit(settings.BgmKeyNowPlaying); ((JObject)obj2)["bgm_key_language"] = JToken.op_Implicit(settings.BgmKeyLanguage); ((JObject)obj2)["now_playing_enabled"] = JToken.op_Implicit(settings.NowPlayingEnabled); ((JObject)obj2)["cover_pos_x"] = JToken.op_Implicit(settings.CoverPosX); ((JObject)obj2)["cover_pos_y"] = JToken.op_Implicit(settings.CoverPosY); ((JObject)obj2)["title_pos_x"] = JToken.op_Implicit(settings.TitlePosX); ((JObject)obj2)["title_pos_y"] = JToken.op_Implicit(settings.TitlePosY); ((JObject)obj2)["cover_size"] = JToken.op_Implicit(settings.CoverSize); ((JObject)obj2)["enabled"] = JToken.op_Implicit(settings.Enabled); ((JObject)obj2)["replace_original"] = JToken.op_Implicit(settings.ReplaceOriginal); ((JObject)obj2)["glow_enabled"] = JToken.op_Implicit(settings.GlowEnabled); ((JObject)obj2)["random_position"] = JToken.op_Implicit(settings.RandomPosition); ((JObject)obj2)["random_angle"] = JToken.op_Implicit(settings.RandomAngle); ((JObject)obj2)["translation_enabled"] = JToken.op_Implicit(settings.TranslationEnabled); ((JObject)obj2)["translation_scale"] = JToken.op_Implicit(settings.TranslationScale); ((JObject)obj2)["translation_font_size"] = JToken.op_Implicit(settings.TranslationFontSize); ((JObject)obj2)["translation_color"] = JToken.op_Implicit(settings.TranslationColor); ((JObject)obj2)["font_size"] = JToken.op_Implicit(settings.FontSize); ((JObject)obj2)["font_family"] = JToken.op_Implicit(settings.FontFamily); ((JObject)obj2)["spacing"] = JToken.op_Implicit(settings.Spacing); ((JObject)obj2)["text_color"] = JToken.op_Implicit(settings.TextColor); ((JObject)obj2)["stroke_color"] = JToken.op_Implicit(settings.StrokeColor); ((JObject)obj2)["stroke_width"] = JToken.op_Implicit(settings.StrokeWidth); ((JObject)obj2)["glow_color"] = JToken.op_Implicit(settings.GlowColor); ((JObject)obj2)["glow_size"] = JToken.op_Implicit(settings.GlowSize); ((JObject)obj2)["glow_alpha"] = JToken.op_Implicit(settings.GlowAlpha); ((JObject)obj2)["shake_intensity"] = JToken.op_Implicit(settings.ShakeIntensity); ((JObject)obj2)["shake_speed"] = JToken.op_Implicit(settings.ShakeSpeed); ((JObject)obj2)["fade_speed"] = JToken.op_Implicit(settings.FadeSpeed); ((JObject)obj2)["rise_speed"] = JToken.op_Implicit(settings.RiseSpeed); ((JObject)obj2)["typewriter_enabled"] = JToken.op_Implicit(settings.TypewriterEnabled); ((JObject)obj2)["typewriter_speed"] = JToken.op_Implicit(settings.TypewriterSpeed); ((JObject)obj2)["glitch_enabled"] = JToken.op_Implicit(settings.GlitchEnabled); ((JObject)obj2)["glitch_intensity"] = JToken.op_Implicit(settings.GlitchIntensity); ((JObject)obj2)["glitch_speed"] = JToken.op_Implicit(settings.GlitchSpeed); ((JObject)obj2)["glitch_reactive_enabled"] = JToken.op_Implicit(settings.GlitchReactiveEnabled); ((JObject)obj2)["glitch_reactive_strength"] = JToken.op_Implicit(settings.GlitchReactiveStrength); ((JObject)obj2)["glitch_reactive_duration"] = JToken.op_Implicit(settings.GlitchReactiveDuration); ((JObject)obj2)["angle_min"] = JToken.op_Implicit(settings.AngleMin); ((JObject)obj2)["angle_max"] = JToken.op_Implicit(settings.AngleMax); ((JObject)obj2)["delay"] = JToken.op_Implicit(settings.Delay); ((JObject)obj2)["pos_x_min"] = JToken.op_Implicit(settings.PosXMin); ((JObject)obj2)["pos_x_max"] = JToken.op_Implicit(settings.PosXMax); ((JObject)obj2)["pos_y_min"] = JToken.op_Implicit(settings.PosYMin); ((JObject)obj2)["pos_y_max"] = JToken.op_Implicit(settings.PosYMax); ((JObject)obj2)["position_anchor"] = JToken.op_Implicit(settings.PositionAnchor); ((JObject)obj2)["zoom"] = JToken.op_Implicit(settings.Zoom); ((JObject)obj2)["anti_overlap_mode"] = JToken.op_Implicit(settings.AntiOverlapMode); ((JObject)obj2)["avoid_window"] = JToken.op_Implicit(settings.AvoidWindow); ((JObject)obj2)["avoid_gap"] = JToken.op_Implicit(settings.AvoidGap); ((JObject)obj2)["avoid_step"] = JToken.op_Implicit(settings.AvoidStep); ((JObject)obj2)["custom_offset_x"] = JToken.op_Implicit(settings.CustomOffsetX); ((JObject)obj2)["custom_offset_y"] = JToken.op_Implicit(settings.CustomOffsetY); ((JObject)obj2)["visualizer_enabled"] = JToken.op_Implicit(settings.VisualizerEnabled); ((JObject)obj2)["visualizer_amplitude"] = JToken.op_Implicit(settings.VisualizerAmplitude); ((JObject)obj2)["visualizer_size"] = JToken.op_Implicit(settings.VisualizerSize); ((JObject)obj2)["visualizer_position"] = JToken.op_Implicit(settings.VisualizerPosition); ((JObject)obj2)["visualizer_bars"] = JToken.op_Implicit(settings.VisualizerBars); ((JObject)obj2)["visualizer_gradient_range"] = JToken.op_Implicit(settings.VisualizerGradientRange); ((JObject)obj2)["visualizer_gradient_speed"] = JToken.op_Implicit(settings.VisualizerGradientSpeed); ((JObject)obj2)["visualizer_gradient_mode"] = JToken.op_Implicit(settings.VisualizerGradientMode); ((JObject)obj2)["visualizer_color_a"] = JToken.op_Implicit(settings.VisualizerColorA); ((JObject)obj2)["visualizer_color_b"] = JToken.op_Implicit(settings.VisualizerColorB); ((JObject)obj2)["visualizer_colors"] = JToken.op_Implicit(settings.VisualizerColors); ((JObject)obj2)["visualizer_mirror_x"] = JToken.op_Implicit(settings.VisualizerMirrorX); ((JObject)obj2)["perspective_enabled"] = JToken.op_Implicit(settings.PerspectiveEnabled); ((JObject)obj2)["persp_x_strength"] = JToken.op_Implicit(settings.PerspXStrength); ((JObject)obj2)["persp_y_strength"] = JToken.op_Implicit(settings.PerspYStrength); File.WriteAllText(settings.FilePath, ((JToken)val).ToString((Formatting)1, Array.Empty<JsonConverter>()), new UTF8Encoding(encoderShouldEmitUTF8Identifier: false)); LimbusCompanyLyrics.SettingsChanged?.Invoke(); settings.LastWriteUtc = File.GetLastWriteTimeUtc(settings.FilePath); } catch (Exception ex) { Log.LogWarning((object)("LimbusCompany 保存设置失败: " + ex.Message)); } } } public class LimbusCompanyLyricsOverlay : MonoBehaviour { private sealed class RecentPlacement { public Vector2 Position; public Vector2 Half; public float Angle; public float Time; } private sealed class GhostLine { public GameObject Go; public RectTransform Rect; public TextMeshProUGUI Text; public CanvasGroup Group; public float Alpha; public Vector2 Half; public float Angle; public float Elapsed; public Vector2 BasePosition; } private struct AvoidBox { public Vector2 Position; public Vector2 Half; public float Angle; } private struct ThemeState { public bool Mute; public float Volume; } private Canvas _canvas; private GameObject _visRoot; private Image _visVignette; private Sprite _visVignetteSprite; private bool _visWasShown; private bool _visSpectrumLogged; private AudioSource _visLastSource; private HashSet<string> _ostBgmNames; private bool _ostBgmNamesLoaded; private static Dictionary<string, HashSet<string>> _levelBgmMap; private static bool _levelBgmMapLoaded; private HashSet<string> _currentLevelBgmNames = new HashSet<string>(StringComparer.OrdinalIgnoreCase); private bool _currentLevelHasMap; private string _currentLevelKey = string.Empty; private readonly Image[] _visBars = (Image[])(object)new Image[512]; private readonly float[] _spectrum = new float[512]; private CanvasGroup _group; private RectTransform _rect; private TextMeshProUGUI _text; private TMP_FontAsset _font; private SubtitlesPanel[] _panels = Array.Empty<SubtitlesPanel>(); private float _nextPanelScan; private JukeboxMusicPlayer _player; private float _nextPlayerScan; private string _pendingText; private float _pendingAt; private string _shownText; private float _alpha; private float _targetAlpha; private float _elapsed; private float _lineAngle; private Vector2 _basePosition; private Vector2 _halfExtents; private Vector2 _lastBasePosition; private Vector2 _lastHalfExtents; private bool _hasLastPosition; private TMP_Text[] _allTexts = Array.Empty<TMP_Text>(); private float _nextTextScan; private string _lastOtherText; private float _nextPanelLog; private int _lastPanelCount = -1; private Vector2 _mainCurrentPosition; private float _typeElapsed; private bool _typing; private readonly List<RecentPlacement> _recent = new List<RecentPlacement>(); private readonly List<GhostLine> _ghosts = new List<GhostLine>(); private const int MaxGhosts = 6; private CanvasGroup _transGroup; private RectTransform _transRect; private TextMeshProUGUI _transText; private float _transAlpha; private float _transTargetAlpha; private string _transShown; private Vector2 _transBasePosition; private Vector2 _transHalfExtents; private float _transAngle; private SubtitleTrack _translationTrack; private int _translationIndex = -1; private TextMeshProUGUI _glitchMainR; private TextMeshProUGUI _glitchMainC; private CanvasGroup _glitchMainRGroup; private CanvasGroup _glitchMainCGroup; private TextMeshProUGUI _glitchTransR; private TextMeshProUGUI _glitchTransC; private CanvasGroup _glitchTransRGroup; private CanvasGroup _glitchTransCGroup; private float _nextGlitchBurstAt; private float _glitchBurstUntil; private Vector2 _glitchOffset; private bool _prevParryFlash; private float _prevStop; private float _forcedGlitchUntil; private float _forcedGlitchStrength; private float _reactiveBarUntil; private int _forcedBarSeed; private float _nextForcedOffsetAt; private int _seenGlitchPreviewToken; private JukeboxSong _currentSong; private float _transTypeElapsed; private bool _transTyping; private float _transRelativeY; private float _nextConfigCheck; private float _nextOverlapCheck; private AudioSource _bgmSource; private Coroutine _bgmLoadRoutine; private readonly List<AudioSource> _pausedThemes = new List<AudioSource>(); private readonly Dictionary<AudioSource, ThemeState> _themeMuteState = new Dictionary<AudioSource, ThemeState>(); private AudioSource[] _musicThemesCache = Array.Empty<AudioSource>(); private float _nextMusicThemeScan; private readonly List<AudioSource> _sceneThemeSources = new List<AudioSource>(); private float _nextSceneThemeScan; private float _nextManagerFind; private object _musicManagerInstance; private FieldInfo _musicManagerOffField; private bool _musicManagerOffSaved; private bool _musicManagerOffOriginal; private GameObject _bgmPanel; private RectTransform _bgmPanelRect; private GameObject _bgmUiRoot; private RectTransform _bgmContent; private TextMeshProUGUI _bgmStatus; private int _presetPage; private TextMeshProUGUI _presetStatusText; private TMP_InputField _presetNameInput; private const int PresetsPerPage = 8; private Slider _npSizeSlider; private TextMeshProUGUI _npSizeValueText; private Button _glitchToggleButton; private Slider _glitchSlider; private TextMeshProUGUI _glitchValueText; private Slider _glitchSpeedSlider; private TextMeshProUGUI _glitchSpeedValueText; private Slider _bgmSeekSlider; private TextMeshProUGUI _bgmTimeText; private TextMeshProUGUI _bgmPauseLabel; private string _bgmLastTimeText; private string _bgmLastPauseText; private Image _menuPreviewCoverImage; private Image _menuPreviewFrameImage; private TextMeshProUGUI _menuPreviewTitleText; private TextMeshProUGUI _menuPreviewArtistText; private Sprite _menuPreviewSprite; private Texture2D _menuPreviewTexture; private string _menuPreviewPath; private string _menuPreviewTitle; private string _menuPreviewArtist; private string _bgmLastStatusText; private bool _bgmPanelOpen; private string[] _bgmAllTracks = Array.Empty<string>(); private string[] _bgmTracks = Array.Empty<string>(); private int _bgmIndex; private string _bgmSelectedCategory; private int _categoryPage; private bool _addingCategory; private bool _confirmDeleteCategory; private string _categoryPendingDelete; private TMP_InputField _categoryNameInput; private TextMeshProUGUI _categoryStatusText; private const int CategoriesPerPage = 3; private const string OstFolderName = "ULTRAKILL-OST"; private int _bgmRebindStage; private int _bgmRebindAction; private int _bgmPage; private int _bgmListOffset; private LimbusCompanyLocalization _settingsUi; private bool _bgmPaused; private const int TracksPerPage = 8; private const string BgmPauseStateKey = "lccb_f5_menu"; private GameObject _npRoot; private Image _npRowImage; private Image _npFrameImage; private Image _npCoverImage; private TextMeshProUGUI _npTitle; private TextMeshProUGUI _npArtist; private Sprite _npSprite; private Texture2D _npSpriteTexture; private bool _npSpriteOwned; private string _npSpritePath; private string _bgmCurrentPath; private SubtitleTrack _bgmSubtitleTrack = SubtitleTrack.Empty; private SubtitleTrack _bgmTranslationTrack = SubtitleTrack.Empty; private int _bgmSubtitleIndex = -1; private int _bgmTranslationIndex = -1; private string _bgmSubtitleText; private string _bgmTranslationText; private string _npLastTitleText; private string _npLastArtistText; private float _npLastFontSize = -1f; private int _npAdjustTarget; private bool _npMouseAdjust; private GameObject _npAdjustHint; private static readonly Key[] DigitKeys; private Coroutine _cursorRoutine; private GameObject _tempEventSystem; private float _nextBgmPanelRefresh; private static readonly string[][] ActionNames; private string _bgmInfoPath; private string _bgmInfoTitle; private string _bgmInfoArtist; private static readonly string[] CoverFileNames; private AudioSource _cachedLoopMusic; private float _nextLoopMusicScan; private readonly HashSet<AudioClip> _musicChangerClips = new HashSet<AudioClip>(); private float _nextMusicChangerScan; private string _musicChangerClipLog = string.Empty; private static readonly float[] VerticalDirections; public static LimbusCompanyLyricsOverlay Instance { get; private set; } public bool BgmReplacing { get; private set; } public string BgmStatus { get; private set; } = ""; private static bool IsZh { get { if (LimbusCompanyLyrics.Settings != null) { return LimbusCompanyLyrics.Settings.Language == "zh"; } return false; } } internal float WindowCanvasScale { get { float num = (((Object)(object)_canvas != (Object)null) ? _canvas.scaleFactor : 1f); if (!(num > 0.0001f)) { return 1f; } return num; } } internal RectTransform NowPlayingCanvasRect { get { if (!((Object)(object)_canvas != (Object)null)) { return null; } return ((Component)_canvas).GetComponent<RectTransform>(); } } private void Awake() { Instance = this; } private void OnEnable() { LimbusCompanyLyrics.SettingsChanged += OnSettingsChanged; SceneManager.sceneLoaded += OnSceneLoadedForBgm; } private void OnDisable() { LimbusCompanyLyrics.SettingsChanged -= OnSettingsChanged; SceneManager.sceneLoaded -= OnSceneLoadedForBgm; CloseBgmPanel(); } private void OnDestroy() { ResumeFromBgmMenu(); _settingsUi?.CloseStandalone(); if ((Object)(object)Instance == (Object)(object)this) { Instance = null; } } private void OnSceneLoadedForBgm(Scene scene, LoadSceneMode mode) { if (_bgmPanelOpen) { CloseBgmPanel(); } ResumeFromBgmMenu(force: true); if (BgmReplacing) { StopBgmReplacement(); } } private void OnSettingsChanged() { ApplyStyle(); } private void LateUpdate() { if (_bgmPanelOpen) { ForceCursorForMenu(); if ((Object)(object)_bgmPanel == (Object)null || !_bgmPanel.activeSelf) { CloseBgmPanel(); } return; } bool flag = false; try { flag = (Object)(object)GameStateManager.Instance != (Object)null && GameStateManager.Instance.IsStateActive("lccb_f5_menu"); } catch (Exception) { } if (_bgmPaused || flag) { ManualLogSource log = LimbusCompanyLyrics.Log; if (log != null) { log.LogWarning((object)"检测到 F5 暂停状态残留,强制恢复游戏输入。"); } ResumeFromBgmMenu(force: true); } } private static void ForceCursorForMenu() { //IL_0000: Unknown result type (might be due to invalid IL or missing references) if ((int)Cursor.lockState != 0) { Cursor.lockState = (CursorLockMode)0; } if (!Cursor.visible) { Cursor.visible = true; } } private IEnumerator ForceCursorLoop() { while (_bgmPanelOpen) { ForceCursorForMenu(); yield return (object)new WaitForEndOfFrame(); } _cursorRoutine = null; } private void Update() { try { HandleBgmPanelKeys(); RefreshBgmPanelTextIfOpen(); PollPlayer(); PollConfig(); PollPanelSuppression(); PollReactiveGlitch(); UpdateBgmLyrics(); Animate(); PollTranslation(); if (BgmReplacing) { KeepGameMusicPaused(); } UpdateVisualizer(); UpdateNowPlayingPanel(); if (_bgmPanelOpen) { UpdateBgmMenuScale(); } if (_bgmPanelOpen && _bgmPage == 0) { UpdateBgmPlaybackUi(); } if (_bgmPanelOpen && _bgmPage == 2) { UpdateNpSizeUi(); } CheckOverlapDiagnostics(); if (_bgmPanelOpen) { ForceCursorForMenu(); } } catch (Exception arg) { LimbusCompanyLyrics.Log.LogError((object)$"LimbusCompanyLyrics 歌词层异常: {arg}"); ((Behaviour)this).enabled = false; } } private void BuildUi() { //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Expected O, but got Unknown //IL_007f: Unknown result type (might be due to invalid IL or missing references) //IL_00b9: Unknown result type (might be due to invalid IL or missing references) //IL_00bf: Expected O, but got Unknown //IL_0100: Unknown result type (might be due to invalid IL or missing references) //IL_013f: Unknown result type (might be due to invalid IL or missing references) //IL_0145: Expected O, but got Unknown //IL_0173: Unknown result type (might be due to invalid IL or missing references) //IL_018d: Unknown result type (might be due to invalid IL or missing references) //IL_01a7: 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_01d1: 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_0295: Expected O, but got Unknown //IL_02c3: Unknown result type (might be due to invalid IL or missing references) //IL_02dd: Unknown result type (might be due to invalid IL or missing references) //IL_02f7: Unknown result type (might be due to invalid IL or missing references) //IL_0307: Unknown result type (might be due to invalid IL or missing references) //IL_0321: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)_canvas != (Object)null)) { GameObject val = new GameObject("LimbusCompanyLyricsCanvas", new Type[1] { typeof(RectTransform) }); val.transform.SetParent(((Component)this).transform, false); _canvas = val.AddComponent<Canvas>(); _canvas.renderMode = (RenderMode)0; _canvas.sortingOrder = 32000; CanvasScaler obj = val.AddComponent<CanvasScaler>(); obj.uiScaleMode = (ScaleMode)1; obj.referenceResolution = new Vector2(1920f, 1080f); obj.screenMatchMode = (ScreenMatchMode)0; obj.matchWidthOrHeight = 0.5f; val.AddComponent<GraphicRaycaster>(); GameObject val2 = new GameObject("LimbusCompanyVisualizerCanvas", new Type[1] { typeof(RectTransform) }); val2.transform.SetParent(((Component)this).transform, false); Canvas obj2 = val2.AddComponent<Canvas>(); obj2.renderMode = (RenderMode)0; obj2.sortingOrder = -1000; CanvasScaler obj3 = val2.AddComponent<CanvasScaler>(); obj3.uiScaleMode = (ScaleMode)1; obj3.referenceResolution = new Vector2(1920f, 1080f); obj3.screenMatchMode = (ScreenMatchMode)0; obj3.matchWidthOrHeight = 0.5f; BuildVisualizer(val2.transform); GameObject val3 = new GameObject("LyricText", new Type[1] { typeof(RectTransform) }); val3.transform.SetParent(val.transform, false); _rect = val3.GetComponent<RectTransform>(); _rect.anchorMin = new Vector2(0.5f, 0.5f); _rect.anchorMax = new Vector2(0.5f, 0.5f); _rect.pivot = new Vector2(0.5f, 0.5f); _rect.anchoredPosition = Vector2.zero; _rect.sizeDelta = new Vector2(1800f, 600f); _group = val3.AddComponent<CanvasGroup>(); _group.alpha = 0f; _group.interactable = false; _group.blocksRaycasts = false; _text = val3.AddComponent<TextMeshProUGUI>(); ((Graphic)_text).raycastTarget = false; ((TMP_Text)_text).richText = false; ((TMP_Text)_text).enableWordWrapping = false; ((TMP_Text)_text).overflowMode = (TextOverflowModes)0; ((TMP_Text)_text).alignment = (TextAlignmentOptions)514; ((TMP_Text)_text).enableAutoSizing = false; ((TMP_Text)_text).text = string.Empty; GameObject val4 = new GameObject("TranslationText", new Type[1] { typeof(RectTransform) }); val4.transform.SetParent(val.transform, false); _transRect = val4.GetComponent<RectTransform>(); _transRect.anchorMin = new Vector2(0.5f, 0.5f); _transRect.anchorMax = new Vector2(0.5f, 0.5f); _transRect.pivot = new Vector2(0.5f, 0.5f); _transRect.anchoredPosition = Vector2.zero; _transRect.sizeDelta = new Vector2(1800f, 600f); _transGroup = val4.AddComponent<CanvasGroup>(); _transGroup.alpha = 0f; _transGroup.interactable = false; _transGroup.blocksRaycasts = false; _transText = val4.AddComponent<TextMeshProUGUI>(); ((Graphic)_transText).raycastTarget = false; ((TMP_Text)_transText).richText = false; ((TMP_Text)_transText).enableWordWrapping = false; ((TMP_Text)_transText).overflowMode = (TextOverflowModes)0; ((TMP_Text)_transText).alignment = (TextAlignmentOptions)514; ((TMP_Text)_transText).enableAutoSizing = false; ((TMP_Text)_transText).text = string.Empty; BuildGlitchGhosts(); EnsureFont(); ApplyStyle(); BuildBgmPanel(); BuildNowPlayingPanel(); } } private void EnsureFont() { if ((Object)(object)_text == (Object)null || (Object)(object)_font != (Object)null) { return; } SubtitlesPanel val = Object.FindObjectOfType<SubtitlesPanel>(); if ((Object)(object)val != (Object)null && (Object)(object)val.text != (Object)null && (Object)(object)val.text.font != (Object)null) { TMP_FontAsset font = val.text.font; if (HasAsianGlyphs(font)) { _font = font; } } if ((Object)(object)_font == (Object)null) { _font = CreateSystemFont(); } if ((Object)(object)_font == (Object)null) { _font = TMP_Settings.defaultFontAsset; } if ((Object)(object)_font == (Object)null) { LimbusCompanyLyrics.Log.LogError((object)"LimbusCompanyLyrics 找不到可用字体,歌词层无法显示。"); return; } TMP_FontAsset val2 = LimbusCompanyFonts.ResolveLatin(); ((TMP_Text)_text).font = val2 ?? _font; if ((Object)(object)_transText != (Object)null) { ((TMP_Text)_transText).font = val2 ?? _font; } } private static void ApplyFontFor(TMP_Text text, string content) { if (!((Object)(object)text == (Object)null)) { TMP_FontAsset val = (LimbusCompanyFonts.IsCjkText(content) ? LimbusCompanyFonts.Resolve() : LimbusCompanyFonts.ResolveLatin()); if ((Object)(object)val != (Object)null && (Object)(object)text.font != (Object)(object)val) { text.font = val; } } } private TMP_FontAsset CreateSystemFont() { LimbusCompanyLyricsSettings settings = LimbusCompanyLyrics.Settings; string[] installed; try { installed = Font.GetOSInstalledFontNames(); } catch (Exception) { installed = Array.Empty<string>(); } string[] obj = new string[12] { settings?.FontFamily, "Yu Gothic UI", "Yu Gothic", "Microsoft YaHei UI", "Microsoft YaHei", "等线 Light", "等线", "DengXian", "MS Gothic", "Meiryo", "Arial Unicode MS", "Segoe UI" }; TMP_FontAsset val = null; string[] array = obj; foreach (string text in array) { if (string.IsNullOrEmpty(text) || !ContainsName(installed, text)) { continue; } try { Font val2 = Font.CreateDynamicFontFromOSFont(text, 96); if ((Object)(object)val2 == (Object)null) { continue; } TMP_FontAsset val3 = TMP_FontAsset.CreateFontAsset(val2); if (!((Object)(object)val3 == (Object)null)) { ((Object)val3).name = "LimbusCompany-" + text; if (HasAsianGlyphs(val3)) { LimbusCompanyLyrics.Log.LogInfo((object)("LimbusCompanyLyrics 歌词字体: " + text)); return val3; } if (val == null) { val = val3; } } } catch (Exception ex2) { LimbusCompanyLyrics.Log.LogWarning((object)("LimbusCompanyLyrics 加载系统字体失败 (" + text + "): " + ex2.Message)); } } return val; } private void BuildVisualizer(Transform parent) { //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Expected O, but got Unknown //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_0043: 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_0059: Unknown result type (might be due to invalid IL or missing references) //IL_0095: Unknown result type (might be due to invalid IL or missing references) //IL_009a: Unknown result type (might be due to invalid IL or missing references) //IL_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00c8: Unknown result type (might be due to invalid IL or missing references) //IL_00dd: Unknown result type (might be due to invalid IL or missing references) //IL_00e8: Unknown result type (might be due to invalid IL or missing references) //IL_00f2: 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_0118: Unknown result type (might be due to invalid IL or missing references) //IL_012f: Unknown result type (might be due to invalid IL or missing references) //IL_0143: Unknown result type (might be due to invalid IL or missing references) _visRoot = new GameObject("AudioVisualizer", new Type[1] { typeof(RectTransform) }); RectTransform component = _visRoot.GetComponent<RectTransform>(); ((Transform)component).SetParent(parent, false); component.anchorMin = Vector2.zero; component.anchorMax = Vector2.one; component.offsetMin = Vector2.zero; component.offsetMax = Vector2.zero; BuildVisualizerVignette(component); for (int i = 0; i < _visBars.Length; i++) { GameObject val = new GameObject("Bar" + i, new Type[1] { typeof(RectTransform) }); RectTransform component2 = val.GetComponent<RectTransform>(); ((Transform)component2).SetParent((Transform)(object)component, false); component2.anchorMin = new Vector2(0.5f, 0.5f); component2.anchorMax = new Vector2(0.5f, 0.5f); component2.pivot = new Vector2(0.5f, 0f); component2.anchoredPosition = Vector2.zero; component2.sizeDelta = Vector2.zero; Image val2 = val.AddComponent<Image>(); ((Graphic)val2).color = new Color(0.776f, 0.635f, 0.29f, 0.55f); ((Graphic)val2).raycastTarget = false; Outline obj = val.AddComponent<Outline>(); ((Shadow)obj).effectColor = Color.black; ((Shadow)obj).effectDistance = new Vector2(1f, -1f); _visBars[i] = val2; } _visRoot.SetActive(false); _visRoot.transform.SetSiblingIndex(0); ManualLogSource log = LimbusCompanyLyrics.Log; if (log != null) { log.LogInfo((object)"音频可视化控件已创建。"); } } private void BuildVisualizerVignette(RectTransform rootRect) { //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Expected O, but got Unknown //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_0043: 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_0069: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Expected O, but got Unknown //IL_0154: 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_0196: Unknown result type (might be due to invalid IL or missing references) //IL_0108: Unknown result type (might be due to invalid IL or missing references) GameObject val = new GameObject("Vignette", new Type[1] { typeof(RectTransform) }); RectTransform component = val.GetComponent<RectTransform>(); ((Transform)component).SetParent((Transform)(object)rootRect, false); component.anchorMin = Vector2.zero; component.anchorMax = Vector2.one; component.offsetMin = Vector2.zero; component.offsetMax = Vector2.zero; ((Transform)component).SetAsFirstSibling(); Texture2D val2 = new Texture2D(256, 256, (TextureFormat)4, false); ((Object)val2).name = "LCCB Visualizer Vignette"; ((Texture)val2).wrapMode = (TextureWrapMode)1; ((Texture)val2).filterMode = (FilterMode)1; float num = Mathf.Sqrt(2f); for (int i = 0; i < 256; i++) { for (int j = 0; j < 256; j++) { float num2 = (float)j / 255f * 2f - 1f; float num3 = (float)i / 255f * 2f - 1f; float num4 = Mathf.Pow(Mathf.Clamp01(Mathf.Sqrt(num2 * num2 + num3 * num3) / num), 2.2f) * 0.78f; val2.SetPixel(j, i, new Color(0f, 0f, 0f, num4)); } } val2.Apply(false, true); _visVignetteSprite = Sprite.Create(val2, new Rect(0f, 0f, 256f, 256f), new Vector2(0.5f, 0.5f)); ((Object)_visVignetteSprite).name = "LCCB Visualizer Vignette"; Image val3 = val.AddComponent<Image>(); val3.sprite = _visVignetteSprite; ((Graphic)val3).color = Color.white; ((Graphic)val3).raycastTarget = false; val3.type = (Type)0; _visVignette = val3; val.SetActive(false); } private void EnsureMouseEventSystem() { //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Expected O, but got Unknown if ((Object)(object)EventSystem.current != (Object)null || (Object)(object)_tempEventSystem != (Object)null) { return; } try { GameObject val = new GameObject("LimbusEventSystem"); val.transform.SetParent(((Component)this).transform, false); _tempEventSystem = val; val.AddComponent<EventSystem>(); InputSystemUIInputModule val2 = val.AddComponent<InputSystemUIInputModule>(); ((object)val2).GetType().GetMethod("AssignDefaultActions")?.Invoke(val2, null); } catch (Exception ex) { ManualLogSource log = LimbusCompanyLyrics.Log; if (log != null) { log.LogWarning((object)("创建 UI EventSystem 失败: " + ex.Message)); } } } private void DestroyTempEventSystem() { if (!((Object)(object)_tempEventSystem == (Object)null)) { Object.Destroy((Object)(object)_tempEventSystem); _tempEventSystem = null; } } private void BuildBgmPanel() { //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Expected O, but got Unknown //IL_005f: 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_0089: Unknown result type (might be due to invalid IL or missing references) //IL_009e: Unknown result type (might be due to invalid IL or missing references) //IL_00a9: Unknown result type (might be due to invalid IL or missing references) //IL_00ce: Unknown result type (might be due to invalid IL or missing referen