Decompiled source of KainRogueProtocol v4.0.2

BepInEx/plugins/KainRogueProtocol/KainRogueProtocol.dll

Decompiled 3 weeks ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Text;
using AIGraph;
using Agents;
using AssetShards;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Core.Logging.Interpolation;
using BepInEx.Logging;
using BepInEx.Unity.IL2CPP;
using CellMenu;
using ChainedPuzzles;
using CullingSystem;
using Enemies;
using FX_EffectSystem;
using GTFO.API;
using GameData;
using Gear;
using HarmonyLib;
using Il2CppInterop.Runtime;
using Il2CppInterop.Runtime.Attributes;
using Il2CppInterop.Runtime.Injection;
using Il2CppInterop.Runtime.InteropTypes;
using Il2CppInterop.Runtime.InteropTypes.Arrays;
using Il2CppSystem;
using Il2CppSystem.Collections;
using Il2CppSystem.Collections.Generic;
using Il2CppSystem.Reflection;
using KainRogueProtocol.Core;
using KainRogueProtocol.Corruption;
using KainRogueProtocol.Data;
using KainRogueProtocol.DataPatches;
using KainRogueProtocol.Effects;
using KainRogueProtocol.Events;
using KainRogueProtocol.Fixes.EnemyPopulationCap;
using KainRogueProtocol.Localization;
using KainRogueProtocol.Modifiers;
using KainRogueProtocol.Networking;
using KainRogueProtocol.Patches;
using KainRogueProtocol.Runtime;
using KainRogueProtocol.Runtime.ActiveSkills;
using KainRogueProtocol.Runtime.Contexts;
using KainRogueProtocol.Runtime.Dash;
using KainRogueProtocol.Runtime.Services;
using KainRogueProtocol.Triggers;
using KainRogueProtocol.UI;
using LevelGeneration;
using Localization;
using Microsoft.CodeAnalysis;
using ModifierAPI;
using Player;
using SNetwork;
using TMPro;
using UnityEngine;
using UnityEngine.AI;
using UnityEngine.EventSystems;
using UnityEngine.Events;
using UnityEngine.Rendering;
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("KainRogueProtocol")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("4.0.1")]
[assembly: AssemblyInformationalVersion("4.0.1")]
[assembly: AssemblyProduct("KainRogueProtocol")]
[assembly: AssemblyTitle("KainRogueProtocol")]
[assembly: AssemblyVersion("4.0.1.0")]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableAttribute : Attribute
	{
		public readonly byte[] NullableFlags;

		public NullableAttribute(byte P_0)
		{
			NullableFlags = new byte[1] { P_0 };
		}

		public NullableAttribute(byte[] P_0)
		{
			NullableFlags = P_0;
		}
	}
	[CompilerGenerated]
	[Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableContextAttribute : Attribute
	{
		public readonly byte Flag;

		public NullableContextAttribute(byte P_0)
		{
			Flag = P_0;
		}
	}
}
internal static class KrpBuildVersion
{
	public const string Value = "4.0.1";
}
namespace KainRogueProtocol.UI
{
	public sealed class ActiveSkillHud
	{
		private const float PanelWidth = 252f;

		private const float PanelHeight = 76f;

		private const float AnchorOffsetX = -198f;

		private const float AnchorOffsetY = 170f;

		private const float DialCenterX = 38f;

		private const float DialCenterY = 38f;

		private const float DialSize = 58f;

		private const float InfoLeft = 76f;

		private const float InfoRight = 214f;

		private const float InfoWidth = 138f;

		private const float BarY = 9f;

		private const float BarHeight = 4f;

		private const float PipGap = 5f;

		private const int MaxPips = 5;

		private const float KeySize = 22f;

		private const float KeyX = 222f;

		private const float KeyY = 27f;

		private const float PollInterval = 0.05f;

		private const float GlowFps = 18f;

		private const float SweepFps = 24f;

		private const float EmberFps = 8f;

		private const float EmphasisDuration = 0.9f;

		private static readonly Color GlassColor = new Color(0.055f, 0.07f, 0.085f, 0.36f);

		private static readonly Color GlassEdgeColor = new Color(1f, 1f, 1f, 0.16f);

		private static readonly Color ShadowColor = new Color(0f, 0f, 0f, 0.55f);

		private static readonly Color DialColor = new Color(0.3f, 0.36f, 0.42f, 0.7f);

		private static readonly Color TickIdleColor = new Color(1f, 1f, 1f, 0.13f);

		private static readonly Color TrackColor = new Color(1f, 1f, 1f, 0.12f);

		private static readonly Color KeyFillColor = new Color(0.03f, 0.04f, 0.05f, 0.55f);

		private static readonly Color DimTextColor = new Color(0.62f, 0.68f, 0.72f, 0.78f);

		private static readonly Color MidTextColor = new Color(0.78f, 0.82f, 0.84f, 0.92f);

		private static readonly Color BrightTextColor = new Color(0.97f, 0.98f, 0.97f, 1f);

		private static readonly Color LockedColor = new Color(0.86f, 0.28f, 0.18f, 1f);

		private static readonly Color DefaultAccent = new Color(1f, 0.69f, 0.13f, 1f);

		private readonly GameObject _root;

		private readonly RectTransform _rootRect;

		private readonly CanvasGroup _canvasGroup;

		private readonly bool _reducedMotion;

		private readonly Func<ActiveSkillHudStatus, KeyCode> _activeKeyProvider;

		private readonly Image _glassEdge;

		private readonly Image _flash;

		private readonly Image _dialBase;

		private readonly Image _tickIdle;

		private readonly Image _tickLit;

		private readonly Image _shockwave;

		private readonly Image _barTrack;

		private readonly Image _barFill;

		private readonly Image _barHead;

		private readonly Image _glint;

		private readonly Image[] _pipTracks = (Image[])(object)new Image[5];

		private readonly Image[] _pipFills = (Image[])(object)new Image[5];

		private readonly Image _keyFill;

		private readonly Image _keyEdge;

		private readonly RawImage? _coreGlow;

		private readonly RawImage? _coreEmbers;

		private readonly RawImage? _ringSweep;

		private readonly Text _eyebrow;

		private readonly Text _nameText;

		private readonly Text _stateWord;

		private readonly Text _stateValue;

		private readonly Text _chargeCount;

		private readonly Text _keyText;

		private bool _visible = true;

		private float _nextPollAt;

		private float _displayFill;

		private bool _hasDisplayFill;

		private string _lastSkillId = string.Empty;

		private string _lastKeyLabel = string.Empty;

		private string _lastStateWord = string.Empty;

		private string _lastStateValue = string.Empty;

		private string _lastChargeText = string.Empty;

		private int _lastAvailable = -1;

		private int _layoutPipCount = -1;

		private bool _lastActive;

		private Color _accent = DefaultAccent;

		private float _emphasisStart = -100f;

		private float _emphasisStrength;

		private bool _emphasisRunning;

		private static Color Clear => new Color(0f, 0f, 0f, 0f);

		public ActiveSkillHud(Transform parent, Func<ActiveSkillHudStatus, KeyCode>? activeKeyProvider = null, bool reducedMotion = false)
		{
			//IL_0065: Unknown result type (might be due to invalid IL or missing references)
			//IL_006a: 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_00e0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ef: Unknown result type (might be due to invalid IL or missing references)
			//IL_011f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0139: Unknown result type (might be due to invalid IL or missing references)
			//IL_0187: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b1: Unknown result type (might be due to invalid IL or missing references)
			//IL_01dc: Unknown result type (might be due to invalid IL or missing references)
			//IL_020b: Unknown result type (might be due to invalid IL or missing references)
			//IL_023a: Unknown result type (might be due to invalid IL or missing references)
			//IL_025a: Unknown result type (might be due to invalid IL or missing references)
			//IL_027a: Unknown result type (might be due to invalid IL or missing references)
			//IL_02cf: Unknown result type (might be due to invalid IL or missing references)
			//IL_0304: Unknown result type (might be due to invalid IL or missing references)
			//IL_0339: Unknown result type (might be due to invalid IL or missing references)
			//IL_0386: Unknown result type (might be due to invalid IL or missing references)
			//IL_03a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_03e8: Unknown result type (might be due to invalid IL or missing references)
			//IL_0420: Unknown result type (might be due to invalid IL or missing references)
			//IL_0458: Unknown result type (might be due to invalid IL or missing references)
			//IL_0490: Unknown result type (might be due to invalid IL or missing references)
			//IL_04ab: Unknown result type (might be due to invalid IL or missing references)
			//IL_04da: Unknown result type (might be due to invalid IL or missing references)
			//IL_052d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0565: Unknown result type (might be due to invalid IL or missing references)
			//IL_0593: Unknown result type (might be due to invalid IL or missing references)
			//IL_05cf: Unknown result type (might be due to invalid IL or missing references)
			//IL_0655: Unknown result type (might be due to invalid IL or missing references)
			//IL_068d: Unknown result type (might be due to invalid IL or missing references)
			//IL_06a3: Unknown result type (might be due to invalid IL or missing references)
			//IL_06d2: Unknown result type (might be due to invalid IL or missing references)
			//IL_071e: Unknown result type (might be due to invalid IL or missing references)
			_activeKeyProvider = activeKeyProvider ?? ((Func<ActiveSkillHudStatus, KeyCode>)((ActiveSkillHudStatus _) => (KeyCode)103));
			_reducedMotion = reducedMotion;
			_root = UiFactory.CreateRect("KRP.ActiveSkillHud", parent, new Vector2(0.5f, 0f), new Vector2(0.5f, 0f), new Vector2(252f, 76f), new Vector2(-198f, 170f));
			_rootRect = _root.GetComponent<RectTransform>();
			_rootRect.pivot = new Vector2(0.5f, 0.5f);
			_rootRect.anchoredPosition = new Vector2(-198f, 170f);
			_canvasGroup = _root.AddComponent<CanvasGroup>();
			_canvasGroup.alpha = 0f;
			_canvasGroup.interactable = false;
			_canvasGroup.blocksRaycasts = false;
			AddSliced("Shadow", KrpUiSprites.GlassShadow, ShadowColor, -16f, -19f, 284f, 108f);
			AddSliced("Glass", KrpUiSprites.GlassFill, GlassColor, 0f, 0f, 252f, 76f);
			_glassEdge = AddSliced("GlassEdge", KrpUiSprites.GlassEdge, GlassEdgeColor, 0f, 0f, 252f, 76f);
			_flash = AddSliced("ReadyFlash", KrpUiSprites.GlassFill, Clear, 0f, 0f, 252f, 76f);
			_dialBase = AddDial("DialBase", KrpUiSprites.DialBase, DialColor, 58f);
			_tickIdle = AddDial("TickIdle", KrpUiSprites.TickRingFine, TickIdleColor, 58f);
			_tickLit = AddDial("TickLit", KrpUiSprites.TickRingFine, DefaultAccent, 58f);
			_tickLit.type = (Type)3;
			_tickLit.fillMethod = (FillMethod)4;
			_tickLit.fillOrigin = 2;
			_tickLit.fillClockwise = true;
			_coreGlow = KrpUiFlipbook.Create(_root.transform, "core_pulse_16.png", Color.white, "CoreGlow");
			PlaceDial((Component?)(object)_coreGlow, 40f);
			_coreEmbers = KrpUiFlipbook.Create(_root.transform, "ember_drift_16.png", Color.white, "CoreEmbers");
			PlaceDial((Component?)(object)_coreEmbers, 44f);
			_ringSweep = KrpUiFlipbook.Create(_root.transform, "ring_sweep_32.png", Color.white, "RingSweep");
			PlaceDial((Component?)(object)_ringSweep, 60f);
			_chargeCount = AddText("ChargeCount", string.Empty, KrpUiFonts.Mono, 21, (FontStyle)1, 18f, 25f, 40f, 26f, (TextAnchor)4, BrightTextColor);
			_shockwave = AddDial("Shockwave", KrpUiSprites.RingSoft, Clear, 58f);
			_eyebrow = AddText("Eyebrow", RogueLocalization.Pick("ACTIVE SKILL", "主动技能"), KrpUiFonts.Label, 10, (FontStyle)0, 76f, 55f, 138f, 13f, (TextAnchor)3, DimTextColor);
			_nameText = AddText("SkillName", string.Empty, KrpUiFonts.Title, 17, (FontStyle)1, 76f, 32f, 138f, 23f, (TextAnchor)3, BrightTextColor);
			_stateWord = AddText("StateWord", string.Empty, KrpUiFonts.Label, 12, (FontStyle)1, 76f, 16f, 60f, 15f, (TextAnchor)3, DefaultAccent);
			_stateValue = AddText("StateValue", string.Empty, KrpUiFonts.Mono, 11, (FontStyle)0, 130f, 16f, 84f, 15f, (TextAnchor)5, MidTextColor);
			_barTrack = AddImage("BarTrack", KrpUiSprites.BarSegments, TrackColor, 76f, 9f, 138f, 4f);
			_barFill = AddImage("BarFill", KrpUiSprites.BarSegments, DefaultAccent, 76f, 9f, 138f, 4f);
			_barFill.type = (Type)3;
			_barFill.fillMethod = (FillMethod)0;
			_barFill.fillOrigin = 0;
			_barHead = AddImage("BarHead", KrpUiSprites.Glint, Clear, 76f, 5f, 18f, 12f);
			((Graphic)_barHead).rectTransform.pivot = new Vector2(0.5f, 0f);
			for (int num = 0; num < 5; num++)
			{
				_pipTracks[num] = AddImage($"PipTrack{num}", KrpUiSprites.Pill, TrackColor, 76f, 9f, 10f, 4f);
				_pipFills[num] = AddImage($"PipFill{num}", KrpUiSprites.Pill, DefaultAccent, 76f, 9f, 10f, 4f);
				_pipFills[num].type = (Type)3;
				_pipFills[num].fillMethod = (FillMethod)0;
				_pipFills[num].fillOrigin = 0;
				((Component)_pipTracks[num]).gameObject.SetActive(false);
				((Component)_pipFills[num]).gameObject.SetActive(false);
			}
			_glint = AddImage("Glint", KrpUiSprites.Glint, Clear, 76f, 3f, 40f, 16f);
			((Graphic)_glint).rectTransform.pivot = new Vector2(0.5f, 0f);
			_keyFill = AddSliced("KeyFill", KrpUiSprites.KeyFill, KeyFillColor, 222f, 27f, 22f, 22f);
			_keyEdge = AddSliced("KeyEdge", KrpUiSprites.KeyEdge, GlassEdgeColor, 222f, 27f, 22f, 22f);
			_keyText = AddText("KeyText", "G", KrpUiFonts.Label, 12, (FontStyle)1, 222f, 27f, 22f, 22f, (TextAnchor)4, BrightTextColor);
			_root.SetActive(false);
		}

