using System; using System.Collections.Generic; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using Microsoft.CodeAnalysis; using RoR2; using RoR2.UI; using TMPro; using UnityEngine; using UnityEngine.EventSystems; using UnityEngine.Events; using UnityEngine.Networking; 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: AssemblyCompany("InRunArtifacts")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.0.1.0")] [assembly: AssemblyInformationalVersion("1.0.1")] [assembly: AssemblyProduct("InRunArtifacts")] [assembly: AssemblyTitle("InRunArtifacts")] [assembly: AssemblyVersion("1.0.1.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 InRunArtifacts { internal static class ArtifactToggleManager { private sealed class ArtifactIconEntry { internal ArtifactDef Artifact; internal Image CardImage; internal Image IconImage; internal Outline Border; internal HGTextMeshProUGUI StatusLabel; internal ArtifactHoverHandler HoverHandler; } private static readonly Dictionary PendingStates = new Dictionary(); private static readonly List Artifacts = new List(); private static readonly List IconEntries = new List(); private static InRunArtifactsPlugin _plugin; private static ConfigEntry _menuKey; private static GameObject _root; private static MPEventSystem _eventSystem; private static bool _cursorOpened; private static bool _paused; private static float _previousTimeScale = 1f; private static HGTextMeshProUGUI _hoverTitle; private static HGTextMeshProUGUI _hoverBody; private static HGTextMeshProUGUI _pendingLabel; internal static bool IsMenuOpen => Object.op_Implicit((Object)(object)_root); private static string T(string chinese, string english) { if (!(Language.currentLanguage?.name ?? "en").StartsWith("zh", StringComparison.OrdinalIgnoreCase)) { return english; } return chinese; } internal static void Initialize(InRunArtifactsPlugin plugin) { _plugin = plugin; _menuKey = ((BaseUnityPlugin)plugin).Config.Bind("神器管理", "打开菜单快捷键", (KeyCode)288, "在一局游戏中打开神器开关菜单。修改会在进入下一张地图前生效。"); Stage.onServerStageComplete += OnServerStageComplete; Run.onRunDestroyGlobal += OnRunDestroy; } internal static void Shutdown() { Stage.onServerStageComplete -= OnServerStageComplete; Run.onRunDestroyGlobal -= OnRunDestroy; PendingStates.Clear(); CloseMenu(); _plugin = null; } internal static void Update() { //IL_0028: Unknown result type (might be due to invalid IL or missing references) if (_menuKey == null) { return; } if (Object.op_Implicit((Object)(object)_root) && Input.GetKeyDown((KeyCode)27)) { CloseMenu(); } else if (Input.GetKeyDown(_menuKey.Value)) { if (Object.op_Implicit((Object)(object)_root)) { CloseMenu(); } else { TryOpenMenu(); } } } private static void TryOpenMenu() { if (!NetworkServer.active || (Object)(object)Run.instance == (Object)null || (Object)(object)RunArtifactManager.instance == (Object)null) { Chat.AddMessage(T("神器管理只能由房主在一局游戏中使用。", "Only the host can manage artifacts during a run.")); return; } if (Time.timeScale <= 0f) { Chat.AddMessage(T("请先关闭当前暂停或选择界面。", "Close the current pause or selection menu first.")); return; } RefreshArtifactList(); if (Artifacts.Count == 0) { Chat.AddMessage(T("没有找到可管理的神器。", "No artifacts found.")); } else { ShowMenu(); } } private static void RefreshArtifactList() { Artifacts.Clear(); for (int i = 0; i < ArtifactCatalog.artifactCount; i++) { ArtifactDef artifactDef = ArtifactCatalog.GetArtifactDef((ArtifactIndex)i); if (Object.op_Implicit((Object)(object)artifactDef)) { Artifacts.Add(artifactDef); } } Artifacts.Sort((ArtifactDef left, ArtifactDef right) => string.Compare(Language.GetString(left.nameToken), Language.GetString(right.nameToken), StringComparison.CurrentCulture)); } private static void ShowMenu() { //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_0075: Unknown result type (might be due to invalid IL or missing references) //IL_0093: 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_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) //IL_00d0: Unknown result type (might be due to invalid IL or missing references) //IL_00ee: 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_0102: 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) LocalUser firstLocalUser = LocalUserManager.GetFirstLocalUser(); if (firstLocalUser == null || (Object)(object)firstLocalUser.eventSystem == (Object)null) { Chat.AddMessage(T("暂时无法打开神器管理界面。", "The artifact menu is currently unavailable.")); return; } _root = UiFactory.CreateOverlay("InRunArtifactsMenu", new Vector2(0.05f, 0.07f), new Vector2(0.95f, 0.93f), out var panel); UiFactory.Stretch(((TMP_Text)UiFactory.CreateText("标题", (Transform)(object)panel, T("神器管理", "Artifact Manager"), 38f, Color.white, (TextAlignmentOptions)514)).rectTransform, new Vector2(0.04f, 0.91f), new Vector2(0.96f, 0.98f), Vector2.zero, Vector2.zero); UiFactory.Stretch(((TMP_Text)UiFactory.CreateText("说明", (Transform)(object)panel, T("点击图标切换下关状态 · 亮色为开启,灰色为关闭 · 鼠标悬停查看效果", "Click to toggle next stage · Bright: ON / Gray: OFF · Hover for details"), 18f, UiFactory.MutedTextColor, (TextAlignmentOptions)514)).rectTransform, new Vector2(0.04f, 0.865f), new Vector2(0.96f, 0.91f), Vector2.zero, Vector2.zero); CreateHoverPanel(panel); CreateArtifactGrid(panel); CreateFooter(panel); _eventSystem = firstLocalUser.eventSystem; if (Object.op_Implicit((Object)(object)_eventSystem)) { MPEventSystem eventSystem = _eventSystem; int cursorOpenerCount = eventSystem.cursorOpenerCount; eventSystem.cursorOpenerCount = cursorOpenerCount + 1; MPEventSystem eventSystem2 = _eventSystem; cursorOpenerCount = eventSystem2.cursorOpenerForGamepadCount; eventSystem2.cursorOpenerForGamepadCount = cursorOpenerCount + 1; _cursorOpened = true; } PauseGame(); InRunArtifactsPlugin.Log.LogInfo((object)$"[神器管理] 单页菜单已打开,共载入 {Artifacts.Count} 个神器。"); } private static void CreateHoverPanel(RectTransform panel) { //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0035: 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_007e: Unknown result type (might be due to invalid IL or missing references) //IL_0092: Unknown result type (might be due to invalid IL or missing references) //IL_00bb: Unknown result type (might be due to invalid IL or missing references) //IL_00e3: 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_00f7: 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_0125: Unknown result type (might be due to invalid IL or missing references) //IL_014d: Unknown result type (might be due to invalid IL or missing references) //IL_015c: Unknown result type (might be due to invalid IL or missing references) //IL_0161: Unknown result type (might be due to invalid IL or missing references) //IL_0166: Unknown result type (might be due to invalid IL or missing references) GameObject val = UiFactory.CreateRect("悬停说明", (Transform)(object)panel); UiFactory.Stretch(val.GetComponent(), new Vector2(0.08f, 0.72f), new Vector2(0.92f, 0.85f), Vector2.zero, Vector2.zero); ((Graphic)val.AddComponent()).color = new Color(0.035f, 0.05f, 0.085f, 0.92f); Outline obj = val.AddComponent(); ((Shadow)obj).effectColor = new Color(0.24f, 0.38f, 0.52f, 0.7f); ((Shadow)obj).effectDistance = new Vector2(1f, -1f); _hoverTitle = UiFactory.CreateText("神器名称", val.transform, T("将鼠标放到神器图标上查看详情", "Hover over an artifact for details"), 23f, UiFactory.GoldColor, (TextAlignmentOptions)513); UiFactory.Stretch(((TMP_Text)_hoverTitle).rectTransform, new Vector2(0.03f, 0.55f), new Vector2(0.97f, 0.94f), Vector2.zero, Vector2.zero); _hoverBody = UiFactory.CreateText("神器效果", val.transform, T("点击图标只修改下一张地图的状态,本关不会立刻改变。", "Changes apply next stage, not the current stage."), 17f, Color.white, (TextAlignmentOptions)513); UiFactory.Stretch(((TMP_Text)_hoverBody).rectTransform, new Vector2(0.03f, 0.08f), new Vector2(0.97f, 0.58f), Vector2.zero, Vector2.zero); } private static void CreateArtifactGrid(RectTransform panel) { //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0035: 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_00c7: Unknown result type (might be due to invalid IL or missing references) GameObject val = UiFactory.CreateRect("神器图标网格", (Transform)(object)panel); UiFactory.Stretch(val.GetComponent(), new Vector2(0.05f, 0.19f), new Vector2(0.95f, 0.7f), Vector2.zero, Vector2.zero); int num = Mathf.Min(9, Mathf.Max(1, Artifacts.Count)); int num2 = Mathf.CeilToInt((float)Artifacts.Count / (float)num); float num3 = ((num2 <= 2) ? 154f : ((num2 == 3) ? 124f : 98f)); float num4 = Mathf.Min(126f, num3 - 12f); GridLayoutGroup obj = val.AddComponent(); obj.constraint = (Constraint)1; obj.constraintCount = num; obj.cellSize = new Vector2(num4, num3); obj.spacing = new Vector2(14f, 12f); ((LayoutGroup)obj).childAlignment = (TextAnchor)4; obj.startAxis = (Axis)0; IconEntries.Clear(); foreach (ArtifactDef artifact in Artifacts) { CreateArtifactIcon(val.transform, artifact); } } private static void CreateArtifactIcon(Transform parent, ArtifactDef artifactDef) { //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0062: 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_0076: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: Unknown result type (might be due to invalid IL or missing references) //IL_00d3: Unknown result type (might be due to invalid IL or missing references) //IL_00e2: Unknown result type (might be due to invalid IL or missing references) //IL_00e7: Unknown result type (might be due to invalid IL or missing references) //IL_00ec: Unknown result type (might be due to invalid IL or missing references) //IL_0152: Unknown result type (might be due to invalid IL or missing references) //IL_015c: Expected O, but got Unknown GameObject val = UiFactory.CreateRect(Language.GetString(artifactDef.nameToken), parent); Image val2 = val.AddComponent(); Outline val3 = val.AddComponent(); ((Shadow)val3).effectDistance = new Vector2(2f, -2f); MPButton obj = UiFactory.CreateButton(val, val2); GameObject obj2 = UiFactory.CreateRect("图标", val.transform); UiFactory.Stretch(obj2.GetComponent(), new Vector2(0.1f, 0.2f), new Vector2(0.9f, 0.95f), Vector2.zero, Vector2.zero); Image val4 = obj2.AddComponent(); val4.preserveAspect = true; ((Graphic)val4).raycastTarget = false; HGTextMeshProUGUI val5 = UiFactory.CreateText("状态", val.transform, string.Empty, 15f, Color.white, (TextAlignmentOptions)514); UiFactory.Stretch(((TMP_Text)val5).rectTransform, new Vector2(0.03f, 0.02f), new Vector2(0.97f, 0.2f), Vector2.zero, Vector2.zero); ArtifactHoverHandler artifactHoverHandler = val.AddComponent(); ArtifactIconEntry entry = new ArtifactIconEntry { Artifact = artifactDef, CardImage = val2, IconImage = val4, Border = val3, StatusLabel = val5, HoverHandler = artifactHoverHandler }; IconEntries.Add(entry); ((UnityEvent)((Button)obj).onClick).AddListener((UnityAction)delegate { ToggleArtifact(entry); }); artifactHoverHandler.OnEnter = delegate { ShowArtifactDescription(entry); }; artifactHoverHandler.OnExit = ShowDefaultDescription; RefreshIconEntry(entry); } private static void CreateFooter(RectTransform panel) { //IL_0010: 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_0047: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_0075: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Unknown result type (might be due to invalid IL or missing references) //IL_009d: Unknown result type (might be due to invalid IL or missing references) //IL_00dc: Unknown result type (might be due to invalid IL or missing references) //IL_00eb: Unknown result type (might be due to invalid IL or missing references) //IL_0104: Unknown result type (might be due to invalid IL or missing references) _pendingLabel = UiFactory.CreateText("待应用数量", (Transform)(object)panel, string.Empty, 18f, UiFactory.MutedTextColor, (TextAlignmentOptions)513); UiFactory.Stretch(((TMP_Text)_pendingLabel).rectTransform, new Vector2(0.06f, 0.08f), new Vector2(0.43f, 0.16f), Vector2.zero, Vector2.zero); CreateFooterButton(panel, T("撤销全部修改", "Undo all"), new Vector2(0.48f, 0.065f), new Vector2(0.69f, 0.155f), new Color(0.18f, 0.22f, 0.29f, 1f), ClearPendingChanges); CreateFooterButton(panel, T("完成(下关生效)", "Done (next stage)"), new Vector2(0.71f, 0.065f), new Vector2(0.94f, 0.155f), new Color(0.12f, 0.48f, 0.56f, 1f), CloseMenu); RefreshPendingLabel(); } private static void CreateFooterButton(RectTransform panel, string label, Vector2 anchorMin, Vector2 anchorMax, Color color, Action action) { //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0035: 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_006b: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_0092: Expected O, but got Unknown //IL_00a3: Unknown result type (might be due to invalid IL or missing references) //IL_00b7: Unknown result type (might be due to invalid IL or missing references) //IL_00bc: Unknown result type (might be due to invalid IL or missing references) //IL_00cb: Unknown result type (might be due to invalid IL or missing references) //IL_00da: Unknown result type (might be due to invalid IL or missing references) GameObject val = UiFactory.CreateRect(label, (Transform)(object)panel); UiFactory.Stretch(val.GetComponent(), anchorMin, anchorMax, Vector2.zero, Vector2.zero); Image val2 = val.AddComponent(); ((Graphic)val2).color = color; Outline obj = val.AddComponent(); ((Shadow)obj).effectColor = new Color(1f, 1f, 1f, 0.2f); ((Shadow)obj).effectDistance = new Vector2(1f, -1f); ((UnityEvent)((Button)UiFactory.CreateButton(val, val2)).onClick).AddListener((UnityAction)delegate { action(); }); UiFactory.Stretch(((TMP_Text)UiFactory.CreateText("文字", val.transform, label, 19f, Color.white, (TextAlignmentOptions)514)).rectTransform, Vector2.zero, Vector2.one, new Vector2(8f, 4f), new Vector2(-8f, -4f)); } private static void ToggleArtifact(ArtifactIconEntry entry) { if (entry != null && Object.op_Implicit((Object)(object)entry.Artifact) && !((Object)(object)RunArtifactManager.instance == (Object)null)) { bool flag = RunArtifactManager.instance.IsArtifactEnabled(entry.Artifact); bool flag2 = !GetTargetState(entry.Artifact, flag); if (flag2 == flag) { PendingStates.Remove(entry.Artifact); } else { PendingStates[entry.Artifact] = flag2; } RefreshIconEntry(entry); RefreshPendingLabel(); ShowArtifactDescription(entry); } } private static bool GetTargetState(ArtifactDef artifactDef, bool currentState) { if (!PendingStates.TryGetValue(artifactDef, out var value)) { return currentState; } return value; } private static void RefreshIconEntry(ArtifactIconEntry entry) { //IL_0087: Unknown result type (might be due to invalid IL or missing references) //IL_0080: Unknown result type (might be due to invalid IL or missing references) //IL_00c9: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: Unknown result type (might be due to invalid IL or missing references) //IL_0101: Unknown result type (might be due to invalid IL or missing references) //IL_00fa: Unknown result type (might be due to invalid IL or missing references) //IL_00f3: Unknown result type (might be due to invalid IL or missing references) //IL_0199: Unknown result type (might be due to invalid IL or missing references) //IL_017e: Unknown result type (might be due to invalid IL or missing references) bool flag = RunArtifactManager.instance.IsArtifactEnabled(entry.Artifact); bool targetState = GetTargetState(entry.Artifact, flag); bool flag2 = targetState != flag; Sprite val = (targetState ? entry.Artifact.smallIconSelectedSprite : entry.Artifact.smallIconDeselectedSprite); entry.IconImage.sprite = (Object.op_Implicit((Object)(object)val) ? val : entry.Artifact.smallIconSelectedSprite); ((Graphic)entry.IconImage).color = (Color)(targetState ? Color.white : new Color(0.34f, 0.36f, 0.4f, 0.78f)); ((Graphic)entry.CardImage).color = (targetState ? new Color(0.1f, 0.12f, 0.16f, 1f) : new Color(0.035f, 0.045f, 0.06f, 0.92f)); ((Shadow)entry.Border).effectColor = (Color)(flag2 ? UiFactory.CyanColor : (targetState ? UiFactory.GoldColor : new Color(0.28f, 0.3f, 0.34f, 0.7f))); ((TMP_Text)entry.StatusLabel).text = ((!flag2) ? (targetState ? T("开启", "ON") : T("关闭", "OFF")) : (targetState ? T("下关:开启 *", "Next: ON *") : T("下关:关闭 *", "Next: OFF *"))); ((Graphic)entry.StatusLabel).color = (targetState ? new Color(0.55f, 0.94f, 0.66f, 1f) : new Color(0.58f, 0.61f, 0.67f, 1f)); } private static void ShowArtifactDescription(ArtifactIconEntry entry) { if (Object.op_Implicit((Object)(object)_hoverTitle) && Object.op_Implicit((Object)(object)_hoverBody) && entry != null && Object.op_Implicit((Object)(object)entry.Artifact)) { bool currentState = RunArtifactManager.instance.IsArtifactEnabled(entry.Artifact); bool targetState = GetTargetState(entry.Artifact, currentState); ((TMP_Text)_hoverTitle).text = Language.GetString(entry.Artifact.nameToken) + " · " + T("下关:", "Next: ") + (targetState ? T("开启", "ON") : T("关闭", "OFF")); ((TMP_Text)_hoverBody).text = Language.GetString(entry.Artifact.descriptionToken); } } private static void ShowDefaultDescription() { if (Object.op_Implicit((Object)(object)_hoverTitle) && Object.op_Implicit((Object)(object)_hoverBody)) { ((TMP_Text)_hoverTitle).text = T("将鼠标放到神器图标上查看详情", "Hover over an artifact for details"); ((TMP_Text)_hoverBody).text = T("点击图标只修改下一张地图的状态,本关不会立刻改变。", "Changes apply next stage, not the current stage."); } } private static void RefreshPendingLabel() { //IL_0070: 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) if (Object.op_Implicit((Object)(object)_pendingLabel)) { ((TMP_Text)_pendingLabel).text = ((PendingStates.Count > 0) ? string.Format(T("待应用修改:{0} 项", "Pending changes: {0}"), PendingStates.Count) : T("尚未修改任何神器", "No pending changes")); ((Graphic)_pendingLabel).color = ((PendingStates.Count > 0) ? UiFactory.CyanColor : UiFactory.MutedTextColor); } } private static void ClearPendingChanges() { PendingStates.Clear(); foreach (ArtifactIconEntry iconEntry in IconEntries) { RefreshIconEntry(iconEntry); } RefreshPendingLabel(); ShowDefaultDescription(); } private static void OnServerStageComplete(Stage stage) { if (!NetworkServer.active || PendingStates.Count == 0 || (Object)(object)RunArtifactManager.instance == (Object)null) { return; } int num = 0; foreach (KeyValuePair pendingState in PendingStates) { if (Object.op_Implicit((Object)(object)pendingState.Key)) { RunArtifactManager.instance.SetArtifactEnabledServer(pendingState.Key, pendingState.Value); num++; } } PendingStates.Clear(); Chat.AddMessage(string.Format(T("已应用 {0} 项神器修改,将在下一张地图生效。", "Applied {0} artifact changes for the next stage."), num)); InRunArtifactsPlugin.Log.LogInfo((object)$"[神器管理] 关卡结束时应用了 {num} 项修改。"); } private static void OnRunDestroy(Run run) { PendingStates.Clear(); CloseMenu(); } private static void PauseGame() { if (!_paused) { _previousTimeScale = Time.timeScale; Time.timeScale = 0f; _paused = true; } } private static void ResumeGame() { if (_paused) { Time.timeScale = ((_previousTimeScale > 0f) ? _previousTimeScale : 1f); _paused = false; } } private static void CloseMenu() { if (_cursorOpened && Object.op_Implicit((Object)(object)_eventSystem)) { _eventSystem.cursorOpenerCount = Mathf.Max(0, _eventSystem.cursorOpenerCount - 1); _eventSystem.cursorOpenerForGamepadCount = Mathf.Max(0, _eventSystem.cursorOpenerForGamepadCount - 1); } _cursorOpened = false; _eventSystem = null; IconEntries.Clear(); _hoverTitle = null; _hoverBody = null; _pendingLabel = null; if (Object.op_Implicit((Object)(object)_root)) { Object.Destroy((Object)(object)_root); } _root = null; ResumeGame(); } } internal sealed class ArtifactHoverHandler : MonoBehaviour, IPointerEnterHandler, IEventSystemHandler, IPointerExitHandler { internal Action OnEnter; internal Action OnExit; public void OnPointerEnter(PointerEventData eventData) { OnEnter?.Invoke(); } public void OnPointerExit(PointerEventData eventData) { OnExit?.Invoke(); } } [BepInPlugin("com.lml.inrunartifacts", "In Run Artifacts", "1.0.1")] public sealed class InRunArtifactsPlugin : BaseUnityPlugin { public const string PluginGUID = "com.lml.inrunartifacts"; internal static ManualLogSource Log; private void Awake() { Log = ((BaseUnityPlugin)this).Logger; ArtifactToggleManager.Initialize(this); Log.LogInfo((object)"局内神器管理 1.0.1 已加载,快捷键 F7。"); } private void Update() { ArtifactToggleManager.Update(); } private void OnDestroy() { ArtifactToggleManager.Shutdown(); } } internal static class UiFactory { internal static readonly Color PanelColor = new Color(0.025f, 0.035f, 0.065f, 0.98f); internal static readonly Color CardColor = new Color(0.055f, 0.075f, 0.115f, 0.98f); internal static readonly Color GoldColor = new Color(0.88f, 0.7f, 0.28f, 1f); internal static readonly Color CyanColor = new Color(0.3f, 0.82f, 0.92f, 1f); internal static readonly Color MutedTextColor = new Color(0.68f, 0.72f, 0.8f, 1f); internal static GameObject CreateOverlay(string name, Vector2 panelAnchorMin, Vector2 panelAnchorMax, out RectTransform panel) { //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Expected O, but got Unknown //IL_0077: 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_00a6: 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_00b0: Unknown result type (might be due to invalid IL or missing references) //IL_00d3: Unknown result type (might be due to invalid IL or missing references) //IL_00f8: Unknown result type (might be due to invalid IL or missing references) //IL_00f9: Unknown result type (might be due to invalid IL or missing references) //IL_00fa: Unknown result type (might be due to invalid IL or missing references) //IL_00ff: 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_0143: Unknown result type (might be due to invalid IL or missing references) //IL_0157: Unknown result type (might be due to invalid IL or missing references) GameObject val = new GameObject(name, new Type[4] { typeof(RectTransform), typeof(Canvas), typeof(CanvasScaler), typeof(GraphicRaycaster) }); val.layer = 5; Canvas component = val.GetComponent(); component.renderMode = (RenderMode)0; component.sortingOrder = 30000; CanvasScaler component2 = val.GetComponent(); component2.uiScaleMode = (ScaleMode)1; component2.referenceResolution = new Vector2(1920f, 1080f); component2.matchWidthOrHeight = 0.5f; GameObject obj = CreateRect("背景遮罩", val.transform); Stretch(obj.GetComponent(), Vector2.zero, Vector2.one, Vector2.zero, Vector2.zero); ((Graphic)obj.AddComponent()).color = new Color(0f, 0f, 0f, 0.78f); GameObject val2 = CreateRect("主面板", val.transform); panel = val2.GetComponent(); Stretch(panel, panelAnchorMin, panelAnchorMax, Vector2.zero, Vector2.zero); ((Graphic)val2.AddComponent()).color = PanelColor; Outline obj2 = val2.AddComponent(); ((Shadow)obj2).effectColor = new Color(GoldColor.r, GoldColor.g, GoldColor.b, 0.75f); ((Shadow)obj2).effectDistance = new Vector2(2f, -2f); return val; } internal static GameObject CreateRect(string name, Transform parent) { //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_0020: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Expected O, but got Unknown GameObject val = new GameObject(name, new Type[1] { typeof(RectTransform) }) { layer = 5 }; val.transform.SetParent(parent, false); return val; } internal static HGTextMeshProUGUI CreateText(string name, Transform parent, string text, float fontSize, Color color, TextAlignmentOptions alignment = (TextAlignmentOptions)514) { //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) HGTextMeshProUGUI obj = CreateRect(name, parent).AddComponent(); ((TMP_Text)obj).text = text; ((TMP_Text)obj).fontSize = fontSize; ((Graphic)obj).color = color; ((TMP_Text)obj).alignment = alignment; ((TMP_Text)obj).enableWordWrapping = true; ((Graphic)obj).raycastTarget = false; return obj; } internal static MPButton CreateButton(GameObject gameObject, Image targetGraphic) { //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_0063: 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_0091: Unknown result type (might be due to invalid IL or missing references) //IL_00a8: Unknown result type (might be due to invalid IL or missing references) MPButton obj = gameObject.AddComponent(); obj.allowAllEventSystems = true; ((Selectable)obj).targetGraphic = (Graphic)(object)targetGraphic; ((Selectable)obj).transition = (Transition)1; ColorBlock defaultColorBlock = ColorBlock.defaultColorBlock; ((ColorBlock)(ref defaultColorBlock)).normalColor = Color.white; ((ColorBlock)(ref defaultColorBlock)).highlightedColor = new Color(1.12f, 1.12f, 1.12f, 1f); ((ColorBlock)(ref defaultColorBlock)).pressedColor = new Color(0.78f, 0.86f, 0.92f, 1f); ((ColorBlock)(ref defaultColorBlock)).selectedColor = ((ColorBlock)(ref defaultColorBlock)).highlightedColor; ((ColorBlock)(ref defaultColorBlock)).disabledColor = new Color(0.42f, 0.42f, 0.42f, 0.65f); ((ColorBlock)(ref defaultColorBlock)).fadeDuration = 0.16f; ((Selectable)obj).colors = defaultColorBlock; return obj; } internal static void Stretch(RectTransform rect, Vector2 anchorMin, Vector2 anchorMax, Vector2 offsetMin, Vector2 offsetMax) { //IL_0001: 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) //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) rect.anchorMin = anchorMin; rect.anchorMax = anchorMax; rect.offsetMin = offsetMin; rect.offsetMax = offsetMax; } } }