		public void Tick()
		{
			float unscaledTime = Time.unscaledTime;
			if (unscaledTime >= _nextPollAt)
			{
				_nextPollAt = unscaledTime + 0.05f;
				if (!_visible || !IsExpeditionInLevel() || !TryResolveStatus(Time.time, out var status))
				{
					SetRootActive(active: false);
					return;
				}
				SetRootActive(active: true);
				UpdateVisuals(status);
			}
			if (_root.activeSelf)
			{
				TickRootMotion();
				AnimateFlipbooks(unscaledTime);
				AnimateEmphasis(unscaledTime);
			}
		}

		public void SetVisible(bool visible)
		{
			_visible = visible;
			if (!visible)
			{
				SetRootActive(active: false);
			}
		}

		private void UpdateVisuals(ActiveSkillHudStatus status)
		{
			//IL_00af: 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_00c0: 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 references)
			//IL_00dc: 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_00e1: Unknown result type (might be due to invalid IL or missing references)
			//IL_011a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0194: Unknown result type (might be due to invalid IL or missing references)
			//IL_018c: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ae: 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_01c8: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c1: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d8: Unknown result type (might be due to invalid IL or missing references)
			//IL_020b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0206: Unknown result type (might be due to invalid IL or missing references)
			//IL_024e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0224: Unknown result type (might be due to invalid IL or missing references)
			//IL_025e: Unknown result type (might be due to invalid IL or missing references)
			//IL_02fc: 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_029f: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a9: Unknown result type (might be due to invalid IL or missing references)
			//IL_0292: Unknown result type (might be due to invalid IL or missing references)
			//IL_032d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0332: Unknown result type (might be due to invalid IL or missing references)
			//IL_033c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0413: Unknown result type (might be due to invalid IL or missing references)
			//IL_03e6: Unknown result type (might be due to invalid IL or missing references)
			//IL_038f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0388: Unknown result type (might be due to invalid IL or missing references)
			//IL_042d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0426: Unknown result type (might be due to invalid IL or missing references)
			//IL_03d3: Unknown result type (might be due to invalid IL or missing references)
			//IL_043d: Unknown result type (might be due to invalid IL or missing references)
			bool isMultiCharge = status.IsMultiCharge;
			int num = (isMultiCharge ? status.Charges : (status.IsReady ? 1 : 0));
			bool flag = num > 0 || status.IsActive;
			if (_lastSkillId != status.SkillId)
			{
				_lastSkillId = status.SkillId;
				_nameText.text = status.SkillName;
				_lastAvailable = num;
				_hasDisplayFill = false;
			}
			else if (num > _lastAvailable && num > 0)
			{
				TriggerEmphasis((_lastAvailable <= 0) ? 1f : 0.6f);
			}
			_lastAvailable = num;
			_lastActive = status.IsActive;
			Color val = ((status.AccentColor.a > 0f) ? status.AccentColor : DefaultAccent);
			_accent = (status.IsLocked ? LockedColor : val);
			Color val2 = default(Color);
			((Color)(ref val2))..ctor(_accent.r, _accent.g, _accent.b, 0.55f);
			string text = FormatKeyLabel(_activeKeyProvider(status));
			if (_lastKeyLabel != text)
			{
				_lastKeyLabel = text;
				_keyText.text = text;
			}
			FormatState(status, out string word, out string value);
			SetIfChanged(_stateWord, ref _lastStateWord, word);
			SetIfChanged(_stateValue, ref _lastStateValue, value);
			((Graphic)_stateWord).color = ((flag || status.IsLocked) ? _accent : DimTextColor);
			((Graphic)_stateValue).color = (flag ? MidTextColor : DimTextColor);
			((Graphic)_nameText).color = (flag ? BrightTextColor : MidTextColor);
			((Graphic)_eyebrow).color = DimTextColor;
			float num2 = SmoothFill(ResolveFill(status));
			_tickLit.fillAmount = num2;
			((Graphic)_tickLit).color = (flag ? _accent : val2);
			((Graphic)_tickIdle).color = (Color)(status.IsLocked ? new Color(LockedColor.r, LockedColor.g, LockedColor.b, 0.16f) : TickIdleColor);
			((Graphic)_dialBase).color = DialColor;
			SetActive((Component?)(object)_coreGlow, flag);
			if ((Object)(object)_coreGlow != (Object)null)
			{
				((Graphic)_coreGlow).color = (status.IsActive ? Color.Lerp(_accent, Color.white, 0.3f) : _accent);
			}
			SetActive((Component?)(object)_coreEmbers, status.IsLocked);
			if ((Object)(object)_coreEmbers != (Object)null)
			{
				((Graphic)_coreEmbers).color = new Color(LockedColor.r, LockedColor.g, LockedColor.b, 0.8f);
			}
			SetActive((Component?)(object)_ringSweep, status.IsActive);
			if ((Object)(object)_ringSweep != (Object)null)
			{
				((Graphic)_ringSweep).color = Color.Lerp(_accent, Color.white, 0.2f);
			}
			((Component)_chargeCount).gameObject.SetActive(isMultiCharge);
			if (isMultiCharge)
			{
				SetIfChanged(_chargeCount, ref _lastChargeText, status.Charges.ToString());
				((Graphic)_chargeCount).color = ((num > 0) ? BrightTextColor : DimTextColor);
				if ((Object)(object)_coreGlow != (Object)null)
				{
					((Graphic)_coreGlow).color = new Color(_accent.r, _accent.g, _accent.b, 0.55f);
				}
			}
			((Graphic)_keyEdge).color = (Color)(flag ? new Color(_accent.r, _accent.g, _accent.b, 0.75f) : GlassEdgeColor);
			((Graphic)_keyText).color = (flag ? BrightTextColor : DimTextColor);
			((Graphic)_glassEdge).color = GlassEdgeColor;
			if (isMultiCharge)
			{
				UpdatePips(status);
			}
			else
			{
				UpdateStrip(status, num2, flag);
			}
		}

		private void UpdateStrip(ActiveSkillHudStatus status, float fill, bool usable)
		{
			//IL_00a6: 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_00e9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bf: Unknown result type (might be due to invalid IL or missing references)
			//IL_014a: 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)
			if (_layoutPipCount != 0)
			{
				_layoutPipCount = 0;
				((Component)_barTrack).gameObject.SetActive(true);
				((Component)_barFill).gameObject.SetActive(true);
				for (int i = 0; i < 5; i++)
				{
					((Component)_pipTracks[i]).gameObject.SetActive(false);
					((Component)_pipFills[i]).gameObject.SetActive(false);
				}
			}
			_barFill.fillAmount = fill;
			((Graphic)_barFill).color = (Color)(usable ? _accent : new Color(_accent.r, _accent.g, _accent.b, 0.6f));
			((Graphic)_barTrack).color = (Color)(status.IsLocked ? new Color(LockedColor.r, LockedColor.g, LockedColor.b, 0.14f) : TrackColor);
			bool flag = !status.IsReady && !status.IsLocked && fill > 0.01f && fill < 0.995f;
			((Component)_barHead).gameObject.SetActive(flag);
			if (flag)
			{
				((Graphic)_barHead).rectTransform.anchoredPosition = new Vector2(76f + 138f * fill, 5f);
				((Graphic)_barHead).color = new Color(_accent.r, _accent.g, _accent.b, status.IsActive ? 0.55f : 0.85f);
			}
		}

		private void UpdatePips(ActiveSkillHudStatus status)
		{
			//IL_013d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0142: Unknown result type (might be due to invalid IL or missing references)
			//IL_018b: 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)
			//IL_01ab: Unknown result type (might be due to invalid IL or missing references)
			int num = Mathf.Clamp(status.MaxCharges, 2, 5);
			if (_layoutPipCount != num)
			{
				_layoutPipCount = num;
				((Component)_barTrack).gameObject.SetActive(false);
				((Component)_barFill).gameObject.SetActive(false);
				((Component)_barHead).gameObject.SetActive(false);
				float num2 = (138f - 5f * (float)(num - 1)) / (float)num;
				for (int i = 0; i < 5; i++)
				{
					bool flag = i < num;
					((Component)_pipTracks[i]).gameObject.SetActive(flag);
					((Component)_pipFills[i]).gameObject.SetActive(flag);
					if (flag)
					{
						float x = 76f + (float)i * (num2 + 5f);
						Place(((Graphic)_pipTracks[i]).rectTransform, x, 9f, num2, 4f);
						Place(((Graphic)_pipFills[i]).rectTransform, x, 9f, num2, 4f);
					}
				}
			}
			float num3 = Mathf.Clamp01(1f - status.CooldownRemaining / Mathf.Max(0.1f, status.CooldownTotal));
			Color accent = default(Color);
			for (int j = 0; j < num; j++)
			{
				float fillAmount;
				if (j < status.Charges)
				{
					fillAmount = 1f;
					accent = _accent;
				}
				else if (j == status.Charges)
				{
					fillAmount = num3;
					((Color)(ref accent))..ctor(_accent.r, _accent.g, _accent.b, 0.5f);
				}
				else
				{
					fillAmount = 0f;
					accent = _accent;
				}
				_pipFills[j].fillAmount = fillAmount;
				((Graphic)_pipFills[j]).color = accent;
			}
		}

		private void TriggerEmphasis(float strength)
		{
			//IL_0020: 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_0045: Unknown result type (might be due to invalid IL or missing references)
			//IL_0055: Unknown result type (might be due to invalid IL or missing references)
			//IL_0065: Unknown result type (might be due to invalid IL or missing references)
			if (_reducedMotion)
			{
				_emphasisStart = -100f;
				_emphasisRunning = false;
				((Graphic)_flash).color = Clear;
				((Graphic)_shockwave).color = Clear;
				((Transform)((Graphic)_shockwave).rectTransform).localScale = Vector3.one;
				((Graphic)_glint).color = Clear;
				((Transform)_rootRect).localScale = Vector3.one;
			}
			else
			{
				_emphasisStart = Time.unscaledTime;
				_emphasisStrength = strength;
				KrpUiSfx.Play("ui_ready.wav", (strength >= 1f) ? 0.65f : 0.4f, 0.35f);
			}
		}

		private void AnimateEmphasis(float now)
		{
			//IL_0037: 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_006c: 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_00dd: Unknown result type (might be due to invalid IL or missing references)
			//IL_0126: Unknown result type (might be due to invalid IL or missing references)
			//IL_012b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0133: 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_0149: 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)
			//IL_0198: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d9: Unknown result type (might be due to invalid IL or missing references)
			//IL_021f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0261: Unknown result type (might be due to invalid IL or missing references)
			//IL_0295: Unknown result type (might be due to invalid IL or missing references)
			if (_reducedMotion)
			{
				return;
			}
			float num = now - _emphasisStart;
			if (num < 0f || num > 0.9f)
			{
				if (_emphasisRunning)
				{
					_emphasisRunning = false;
					((Graphic)_flash).color = Clear;
					((Graphic)_shockwave).color = Clear;
					((Transform)((Graphic)_shockwave).rectTransform).localScale = Vector3.one;
					((Graphic)_glint).color = Clear;
					((Transform)_rootRect).localScale = Vector3.one;
				}
				return;
			}
			_emphasisRunning = true;
			float emphasisStrength = _emphasisStrength;
			float num2 = emphasisStrength * 0.28f * (1f - KrpUiMotion.EaseOutCubic(Mathf.Clamp01(num / 0.7f)));
			((Graphic)_flash).color = new Color(_accent.r, _accent.g, _accent.b, num2);
			float num3 = 1f - Mathf.Clamp01(num / 0.5f);
			((Graphic)_keyEdge).color = Color.Lerp(new Color(_accent.r, _accent.g, _accent.b, 0.75f), Color.white, num3 * emphasisStrength);
			((Graphic)_stateWord).color = Color.Lerp(_accent, Color.white, num3 * 0.7f * emphasisStrength);
			float num4 = Mathf.Clamp01(num / 0.65f);
			float num5 = 1f + 1.15f * KrpUiMotion.EaseOutCubic(num4);
			((Transform)((Graphic)_shockwave).rectTransform).localScale = new Vector3(num5, num5, 1f);
			((Graphic)_shockwave).color = new Color(_accent.r, _accent.g, _accent.b, 0.85f * emphasisStrength * (1f - num4));
			float num6 = Mathf.Sin(Mathf.Clamp01(num / 0.32f) * MathF.PI) * 0.045f * emphasisStrength;
			((Transform)_rootRect).localScale = new Vector3(1f + num6, 1f + num6, 1f);
			float num7 = Mathf.Clamp01(num / 0.55f);
			float num8 = Mathf.Lerp(66f, 224f, KrpUiMotion.EaseOutCubic(num7));
			((Graphic)_glint).rectTransform.anchoredPosition = new Vector2(num8, 3f);
			((Graphic)_glint).color = new Color(1f, 1f, 1f, 0.9f * emphasisStrength * Mathf.Sin(num7 * MathF.PI));
		}

		private void AnimateFlipbooks(float now)
		{
			if (!_reducedMotion)
			{
				if ((Object)(object)_coreGlow != (Object)null && ((Component)_coreGlow).gameObject.activeSelf)
				{
					KrpUiFlipbook.Step(_coreGlow, 4, 4, (int)(now * (_lastActive ? 34.2f : 18f)));
				}
				if ((Object)(object)_coreEmbers != (Object)null && ((Component)_coreEmbers).gameObject.activeSelf)
				{
					KrpUiFlipbook.Step(_coreEmbers, 4, 4, (int)(now * 8f));
				}
				if ((Object)(object)_ringSweep != (Object)null && ((Component)_ringSweep).gameObject.activeSelf)
				{
					KrpUiFlipbook.Step(_ringSweep, 8, 4, (int)(now * 24f));
				}
			}
		}

		private float SmoothFill(float target)
		{
			target = Mathf.Clamp01(target);
			if (!_hasDisplayFill || _reducedMotion || target < _displayFill)
			{
				_displayFill = target;
				_hasDisplayFill = true;
				return _displayFill;
			}
			_displayFill = KrpUiMotion.Damp(_displayFill, target, 16f, 0.05f);
			if (Mathf.Abs(_displayFill - target) < 0.001f)
			{
				_displayFill = target;
			}
			return _displayFill;
		}

		private void TickRootMotion()
		{
			if (_reducedMotion)
			{
				_canvasGroup.alpha = 1f;
			}
			else if (_canvasGroup.alpha < 1f)
			{
				_canvasGroup.alpha = KrpUiMotion.Damp(_canvasGroup.alpha, 1f, 12f, Time.unscaledDeltaTime);
				if (_canvasGroup.alpha > 0.995f)
				{
					_canvasGroup.alpha = 1f;
				}
			}
		}

		private void SetRootActive(bool active)
		{
			//IL_0046: Unknown result type (might be due to invalid IL or missing references)
			if (_root.activeSelf != active)
			{
				_root.SetActive(active);
				if (!active)
				{
					_canvasGroup.alpha = 0f;
					_hasDisplayFill = false;
					_emphasisStart = -100f;
					((Transform)_rootRect).localScale = Vector3.one;
				}
			}
		}

		private static bool IsExpeditionInLevel()
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_000e: Invalid comparison between Unknown and I4
			try
			{
				return GameStateManager.IsInExpedition && (int)GameStateManager.CurrentStateName == 10;
			}
			catch
			{
				return false;
			}
		}

		private Image AddImage(string name, Sprite? sprite, Color color, float x, float y, float width, float height)
		{
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			Image obj = UiFactory.CreateImage(name, _root.transform, color);
			obj.sprite = sprite;
			Place(((Graphic)obj).rectTransform, x, y, width, height);
			return obj;
		}

		private Image AddSliced(string name, Sprite? sprite, Color color, float x, float y, float width, float height)
		{
			//IL_0003: Unknown result type (might be due to invalid IL or missing references)
			Image val = AddImage(name, sprite, color, x, y, width, height);
			if ((Object)(object)sprite != (Object)null)
			{
				val.type = (Type)1;
				val.fillCenter = true;
			}
			return val;
		}

		private Image AddDial(string name, Sprite? sprite, Color color, float size)
		{
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			Image obj = UiFactory.CreateImage(name, _root.transform, color);
			obj.sprite = sprite;
			PlaceDial((Component?)(object)obj, size);
			return obj;
		}

		private Text AddText(string name, string value, Font? font, int fontSize, FontStyle style, float x, float y, float width, float height, TextAnchor alignment, Color color)
		{
			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_002a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0079: Unknown result type (might be due to invalid IL or missing references)
			//IL_008d: Unknown result type (might be due to invalid IL or missing references)
			Text val = UiFactory.CreateText(name, _root.transform, value, fontSize, alignment, color);
			if ((Object)(object)font != (Object)null)
			{
				val.font = font;
			}
			val.fontStyle = style;
			val.resizeTextForBestFit = false;
			val.horizontalOverflow = (HorizontalWrapMode)1;
			val.verticalOverflow = (VerticalWrapMode)1;
			Place(((Graphic)val).rectTransform, x, y, width, height);
			Shadow obj = ((Component)val).gameObject.AddComponent<Shadow>();
			obj.effectColor = new Color(0f, 0f, 0f, 0.6f);
			obj.effectDistance = new Vector2(1f, -1f);
			return val;
		}

		private static void Place(RectTransform rect, float x, float y, float width, float height)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_0025: 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)
			rect.anchorMin = Vector2.zero;
			rect.anchorMax = Vector2.zero;
			rect.pivot = Vector2.zero;
			rect.sizeDelta = new Vector2(width, height);
			rect.anchoredPosition = new Vector2(x, y);
		}

		private static void PlaceDial(Component? component, float size)
		{
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: 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)
			//IL_003e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0052: Unknown result type (might be due to invalid IL or missing references)
			if (!((Object)(object)component == (Object)null))
			{
				RectTransform component2 = component.GetComponent<RectTransform>();
				component2.anchorMin = Vector2.zero;
				component2.anchorMax = Vector2.zero;
				component2.pivot = new Vector2(0.5f, 0.5f);
				component2.sizeDelta = new Vector2(size, size);
				component2.anchoredPosition = new Vector2(38f, 38f);
			}
		}

		private static void SetActive(Component? component, bool active)
		{
			if ((Object)(object)component != (Object)null && component.gameObject.activeSelf != active)
			{
				component.gameObject.SetActive(active);
			}
		}

		private static void SetIfChanged(Text text, ref string cache, string value)
		{
			if (!string.Equals(cache, value, StringComparison.Ordinal))
			{
				cache = value;
				text.text = value;
			}
		}

		private static bool TryResolveStatus(float now, out ActiveSkillHudStatus status)
		{
			status = default(ActiveSkillHudStatus);
			if (RogueDashRuntime.TryGetHudStatus(now, out var status2))
			{
				status = status2;
			}
			if (RogueTempHealthPulseRuntime.TryGetHudStatus(now, out var status3) && ShouldReplace(status, status3))
			{
				status = status3;
			}
			if (RogueFireCoverageRuntime.TryGetHudStatus(now, out var status4) && ShouldReplace(status, status4))
			{
				status = status4;
			}
			if (RogueEscapePlanRuntime.TryGetHudStatus(now, out var status5) && ShouldReplace(status, status5))
			{
				status = status5;
			}
			if (RogueSilentInfiltrationRuntime.TryGetHudStatus(now, out var status6) && ShouldReplace(status, status6))
			{
				status = status6;
			}
			if (RogueDimensionalAnchorRuntime.TryGetHudStatus(now, out var status7) && ShouldReplace(status, status7))
			{
				status = status7;
			}
			if (RogueSiphonBlackHoleRuntime.TryGetHudStatus(now, out var status8) && ShouldReplace(status, status8))
			{
				status = status8;
			}
			if (RogueElementalActiveSkillRuntime.TryGetHudStatus(now, out var status9) && ShouldReplace(status, status9))
			{
				status = status9;
			}
			if (RogueDecoyProtocolRuntime.TryGetHudStatus(now, out var status10) && ShouldReplace(status, status10))
			{
				status = status10;
			}
			if (RogueFocusStanceRuntime.TryGetHudStatus(now, out var status11) && ShouldReplace(status, status11))
			{
				status = status11;
			}
			if (RogueForbiddenAgitationRuntime.TryGetHudStatus(now, out var status12) && ShouldReplace(status, status12))
			{
				status = status12;
			}
			if (ToolCardRuntime.TryGetEngineeringMiracleHudStatus(now, out var status13) && ShouldReplace(status, status13))
			{
				status = status13;
			}
			return status.HasValue;
		}

		private static bool ShouldReplace(ActiveSkillHudStatus current, ActiveSkillHudStatus candidate)
		{
			if (!current.HasValue)
			{
				return true;
			}
			if (candidate.DisplayPriority != current.DisplayPriority)
			{
				return candidate.DisplayPriority > current.DisplayPriority;
			}
			if (!candidate.IsActive && !candidate.IsReady && !candidate.IsLocked)
			{
				float num = candidate.CooldownRemaining - current.CooldownRemaining;
				if (Mathf.Abs(num) > 0.05f)
				{
					return num < 0f;
				}
			}
			return candidate.SkillOrder < current.SkillOrder;
		}

		private static float ResolveFill(ActiveSkillHudStatus status)
		{
			if (status.IsMultiCharge)
			{
				if (status.Charges < status.MaxCharges)
				{
					return Mathf.Clamp01(1f - status.CooldownRemaining / Mathf.Max(0.1f, status.CooldownTotal));
				}
				return 1f;
			}
			if (status.IsActive)
			{
				return Mathf.Clamp01(status.ActiveRemaining / Mathf.Max(0.1f, status.ActiveTotal));
			}
			if (status.IsReady)
			{
				return 1f;
			}
			return Mathf.Clamp01(1f - status.CooldownRemaining / Mathf.Max(0.1f, status.CooldownTotal));
		}

		private static void FormatState(ActiveSkillHudStatus status, out string word, out string value)
		{
			if (status.IsMultiCharge)
			{
				word = ((status.Charges > 0) ? RogueLocalization.Pick("READY", "就绪") : RogueLocalization.Pick("CHARGING", "充能中"));
				value = ((status.Charges < status.MaxCharges && status.CooldownRemaining > 0f) ? $"{status.Charges}/{status.MaxCharges}  +1 {status.CooldownRemaining:0.0}s" : $"{status.Charges}/{status.MaxCharges}");
			}
			else if (status.IsLocked)
			{
				word = RogueLocalization.Pick("LOCKED", "条件未满足");
				value = string.Empty;
			}
			else if (status.IsActive)
			{
				word = RogueLocalization.Pick("ACTIVE", "生效中");
				value = ResolveStateValue(status.StateText, $"{status.ActiveRemaining:0.0}s");
			}
			else if (status.IsReady)
			{
				word = RogueLocalization.Pick("READY", "就绪");
				value = ResolveReadyStateValue(status.StateText);
			}
			else
			{
				word = RogueLocalization.Pick("COOLDOWN", "冷却");
				value = ResolveStateValue(status.StateText, $"{status.CooldownRemaining:0.0}s");
			}
		}

		private static string ResolveStateValue(string stateText, string fallback)
		{
			if (string.IsNullOrWhiteSpace(stateText))
			{
				return fallback;
			}
			string text = stateText.Trim();
			if (text.StartsWith("ACTIVE ", StringComparison.OrdinalIgnoreCase))
			{
				text = text.Substring("ACTIVE ".Length).TrimStart();
			}
			else if (text.StartsWith("生效 ", StringComparison.Ordinal))
			{
				text = text.Substring("生效 ".Length).TrimStart();
			}
			if (text.Length != 0)
			{
				return text;
			}
			return fallback;
		}

		private static string ResolveReadyStateValue(string stateText)
		{
			if (string.IsNullOrWhiteSpace(stateText))
			{
				return string.Empty;
			}
			string text = stateText.Trim();
			if (!string.Equals(text, "READY", StringComparison.OrdinalIgnoreCase) && !string.Equals(text, "就绪", StringComparison.Ordinal))
			{
				return text;
			}
			return string.Empty;
		}

		private unsafe static string FormatKeyLabel(KeyCode key)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0003: Invalid comparison between Unknown and I4
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Invalid comparison between Unknown and I4
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Invalid comparison between Unknown and I4
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0032: Invalid comparison between Unknown and I4
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0020: Invalid comparison between Unknown and I4
			//IL_0037: Unknown result type (might be due to invalid IL or missing references)
			//IL_003d: Unknown result type (might be due to invalid IL or missing references)
			//IL_005b: Expected I4, but got Unknown
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			//IL_0027: Expected I4, but got Unknown
			//IL_005b: 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_0073: Expected I4, but got Unknown
			if ((int)key >= 97 && (int)key <= 122)
			{
				return ((object)(*(KeyCode*)(&key))/*cast due to .constrained prefix*/).ToString();
			}
			if ((int)key >= 48 && (int)key <= 57)
			{
				return (key - 48).ToString();
			}
			if ((int)key != 32)
			{
				return (key - 303) switch
				{
					1 => "LSH", 
					0 => "RSH", 
					3 => "LCTL", 
					2 => "RCTL", 
					5 => "LALT", 
					4 => "RALT", 
					_ => (key - 323) switch
					{
						0 => "M1", 
						1 => "M2", 
						2 => "M3", 
						_ => ((object)(*(KeyCode*)(&key))/*cast due to .constrained prefix*/).ToString().ToUpperInvariant(), 
					}, 
				};
			}
			return "SPC";
		}
	}
	public readonly struct ActiveSkillHudStatus
	{
		public string SkillId { get; }

		public string SkillName { get; }

		public string StateText { get; }

		public bool IsReady { get; }

		public bool IsActive { get; }

		public bool IsLocked { get; }

		public float CooldownRemaining { get; }

		public float CooldownTotal { get; }

		public float ActiveRemaining { get; }

		public float ActiveTotal { get; }

		public Color AccentColor { get; }

		public int SkillOrder { get; }

		public int Charges { get; }

		public int MaxCharges { get; }

		public bool IsMultiCharge => MaxCharges > 1;

		public bool HasValue => !string.IsNullOrEmpty(SkillId);

		public int DisplayPriority
		{
			get
			{
				if (!IsActive)
				{
					if (!IsReady)
					{
						return (!IsLocked) ? 1 : 0;
					}
					return 2;
				}
				return 3;
			}
		}

		public ActiveSkillHudStatus(string skillId, string skillName, string stateText, bool isReady, bool isActive, bool isLocked, float cooldownRemaining, float cooldownTotal, float activeRemaining, float activeTotal, Color accentColor, int skillOrder, int charges = 0, int maxCharges = 0)
		{
			//IL_0092: 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)
			Charges = Mathf.Max(0, charges);
			MaxCharges = Mathf.Max(0, maxCharges);
			SkillId = skillId;
			SkillName = skillName;
			StateText = stateText;
			IsReady = isReady;
			IsActive = isActive;
			IsLocked = isLocked;
			CooldownRemaining = Mathf.Max(0f, cooldownRemaining);
			CooldownTotal = Mathf.Max(0.1f, cooldownTotal);
			ActiveRemaining = Mathf.Max(0f, activeRemaining);
			ActiveTotal = Mathf.Max(0.1f, activeTotal);
			AccentColor = accentColor;
			SkillOrder = skillOrder;
		}
	}
	internal sealed class AutoAimIrisMotion
	{
		internal const float IdleRotationSpeed = 24f;

		internal const float AimingRotationSpeed = 7f;

		internal const float FiringRotationSpeed = 600f;

		public float OuterAngle { get; private set; }

		public float InnerAngle { get; private set; }

		public float Speed { get; private set; } = 24f;

		public void Advance(float deltaTime, bool aiming, bool firing)
		{
			if (!(deltaTime <= 0f) && !float.IsNaN(deltaTime) && !float.IsInfinity(deltaTime))
			{
				float num = Math.Min(deltaTime, 0.1f);
				float num2 = (firing ? 600f : (aiming ? 7f : 24f));
				float num3 = (firing ? 30f : 5f);
				float num4 = 1f - (float)Math.Exp((0f - num) * num3);
				float num5 = num2 * num + (Speed - num2) * num4 / num3;
				Speed += (num2 - Speed) * num4;
				OuterAngle = Wrap(OuterAngle + num5);
				InnerAngle = Wrap(InnerAngle - num5 * 0.65f);
			}
		}

		private static float Wrap(float angle)
		{
			return (angle % 360f + 360f) % 360f;
		}
	}
	internal sealed class AutoAimIrisReticle
	{
		private static readonly Vector2[] HexCorners = (Vector2[])(object)new Vector2[6]
		{
			new Vector2(0f, 1f),
			new Vector2(0.8660254f, 0.5f),
			new Vector2(0.8660254f, -0.5f),
			new Vector2(0f, -1f),
			new Vector2(-0.8660254f, -0.5f),
			new Vector2(-0.8660254f, 0.5f)
		};

		private static readonly Color Cyan = new Color(0.4f, 0.91f, 0.98f, 1f);

		private static readonly Color Gold = new Color(1f, 0.78f, 0.34f, 1f);

		private readonly GameObject _root;

		private readonly RectTransform _parent;

		private readonly RectTransform _rootRect;

		private readonly RectTransform _outerRotor;

		private readonly RectTransform _innerRotor;

		private readonly Canvas? _canvas;

		private readonly Image[] _outer;

		private readonly Image[] _inner;

		private readonly Image[] _ticks;

		private readonly Image _dot;

		private readonly Sprite _strokeSprite;

		private readonly Sprite _dotSprite;

		private readonly AutoAimIrisMotion _motion = new AutoAimIrisMotion();

		private float _radius;

		private float _lastRadiusPixels;

		private Collider? _lastPart;

		private bool _hasLayout;

		private bool _wasWeakspot;

		public bool IsAlive
		{
			get
			{
				if ((Object)(object)_root != (Object)null)
				{
					return (Object)(object)_parent != (Object)null;
				}
				return false;
			}
		}

		public AutoAimIrisReticle(RectTransform parent)
		{
			_parent = parent;
			_canvas = ((Component)parent).GetComponentInParent<Canvas>();
			_rootRect = CreateRect("KRP_AutoAim_Iris", (Transform)(object)parent);
			_root = ((Component)_rootRect).gameObject;
			_outerRotor = CreateRect("OuterHex", (Transform)(object)_rootRect);
			_innerRotor = CreateRect("InnerIris", (Transform)(object)_rootRect);
			_strokeSprite = CreateSprite("KRP_Iris_SoftStroke", dot: false);
			_dotSprite = CreateSprite("KRP_Iris_Dot", dot: true);
			_outer = CreateStrokes("Edge", _outerRotor, 12);
			_inner = CreateStrokes("Dash", _innerRotor, 18);
			_ticks = CreateStrokes("Pole", _outerRotor, 2);
			_dot = CreateImage("AimPoint", (Transform)(object)_rootRect, _dotSprite);
			_root.SetActive(false);
		}

		public void UpdateMain(Camera camera, Vector3 targetPosition, Collider? targetPart, bool isWeakspot, bool aiming, bool firing, float visibleProgress, float fireBlend, float now)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: 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_003b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0053: 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_006a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0097: 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)
			//IL_00a9: 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_00b5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cd: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b0: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b5: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c2: 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_01e1: Unknown result type (might be due to invalid IL or missing references)
			//IL_01da: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e6: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f3: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f8: Unknown result type (might be due to invalid IL or missing references)
			//IL_0200: Unknown result type (might be due to invalid IL or missing references)
			//IL_0206: Unknown result type (might be due to invalid IL or missing references)
			//IL_0211: Unknown result type (might be due to invalid IL or missing references)
			//IL_024a: Unknown result type (might be due to invalid IL or missing references)
			//IL_026f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0288: 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_0294: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a8: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ad: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ba: Unknown result type (might be due to invalid IL or missing references)
			//IL_02bc: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c3: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c8: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ca: Unknown result type (might be due to invalid IL or missing references)
			//IL_02d1: Unknown result type (might be due to invalid IL or missing references)
			//IL_02de: Unknown result type (might be due to invalid IL or missing references)
			//IL_02f2: Unknown result type (might be due to invalid IL or missing references)
			//IL_02f4: Unknown result type (might be due to invalid IL or missing references)
			//IL_02fb: Unknown result type (might be due to invalid IL or missing references)
			//IL_0300: Unknown result type (might be due to invalid IL or missing references)
			//IL_0302: Unknown result type (might be due to invalid IL or missing references)
			//IL_0309: Unknown result type (might be due to invalid IL or missing references)
			//IL_0316: Unknown result type (might be due to invalid IL or missing references)
			//IL_03f3: Unknown result type (might be due to invalid IL or missing references)
			//IL_0403: Unknown result type (might be due to invalid IL or missing references)
			//IL_0408: Unknown result type (might be due to invalid IL or missing references)
			//IL_0418: Unknown result type (might be due to invalid IL or missing references)
			//IL_0425: Unknown result type (might be due to invalid IL or missing references)
			//IL_0434: Unknown result type (might be due to invalid IL or missing references)
			//IL_0444: Unknown result type (might be due to invalid IL or missing references)
			//IL_0449: Unknown result type (might be due to invalid IL or missing references)
			//IL_0459: Unknown result type (might be due to invalid IL or missing references)
			//IL_0466: Unknown result type (might be due to invalid IL or missing references)
			//IL_0482: Unknown result type (might be due to invalid IL or missing references)
			//IL_0494: Unknown result type (might be due to invalid IL or missing references)
			//IL_04a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_0381: Unknown result type (might be due to invalid IL or missing references)
			//IL_0383: Unknown result type (might be due to invalid IL or missing references)
			//IL_0387: Unknown result type (might be due to invalid IL or missing references)
			//IL_0391: Unknown result type (might be due to invalid IL or missing references)
			//IL_0396: Unknown result type (might be due to invalid IL or missing references)
			//IL_0398: Unknown result type (might be due to invalid IL or missing references)
			//IL_03a2: Unknown result type (might be due to invalid IL or missing references)
			//IL_03ac: Unknown result type (might be due to invalid IL or missing references)
			//IL_03b9: Unknown result type (might be due to invalid IL or missing references)
			Vector3 val = camera.WorldToScreenPoint(targetPosition);
			if (val.z <= camera.nearClipPlane || visibleProgress <= 0.001f)
			{
				SetVisible(visible: false);
				return;
			}
			Camera val2 = (((Object)(object)_canvas != (Object)null && (int)_canvas.renderMode != 0) ? _canvas.worldCamera : null);
			Vector2 val3 = default(Vector2);
			((Vector2)(ref val3))..ctor(val.x, val.y);
			Vector2 val4 = default(Vector2);
			if (!RectTransformUtility.ScreenPointToLocalPointInRectangle(_parent, val3, val2, ref val4))
			{
				SetVisible(visible: false);
				return;
			}
			float num = Mathf.Max(0.1f, (float)Screen.height / 1080f);
			float partRadiusPixels = GetPartRadiusPixels(camera, val3, targetPart, num);
			Vector2 val5 = default(Vector2);
			if (!RectTransformUtility.ScreenPointToLocalPointInRectangle(_parent, val3 + Vector2.right * partRadiusPixels, val2, ref val5))
			{
				SetVisible(visible: false);
				return;
			}
			float num2 = Vector2.Distance(val4, val5);
			_radius = ((!_hasLayout || ((Object)(object)targetPart != (Object)null && (Object)(object)targetPart != (Object)(object)_lastPart)) ? num2 : Mathf.Lerp(_radius, num2, 1f - Mathf.Exp((0f - Time.deltaTime) * 14f)));
			if ((Object)(object)targetPart != (Object)null)
			{
				_lastPart = targetPart;
				_wasWeakspot = isWeakspot;
			}
			_hasLayout = true;
			float num3 = num2 / Mathf.Max(1f, partRadiusPixels) * num;
			float num4 = Mathf.SmoothStep(0f, 1f, fireBlend);
			float num5 = _radius * Mathf.Lerp(1.12f, 1f, visibleProgress) * Mathf.Lerp(1f, 0.92f, num4);
			float num6 = Mathf.Clamp01(visibleProgress) * Mathf.Lerp(0.82f, 1f, num4);
			Color color = Color.Lerp(Cyan, Color.white, num4 * 0.55f);
			color.a = num6;
			Color color2 = Color.Lerp(_wasWeakspot ? Gold : Cyan, Color.white, num4 * 0.4f);
			((Transform)_rootRect).localPosition = new Vector3(val4.x, val4.y, 0f);
			_motion.Advance(Time.deltaTime, aiming, firing);
			((Transform)_outerRotor).localEulerAngles = new Vector3(0f, 0f, _motion.OuterAngle);
			((Transform)_innerRotor).localEulerAngles = new Vector3(0f, 0f, _motion.InnerAngle);
			for (int i = 0; i < 6; i++)
			{
				Vector2 val6 = HexCorners[i] * num5;
				Vector2 val7 = HexCorners[(i + 1) % 6] * num5;
				PlaceStroke(_outer[i * 2], Vector2.Lerp(val6, val7, 0.04f), Vector2.Lerp(val6, val7, 0.44f), 7.5f * num3, color);
				PlaceStroke(_outer[i * 2 + 1], Vector2.Lerp(val6, val7, 0.56f), Vector2.Lerp(val6, val7, 0.96f), 7.5f * num3, color);
				for (int j = 0; j < 3; j++)
				{
					float num7 = 0.08f + (float)j * 0.32f;
					color2.a = num6 * (0.42f + 0.22f * (0.5f + 0.5f * Mathf.Sin(now * 2.4f - (float)i - (float)j * 0.3f)));
					PlaceStroke(_inner[i * 3 + j], Vector2.Lerp(val6, val7, num7) * 0.71f, Vector2.Lerp(val6, val7, num7 + 0.15f) * 0.71f, 4.5f * num3, color2);
				}
			}
			color.a = num6 * 0.65f;
			PlaceStroke(_ticks[0], Vector2.up * (num5 + 4f * num3), Vector2.up * (num5 + 11f * num3), 5.5f * num3, color);
			PlaceStroke(_ticks[1], Vector2.down * (num5 + 4f * num3), Vector2.down * (num5 + 11f * num3), 5.5f * num3, color);
			color2.a = num6 * 0.9f;
			((Graphic)_dot).color = color2;
			((Graphic)_dot).rectTransform.sizeDelta = Vector2.one * (7f * num3);
			SetVisible(visible: true);
		}

		private float GetPartRadiusPixels(Camera camera, Vector2 center, Collider? part, float scale)
		{
			//IL_002a: Unknown result type (might be due to invalid IL or missing references)
			//IL_002f: 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_0037: Unknown result type (might be due to invalid IL or missing references)
			//IL_003a: Unknown result type (might be due to invalid IL or missing references)
			//IL_003f: Unknown result type (might be due to invalid IL or missing references)
			//IL_005a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0052: Unknown result type (might be due to invalid IL or missing references)
			//IL_006e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0066: Unknown result type (might be due to invalid IL or missing references)
			//IL_0082: Unknown result type (might be due to invalid IL or missing references)
			//IL_007a: 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_008d: 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_0094: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a5: 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_00b3: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)part == (Object)null || !part.enabled)
			{
				if (!_hasLayout)
				{
					return 28f * scale;
				}
				return _lastRadiusPixels;
			}
			Bounds bounds = part.bounds;
			Vector3 min = ((Bounds)(ref bounds)).min;
			Vector3 max = ((Bounds)(ref bounds)).max;
			float num = 0f;
			for (int i = 0; i < 8; i++)
			{
				Vector3 val = camera.WorldToScreenPoint(new Vector3(((i & 1) == 0) ? min.x : max.x, ((i & 2) == 0) ? min.y : max.y, ((i & 4) == 0) ? min.z : max.z));
				if (!(val.z <= camera.nearClipPlane))
				{
					num = Mathf.Max(num, Vector2.Distance(center, new Vector2(val.x, val.y)));
				}
			}
			_lastRadiusPixels = Mathf.Clamp(num / 0.8660254f + 8f * scale, 28f * scale, 92f * scale);
			return _lastRadiusPixels;
		}

		public void SetVisible(bool visible)
		{
			if (IsAlive)
			{
				if (_root.activeSelf != visible)
				{
					_root.SetActive(visible);
				}
				if (!visible)
				{
					_hasLayout = false;
					_lastPart = null;
				}
			}
		}

		public void Destroy()
		{
			if ((Object)(object)_root != (Object)null)
			{
				Object.Destroy((Object)(object)_root);
			}
			DestroySprite(_strokeSprite);
			DestroySprite(_dotSprite);
		}

		private static void DestroySprite(Sprite sprite)
		{
			if (!((Object)(object)sprite == (Object)null))
			{
				Texture2D texture = sprite.texture;
				Object.Destroy((Object)(object)sprite);
				if ((Object)(object)texture != (Object)null)
				{
					Object.Destroy((Object)(object)texture);
				}
			}
		}

		private Image[] CreateStrokes(string name, RectTransform parent, int count)
		{
			Image[] array = (Image[])(object)new Image[count];
			for (int i = 0; i < count; i++)
			{
				array[i] = CreateImage($"{name}_{i:00}", (Transform)(object)parent, _strokeSprite);
			}
			return array;
		}

		private static RectTransform CreateRect(string name, Transform parent)
		{
			//IL_0001: 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_002d: 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_002f: 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_003c: Unknown result type (might be due to invalid IL or missing references)
			RectTransform obj = new GameObject(name).AddComponent<RectTransform>();
			((Transform)obj).SetParent(parent, false);
			Vector2 val = default(Vector2);
			((Vector2)(ref val))..ctor(0.5f, 0.5f);
			obj.pivot = val;
			Vector2 anchorMin = (obj.anchorMax = val);
			obj.anchorMin = anchorMin;
			obj.sizeDelta = Vector2.zero;
			return obj;
		}

		private static Image CreateImage(string name, Transform parent, Sprite sprite)
		{
			//IL_0020: Unknown result type (might be due to invalid IL or missing references)
			Image obj = ((Component)CreateRect(name, parent)).gameObject.AddComponent<Image>();
			obj.sprite = sprite;
			((Graphic)obj).raycastTarget = false;
			((Graphic)obj).color = Color.clear;
			return obj;
		}

		private static void PlaceStroke(Image image, Vector2 start, Vector2 end, float thickness, Color color)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: 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_0010: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0042: Unknown result type (might be due to invalid IL or missing references)
			//IL_0048: 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_0064: Unknown result type (might be due to invalid IL or missing references)
			Vector2 val = end - start;
			RectTransform rectTransform = ((Graphic)image).rectTransform;
			rectTransform.anchoredPosition = (start + end) * 0.5f;
			rectTransform.sizeDelta = new Vector2(((Vector2)(ref val)).magnitude, thickness);
			((Transform)rectTransform).localEulerAngles = new Vector3(0f, 0f, Mathf.Atan2(val.y, val.x) * 57.29578f);
			((Graphic)image).color = color;
		}

		private static Sprite CreateSprite(string name, bool dot)
		{
			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0015: Expected O, but got Unknown
			//IL_0140: Unknown result type (might be due to invalid IL or missing references)
			//IL_014f: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fb: Unknown result type (might be due to invalid IL or missing references)
			int num = (dot ? 64 : 16);
			Texture2D val = new Texture2D(64, num, (TextureFormat)4, false);
			((Object)val).name = name;
			((Texture)val).wrapMode = (TextureWrapMode)1;
			((Texture)val).filterMode = (FilterMode)1;
			Color[] array = (Color[])(object)new Color[64 * num];
			for (int i = 0; i < num; i++)
			{
				for (int j = 0; j < 64; j++)
				{
					float num2 = (float)i - (float)(num - 1) * 0.5f;
					float num3 = (dot ? ((float)j - 31.5f) : Mathf.Max(new float[3]
					{
						4f - (float)j,
						(float)j - 59f,
						0f
					}));
					float num4 = Mathf.Sqrt(num3 * num3 + num2 * num2);
					float num5 = Mathf.Clamp01((dot ? 16f : 2.25f) + 0.75f - num4);
					float num6 = Mathf.Clamp01(1f - num4 / (dot ? 29f : 7f)) * 0.16f;
					array[i * 64 + j] = new Color(1f, 1f, 1f, Mathf.Max(num5, num6));
				}
			}
			val.SetPixels(Il2CppStructArray<Color>.op_Implicit(array));
			val.Apply(false, true);
			return Sprite.Create(val, new Rect(0f, 0f, 64f, (float)num), new Vector2(0.5f, 0.5f), 64f);
		}
	}
	public sealed class BuffBar
	{
		private readonly GameObject _panel;

		private readonly Text _text;

		private readonly Image _accent;

		public BuffBar(Transform parent)
		{
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_0026: 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_0044: 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_0083: 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_00a1: 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_00d4: Unknown result type (might be due to invalid IL or missing references)
			_panel = UiFactory.CreatePanel("BuffBar", parent, new Vector2(0.5f, 1f), new Vector2(0.5f, 1f), new Vector2(680f, 38f), new Vector2(0f, -42f));
			_accent = UiFactory.CreateImage("BuffAccent", _panel.transform, UiFactory.MutedTextColor);
			UiFactory.SetRect((Component)(object)_accent, new Vector2(0f, 0.5f), new Vector2(0f, 0.5f), new Vector2(4f, 24f), new Vector2(18f, 0f));
			_text = UiFactory.CreateText("BuffBarText", _panel.transform, RogueLocalization.ActiveCardsStatus(0), 16, (TextAnchor)4, UiFactory.MutedTextColor);
			UiFactory.Stretch((Component)(object)_text, 30f, 4f, 12f, 4f);
		}

		public void Refresh(RogueState state)
		{
			//IL_0045: Unknown result type (might be due to invalid IL or missing references)
			//IL_0055: Unknown result type (might be due to invalid IL or missing references)
			//IL_0013: 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)
			if (state.SelectedCards.Count == 0)
			{
				((Graphic)_accent).color = UiFactory.MutedTextColor;
				((Graphic)_text).color = UiFactory.MutedTextColor;
				_text.text = RogueLocalization.ActiveCardsStatus(0);
				return;
			}
			((Graphic)_accent).color = UiFactory.AccentColor;
			((Graphic)_text).color = UiFactory.TextColor;
			string text = string.Join("  +  ", state.SelectedCards.Select((RogueCard card) => RogueLocalization.UpperForCurrentLanguage(card.DisplayName())));
			_text.text = "KRP / " + text;
		}

		public void SetVisible(bool visible)
		{
			_panel.SetActive(visible);
		}
	}
	public sealed class CardPoolPanel
	{
		private const int Columns = 4;

		private const float CellWidth = 344f;

		private const float CellHeight = 184f;

		private const float EntryWidth = 320f;

		private const float EntryHeight = 156f;

		private const float ViewportWidth = 1440f;

		private const float ViewportHeight = 610f;

		private const float TopPadding = 23f;

		private const float ScrollStep = 96f;

		private const float OpenDuration = 0.38f;

		private const float EntryStagger = 0.018f;

		private const float EntryDuration = 0.24f;

		private readonly GameObject _panel;

		private readonly CanvasGroup _canvasGroup;

		private readonly RectTransform _frameRect;

		private readonly bool _reducedMotion;

		private readonly RectTransform _contentRoot;

		private readonly Image _scrollTrack;

		private readonly Image _scrollThumb;

		private readonly Text _headerText;

		private readonly Text _promptText;

		private readonly Button _noCooldownButton;

		private readonly Text _noCooldownLabel;

		private readonly Image _noCooldownBackground;

		private bool? _lastNoCooldownDisplayed;

		private readonly List<GameObject> _entries = new List<GameObject>();

		private readonly List<CanvasGroup> _entryGroups = new List<CanvasGroup>();

		private readonly List<Vector2> _entryTargets = new List<Vector2>();

		private readonly List<Vector2> _entryEntryPositions = new List<Vector2>();

		private readonly List<float> _entryBaseScales = new List<float>();

		private readonly HashSet<GameObject> _hoveredEntries = new HashSet<GameObject>();

		private RogueCard[] _cards = Array.Empty<RogueCard>();

		private CorruptionCard[] _corruptionCards = Array.Empty<CorruptionCard>();

		private readonly HashSet<int> _selectedCardIds = new HashSet<int>();

		private readonly HashSet<string> _selectedCorruptionIds = new HashSet<string>(StringComparer.OrdinalIgnoreCase);

		private Func<RogueCard, bool, bool>? _onCardToggled;

		private Func<CorruptionCard, bool, bool>? _onCorruptionToggled;

		private bool _isCorruptionMode;

		private bool _isVisible;

		private float _scrollOffset;

		private float _maxScrollOffset;

		private bool _opening;

		private bool _closing;

		private float _motionTime;

		private float _closeStartAlpha;

		public bool IsVisible
		{
			get
			{
				if (!_isVisible)
				{
					return _closing;
				}
				return true;
			}
		}

		public int CardViewCount => _entries.Count;

		public CardPoolPanel(Transform parent, bool reducedMotion = false)
		{
			//IL_0087: Unknown result type (might be due to invalid IL or missing references)
			//IL_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0091: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: 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_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_015d: Unknown result type (might be due to invalid IL or missing references)
			//IL_016c: Unknown result type (might be due to invalid IL or missing references)
			//IL_019d: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c5: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f0: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ff: Unknown result type (might be due to invalid IL or missing references)
			//IL_020e: Unknown result type (might be due to invalid IL or missing references)
			//IL_021d: Unknown result type (might be due to invalid IL or missing references)
			//IL_023e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0243: Unknown result type (might be due to invalid IL or missing references)
			//IL_0252: Unknown result type (might be due to invalid IL or missing references)
			//IL_0261: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c9: Unknown result type (might be due to invalid IL or missing references)
			//IL_032e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0342: Unknown result type (might be due to invalid IL or missing references)
			//IL_0351: Unknown result type (might be due to invalid IL or missing references)
			//IL_0360: Unknown result type (might be due to invalid IL or missing references)
			//IL_036f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0396: Unknown result type (might be due to invalid IL or missing references)
			//IL_03aa: Unknown result type (might be due to invalid IL or missing references)
			//IL_03b9: Unknown result type (might be due to invalid IL or missing references)
			//IL_03c8: Unknown result type (might be due to invalid IL or missing references)
			//IL_03d7: Unknown result type (might be due to invalid IL or missing references)
			//IL_03f6: Unknown result type (might be due to invalid IL or missing references)
			//IL_0405: Unknown result type (might be due to invalid IL or missing references)
			//IL_0414: Unknown result type (might be due to invalid IL or missing references)
			//IL_0423: Unknown result type (might be due to invalid IL or missing references)
			//IL_044a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0459: Unknown result type (might be due to invalid IL or missing references)
			//IL_0468: Unknown result type (might be due to invalid IL or missing references)
			//IL_046d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0494: Unknown result type (might be due to invalid IL or missing references)
			//IL_04be: Unknown result type (might be due to invalid IL or missing references)
			//IL_04dd: Unknown result type (might be due to invalid IL or missing references)
			//IL_04ec: Unknown result type (might be due to invalid IL or missing references)
			//IL_04fb: Unknown result type (might be due to invalid IL or missing references)
			//IL_050a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0525: Unknown result type (might be due to invalid IL or missing references)
			//IL_055d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0577: Unknown result type (might be due to invalid IL or missing references)
			//IL_0586: Unknown result type (might be due to invalid IL or missing references)
			//IL_0595: Unknown result type (might be due to invalid IL or missing references)
			//IL_059a: Unknown result type (might be due to invalid IL or missing references)
			//IL_05c2: Unknown result type (might be due to invalid IL or missing references)
			//IL_05f1: Unknown result type (might be due to invalid IL or missing references)
			//IL_0600: Unknown result type (might be due to invalid IL or missing references)
			//IL_060f: Unknown result type (might be due to invalid IL or missing references)
			//IL_061e: Unknown result type (might be due to invalid IL or missing references)
			_reducedMotion = reducedMotion;
			_panel = UiFactory.CreateRect("DevelopmentCardPoolPanel", parent, Vector2.zero, Vector2.one, Vector2.zero, Vector2.zero);
			_canvasGroup = _panel.AddComponent<CanvasGroup>();
			_canvasGroup.alpha = 0f;
			_canvasGroup.interactable = false;
			_canvasGroup.blocksRaycasts = false;
			UiFactory.Stretch((Component)(object)UiFactory.CreateImage("CardPoolDimmer", _panel.transform, new Color(0f, 0.005f, 0.006f, 0.9f)), 0f, 0f, 0f, 0f);
			GameObject val = UiFactory.CreatePanel("CardPoolFrame", _panel.transform, new Vector2(0.5f, 0.5f), new Vector2(0.5f, 0.5f), new Vector2(1540f, 840f), new Vector2(0f, -20f));
			_frameRect = val.GetComponent<RectTransform>();
			((Graphic)val.GetComponent<Image>()).color = new Color(0f, 0f, 0f, 0.72f);
			_headerText = UiFactory.CreateText("CardPoolHeader", val.transform, RogueLocalization.Pick("<color=#8FDCFF>Kain</color> ROGUE PROTOCOL / DEV CARD POOL", "<color=#8FDCFF>Kain</color> ROGUE PROTOCOL / 开发卡池"), 27, (TextAnchor)3, UiFactory.AccentColor);
			_headerText.fontStyle = (FontStyle)1;
			UiFactory.SetRect((Component)(object)_headerText, new Vector2(0f, 1f), new Vector2(1f, 1f), new Vector2(-430f, 48f), new Vector2(40f, -44f));
			GameObject val2 = UiFactory.CreateCard("DevActiveSkillNoCooldown", val.transform);
			UiFactory.SetRect((Component)(object)val2.GetComponent<RectTransform>(), Vector2.one, Vector2.one, new Vector2(310f, 40f), new Vector2(-195f, -44f));
			_noCooldownBackground = val2.GetComponent<Image>();
			_noCooldownButton = val2.AddComponent<Button>();
			((Selectable)_noCooldownButton).targetGraphic = (Graphic)(object)_noCooldownBackground;
			((UnityEvent)_noCooldownButton.onClick).AddListener(UnityAction.op_Implicit((Action)ToggleNoCooldown));
			_noCooldownLabel = UiFactory.CreateText("Label", val2.transform, string.Empty, 18, (TextAnchor)4, UiFactory.TextColor);
			_noCooldownLabel.resizeTextForBestFit = true;
			_noCooldownLabel.resizeTextMinSize = 12;
			_noCooldownLabel.resizeTextMaxSize = 18;
			UiFactory.Stretch((Component)(object)_noCooldownLabel, 10f, 3f, 10f, 3f);
			RefreshNoCooldownButton();
			UiFactory.SetRect((Component)(object)UiFactory.CreateImage("CardPoolRule", val.transform, UiFactory.LineColor), new Vector2(0f, 1f), new Vector2(1f, 1f), new Vector2(-80f, 2f), new Vector2(40f, -78f));
			UiFactory.SetRect((Component)(object)UiFactory.CreateText("CardPoolSub", val.transform, RogueLocalization.Pick("Dev test tool: click a card to toggle its effect for this run. Scroll to browse, press ESC to close.", "开发测试工具:点击卡牌可开启或关闭当前局的效果。滚轮浏览,按 ESC 关闭。"), 15, (TextAnchor)3, UiFactory.MutedTextColor), new Vector2(0f, 1f), new Vector2(1f, 1f), new Vector2(-80f, 28f), new Vector2(40f, -105f));
			GameObject val3 = UiFactory.CreateRect("CardPoolGridViewport", val.transform, new Vector2(0.5f, 0.5f), new Vector2(0.5f, 0.5f), new Vector2(1440f, 610f), new Vector2(0f, -42f));
			val3.AddComponent<RectMask2D>();
			GameObject val4 = UiFactory.CreateRect("CardPoolGridContent", val3.transform, new Vector2(0.5f, 1f), new Vector2(0.5f, 1f), new Vector2(1440f, 610f), Vector2.zero);
			_contentRoot = val4.GetComponent<RectTransform>();
			_contentRoot.pivot = new Vector2(0.5f, 1f);
			_scrollTrack = UiFactory.CreateImage("CardPoolScrollTrack", val.transform, new Color(0.12f, 0.2f, 0.18f, 0.28f));
			UiFactory.SetRect((Component)(object)_scrollTrack, new Vector2(1f, 0.5f), new Vector2(1f, 0.5f), new Vector2(3f, 610f), new Vector2(-40f, -42f));
			_scrollThumb = UiFactory.CreateImage("CardPoolScrollThumb", ((Component)_scrollTrack).transform, UiFactory.AccentColor);
			((Graphic)_scrollThumb).color = new Color(UiFactory.AccentColor.r, UiFactory.AccentColor.g, UiFactory.AccentColor.b, 0.78f);
			UiFactory.SetRect((Component)(object)_scrollThumb, new Vector2(0.5f, 1f), new Vector2(0.5f, 1f), new Vector2(7f, 120f), Vector2.zero);
			_promptText = UiFactory.CreateText("CardPoolPrompt", val.transform, RogueLocalization.Pick("Hotkeys: ~ open panel / F8 persistent UI / F7 random reward", "快捷键 ~ 打开本面板 / F8 常驻 UI / F7 随机三选一"), 14, (TextAnchor)4, UiFactory.TextColor);
			_promptText.text = "Hotkeys: KAIN sequence opens panel / F8 persistent UI / F7 random reward";
			UiFactory.SetRect((Component)(object)_promptText, new Vector2(0f, 0f), new Vector2(1f, 0f), new Vector2(-80f, 34f), new Vector2(40f, 34f));
			_panel.SetActive(false);
		}

		public void Show(RogueCard[] cards, IEnumerable<int> selectedIds, Func<RogueCard, bool, bool> onToggled)
		{
			_isCorruptionMode = false;
			((Component)_noCooldownButton).gameObject.SetActive(true);
			RefreshNoCooldownButton();
			_cards = cards;
			_corruptionCards = Array.Empty<CorruptionCard>();
			_onCardToggled = onToggled;
			_onCorruptionToggled = null;
			_selectedCardIds.Clear();
			foreach (int selectedId in selectedIds)
			{
				if (selectedId > 0)
				{
					_selectedCardIds.Add(selectedId);
				}
			}
			_selectedCorruptionIds.Clear();
			_headerText.text = RogueLocalization.Pick("<color=#8FDCFF>Kain</color> ROGUE PROTOCOL / DEV CARD POOL", "<color=#8FDCFF>Kain</color> ROGUE PROTOCOL / DEV CARD POOL");
			_scrollOffset = 0f;
			RebuildEntries();
			_panel.SetActive(true);
			_isVisible = true;
			PrepareOpenMotion();
		}

		public void ShowCorruptions(CorruptionCard[] cards, IEnumerable<string> selectedIds, Func<CorruptionCard, bool, bool> onToggled)
		{
			_isCorruptionMode = true;
			((Component)_noCooldownButton).gameObject.SetActive(false);
			_cards = Array.Empty<RogueCard>();
			_corruptionCards = cards;
			_onCardToggled = null;
			_onCorruptionToggled = onToggled;
			_selectedCorruptionIds.Clear();
			foreach (string selectedId in selectedIds)
			{
				if (!string.IsNullOrWhiteSpace(selectedId))
				{
					_selectedCorruptionIds.Add(selectedId);
				}
			}
			_headerText.text = RogueLocalization.Pick("<color=#FF5B5B>Kain</color> ROGUE PROTOCOL / CORRUPTION POOL", "<color=#FF5B5B>Kain</color> ROGUE PROTOCOL / CORRUPTION POOL");
			_scrollOffset = 0f;
			RebuildEntries();
			_panel.SetActive(true);
			_isVisible = true;
			PrepareOpenMotion();
		}

		public void Tick()
		{
			//IL_0036: Unknown result type (might be due to invalid IL or missing references)
			if (!_isVisible && !_closing)
			{
				return;
			}
			TickMotion();
			RefreshNoCooldownButton();
			if (!_isVisible)
			{
				return;
			}
			if (Input.GetKeyDown((KeyCode)27))
			{
				Close();
				return;
			}
			float num = Input.mouseScrollDelta.y;
			if (Mathf.Abs(num) <= 0.001f)
			{
				num = Input.GetAxis("Mouse ScrollWheel") * 10f;
			}
			if (Mathf.Abs(num) > 0.001f && _maxScrollOffset > 0f)
			{
				_scrollOffset = Mathf.Clamp(_scrollOffset - num * 96f, 0f, _maxScrollOffset);
				ApplyScrollPosition();
			}
			TickEntryMotion();
		}

		private void ToggleNoCooldown()
		{
			RogueDeveloperActiveSkillCooldown.SetLocalEnabled(!RogueDeveloperActiveSkillCooldown.LocalEnabled);
			RefreshNoCooldownButton();
		}

		private void RefreshNoCooldownButton()
		{
			//IL_006e: 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_00b0: 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)
			bool localEnabled = RogueDeveloperActiveSkillCooldown.LocalEnabled;
			if (_lastNoCooldownDisplayed != localEnabled)
			{
				_lastNoCooldownDisplayed = localEnabled;
				_noCooldownLabel.text = (localEnabled ? RogueLocalization.Pick("NO SKILL COOLDOWN: ON", "主动技能无冷却:开启") : RogueLocalization.Pick("NO SKILL COOLDOWN: OFF", "主动技能无冷却:关闭"));
				((Graphic)_noCooldownLabel).color = (localEnabled ? UiFactory.AccentColor : UiFactory.TextColor);
				((Graphic)_noCooldownBackground).color = (localEnabled ? new Color(0.24f, 0.15f, 0.035f, 0.98f) : new Color(0.055f, 0.075f, 0.085f, 0.98f));
			}
		}

		private void RebuildEntries()
		{
			//IL_016f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0153: Unknown result type (might be due to invalid IL or missing references)
			foreach (GameObject entry in _entries)
			{
				Object.Destroy((Object)(object)entry);
			}
			_entries.Clear();
			_entryGroups.Clear();
			_entryTargets.Clear();
			_entryEntryPositions.Clear();
			_entryBaseScales.Clear();
			_hoveredEntries.Clear();
			int num = (_isCorruptionMode ? _corruptionCards.Length : _cards.Length);
			int num2 = Mathf.CeilToInt((float)num / 4f);
			float num3 = Mathf.Max(610f, 23f + (float)num2 * 184f);
			_contentRoot.SetSizeWithCurrentAnchors((Axis)0, 1440f);
			_contentRoot.SetSizeWithCurrentAnchors((Axis)1, num3);
			_maxScrollOffset = Mathf.Max(0f, num3 - 610f);
			_scrollOffset = Mathf.Clamp(_scrollOffset, 0f, _maxScrollOffset);
			for (int i = 0; i < num; i++)
			{
				int num4 = i % 4;
				int num5 = i / 4;
				float num6 = -516f + (float)num4 * 344f;
				float num7 = -101f - (float)num5 * 184f;
				if (_isCorruptionMode)
				{
					CreateCorruptionEntry(_corruptionCards[i], i, new Vector2(num6, num7));
				}
				else
				{
					CreateEntry(_cards[i], i, new Vector2(num6, num7));
				}
			}
			ApplyScrollPosition();
			if (_isCorruptionMode)
			{
				_promptText.text = ((_maxScrollOffset > 0f) ? RogueLocalization.Format("Loaded {0} corruptions. Scroll to browse, click to toggle for this run, press ESC to close.", "Loaded {0} corruptions. Scroll to browse, click to toggle for this run, press ESC to close.", num) : RogueLocalization.Format("Loaded {0} corruptions. Click to toggle for this run, press ESC to close.", "Loaded {0} corruptions. Click to toggle for this run, press ESC to close.", num));
			}
			else
			{
				_promptText.text = ((_maxScrollOffset > 0f) ? RogueLocalization.Format("Loaded {0} cards. Scroll to browse, click to toggle, press ESC to close.", "已载入 {0} 张卡。滚轮浏览,点击开关效果,按 ESC 关闭。", _cards.Length) : RogueLocalization.Format("Loaded {0} cards. Click to toggle effects, press ESC to close.", "已载入 {0} 张卡。点击开关效果,按 ESC 关闭。", _cards.Length));
			}
		}

		private void CreateEntry(RogueCard card, int index, Vector2 position)
		{
			//IL_0058: 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_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_00d5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ba: 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_0109: Unknown result type (might be due to invalid IL or missing references)
			//IL_010e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0178: 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_01e5: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f9: Unknown result type (might be due to invalid IL or missing references)
			//IL_0208: 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_022a: Unknown result type (might be due to invalid IL or missing references)
			//IL_025e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0272: Unknown result type (might be due to invalid IL or missing references)
			//IL_0281: Unknown result type (might be due to invalid IL or missing references)
			//IL_0290: Unknown result type (might be due to invalid IL or missing references)
			//IL_029f: Unknown result type (might be due to invalid IL or missing references)
			//IL_02e9: 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_02fd: Unknown result type (might be due to invalid IL or missing references)
			//IL_030c: 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_034e: Unknown result type (might be due to invalid IL or missing references)
			//IL_035d: Unknown result type (might be due to invalid IL or missing references)
			//IL_036c: Unknown result type (might be due to invalid IL or missing references)
			//IL_037b: Unknown result type (might be due to invalid IL or missing references)
			//IL_041e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0449: Unknown result type (might be due to invalid IL or missing references)
			//IL_0458: Unknown result type (might be due to invalid IL or missing references)
			//IL_0467: Unknown result type (might be due to invalid IL or missing references)
			//IL_0476: Unknown result type (might be due to invalid IL or missing references)
			//IL_049e: Unknown result type (might be due to invalid IL or missing references)
			//IL_04c9: Unknown result type (might be due to invalid IL or missing references)
			//IL_04d8: Unknown result type (might be due to invalid IL or missing references)
			//IL_04e7: Unknown result type (might be due to invalid IL or missing references)
			//IL_04f6: Unknown result type (might be due to invalid IL or missing references)
			//IL_051f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0533: Unknown result type (might be due to invalid IL or missing references)
			//IL_0542: Unknown result type (might be due to invalid IL or missing references)
			//IL_0551: Unknown result type (might be due to invalid IL or missing references)
			//IL_0560: Unknown result type (might be due to invalid IL or missing references)
			GameObject entry = UiFactory.CreateCard($"CardPoolEntry_{index + 1}", (Transform)(object)_contentRoot);
			UiFactory.SetRect((Component)(object)entry.GetComponent<RectTransform>(), new Vector2(0.5f, 1f), new Vector2(0.5f, 1f), new Vector2(320f, 156f), position);
			bool flag = _selectedCardIds.Contains(card.PersistentID);
			((Graphic)entry.GetComponent<Image>()).color = (flag ? new Color(0.035f, 0.075f, 0.067f, 0.98f) : new Color(0.024f, 0.038f, 0.035f, 0.95f));
			_entries.Add(entry);
			RegisterEntryMotion(entry, position);
			Color rarityColor = RogueUiAssetLibrary.RarityPrimaryColor(card.Rarity);
			float glowStrength = RogueUiAssetLibrary.RarityGlowStrength(card.Rarity);
			int rank = RogueUiAssetLibrary.RarityRank(card.Rarity);
			Image[] edgeGlows = CreateEntryEdgeGlows(entry.transform);
			Image[] particles = CreateEntryPerimeterParticles(entry.transform, index);
			SetEntryEdgeGlowColors(edgeGlows, rarityColor, Mathf.Clamp01(0.1f + glowStrength * 0.3f), rank);
			SetEntryParticleColors(particles, rarityColor, Mathf.Clamp01(0.12f + glowStrength * 0.36f), rank, index);
			UiFactory.SetRect((Component)(object)UiFactory.CreateImage("Accent", entry.transform, rarityColor), new Vector2(0f, 1f), new Vector2(1f, 1f), new Vector2(0f, (float)(4 + rank)), new Vector2(0f, -2f));
			UiFactory.SetRect((Component)(object)UiFactory.CreateText("Index", entry.transform, $"{index + 1:00}", 14, (TextAnchor)3, UiFactory.AccentColor), new Vector2(0f, 1f), new Vector2(0f, 1f), new Vector2(44f, 24f), new Vector2(34f, -24f));
			UiFactory.SetRect((Component)(object)UiFactory.CreateText("State", entry.transform, flag ? RogueLocalization.Pick("ACTIVE", "已开启") : RogueLocalization.Pick("AVAILABLE", "未开启"), 11, (TextAnchor)5, flag ? UiFactory.AccentColor : UiFactory.MutedTextColor), new Vector2(1f, 1f), new Vector2(1f, 1f), new Vector2(92f, 22f), new Vector2(-28f, -22f));
			RogueUiAssetLibrary.BindRarityModule(UiFactory.CreateRect("RarityModuleSlot", entry.transform, new Vector2(1f, 1f), new Vector2(1f, 1f), new Vector2(46f, 46f), new Vector2(-42f, -40f)).transform, card.Rarity, out Image baseImage, out Image rarityGlow, out Image rarityAccent);
			UiFactory.Stretch((Component)(object)baseImage, 0f, 0f, 0f, 0f);
			UiFactory.Stretch((Component)(object)rarityGlow, -6f, -6f, -6f, -6f);
			UiFactory.Stretch((Component)(object)rarityAccent, 0f, 0f, 0f, 0f);
			Text obj = UiFactory.CreateText("Title", entry.transform, card.DisplayName(), 18, (TextAnchor)3, UiFactory.TextColor);
			obj.resizeTextForBestFit = true;
			obj.resizeTextMinSize = 12;
			obj.resizeTextMaxSize = 18;
			UiFactory.SetRect((Component)(object)obj, new Vector2(0f, 1f), new Vector2(1f, 1f), new Vector2(-112f, 28f), new Vector2(84f, -24f));
			Text obj2 = UiFactory.CreateText("Description", entry.transform, card.DisplayDescription(), 12, (TextAnchor)0, UiFactory.TextColor);
			obj2.resizeTextForBestFit = true;
			obj2.resizeTextMinSize = 9;
			obj2.resizeTextMaxSize = 12;
			UiFactory.SetRect((Component)(object)obj2, new Vector2(0f, 1f), new Vector2(1f, 1f), new Vector2(-34f, 58f), new Vector2(17f, -88f));
			UiFactory.SetRect((Component)(object)UiFactory.CreateText("Tags", entry.transform, card.DisplayCompactTags(3), 10, (TextAnchor)3, UiFactory.MutedTextColor), new Vector2(0f, 0f), new Vector2(1f, 0f), new Vector2(-34f, 22f), new Vector2(17f, 18f));
			((UnityEvent)entry.AddComponent<Button>().onClick).AddListener(UnityAction.op_Implicit((Action)delegate
			{
				ToggleCard(card);
			}));
			EventTrigger trigger = entry.AddComponent<EventTrigger>();
			AddTrigger(trigger, (EventTriggerType)0, delegate
			{
				//IL_001e: Unknown result type (might be due to invalid IL or missing references)
				//IL_0052: Unknown result type (might be due to invalid IL or missing references)
				_hoveredEntries.Add(entry);
				SetEntryEdgeGlowColors(edgeGlows, rarityColor, Mathf.Clamp01(0.24f + glowStrength * 0.45f), rank);
				SetEntryParticleColors(particles, rarityColor, Mathf.Clamp01(0.22f + glowStrength * 0.48f), rank, index);
				RogueUiAssetLibrary.SetRarityModuleState(rarityGlow, rarityAccent, highlighted: true, selected: false);
			});
			AddTrigger(trigger, (EventTriggerType)1, delegate
			{
				//IL_001e: Unknown result type (might be due to invalid IL or missing references)
				//IL_0052: Unknown result type (might be due to invalid IL or missing references)
				_hoveredEntries.Remove(entry);
				SetEntryEdgeGlowColors(edgeGlows, rarityColor, Mathf.Clamp01(0.1f + glowStrength * 0.3f), rank);
				SetEntryParticleColors(particles, rarityColor, Mathf.Clamp01(0.12f + glowStrength * 0.36f), rank, index);
				RogueUiAssetLibrary.SetRarityModuleState(rarityGlow, rarityAccent, highlighted: false, selected: false);
			});
		}

		private void ToggleCard(RogueCard card)
		{
			bool flag = !_selectedCardIds.Contains(card.PersistentID);
			Func<RogueCard, bool, bool>? onCardToggled = _onCardToggled;
			if (onCardToggled == null || !onCardToggled(card, flag))
			{
				_promptText.text = RogueLocalization.Pick("Card effect could not be changed.", "无法切换这张卡的效果。");
				return;
			}
			if (flag)
			{
				_selectedCardIds.Add(card.PersistentID);
			}
			else
			{
				_selectedCardIds.Remove(card.PersistentID);
			}
			RebuildEntries();
		}

		private void CreateCorruptionEntry(CorruptionCard card, int index, Vector2 position)
		{
			//IL_0058: 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_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_00d5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ba: 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_0115: Unknown result type (might be due to invalid IL or missing references)
			//IL_010e: Unknown result type (might be due to invalid IL or missing references)
			//IL_011a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0180: Unknown result type (might be due to invalid IL or missing references)
			//IL_01af: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ed: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_0229: Unknown result type (might be due to invalid IL or missing references)
			//IL_0238: Unknown result type (might be due to invalid IL or missing references)
			//IL_0276: Unknown result type (might be due to invalid IL or missing references)
			//IL_026f: Unknown result type (might be due to invalid IL or missing references)
			//IL_028a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0299: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a8: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b7: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ed: Unknown result type (might be due to invalid IL or missing references)
			//IL_02e6: Unknown result type (might be due to invalid IL or missing references)
			//IL_0301: Unknown result type (might be due to invalid IL or missing references)
			//IL_0310: Unknown result type (might be due to invalid IL or missing references)
			//IL_031f: Unknown result type (might be due to invalid IL or missing references)
			//IL_032e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0356: Unknown result type (might be due to invalid IL or missing references)
			//IL_0381: Unknown result type (might be due to invalid IL or missing references)
			//IL_0390: Unknown result type (might be due to invalid IL or missing references)
			//IL_039f: Unknown result type (might be due to invalid IL or missing references)
			//IL_03ae: Unknown result type (might be due to invalid IL or missing references)
			//IL_03d6: Unknown result type (might be due to invalid IL or missing references)
			//IL_0401: Unknown result type (might be due to invalid IL or missing references)
			//IL_0410: Unknown result type (might be due to invalid IL or missing references)
			//IL_041f: Unknown result type (might be due to invalid IL or missing references)
			//IL_042e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0470: Unknown result type (might be due to invalid IL or missing references)
			//IL_0484: Unknown result type (might be due to invalid IL or missing references)
			//IL_0493: Unknown result type (might be due to invalid IL or missing references)
			//IL_04a2: Unknown result type (might be due to invalid IL or missing references)
			//IL_04b1: Unknown result type (might be due to invalid IL or missing references)
			GameObject entry = UiFactory.CreateCard($"CorruptionPoolEntry_{index + 1}", (Transform)(object)_contentRoot);
			UiFactory.SetRect((Component)(object)entry.GetComponent<RectTransform>(), new Vector2(0.5f, 1f), new Vector2(0.5f, 1f), new Vector2(320f, 156f), position);
			bool flag = _selectedCorruptionIds.Contains(card.Id);
			((Graphic)entry.GetComponent<Image>()).color = (flag ? new Color(0.085f, 0.028f, 0.028f, 0.98f) : new Color(0.032f, 0.025f, 0.026f, 0.95f));
			_entries.Add(entry);
			RegisterEntryMotion(entry, position);
			string rarity = CorruptionRarity(card);
			Color rarityColor = (flag ? UiFactory.DangerColor : RogueUiAssetLibrary.RarityPrimaryColor(rarity));
			float glowStrength = (flag ? 0.88f : RogueUiAssetLibrary.RarityGlowStrength(rarity));
			int rank = (flag ? 4 : RogueUiAssetLibrary.RarityRank(rarity));
			Image[] edgeGlows = CreateEntryEdgeGlows(entry.transform);
			Image[] particles = CreateEntryPerimeterParticles(entry.transform, index);
			SetEntryEdgeGlowColors(edgeGlows, rarityColor, Mathf.Clamp01(0.16f + glowStrength * 0.34f), rank);
			SetEntryParticleColors(particles, rarityColor, Mathf.Clamp01(0.15f + glowStrength * 0.38f), rank, index);
			UiFactory.SetRect((Component)(object)UiFactory.CreateImage("Accent", entry.transform, rarityColor), new Vector2(0f, 1f), new Vector2(1f, 1f), new Vector2(0f, (float)(flag ? 8 : (4 + rank))), new Vector2(0f, -2f));
			UiFactory.SetRect((Component)(object)UiFactory.CreateText("Index", entry.transform, $"{index + 1:00}", 14, (TextAnchor)3, flag ? UiFactory.DangerColor : UiFactory.AccentColor), new Vector2(0f, 1f), new Vector2(0f, 1f), new Vector2(44f, 24f), new Vector2(34f, -24f));
			UiFactory.SetRect((Component)(object)UiFactory.CreateText("State", entry.transform, flag ? "ACTIVE" : "AVAILABLE", 11, (TextAnchor)5, flag ? UiFactory.DangerColor : UiFactory.MutedTextColor), new Vector2(1f, 1f), new Vector2(1f, 1f), new Vector2(92f, 22f), new Vector2(-28f, -22f));
			Text obj = UiFactory.CreateText("Title", entry.transform, card.DisplayName(), 18, (TextAnchor)3, UiFactory.TextColor);
			obj.resizeTextForBestFit = true;
			obj.resizeTextMinSize = 12;
			obj.resizeTextMaxSize = 18;
			UiFactory.SetRect((Component)(object)obj, new Vector2(0f, 1f), new Vector2(1f, 1f), new Vector2(-126f, 28f), new Vector2(84f, -24f));
			Text obj2 = UiFactory.CreateText("Description", entry.transform, card.DisplayDescription(), 12, (TextAnchor)0, UiFactory.TextColor);
			obj2.resizeTextForBestFit = true;
			obj2.resizeTextMinSize = 9;
			obj2.resizeTextMaxSize = 12;
			UiFactory.SetRect((Component)(object)obj2, new Vector2(0f, 1f), new Vector2(1f, 1f), new Vector2(-34f, 58f), new Vector2(17f, -88f));
			UiFactory.SetRect((Component)(object)UiFactory.CreateText("Tags", entry.transform, $"{card.Tier} / THREAT {card.ThreatScore}", 10, (TextAnchor)3, UiFactory.MutedTextColor), new Vector2(0f, 0f), new Vector2(1f, 0f), new Vector2(-34f, 22f), new Vector2(17f, 18f));
			((UnityEvent)entry.AddComponent<Button>().onClick).AddListener(UnityAction.op_Implicit((Action)delegate
			{
				ToggleCorruption(card);
			}));
			EventTrigger trigger = entry.AddComponent<EventTrigger>();
			AddTrigger(trigger, (EventTriggerType)0, delegate
			{
				//IL_001e: Unknown result type (might be due to invalid IL or missing references)
				//IL_0052: Unknown result type (might be due to invalid IL or missing references)
				_hoveredEntries.Add(entry);
				SetEntryEdgeGlowColors(edgeGlows, rarityColor, Mathf.Clamp01(0.3f + glowStrength * 0.45f), rank);
				SetEntryParticleColors(particles, rarityColor, Mathf.Clamp01(0.25f + glowStrength * 0.48f), rank, index);
			});
			AddTrigger(trigger, (EventTriggerType)1, delegate
			{
				//IL_001e: Unknown result type (might be due to invalid IL or missing references)
				//IL_0052: Unknown result type (might be due to invalid IL or missing references)
				_hoveredEntries.Remove(entry);
				SetEntryEdgeGlowColors(edgeGlows, rarityColor, Mathf.Clamp01(0.16f + glowStrength * 0.34f), rank);
				SetEntryParticleColors(particles, rarityColor, Mathf.Clamp01(0.15f + glowStrength * 0.38f), rank, index);
			});
		}

		private void ToggleCorruption(CorruptionCard card)
		{
			bool flag = !_selected