Decompiled source of KainRogueProtocol CHS EN v1.1.1

BepInEx/plugins/KainRogueProtocol/KainRogueProtocol.dll

Decompiled 14 hours 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.InteropServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using AIGraph;
using Agents;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Core.Logging.Interpolation;
using BepInEx.Logging;
using BepInEx.Unity.IL2CPP;
using ChainedPuzzles;
using Enemies;
using GameData;
using Gear;
using HarmonyLib;
using Iced.Intel;
using Il2CppInterop.Runtime;
using Il2CppInterop.Runtime.InteropTypes;
using Il2CppInterop.Runtime.InteropTypes.Arrays;
using Il2CppInterop.Runtime.Runtime;
using Il2CppInterop.Runtime.Runtime.VersionSpecific.Class;
using Il2CppInterop.Runtime.Runtime.VersionSpecific.MethodInfo;
using Il2CppSystem;
using Il2CppSystem.Collections;
using Il2CppSystem.Collections.Generic;
using KainRogueProtocol.Core;
using KainRogueProtocol.Corruption;
using KainRogueProtocol.Data;
using KainRogueProtocol.Diagnostics;
using KainRogueProtocol.Effects;
using KainRogueProtocol.Events;
using KainRogueProtocol.Fixes.PierceAuthorization;
using KainRogueProtocol.Localization;
using KainRogueProtocol.Modifiers;
using KainRogueProtocol.Networking;
using KainRogueProtocol.Patches;
using KainRogueProtocol.Runtime;
using KainRogueProtocol.Triggers;
using KainRogueProtocol.UI;
using LevelGeneration;
using Microsoft.CodeAnalysis;
using ModifierAPI;
using Player;
using SNetwork;
using TMPro;
using UnityEngine;
using UnityEngine.EventSystems;
using UnityEngine.Events;
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: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("0.0.0.0")]
[module: UnverifiableCode]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.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]
	[Microsoft.CodeAnalysis.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;
		}
	}
}
namespace KainRogueProtocol.UI
{
	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;
			_text.text = "KRP / " + string.Join("  +  ", state.SelectedCards.Select((RogueCard card) => RogueLocalization.UpperForCurrentLanguage(card.DisplayName())));
		}

		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 readonly GameObject _panel;

		private readonly RectTransform _contentRoot;

		private readonly Image _scrollTrack;

		private readonly Image _scrollThumb;

		private readonly Text _headerText;

		private readonly Text _promptText;

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

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

		private Action<RogueCard>? _onSelected;

		private bool _isVisible;

		private float _scrollOffset;

		private float _maxScrollOffset;

		public bool IsVisible => _isVisible;

		public int CardViewCount => _entries.Count;

		public CardPoolPanel(Transform parent)
		{
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_0028: 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_0032: 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)
			//IL_00a2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cf: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f4: Unknown result type (might be due to invalid IL or missing references)
			//IL_011c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0147: Unknown result type (might be due to invalid IL or missing references)
			//IL_0156: Unknown result type (might be due to invalid IL or missing references)
			//IL_0165: Unknown result type (might be due to invalid IL or missing references)
			//IL_0174: Unknown result type (might be due to invalid IL or missing references)
			//IL_0189: 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_01ac: Unknown result type (might be due to invalid IL or missing references)
			//IL_01bb: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ca: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f1: Unknown result type (might be due to invalid IL or missing references)
			//IL_0205: Unknown result type (might be due to invalid IL or missing references)
			//IL_0214: Unknown result type (might be due to invalid IL or missing references)
			//IL_0223: Unknown result type (might be due to invalid IL or missing references)
			//IL_0232: Unknown result type (might be due to invalid IL or missing references)
			//IL_0251: Unknown result type (might be due to invalid IL or missing references)
			//IL_0260: Unknown result type (might be due to invalid IL or missing references)
			//IL_026f: Unknown result type (might be due to invalid IL or missing references)
			//IL_027e: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b4: 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_02ef: Unknown result type (might be due to invalid IL or missing references)
			//IL_0319: Unknown result type (might be due to invalid IL or missing references)
			//IL_0338: Unknown result type (might be due to invalid IL or missing references)
			//IL_0347: 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_0365: Unknown result type (might be due to invalid IL or missing references)
			//IL_0380: Unknown result type (might be due to invalid IL or missing references)
			//IL_03b8: Unknown result type (might be due to invalid IL or missing references)
			//IL_03d2: Unknown result type (might be due to invalid IL or missing references)
			//IL_03e1: Unknown result type (might be due to invalid IL or missing references)
			//IL_03f0: Unknown result type (might be due to invalid IL or missing references)
			//IL_03f5: Unknown result type (might be due to invalid IL or missing references)
			//IL_041d: Unknown result type (might be due to invalid IL or missing references)
			//IL_043c: Unknown result type (might be due to invalid IL or missing references)
			//IL_044b: Unknown result type (might be due to invalid IL or missing references)
			//IL_045a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0469: Unknown result type (might be due to invalid IL or missing references)
			_panel = UiFactory.CreateRect("DevelopmentCardPoolPanel", parent, Vector2.zero, Vector2.one, Vector2.zero, Vector2.zero);
			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));
			((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(-80f, 48f), new Vector2(40f, -44f));
			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 any card to add it to the current 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 val2 = 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));
			val2.AddComponent<RectMask2D>();
			GameObject val3 = UiFactory.CreateRect("CardPoolGridContent", val2.transform, new Vector2(0.5f, 1f), new Vector2(0.5f, 1f), new Vector2(1440f, 610f), Vector2.zero);
			_contentRoot = val3.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);
			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, Action<RogueCard> onSelected)
		{
			_cards = cards;
			_onSelected = onSelected;
			_scrollOffset = 0f;
			RebuildEntries();
			_panel.SetActive(true);
			_isVisible = true;
		}

		public void Tick()
		{
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			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();
			}
		}

		private void RebuildEntries()
		{
			//IL_00ff: Unknown result type (might be due to invalid IL or missing references)
			foreach (GameObject entry in _entries)
			{
				Object.Destroy((Object)(object)entry);
			}
			_entries.Clear();
			int num = Mathf.CeilToInt((float)_cards.Length / 4f);
			float num2 = Mathf.Max(610f, 23f + (float)num * 184f);
			_contentRoot.SetSizeWithCurrentAnchors((Axis)0, 1440f);
			_contentRoot.SetSizeWithCurrentAnchors((Axis)1, num2);
			_maxScrollOffset = Mathf.Max(0f, num2 - 610f);
			_scrollOffset = Mathf.Clamp(_scrollOffset, 0f, _maxScrollOffset);
			for (int i = 0; i < _cards.Length; i++)
			{
				RogueCard card = _cards[i];
				int num3 = i % 4;
				int num4 = i / 4;
				float num5 = -516f + (float)num3 * 344f;
				float num6 = -101f - (float)num4 * 184f;
				CreateEntry(card, i, new Vector2(num5, num6));
			}
			ApplyScrollPosition();
			_promptText.text = ((_maxScrollOffset > 0f) ? RogueLocalization.Format("Loaded {0} cards. Scroll to browse, click to select, press ESC to close.", "已载入 {0} 张卡。滚轮滚动浏览,点击选择,按 ESC 关闭。", _cards.Length) : RogueLocalization.Format("Loaded {0} cards. Click any card to select, press ESC to close.", "已载入 {0} 张卡。点击任意卡牌立即选择,按 ESC 关闭。", _cards.Length));
		}

		private void CreateEntry(RogueCard card, int index, Vector2 position)
		{
			//IL_004c: Unknown result type (might be due to invalid IL or missing references)
			//IL_005b: 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_006f: 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_00ba: 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_00d0: 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_00fe: Unknown result type (might be due to invalid IL or missing references)
			//IL_010d: Unknown result type (might be due to invalid IL or missing references)
			//IL_013c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0150: Unknown result type (might be due to invalid IL or missing references)
			//IL_015f: Unknown result type (might be due to invalid IL or missing references)
			//IL_016e: Unknown result type (might be due to invalid IL or missing references)
			//IL_017d: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a1: 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_01bf: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ce: Unknown result type (might be due to invalid IL or missing references)
			//IL_0271: Unknown result type (might be due to invalid IL or missing references)
			//IL_029c: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ab: 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_02c9: Unknown result type (might be due to invalid IL or missing references)
			//IL_02f1: Unknown result type (might be due to invalid IL or missing references)
			//IL_031c: Unknown result type (might be due to invalid IL or missing references)
			//IL_032b: Unknown result type (might be due to invalid IL or missing references)
			//IL_033a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0349: Unknown result type (might be due to invalid IL or missing references)
			//IL_0372: 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_0395: Unknown result type (might be due to invalid IL or missing references)
			//IL_03a4: Unknown result type (might be due to invalid IL or missing references)
			//IL_03b3: Unknown result type (might be due to invalid IL or missing references)
			RogueCard card2 = card;
			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);
			((Graphic)entry.GetComponent<Image>()).color = new Color(0.024f, 0.038f, 0.035f, 0.95f);
			_entries.Add(entry);
			Color color = RogueUiAssetLibrary.RarityPrimaryColor(card2.Rarity);
			UiFactory.SetRect((Component)(object)UiFactory.CreateImage("Accent", entry.transform, color), new Vector2(0f, 1f), new Vector2(1f, 1f), new Vector2(0f, 4f), 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));
			RogueUiAssetLibrary.BindRarityModule(UiFactory.CreateRect("RarityModuleSlot", entry.transform, new Vector2(1f, 1f), new Vector2(1f, 1f), new Vector2(46f, 46f), new Vector2(-42f, -40f)).transform, card2.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, card2.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, card2.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, card2.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
			{
				Select(card2);
			}));
			EventTrigger trigger = entry.AddComponent<EventTrigger>();
			AddTrigger(trigger, (EventTriggerType)0, delegate
			{
				//IL_000b: Unknown result type (might be due to invalid IL or missing references)
				//IL_0015: Unknown result type (might be due to invalid IL or missing references)
				entry.transform.localScale = Vector3.one * 1.018f;
				RogueUiAssetLibrary.SetRarityModuleState(rarityGlow, rarityAccent, highlighted: true, selected: false);
			});
			AddTrigger(trigger, (EventTriggerType)1, delegate
			{
				//IL_000b: Unknown result type (might be due to invalid IL or missing references)
				entry.transform.localScale = Vector3.one;
				RogueUiAssetLibrary.SetRarityModuleState(rarityGlow, rarityAccent, highlighted: false, selected: false);
			});
		}

		private void Select(RogueCard card)
		{
			Close();
			_onSelected?.Invoke(card);
		}

		private void Close()
		{
			_panel.SetActive(false);
			_isVisible = false;
		}

		private void ApplyScrollPosition()
		{
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_0049: Unknown result type (might be due to invalid IL or missing references)
			//IL_004e: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d8: Unknown result type (might be due to invalid IL or missing references)
			_contentRoot.anchoredPosition = new Vector2(0f, _scrollOffset);
			bool flag = _maxScrollOffset > 0f;
			((Component)_scrollTrack).gameObject.SetActive(flag);
			if (flag)
			{
				Rect rect = _contentRoot.rect;
				float num = Mathf.Max(610f, ((Rect)(ref rect)).height);
				float num2 = Mathf.Clamp(610f / num * 610f, 74f, 610f);
				float num3 = Mathf.Max(0f, 610f - num2);
				float num4 = ((_maxScrollOffset <= 0f) ? 0f : (_scrollOffset / _maxScrollOffset));
				RectTransform rectTransform = ((Graphic)_scrollThumb).rectTransform;
				rectTransform.SetSizeWithCurrentAnchors((Axis)0, 7f);
				rectTransform.SetSizeWithCurrentAnchors((Axis)1, num2);
				rectTransform.anchoredPosition = new Vector2(0f, (0f - num4) * num3);
			}
		}

		private static void AddTrigger(EventTrigger trigger, EventTriggerType type, Action<BaseEventData> callback)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_000d: Expected O, but got Unknown
			Entry val = new Entry
			{
				eventID = type
			};
			((UnityEvent<BaseEventData>)(object)val.callback).AddListener(UnityAction<BaseEventData>.op_Implicit(callback));
			trigger.triggers.Add(val);
		}

		private static string DisplayRarity(string rarity)
		{
			return RogueLocalization.DisplayRarity(rarity);
		}
	}
	public sealed class ConditionalCardStatusPanel
	{
		private sealed class RowView
		{
			public GameObject Root { get; }

			public Image Rarity { get; }

			public Text Title { get; }

			public Text Status { get; }

			public RowView(GameObject root, Image rarity, Text title, Text status)
			{
				Root = root;
				Rarity = rarity;
				Title = title;
				Status = status;
			}
		}

		private static readonly HashSet<int> ConditionalCardIds = new HashSet<int>
		{
			100301, 100306, 100310, 100313, 100314, 100315, 100316, 100318, 100320, 100322,
			100324
		};

		private readonly GameObject _panel;

		private readonly List<RowView> _rows = new List<RowView>();

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

		private int _lastVersion = -1;

		private float _nextTextUpdateAt;

		private bool _visible = true;

		public int CardViewCount => _rows.Count;

		public ConditionalCardStatusPanel(Transform parent)
		{
			//IL_003b: Unknown result type (might be due to invalid IL or missing references)
			//IL_004a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0059: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: 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)
			_panel = UiFactory.CreateRect("KRP.ConditionalCardStatusPanel", parent, new Vector2(0f, 0.5f), new Vector2(0f, 0.5f), new Vector2(390f, 520f), new Vector2(28f, -82f));
			_panel.GetComponent<RectTransform>().pivot = new Vector2(0f, 0.5f);
			_panel.SetActive(true);
		}

		public void Refresh(RogueState state)
		{
			if (_lastVersion == state.Version)
			{
				return;
			}
			_lastVersion = state.Version;
			_cards = state.SelectedCards.Where((RogueCard card) => ConditionalCardIds.Contains(card.PersistentID)).ToArray();
			EnsureRows(_cards.Length);
			for (int i = 0; i < _rows.Count; i++)
			{
				bool flag = i < _cards.Length;
				_rows[i].Root.SetActive(flag);
				if (flag)
				{
					BindStatic(_rows[i], _cards[i], i);
				}
			}
			_panel.SetActive(_visible && _cards.Length != 0);
			_nextTextUpdateAt = 0f;
		}

		public void Tick()
		{
			if (_visible && _cards.Length != 0 && !(Time.unscaledTime < _nextTextUpdateAt))
			{
				_nextTextUpdateAt = Time.unscaledTime + 0.25f;
				for (int i = 0; i < _cards.Length && i < _rows.Count; i++)
				{
					_rows[i].Status.text = BuildStatusText(_cards[i], Time.time);
				}
			}
		}

		public void SetVisible(bool visible)
		{
			_visible = visible;
			_panel.SetActive(visible && _cards.Length != 0);
		}

		private void EnsureRows(int count)
		{
			while (_rows.Count < count)
			{
				_rows.Add(CreateRow(_rows.Count));
			}
		}

		private RowView CreateRow(int index)
		{
			//IL_0032: Unknown result type (might be due to invalid IL or missing references)
			//IL_0047: Unknown result type (might be due to invalid IL or missing references)
			//IL_005c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0071: Unknown result type (might be due to invalid IL or missing references)
			//IL_0086: Unknown result type (might be due to invalid IL or missing references)
			//IL_00aa: Unknown result type (might be due to invalid IL or missing references)
			//IL_0103: Unknown result type (might be due to invalid IL or missing references)
			//IL_0119: Unknown result type (might be due to invalid IL or missing references)
			//IL_0128: Unknown result type (might be due to invalid IL or missing references)
			//IL_0137: Unknown result type (might be due to invalid IL or missing references)
			//IL_0146: Unknown result type (might be due to invalid IL or missing references)
			//IL_017e: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b6: 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_01d4: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e3: Unknown result type (might be due to invalid IL or missing references)
			//IL_0214: Unknown result type (might be due to invalid IL or missing references)
			//IL_0251: Unknown result type (might be due to invalid IL or missing references)
			//IL_0260: Unknown result type (might be due to invalid IL or missing references)
			//IL_026f: Unknown result type (might be due to invalid IL or missing references)
			//IL_027e: 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_00ee: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = UiFactory.CreateCard($"ConditionalCard_{index:00}", _panel.transform);
			RectTransform component = val.GetComponent<RectTransform>();
			component.anchorMin = new Vector2(0f, 1f);
			component.anchorMax = new Vector2(0f, 1f);
			component.pivot = new Vector2(0f, 1f);
			component.sizeDelta = new Vector2(350f, 42f);
			component.anchoredPosition = new Vector2(0f, (float)(-index * 48));
			((Graphic)val.GetComponent<Image>()).color = new Color(0f, 0f, 0f, 0.08f);
			Outline component2 = val.GetComponent<Outline>();
			if ((Object)(object)component2 != (Object)null)
			{
				((Shadow)component2).effectColor = new Color(0.7f, 0.9f, 0.82f, 0.08f);
				((Shadow)component2).effectDistance = new Vector2(1f, -1f);
			}
			Image val2 = UiFactory.CreateImage("Rarity", val.transform, UiFactory.MutedTextColor);
			UiFactory.SetRect((Component)(object)val2, new Vector2(0f, 0f), new Vector2(0f, 1f), new Vector2(2f, -8f), new Vector2(6f, 0f));
			((Graphic)val2).raycastTarget = false;
			Text val3 = UiFactory.CreateText("Title", val.transform, string.Empty, 13, (TextAnchor)3, new Color(0.9f, 0.97f, 0.92f, 0.94f));
			val3.resizeTextForBestFit = true;
			val3.resizeTextMinSize = 9;
			val3.resizeTextMaxSize = 13;
			AddReadableTextEffect(val3, 0.82f);
			UiFactory.SetRect((Component)(object)val3, new Vector2(0f, 1f), new Vector2(1f, 1f), new Vector2(-28f, 21f), new Vector2(18f, -13f));
			Text val4 = UiFactory.CreateText("Status", val.transform, string.Empty, 11, (TextAnchor)3, new Color(0.62f, 0.88f, 0.8f, 0.88f));
			val4.resizeTextForBestFit = true;
			val4.resizeTextMinSize = 8;
			val4.resizeTextMaxSize = 11;
			AddReadableTextEffect(val4, 0.72f);
			UiFactory.SetRect((Component)(object)val4, new Vector2(0f, 0f), new Vector2(1f, 0f), new Vector2(-28f, 19f), new Vector2(18f, 9f));
			val.SetActive(false);
			return new RowView(val, val2, val3, val4);
		}

		private static void BindStatic(RowView row, RogueCard card, int index)
		{
			//IL_0016: 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_002b: 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)
			row.Root.GetComponent<RectTransform>().anchoredPosition = new Vector2(0f, (float)(-index * 48));
			Color color = RogueUiAssetLibrary.RarityPrimaryColor(card.Rarity);
			color.a = 0.72f;
			((Graphic)row.Rarity).color = color;
			row.Title.text = card.DisplayName();
			row.Status.text = BuildStatusText(card, Time.time);
		}

		private static void AddReadableTextEffect(Text text, float alpha)
		{
			//IL_001c: 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)
			Shadow obj = ((Component)text).gameObject.AddComponent<Shadow>();
			obj.effectColor = new Color(0f, 0f, 0f, alpha);
			obj.effectDistance = new Vector2(1.5f, -1.5f);
		}

		private static string BuildStatusText(RogueCard card, float now)
		{
			return card.PersistentID switch
			{
				100301 => RogueLocalization.ConditionalCardStatus(card.PersistentID, now), 
				100306 => RogueLocalization.ConditionalCardStatus(card.PersistentID, now), 
				100310 => RogueGameplayRuntime.GetSoulSiphonStatusText(), 
				100313 => RogueLocalization.ConditionalCardStatus(card.PersistentID, now), 
				100314 => RogueLocalization.ConditionalCardStatus(card.PersistentID, now), 
				100315 => RogueLocalization.ConditionalCardStatus(card.PersistentID, now), 
				100316 => RogueGameplayRuntime.GetStressResponseStatusText(now), 
				100318 => RogueLocalization.ConditionalCardStatus(card.PersistentID, now), 
				100320 => RogueGameplayRuntime.GetChronicTherapyStatusText(now), 
				100322 => RogueGameplayRuntime.GetEtherealizationStatusText(now), 
				100324 => RogueGameplayRuntime.GetPenetrationProtocolStatusText(), 
				_ => RogueLocalization.ConditionalCardStatus(card.PersistentID, now), 
			};
		}
	}
	public sealed class CorruptionIntroPanel
	{
		private readonly GameObject _panel;

		private readonly Text _title;

		private readonly Text _body;

		private readonly Text _footer;

		private bool _isVisible;

		private float _hideAt = -1f;

		public CorruptionIntroPanel(Transform parent)
		{
			//IL_0022: 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_0040: Unknown result type (might be due to invalid IL or missing references)
			//IL_004f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0081: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00af: Unknown result type (might be due to invalid IL or missing references)
			//IL_00be: 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_00e7: 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)
			//IL_010a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0119: Unknown result type (might be due to invalid IL or missing references)
			//IL_0128: Unknown result type (might be due to invalid IL or missing references)
			//IL_014b: 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_019f: 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_01bd: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ea: Unknown result type (might be due to invalid IL or missing references)
			//IL_0209: Unknown result type (might be due to invalid IL or missing references)
			//IL_0218: Unknown result type (might be due to invalid IL or missing references)
			//IL_0227: Unknown result type (might be due to invalid IL or missing references)
			//IL_0236: Unknown result type (might be due to invalid IL or missing references)
			_panel = UiFactory.CreatePanel("CorruptionIntroPanel", parent, new Vector2(0.5f, 0.5f), new Vector2(0.5f, 0.5f), new Vector2(860f, 420f), new Vector2(0f, -40f));
			_title = UiFactory.CreateText("CorruptionTitle", _panel.transform, RogueLocalization.Pick("CORRUPTION CONFIRMED", "本局异变已确认"), 28, (TextAnchor)3, UiFactory.DangerColor);
			UiFactory.SetRect((Component)(object)_title, new Vector2(0f, 1f), new Vector2(1f, 1f), new Vector2(-80f, 42f), new Vector2(42f, -42f));
			UiFactory.SetRect((Component)(object)UiFactory.CreateImage("CorruptionRule", _panel.transform, UiFactory.LineColor), new Vector2(0.5f, 1f), new Vector2(0.5f, 1f), new Vector2(780f, 2f), new Vector2(0f, -76f));
			_body = UiFactory.CreateText("CorruptionBody", _panel.transform, string.Empty, 18, (TextAnchor)0, UiFactory.TextColor);
			_body.resizeTextForBestFit = true;
			_body.resizeTextMinSize = 13;
			_body.resizeTextMaxSize = 18;
			UiFactory.SetRect((Component)(object)_body, new Vector2(0f, 1f), new Vector2(1f, 1f), new Vector2(-84f, 260f), new Vector2(42f, -220f));
			_footer = UiFactory.CreateText("CorruptionFooter", _panel.transform, RogueLocalization.Pick("Synced to expedition chat log", "已同步至本局聊天记录"), 14, (TextAnchor)5, UiFactory.MutedTextColor);
			UiFactory.SetRect((Component)(object)_footer, new Vector2(0f, 0f), new Vector2(1f, 0f), new Vector2(-84f, 32f), new Vector2(42f, 34f));
			_panel.SetActive(false);
		}

		public void Show(CorruptionCard[] cards, float durationSeconds)
		{
			_body.text = ((cards.Length == 0) ? RogueLocalization.Pick("No active corruptions.", "暂无已激活异变。") : string.Join(Environment.NewLine + Environment.NewLine, cards.Select((CorruptionCard card) => "[" + card.DisplayName() + "]\n" + card.DisplayDescription())));
			_hideAt = ((durationSeconds > 0f) ? (Time.time + durationSeconds) : (-1f));
			_panel.SetActive(true);
			_isVisible = true;
		}

		public void Toggle(CorruptionCard[] cards)
		{
			if (_isVisible)
			{
				Hide();
			}
			else
			{
				Show(cards, 0f);
			}
		}

		public void Tick()
		{
			if (_isVisible && !(_hideAt < 0f) && !(Time.time < _hideAt))
			{
				Hide();
			}
		}

		private void Hide()
		{
			_panel.SetActive(false);
			_isVisible = false;
			_hideAt = -1f;
		}
	}
	public sealed class DebugOverlay
	{
		private readonly GameObject _panel;

		private readonly Text _text;

		private RogueState? _state;

		private bool _visible;

		private float _nextUpdateAt;

		private int _lastVersion = -1;

		public DebugOverlay(Transform parent, bool enabled)
		{
			//IL_001e: 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_003c: Unknown result type (might be due to invalid IL or missing references)
			//IL_004b: 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_007e: Unknown result type (might be due to invalid IL or missing references)
			//IL_008d: Unknown result type (might be due to invalid IL or missing references)
			//IL_009c: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ab: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ce: Unknown result type (might be due to invalid IL or missing references)
			_panel = UiFactory.CreatePanel("DebugOverlay", parent, new Vector2(0f, 1f), new Vector2(0f, 1f), new Vector2(360f, 112f), new Vector2(218f, -78f));
			UiFactory.SetRect((Component)(object)UiFactory.CreateImage("DebugAccent", _panel.transform, UiFactory.DangerColor), new Vector2(0f, 1f), new Vector2(1f, 1f), new Vector2(0f, 2f), new Vector2(0f, -1f));
			_text = UiFactory.CreateText("DebugText", _panel.transform, string.Empty, 13, (TextAnchor)0, UiFactory.TextColor);
			UiFactory.Stretch((Component)(object)_text, 14f, 8f, 12f, 8f);
			_visible = enabled;
			_panel.SetActive(enabled);
		}

		public void Refresh(RogueState state)
		{
			_state = state;
			Tick();
		}

		public void Tick()
		{
			if (_visible && _state != null && (_state.Version != _lastVersion || !(Time.unscaledTime < _nextUpdateAt)))
			{
				_lastVersion = _state.Version;
				_nextUpdateAt = Time.unscaledTime + 0.5f;
				_text.text = RogueLocalization.DebugOverlayStatus(_state.Seed, _state.Version, _state.SelectedCards.Count);
			}
		}

		public void SetVisible(bool visible)
		{
			_visible = visible;
			_panel.SetActive(visible);
		}
	}
	public sealed class MapCardStrip
	{
		private sealed class CardView
		{
			public GameObject Root { get; }

			public Image Background { get; }

			public Image Rarity { get; }

			public Text Name { get; }

			public Text Tag { get; }

			public CardView(GameObject root, Image background, Image rarity, Text name, Text tag)
			{
				Root = root;
				Background = background;
				Rarity = rarity;
				Name = name;
				Tag = tag;
			}
		}

		private const int MaxVisibleCards = 8;

		private readonly GameObject _panel;

		private readonly Text _title;

		private readonly List<CardView> _views = new List<CardView>();

		private int _lastVersion = -1;

		private bool _mapVisible;

		private bool _hasActiveCards;

		public int CardViewCount => _views.Count;

		public MapCardStrip(Transform parent)
		{
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_0038: Unknown result type (might be due to invalid IL or missing references)
			//IL_0047: Unknown result type (might be due to invalid IL or missing references)
			//IL_0056: Unknown result type (might be due to invalid IL or missing references)
			//IL_0084: Unknown result type (might be due to invalid IL or missing references)
			//IL_009e: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00df: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f9: Unknown result type (might be due to invalid IL or missing references)
			//IL_010d: Unknown result type (might be due to invalid IL or missing references)
			//IL_011c: 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_013a: Unknown result type (might be due to invalid IL or missing references)
			//IL_015e: Unknown result type (might be due to invalid IL or missing references)
			//IL_017d: 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_019b: Unknown result type (might be due to invalid IL or missing references)
			//IL_01aa: Unknown result type (might be due to invalid IL or missing references)
			_panel = UiFactory.CreatePanel("KRP.MapCardStrip", parent, new Vector2(0.5f, 1f), new Vector2(0.5f, 1f), new Vector2(940f, 124f), new Vector2(0f, -78f));
			((Graphic)_panel.GetComponent<Image>()).color = new Color(0f, 0f, 0f, 0.58f);
			UiFactory.SetRect((Component)(object)UiFactory.CreateImage("TopRedRule", _panel.transform, UiFactory.DangerColor), new Vector2(0f, 1f), new Vector2(1f, 1f), new Vector2(0f, 2f), new Vector2(0f, -2f));
			UiFactory.SetRect((Component)(object)UiFactory.CreateImage("Accent", _panel.transform, UiFactory.AccentColor), new Vector2(0f, 1f), new Vector2(0f, 1f), new Vector2(4f, 30f), new Vector2(18f, -42f));
			_title = UiFactory.CreateText("Title", _panel.transform, RogueLocalization.ActiveCardsStatus(0), 18, (TextAnchor)4, UiFactory.MutedTextColor);
			UiFactory.SetRect((Component)(object)_title, new Vector2(0f, 1f), new Vector2(1f, 1f), new Vector2(-72f, 34f), new Vector2(48f, -31f));
			for (int i = 0; i < 8; i++)
			{
				_views.Add(CreateCardView(i));
			}
			_panel.SetActive(false);
		}

		public void Refresh(RogueState state)
		{
			//IL_0091: Unknown result type (might be due to invalid IL or missing references)
			//IL_008a: Unknown result type (might be due to invalid IL or missing references)
			if (_lastVersion == state.Version)
			{
				return;
			}
			_lastVersion = state.Version;
			RogueCard[] array = state.SelectedCards.Take(8).ToArray();
			_hasActiveCards = state.SelectedCards.Count > 0;
			if (!_hasActiveCards)
			{
				_mapVisible = false;
				_panel.SetActive(false);
			}
			_title.text = RogueLocalization.ActiveCardsStatus(state.SelectedCards.Count);
			((Graphic)_title).color = ((state.SelectedCards.Count == 0) ? UiFactory.MutedTextColor : UiFactory.TextColor);
			for (int i = 0; i < _views.Count; i++)
			{
				bool flag = i < array.Length;
				_views[i].Root.SetActive(flag);
				if (flag)
				{
					Bind(_views[i], array[i]);
				}
			}
		}

		public void Tick()
		{
			bool flag = _hasActiveCards && RogueMapUiState.IsMapOpen;
			if (flag != _mapVisible)
			{
				_mapVisible = flag;
				_panel.SetActive(flag);
			}
		}

		private CardView CreateCardView(int index)
		{
			//IL_0032: Unknown result type (might be due to invalid IL or missing references)
			//IL_0047: Unknown result type (might be due to invalid IL or missing references)
			//IL_005c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0073: 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_00ac: 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_010b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0121: Unknown result type (might be due to invalid IL or missing references)
			//IL_0130: 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_0172: Unknown result type (might be due to invalid IL or missing references)
			//IL_019e: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ad: Unknown result type (might be due to invalid IL or missing references)
			//IL_01bc: Unknown result type (might be due to invalid IL or missing references)
			//IL_01cb: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e8: Unknown result type (might be due to invalid IL or missing references)
			//IL_0219: Unknown result type (might be due to invalid IL or missing references)
			//IL_0228: Unknown result type (might be due to invalid IL or missing references)
			//IL_0237: Unknown result type (might be due to invalid IL or missing references)
			//IL_0246: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = UiFactory.CreateCard($"MapCard_{index:00}", _panel.transform);
			RectTransform component = val.GetComponent<RectTransform>();
			component.anchorMin = new Vector2(0f, 0f);
			component.anchorMax = new Vector2(0f, 0f);
			component.sizeDelta = new Vector2(104f, 52f);
			component.anchoredPosition = new Vector2((float)(48 + index * 110), 16f);
			((Graphic)val.GetComponent<Image>()).color = new Color(0.02f, 0.028f, 0.026f, 0.78f);
			Image val2 = UiFactory.CreateImage("CardImage", val.transform, Color.white);
			UiFactory.SetRect((Component)(object)val2, new Vector2(0f, 0.5f), new Vector2(0f, 0.5f), new Vector2(33f, 44f), new Vector2(20f, 0f));
			((Graphic)val2).raycastTarget = false;
			Image val3 = UiFactory.CreateImage("Rarity", val.transform, UiFactory.MutedTextColor);
			UiFactory.SetRect((Component)(object)val3, new Vector2(0f, 1f), new Vector2(1f, 1f), new Vector2(0f, 3f), new Vector2(0f, -1f));
			((Graphic)val3).raycastTarget = false;
			Text val4 = UiFactory.CreateText("Name", val.transform, string.Empty, 11, (TextAnchor)3, UiFactory.TextColor);
			val4.resizeTextForBestFit = true;
			val4.resizeTextMinSize = 8;
			val4.resizeTextMaxSize = 11;
			UiFactory.SetRect((Component)(object)val4, new Vector2(0f, 0.5f), new Vector2(1f, 0.5f), new Vector2(-48f, 30f), new Vector2(46f, 6f));
			Text val5 = UiFactory.CreateText("Tag", val.transform, string.Empty, 9, (TextAnchor)3, UiFactory.MutedTextColor);
			val5.resizeTextForBestFit = true;
			val5.resizeTextMinSize = 7;
			val5.resizeTextMaxSize = 9;
			UiFactory.SetRect((Component)(object)val5, new Vector2(0f, 0.5f), new Vector2(1f, 0.5f), new Vector2(-48f, 18f), new Vector2(46f, -15f));
			val.SetActive(false);
			return new CardView(val, val2, val3, val4, val5);
		}

		private static void Bind(CardView view, RogueCard card)
		{
			//IL_0017: 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)
			view.Background.sprite = RogueUiAssetLibrary.GetCardBackground(card);
			((Graphic)view.Background).color = Color.white;
			((Graphic)view.Rarity).color = RogueUiAssetLibrary.RarityPrimaryColor(card.Rarity);
			view.Name.text = card.DisplayName();
			view.Tag.text = ((card.Tags.Count == 0) ? RogueLocalization.DisplayRarity(card.Rarity) : card.DisplayCompactTags(2));
		}
	}
	public sealed class RewardChoicePanel
	{
		private const float ReferenceCardWidth = 768f;

		private const float ReferenceCardHeight = 1024f;

		private const float CardAspect = 0.75f;

		private const float GapRatio = 0.32f;

		private readonly GameObject _panel;

		private readonly RectTransform _panelRect;

		private readonly GameObject[] _cards = (GameObject[])(object)new GameObject[3];

		private readonly RectTransform[] _cardRects = (RectTransform[])(object)new RectTransform[3];

		private readonly RectTransform[] _contentRoots = (RectTransform[])(object)new RectTransform[3];

		private readonly Button[] _buttons = (Button[])(object)new Button[3];

		private readonly Image[] _cardBodies = (Image[])(object)new Image[3];

		private readonly Image[] _outerBorders = (Image[])(object)new Image[3];

		private readonly Image[] _innerBorders = (Image[])(object)new Image[3];

		private readonly Image[] _backgroundArts = (Image[])(object)new Image[3];

		private readonly Image[] _glows = (Image[])(object)new Image[3];

		private readonly Image[] _accentBars = (Image[])(object)new Image[3];

		private readonly Image[] _rarityBaseImages = (Image[])(object)new Image[3];

		private readonly Image[] _rarityGlowImages = (Image[])(object)new Image[3];

		private readonly Image[] _rarityAccentImages = (Image[])(object)new Image[3];

		private readonly Image[] _scanLines = (Image[])(object)new Image[3];

		private readonly RectTransform[] _scanRects = (RectTransform[])(object)new RectTransform[3];

		private readonly TextMeshProUGUI[] _keyTexts = (TextMeshProUGUI[])(object)new TextMeshProUGUI[3];

		private readonly TextMeshProUGUI[] _titleTexts = (TextMeshProUGUI[])(object)new TextMeshProUGUI[3];

		private readonly TextMeshProUGUI[] _descriptionTexts = (TextMeshProUGUI[])(object)new TextMeshProUGUI[3];

		private readonly TextMeshProUGUI[] _tagTexts = (TextMeshProUGUI[])(object)new TextMeshProUGUI[3];

		private readonly TextMeshProUGUI[] _footerTexts = (TextMeshProUGUI[])(object)new TextMeshProUGUI[3];

		private readonly GameObject[][] _debugRects = new GameObject[3][];

		private readonly Text _protocolStatsText;

		private readonly Text _centerStatusText;

		private readonly Text _mainTitle;

		private readonly Text _glitchTitle;

		private readonly Text _bottomPromptText;

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

		private Action<RogueCard>? _onSelected;

		private Func<RogueCard[]>? _onReroll;

		private bool _isVisible;

		private bool _rerollAvailable;

		private int _hoverIndex = 1;

		private float _nextGlitchAt;

		private float _glitchUntil;

		private int _selectedIndex = -1;

		private bool _layoutDebugVisible;

		private bool _layoutDirty = true;

		private float _lastLayoutWidth = -1f;

		private float _lastLayoutHeight = -1f;

		public bool IsVisible => _isVisible;

		public int CardViewCount => _cards.Length;

		public RewardChoicePanel(Transform parent)
		{
			//IL_013f: 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_014e: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ba: Unknown result type (might be due to invalid IL or missing references)
			//IL_01bf: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c4: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d3: Unknown result type (might be due to invalid IL or missing references)
			_panel = UiFactory.CreateRect("RewardChoicePanel.VersionA", parent, Vector2.zero, Vector2.one, Vector2.zero, Vector2.zero);
			_panelRect = _panel.GetComponent<RectTransform>();
			CreateBackground();
			CreateTopStatusBar(out _protocolStatsText, out _centerStatusText);
			CreateHeader(out _mainTitle, out _glitchTitle);
			CreateSideDecor();
			CreateBottomPrompt(out _bottomPromptText);
			GameObject val = UiFactory.CreateRect("RewardCardsRow", _panel.transform, Vector2.zero, Vector2.one, Vector2.zero, new Vector2(0f, -36f));
			for (int i = 0; i < 3; i++)
			{
				CreateCard(val.transform, i);
			}
			_panel.SetActive(false);
			_isVisible = false;
			_nextGlitchAt = Time.time + 4f;
		}

		public void RefreshState(RogueState state)
		{
			_protocolStatsText.text = RogueLocalization.Format("KAIN ROGUE PROTOCOL\nSEED {0}\nVERSION {1}\nCARDS {2}", "KAIN ROGUE PROTOCOL\n种子 {0}\n版本 {1}\n卡牌 {2}", state.Seed, state.Version, state.SelectedCards.Count);
			_centerStatusText.text = RogueLocalization.ActiveCardsStatus(state.SelectedCards.Count);
		}

		public void Show(RogueCard[] cards, Action<RogueCard> onSelected, Func<RogueCard[]>? onReroll = null, bool canReroll = false)
		{
			//IL_0085: 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_00b1: 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)
			_activeCards = cards;
			_onSelected = onSelected;
			_onReroll = onReroll;
			_rerollAvailable = canReroll && onReroll != null;
			_hoverIndex = ((cards.Length > 1) ? 1 : 0);
			_selectedIndex = -1;
			_layoutDirty = true;
			_panel.SetActive(true);
			_isVisible = true;
			LayoutRewardCards();
			for (int i = 0; i < _cards.Length; i++)
			{
				bool flag = i < cards.Length;
				_cards[i].SetActive(flag);
				if (flag)
				{
					RogueCard rogueCard = cards[i];
					RogueUiAssetLibrary.RarityPrimaryColor(rogueCard.Rarity);
					Sprite cardBackground = RogueUiAssetLibrary.GetCardBackground(rogueCard);
					_backgroundArts[i].sprite = cardBackground;
					((Graphic)_backgroundArts[i]).color = (Color)(((Object)(object)cardBackground == (Object)null) ? new Color(0.018f, 0.026f, 0.024f, 0.94f) : Color.white);
					RogueUiAssetLibrary.SetRarityModuleSprites(_rarityBaseImages[i], _rarityGlowImages[i], _rarityAccentImages[i], rogueCard.Rarity);
					((Graphic)_accentBars[i]).color = new Color(0f, 0f, 0f, 0f);
					((TMP_Text)_keyTexts[i]).text = $"[{i + 1}]";
					((TMP_Text)_titleTexts[i]).text = rogueCard.DisplayName();
					((TMP_Text)_descriptionTexts[i]).text = rogueCard.DisplayDescription();
					((TMP_Text)_tagTexts[i]).text = rogueCard.DisplayTags(4);
					((TMP_Text)_footerTexts[i]).text = RogueLocalization.RewardFooterPrompt(i + 1);
					SetCardVisual(i, i == _hoverIndex, selected: false);
				}
			}
			_bottomPromptText.text = RogueLocalization.RewardBottomPrompt(_rerollAvailable);
			_panel.SetActive(true);
			_isVisible = true;
		}

		public void Tick()
		{
			if (_isVisible)
			{
				if (Input.GetKeyDown((KeyCode)49) || Input.GetKeyDown((KeyCode)257))
				{
					Select(0);
				}
				else if (Input.GetKeyDown((KeyCode)50) || Input.GetKeyDown((KeyCode)258))
				{
					Select(1);
				}
				else if (Input.GetKeyDown((KeyCode)51) || Input.GetKeyDown((KeyCode)259))
				{
					Select(2);
				}
				else if (Input.GetKeyDown((KeyCode)27))
				{
					_bottomPromptText.text = RogueLocalization.RewardSelectionRequired();
				}
				else if (Input.GetKeyDown((KeyCode)114))
				{
					Reroll();
				}
				else if (Input.GetKeyDown((KeyCode)291))
				{
					SetLayoutDebugVisible(!_layoutDebugVisible);
				}
				LayoutRewardCards();
				TickCards();
				TickGlitchTitle();
			}
		}

		private void CreateBackground()
		{
			//IL_0024: 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_00a8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d2: Unknown result type (might be due to invalid IL or missing references)
			//IL_011e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0132: Unknown result type (might be due to invalid IL or missing references)
			//IL_0141: 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)
			//IL_016d: 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_01bb: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ca: 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_01e8: Unknown result type (might be due to invalid IL or missing references)
			//IL_0216: 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_0239: Unknown result type (might be due to invalid IL or missing references)
			//IL_0248: Unknown result type (might be due to invalid IL or missing references)
			//IL_0257: Unknown result type (might be due to invalid IL or missing references)
			UiFactory.Stretch((Component)(object)UiFactory.CreateImage("DimmerFullScreen", _panel.transform, new Color(0f, 0.006f, 0.007f, 0.82f)), 0f, 0f, 0f, 0f);
			for (int i = 0; i < 28; i++)
			{
				int num = -520 + i * 40;
				UiFactory.SetRect((Component)(object)UiFactory.CreateImage($"HorizontalScanline_{i:00}", _panel.transform, new Color(0.58f, 0.9f, 0.86f, (i % 3 == 0) ? 0.045f : 0.018f)), new Vector2(0f, 0.5f), new Vector2(1f, 0.5f), new Vector2(0f, 1f), new Vector2(0f, (float)num));
			}
			for (int j = 0; j < 9; j++)
			{
				UiFactory.SetRect((Component)(object)UiFactory.CreateImage($"RedWarningMark_{j:00}", _panel.transform, new Color(0.9f, 0.03f, 0.02f, 0.24f)), new Vector2(0f, 1f), new Vector2(0f, 1f), new Vector2((float)(120 + j * 11), 3f), new Vector2((float)(110 + j * 175), (float)(-94 - j % 3 * 22)));
			}
			UiFactory.SetRect((Component)(object)UiFactory.CreateImage("BottomVignette", _panel.transform, new Color(0f, 0f, 0f, 0.44f)), new Vector2(0f, 0f), new Vector2(1f, 0f), new Vector2(0f, 170f), new Vector2(0f, 74f));
			UiFactory.SetRect((Component)(object)UiFactory.CreateImage("TopVignette", _panel.transform, new Color(0f, 0f, 0f, 0.35f)), new Vector2(0f, 1f), new Vector2(1f, 1f), new Vector2(0f, 160f), new Vector2(0f, -80f));
		}

		private void CreateTopStatusBar(out Text protocolStatsText, out Text centerStatusText)
		{
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_0038: Unknown result type (might be due to invalid IL or missing references)
			//IL_0047: Unknown result type (might be due to invalid IL or missing references)
			//IL_006c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0095: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d6: 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_0142: Unknown result type (might be due to invalid IL or missing references)
			//IL_0151: Unknown result type (might be due to invalid IL or missing references)
			//IL_0160: Unknown result type (might be due to invalid IL or missing references)
			//IL_016f: Unknown result type (might be due to invalid IL or missing references)
			//IL_018e: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b4: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c3: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d2: 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_020d: Unknown result type (might be due to invalid IL or missing references)
			//IL_021c: Unknown result type (might be due to invalid IL or missing references)
			//IL_022b: 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_0263: Unknown result type (might be due to invalid IL or missing references)
			//IL_0277: Unknown result type (might be due to invalid IL or missing references)
			//IL_0286: 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)
			//IL_02a4: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = UiFactory.CreatePanel("TopStatusBar", _panel.transform, new Vector2(0f, 1f), new Vector2(1f, 1f), new Vector2(0f, 100f), new Vector2(0f, -50f));
			((Graphic)val.GetComponent<Image>()).color = new Color(0f, 0f, 0f, 0.72f);
			UiFactory.SetRect((Component)(object)UiFactory.CreateImage("TopRedRule", val.transform, new Color(0.93f, 0.03f, 0.02f, 0.82f)), new Vector2(0f, 1f), new Vector2(1f, 1f), new Vector2(0f, 2f), new Vector2(0f, -8f));
			protocolStatsText = UiFactory.CreateText("ProtocolStats", val.transform, RogueLocalization.Format("KAIN ROGUE PROTOCOL\nSEED {0}\nVERSION {1}\nCARDS {2}", "KAIN ROGUE PROTOCOL\n种子 {0}\n版本 {1}\n卡牌 {2}", 0, 0, 0), 13, (TextAnchor)0, Color.white);
			protocolStatsText.lineSpacing = 0.9f;
			UiFactory.SetRect((Component)(object)protocolStatsText, new Vector2(0f, 0.5f), new Vector2(0f, 0.5f), new Vector2(330f, 72f), new Vector2(198f, -8f));
			centerStatusText = UiFactory.CreateText("CenterStatusText", val.transform, RogueLocalization.ActiveCardsStatus(0), 18, (TextAnchor)4, UiFactory.MutedTextColor);
			UiFactory.SetRect((Component)(object)centerStatusText, new Vector2(0.5f, 0.5f), new Vector2(0.5f, 0.5f), new Vector2(640f, 38f), new Vector2(0f, -4f));
			UiFactory.SetRect((Component)(object)UiFactory.CreateText("ExitTerminal", val.transform, RogueLocalization.Pick("EXIT", "退出"), 23, (TextAnchor)4, Color.white), new Vector2(1f, 0.5f), new Vector2(1f, 0.5f), new Vector2(170f, 42f), new Vector2(-118f, -2f));
			UiFactory.SetRect((Component)(object)UiFactory.CreateImage("ExitFrame", val.transform, new Color(1f, 1f, 1f, 0.12f)), new Vector2(1f, 0.5f), new Vector2(1f, 0.5f), new Vector2(180f, 2f), new Vector2(-118f, -29f));
		}

		private void CreateHeader(out Text mainTitle, out Text glitchTitle)
		{
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			//IL_0038: Unknown result type (might be due to invalid IL or missing references)
			//IL_0047: Unknown result type (might be due to invalid IL or missing references)
			//IL_0056: 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)
			//IL_009c: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ca: 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_00e8: Unknown result type (might be due to invalid IL or missing references)
			//IL_0114: Unknown result type (might be due to invalid IL or missing references)
			//IL_0128: Unknown result type (might be due to invalid IL or missing references)
			//IL_0137: Unknown result type (might be due to invalid IL or missing references)
			//IL_0146: Unknown result type (might be due to invalid IL or missing references)
			//IL_0155: Unknown result type (might be due to invalid IL or missing references)
			//IL_0181: Unknown result type (might be due to invalid IL or missing references)
			//IL_0195: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a4: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b3: 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_01dc: 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_0237: Unknown result type (might be due to invalid IL or missing references)
			//IL_024b: 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_0269: Unknown result type (might be due to invalid IL or missing references)
			//IL_0278: Unknown result type (might be due to invalid IL or missing references)
			mainTitle = UiFactory.CreateText("MainTitle", _panel.transform, "<color=#8FDCFF>Kain</color> ROGUE PROTOCOL", 34, (TextAnchor)4, UiFactory.AccentColor);
			mainTitle.fontStyle = (FontStyle)1;
			UiFactory.SetRect((Component)(object)mainTitle, new Vector2(0.5f, 1f), new Vector2(0.5f, 1f), new Vector2(740f, 48f), new Vector2(0f, -175f));
			glitchTitle = UiFactory.CreateText("MainTitleGlitchRed", _panel.transform, "<color=#8FDCFF>Kain</color> ROGUE PROTOCOL", 34, (TextAnchor)4, new Color(0.9f, 0.04f, 0.02f, 0f));
			glitchTitle.fontStyle = (FontStyle)1;
			UiFactory.SetRect((Component)(object)glitchTitle, new Vector2(0.5f, 1f), new Vector2(0.5f, 1f), new Vector2(740f, 48f), new Vector2(0f, -175f));
			UiFactory.SetRect((Component)(object)UiFactory.CreateText("SubtitleCN", _panel.transform, RogueLocalization.Pick("MULTI-THREAD INTRUSION PROTOCOL · CARD REWARD SELECTION", "多线程入侵协议 · 卡牌奖励选择"), 16, (TextAnchor)4, UiFactory.TextColor), new Vector2(0.5f, 1f), new Vector2(0.5f, 1f), new Vector2(680f, 24f), new Vector2(0f, -214f));
			UiFactory.SetRect((Component)(object)UiFactory.CreateText("SubtitleEN", _panel.transform, RogueLocalization.Pick("SELECT ONE REWARD TO ADD TO YOUR PROTOCOL", "选择一项奖励加入你的协议"), 13, (TextAnchor)4, UiFactory.MutedTextColor), new Vector2(0.5f, 1f), new Vector2(0.5f, 1f), new Vector2(680f, 22f), new Vector2(0f, -238f));
			UiFactory.SetRect((Component)(object)UiFactory.CreateImage("HeaderRuleLeft", _panel.transform, UiFactory.LineColor), new Vector2(0.5f, 1f), new Vector2(0.5f, 1f), new Vector2(380f, 1f), new Vector2(-530f, -220f));
			UiFactory.SetRect((Component)(object)UiFactory.CreateImage("HeaderRuleRight", _panel.transform, UiFactory.LineColor), new Vector2(0.5f, 1f), new Vector2(0.5f, 1f), new Vector2(380f, 1f), new Vector2(530f, -220f));
		}

		private void CreateSideDecor()
		{
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_0038: Unknown result type (might be due to invalid IL or missing references)
			//IL_0047: Unknown result type (might be due to invalid IL or missing references)
			//IL_006c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0093: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cc: 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_00fe: Unknown result type (might be due to invalid IL or missing references)
			//IL_010d: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = UiFactory.CreatePanel("SideMenuLeft", _panel.transform, new Vector2(0f, 0.5f), new Vector2(0f, 0.5f), new Vector2(210f, 420f), new Vector2(124f, -78f));
			((Graphic)val.GetComponent<Image>()).color = new Color(0f, 0f, 0f, 0.34f);
			Text obj = UiFactory.CreateText("SideMenuText", val.transform, RogueLocalization.Pick("REWARD\nSELECTION\n\n01  CARD POOL\n02  ACTIVE BUFFS\n03  CORRUPTION\n04  EXIT LOCKED", "奖励\n选择\n\n01  卡池\n02  已激活增益\n03  腐化\n04  退出锁定"), 12, (TextAnchor)0, UiFactory.MutedTextColor);
			obj.lineSpacing = 1.15f;
			UiFactory.Stretch((Component)(object)obj, 22f, 20f, 18f, 20f);
			UiFactory.SetRect((Component)(object)UiFactory.CreateImage("SideMenuAccent", val.transform, UiFactory.AccentColor), new Vector2(0f, 1f), new Vector2(0f, 1f), new Vector2(3f, 82f), new Vector2(14f, -58f));
		}

		private void CreateBottomPrompt(out Text prompt)
		{
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_0038: Unknown result type (might be due to invalid IL or missing references)
			//IL_0047: Unknown result type (might be due to invalid IL or missing references)
			//IL_006c: 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)
			GameObject val = UiFactory.CreatePanel("BottomPromptBar", _panel.transform, new Vector2(0.5f, 0f), new Vector2(0.5f, 0f), new Vector2(980f, 54f), new Vector2(0f, 58f));
			((Graphic)val.GetComponent<Image>()).color = new Color(0f, 0f, 0f, 0.58f);
			prompt = UiFactory.CreateText("BottomPromptText", val.transform, RogueLocalization.Pick("Press 1-3 or click with mouse to select reward", "数字键 1-3 或鼠标点击选择奖励"), 15, (TextAnchor)4, UiFactory.TextColor);
			UiFactory.Stretch((Component)(object)prompt, 24f, 6f, 24f, 6f);
		}

		private void CreateCard(Transform parent, int index)
		{
			//IL_0054: Unknown result type (might be due to invalid IL or missing references)
			//IL_0063: Unknown result type (might be due to invalid IL or missing references)
			//IL_0072: Unknown result type (might be due to invalid IL or missing references)
			//IL_0077: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e8: Unknown result type (might be due to invalid IL or missing references)
			//IL_015e: Unknown result type (might be due to invalid IL or missing references)
			//IL_01aa: 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_01b4: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b9: 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_0258: Unknown result type (might be due to invalid IL or missing references)
			//IL_0275: Unknown result type (might be due to invalid IL or missing references)
			//IL_0284: Unknown result type (might be due to invalid IL or missing references)
			//IL_0293: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a2: Unknown result type (might be due to invalid IL or missing references)
			//IL_02d9: 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_034f: Unknown result type (might be due to invalid IL or missing references)
			//IL_035e: Unknown result type (might be due to invalid IL or missing references)
			//IL_036d: Unknown result type (might be due to invalid IL or missing references)
			//IL_037c: 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_039b: Unknown result type (might be due to invalid IL or missing references)
			//IL_03a0: Unknown result type (might be due to invalid IL or missing references)
			//IL_03c4: Unknown result type (might be due to invalid IL or missing references)
			//IL_0492: Unknown result type (might be due to invalid IL or missing references)
			//IL_04e4: Unknown result type (might be due to invalid IL or missing references)
			//IL_050f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0561: Unknown result type (might be due to invalid IL or missing references)
			//IL_058c: Unknown result type (might be due to invalid IL or missing references)
			//IL_05e2: Unknown result type (might be due to invalid IL or missing references)
			//IL_060d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0651: Unknown result type (might be due to invalid IL or missing references)
			//IL_067f: Unknown result type (might be due to invalid IL or missing references)
			//IL_06c3: Unknown result type (might be due to invalid IL or missing references)
			//IL_0707: Unknown result type (might be due to invalid IL or missing references)
			//IL_0724: Unknown result type (might be due to invalid IL or missing references)
			//IL_0733: Unknown result type (might be due to invalid IL or missing references)
			//IL_0742: Unknown result type (might be due to invalid IL or missing references)
			//IL_0751: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ad: Unknown result type (might be due to invalid IL or missing references)
			_cards[index] = UiFactory.CreateCard($"RewardCard_{index + 1}", parent);
			_cardRects[index] = _cards[index].GetComponent<RectTransform>();
			UiFactory.SetRect((Component)(object)_cardRects[index], new Vector2(0.5f, 0.5f), new Vector2(0.5f, 0.5f), new Vector2(384f, 512f), Vector2.zero);
			Outline component = _cards[index].GetComponent<Outline>();
			if ((Object)(object)component != (Object)null)
			{
				((Shadow)component).effectColor = new Color(0f, 0f, 0f, 0f);
			}
			_cardBodies[index] = _cards[index].GetComponent<Image>();
			((Graphic)_cardBodies[index]).color = new Color(0f, 0f, 0f, 0f);
			_buttons[index] = _cards[index].AddComponent<Button>();
			int capturedIndex = index;
			((UnityEvent)_buttons[index].onClick).AddListener(UnityAction.op_Implicit((Action)delegate
			{
				Select(capturedIndex);
			}));
			AddPointerCallbacks(_cards[index], capturedIndex);
			_backgroundArts[index] = UiFactory.CreateImage("CardBackgroundArt", _cards[index].transform, Color.white);
			UiFactory.Stretch((Component)(object)_backgroundArts[index], 0f, 0f, 0f, 0f);
			((Graphic)_backgroundArts[index]).raycastTarget = false;
			GameObject val = UiFactory.CreateRect("CardContentRoot", _cards[index].transform, Vector2.zero, Vector2.one, Vector2.zero, Vector2.zero);
			_contentRoots[index] = val.GetComponent<RectTransform>();
			_glows[index] = UiFactory.CreateImage("RarityGlow", _cards[index].transform, new Color(1f, 1f, 1f, 0.08f));
			UiFactory.Stretch((Component)(object)_glows[index], -8f, -8f, -8f, -8f);
			_outerBorders[index] = UiFactory.CreateImage("CardBorderOuter", _cards[index].transform, new Color(0f, 0f, 0f, 0f));
			UiFactory.SetRect((Component)(object)_outerBorders[index], new Vector2(0f, 1f), new Vector2(1f, 1f), new Vector2(0f, 4f), new Vector2(0f, -2f));
			_innerBorders[index] = UiFactory.CreateImage("CardBorderInner", _cards[index].transform, new Color(0f, 0f, 0f, 0f));
			UiFactory.Stretch((Component)(object)_innerBorders[index], 12f, 12f, 12f, 12f);
			_accentBars[index] = UiFactory.CreateImage("RarityAccentBar", _cards[index].transform, new Color(0f, 0f, 0f, 0f));
			UiFactory.SetRect((Component)(object)_accentBars[index], new Vector2(0f, 1f), new Vector2(1f, 1f), new Vector2(0f, 5f), new Vector2(0f, -2f));
			GameObject obj = UiFactory.CreateRect("CardRarityModuleSlot", val.transform, Vector2.zero, Vector2.one, Vector2.zero, Vector2.zero);
			ApplyTopLeftNormalizedRect(obj.GetComponent<RectTransform>(), new Rect(0.088f, 0.06f, 0.15f, 0.125f));
			RogueUiAssetLibrary.BindRarityModule(obj.transform, "common", out _rarityBaseImages[index], out _rarityGlowImages[index], out _rarityAccentImages[index]);
			UiFactory.Stretch((Component)(object)_rarityBaseImages[index], 0f, 0f, 0f, 0f);
			UiFactory.Stretch((Component)(object)_rarityGlowImages[index], -8f, -8f, -8f, -8f);
			UiFactory.Stretch((Component)(object)_rarityAccentImages[index], 0f, 0f, 0f, 0f);
			_keyTexts[index] = UiFactory.CreateTmpText("KeyText", val.transform, $"[{index + 1}]", 24f, (TextAlignmentOptions)514, UiFactory.AccentColor);
			((TMP_Text)_keyTexts[index]).fontStyle = (FontStyles)1;
			ConfigureTmp(_keyTexts[index], wrap: false, 18f, 28f);
			ApplyTopLeftNormalizedRect(((TMP_Text)_keyTexts[index]).rectTransform, new Rect(0.07f, 0.855f, 0.09f, 0.045f));
			_titleTexts[index] = UiFactory.CreateTmpText("CardName", val.transform, string.Empty, 34f, (TextAlignmentOptions)514, UiFactory.TextColor);
			((TMP_Text)_titleTexts[index]).fontStyle = (FontStyles)1;
			ConfigureTmp(_titleTexts[index], wrap: false, 24f, 36f);
			ApplyTopLeftNormalizedRect(((TMP_Text)_titleTexts[index]).rectTransform, new Rect(0.225f, 0.078f, 0.68f, 0.105f));
			_descriptionTexts[index] = UiFactory.CreateTmpText("DescriptionText", val.transform, string.Empty, 20f, (TextAlignmentOptions)514, UiFactory.TextColor);
			ConfigureTmp(_descriptionTexts[index], wrap: true, 14f, 22f);
			((TMP_Text)_descriptionTexts[index]).lineSpacing = -8f;
			ApplyTopLeftNormalizedRect(((TMP_Text)_descriptionTexts[index]).rectTransform, new Rect(0.13f, 0.68f, 0.74f, 0.13f));
			_tagTexts[index] = UiFactory.CreateTmpText("TagRow", val.transform, string.Empty, 16f, (TextAlignmentOptions)514, UiFactory.MutedTextColor);
			ConfigureTmp(_tagTexts[index], wrap: false, 11f, 18f);
			ApplyTopLeftNormalizedRect(((TMP_Text)_tagTexts[index]).rectTransform, new Rect(0.17f, 0.832f, 0.66f, 0.055f));
			_footerTexts[index] = UiFactory.CreateTmpText("FooterPrompt", val.transform, RogueLocalization.RewardFooterPrompt(index + 1), 16f, (TextAlignmentOptions)514, UiFactory.MutedTextColor);
			ConfigureTmp(_footerTexts[index], wrap: false, 11f, 18f);
			ApplyTopLeftNormalizedRect(((TMP_Text)_footerTexts[index]).rectTransform, new Rect(0.245f, 0.923f, 0.51f, 0.045f));
			CreateLayoutDebugRects(index, val.transform);
			_scanLines[index] = UiFactory.CreateImage("HoverScanline", _cards[index].transform, new Color(1f, 1f, 1f, 0f));
			UiFactory.SetRect((Component)(object)_scanLines[index], new Vector2(0f, 0.5f), new Vector2(1f, 0.5f), new Vector2(-36f, 34f), new Vector2(18f, 0f));
			_scanRects[index] = ((Component)_scanLines[index]).GetComponent<RectTransform>();
		}

		private void AddPointerCallbacks(GameObject target, int index)
		{
			EventTrigger trigger = target.AddComponent<EventTrigger>();
			AddTrigger(trigger, (EventTriggerType)0, delegate
			{
				_hoverIndex = index;
			});
			AddTrigger(trigger, (EventTriggerType)1, delegate
			{
				if (_hoverIndex == index)
				{
					_hoverIndex = -1;
				}
			});
		}

		private static void AddTrigger(EventTrigger trigger, EventTriggerType type, Action<BaseEventData> callback)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_000d: Expected O, but got Unknown
			Entry val = new Entry
			{
				eventID = type
			};
			((UnityEvent<BaseEventData>)(object)val.callback).AddListener(UnityAction<BaseEventData>.op_Implicit(callback));
			trigger.triggers.Add(val);
		}

		private void TickCards()
		{
			//IL_004b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0050: Unknown result type (might be due to invalid IL or missing references)
			//IL_008e: Unknown result type (might be due to invalid IL or missing references)
			for (int i = 0; i < _activeCards.Length && i < _cards.Length; i++)
			{
				bool flag = i == _hoverIndex || _selectedIndex == i;
				SetCardVisual(i, flag, _selectedIndex == i);
				float num = (flag ? 145f : 58f);
				Rect rect = _cardRects[i].rect;
				float num2 = Mathf.Max(1f, ((Rect)(ref rect)).height);
				float num3 = Mathf.Repeat(Time.time * num + (float)i * 80f, num2) - num2 * 0.5f;
				_scanRects[i].anchoredPosition = new Vector2(18f, num3);
			}
		}

		private void TickGlitchTitle()
		{
			//IL_00a4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c3: Unknown result type (might be due to invalid IL or missing references)
			//IL_0056: Unknown result type (might be due to invalid IL or missing references)
			//IL_007f: Unknown result type (might be due to invalid IL or missing references)
			float time = Time.time;
			if (time >= _nextGlitchAt)
			{
				_glitchUntil = time + 0.12f;
				_nextGlitchAt = time + Random.Range(3.5f, 6.5f);
			}
			if (time < _glitchUntil)
			{
				((Graphic)_glitchTitle).color = new Color(0.95f, 0.03f, 0.02f, 0.45f);
				((Graphic)_glitchTitle).rectTransform.anchoredPosition = new Vector2(Random.Range(-4f, 4f), -175f);
			}
			else
			{
				((Graphic)_glitchTitle).color = new Color(0.95f, 0.03f, 0.02f, 0f);
				((Graphic)_glitchTitle).rectTransform.anchoredPosition = new Vector2(0f, -175f);
			}
		}

		private void SetCardVisual(int index, bool highlighted, bool selected)
		{
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0022: 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_0094: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a8: 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_00c2: 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)
			//IL_00d6: Unknown result type (might be due to invalid IL or missing references)
			//IL_0113: Unknown result type (might be due to invalid IL or missing references)
			//IL_012a: Unknown result type (might be due to invalid IL or missing references)
			//IL_013e: Unknown result type (might be due to invalid IL or missing references)
			if (index >= 0 && index < _activeCards.Length)
			{
				Color color = RogueUiAssetLibrary.RarityPrimaryColor(_activeCards[index].Rarity);
				Mathf.Sin(Time.time * 3.2f + (float)index);
				float num = 0f;
				float alpha = 0f;
				if (selected)
				{
					num = 0f;
					alpha = 0f;
				}
				((Graphic)_cardBodies[index]).color = new Color(0f, 0f, 0f, 0f);
				((Graphic)_accentBars[index]).color = new Color(0f, 0f, 0f, 0f);
				((Graphic)_outerBorders[index]).color = WithAlpha(color, num);
				((Graphic)_innerBorders[index]).color = WithAlpha(color, num * 0.32f);
				((Graphic)_glows[index]).color = WithAlpha(color, alpha);
				RogueUiAssetLibrary.SetRarityModuleState(_rarityGlowImages[index], _rarityAccentImages[index], highlighted, selected);
				((Graphic)_scanLines[index]).color = new Color(1f, 1f, 1f, 0f);
				_cards[index].transform.localScale = Vector3.one * (highlighted ? 1.025f : 1f);
			}
		}

		private void LayoutRewardCards()
		{
			//IL_000b: 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_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_00ff: Unknown result type (might be due to invalid IL or missing references)
			//IL_0114: Unknown result type (might be due to invalid IL or missing references)
			//IL_0129: Unknown result type (might be due to invalid IL or missing references)
			//IL_0152: Unknown result type (might be due to invalid IL or missing references)
			Rect rect = _panelRect.rect;
			float num = Mathf.Max(1280f, ((Rect)(ref rect)).width);
			rect = _panelRect.rect;
			float num2 = Mathf.Max(720f, ((Rect)(ref rect)).height);
			if (_layoutDirty || !(Mathf.Abs(num - _lastLayoutWidth) < 0.5f) || !(Mathf.Abs(num2 - _lastLayoutHeight) < 0.5f))
			{
				_layoutDirty = false;
				_lastLayoutWidth = num;
				_lastLayoutHeight = num2;
				float num3 = num * 0.86f;
				float num4 = num2 * 0.78f;
				float num5 = Mathf.Min(num3 / 3.6399999f / 0.75f, num4);
				float num6 = num5 * 0.75f;
				float num7 = num6 * 0.32f;
				float num8 = (0f - (3f * num6 + 2f * num7)) * 0.5f + num6 * 0.5f;
				float num9 = (0f - num2) * 0.075f;
				for (int i = 0; i < _cardRects.Length; i++)
				{
					RectTransform obj = _cardRects[i];
					obj.anchorMin = new Vector2(0.5f, 0.5f);
					obj.anchorMax = new Vector2(0.5f, 0.5f);
					obj.pivot = new Vector2(0.5f, 0.5f);
					obj.SetSizeWithCurrentAnchors((Axis)0, num6);
					obj.SetSizeWithCurrentAnchors((Axis)1, num5);
					obj.anchoredPosition = new Vector2(num8 + (float)i * (num6 + num7), num9);
					UpdateCardTypography(i);
				}
			}
		}

		private void UpdateCardTypography(int index)
		{
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			Rect rect = _cardRects[index].rect;
			float scale = Mathf.Max(0.25f, ((Rect)(ref rect)).height / 1024f);
			ApplyFontScale(_titleTexts[index], 34f, 24f, 36f, scale);
			ApplyFontScale(_tagTexts[index], 16f, 11f, 18f, scale);
			ApplyFontScale(_descriptionTexts[index], 20f, 14f, 22f, scale);
			ApplyFontScale(_footerTexts[index], 16f, 11f, 18f, scale);
			ApplyFontScale(_keyTexts[index], 24f, 18f, 28f, scale);
		}

		private static void ApplyFontScale(TextMeshProUGUI text, float size, float min, float max, float scale)
		{
			((TMP_Text)text).fontSize = size * scale;
			((TMP_Text)text).fontSizeMin = min * scale;
			((TMP_Text)text).fontSizeMax = max * scale;
		}

		private static void ConfigureTmp(TextMeshProUGUI text, bool wrap, float minSize, float maxSize)
		{
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			((TMP_Text)text).enableAutoSizing = true;
			((TMP_Text)text).fontSizeMin = minSize;
			((TMP_Text)text).fontSizeMax = maxSize;
			((TMP_Text)text).enableWordWrapping = wrap;
			((TMP_Text)text).overflowMode = (TextOverflowModes)1;
			((TMP_Text)text).alignment = (TextAlignmentOptions)514;
			((TMP_Text)text).margin = Vector4.zero;
		}

		private static void ApplyTopLeftNormalizedRect(RectTransform target, Rect normalized)
		{
			//IL_001d: 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_004f: 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_006f: 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_0085: Unknown result type (might be due to invalid IL or missing references)
			target.anchorMin = new Vector2(((Rect)(ref normalized)).x, 1f - ((Rect)(ref normalized)).y - ((Rect)(ref normalized)).height);
			target.anchorMax = new Vector2(((Rect)(ref normalized)).x + ((Rect)(ref normalized)).width, 1f - ((Rect)(ref normalized)).y);
			target.offsetMin = Vector2.zero;
			target.offsetMax = Vector2.zero;
			target.pivot = new Vector2(0.5f, 0.5f);
			target.anchoredPosition = Vector2.zero;
			target.sizeDelta = Vector2.zero;
		}

		private void CreateLayoutDebugRects(int index, Transform contentRoot)
		{
			//IL_0022: 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_0062: 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_00a2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e2: 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)
			//IL_0122: Unknown result type (might be due to invalid IL or missing references)
			//IL_013b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0162: Unknown result type (might be due to invalid IL or missing references)
			//IL_017b: Unknown result type (might be due to invalid IL or missing references)
			GameObject[] array = (GameObject[])(object)new GameObject[6]
			{
				CreateDebugRect("DebugRarity", contentRoot, new Rect(0.088f, 0.06f, 0.15f, 0.125f), new Color(1f, 0.62f, 0f, 0.22f)),
				CreateDebugRect("DebugTitle", contentRoot, new Rect(0.225f, 0.078f, 0.68f, 0.105f), new Color(1f, 0.05f, 0.05f, 0.2f)),
				CreateDebugRect("DebugTags", contentRoot, new Rect(0.17f, 0.832f, 0.66f, 0.055f), new Color(0.25f, 1f, 0.05f, 0.2f)),
				CreateDebugRect("DebugDescription", contentRoot, new Rect(0.13f, 0.68f, 0.74f, 0.13f), new Color(1f, 0.25f, 0.25f, 0.18f)),
				CreateDebugRect("DebugSelect", contentRoot, new Rect(0.245f, 0.923f, 0.51f, 0.045f), new Color(1f, 1f, 1f, 0.2f)),
				CreateDebugRect("DebugKey", contentRoot, new Rect(0.07f, 0.855f, 0.09f, 0.045f), new Color(1f, 1f, 1f, 0.2f))
			};
			_debugRects[index] = array;
			GameObject[] array2 = array;
			for (int i = 0; i < array2.Length; i++)
			{
				array2[i].SetActive(_layoutDebugVisible);
			}
		}

		private static GameObject CreateDebugRect(string name, Transform parent, Rect normalized, Color color)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			Image obj = UiFactory.CreateImage(name, parent, color);
			((Graphic)obj).raycastTarget = false;
			ApplyTopLeftNormalizedRect(((Graphic)obj).rectTransform, normalized);
			return ((Component)obj).gameObject;
		}

		private void SetLayoutDebugVisible(bool visible)
		{
			_layoutDebugVisible = visible;
			GameObject[][] debugRects = _debugRects;
			foreach (GameObject[] array in debugRects)
			{
				if (array != null)
				{
					GameObject[] array2 = array;
					for (int j = 0; j < array2.Length; j++)
					{
						array2[j].SetActive(visible);
					}
				}
			}
		}

		private void Select(int index)
		{
			if (index >= 0 && index < _activeCards.Length && _onSelected != null && _selectedIndex < 0)
			{
				_selectedIndex = index;
				RogueCard obj = _activeCards[index];
				_panel.SetActive(false);
				_isVisible = false;
				_onSelected(obj);
			}
		}

		private void Reroll()
		{
			if (!_rerollAvailable || _onReroll == null || _onSelected == null || _selectedIndex >= 0)
			{
				_bottomPromptText.text = RogueLocalization.RerollUnavailable();
				return;
			}
			RogueCard[] array = _onReroll();
			if (array.Length == 0)
			{
				_bottomPromptText.text = RogueLocalization.RerollFailed();
				return;
			}
			Action<RogueCard> onSelected = _onSelected;
			_rerollAvailable = false;
			Show(array, onSelected);
			_bottomPromptText.text = RogueLocalization.RerollUsed();
			RogueLogger.Info("Reward panel rerolled current choices.");
		}

		private static Color WithAlpha(Color color, float alpha)
		{
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			color.a = alpha;
			return color;
		}

		private static string DisplayRarity(string rarity)
		{
			return RogueLocalization.DisplayRarity(rarity);
		}
	}
	public sealed class RewardOpportunityPrompt
	{
		private readonly GameObject _panel;

		private readonly Text _text;

		private int _availableChoices;

		public RewardOpportunityPrompt(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_003a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: 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)
			_panel = UiFactory.CreatePanel("RewardOpportunityPrompt", parent, new Vector2(0.5f, 0.82f), new Vector2(0.5f, 0.82f), new Vector2(520f, 42f), Vector2.zero);
			((Graphic)_panel.GetComponent<Image>()).color = new Color(0f, 0f, 0f, 0.48f);
			_text = UiFactory.CreateText("RewardOpportunityPromptText", _panel.transform, RogueLocalization.RewardOpportunityPrompt(1), 22, (TextAnchor)4, UiFactory.AccentColor);
			_text.fontStyle = (FontStyle)1;
			UiFactory.Stretch((Component)(object)_text, 18f, 4f, 18f, 4f);
			_panel.SetActive(false);
		}

		public void Refresh(RogueState state)
		{
			_availableChoices = state.RewardChoicesAvailable;
			_panel.SetActive(_availableChoices > 0);
		}

		public void Tick()
		{
			//IL_0027: Unknown result type (might be due to invalid IL or missing references)
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0040: Unknown result type (might be due to invalid IL or missing references)
			if (_availableChoices > 0)
			{
				float num = 0.45f + Mathf.Sin(Time.unscaledTime * 2.2f) * 0.25f;
				Color accentColor = UiFactory.AccentColor;
				accentColor.a = Mathf.Clamp01(num);
				((Graphic)_text).color = accentColor;
				_text.text = RogueLocalization.RewardOpportunityPrompt(_availableChoices);
			}
		}

		public void SetVisible(bool visible)
		{
			_panel.SetActive(visible && _availableChoices > 0);
		}
	}
	internal static class RogueChatBridge
	{
		public static bool TryPostHostMessage(string message)
		{
			try
			{
				PlayerAgent val = default(PlayerAgent);
				if (PlayerManager.TryGetLocalPlayerAgent(ref val) && (Object)(object)val != (Object)null)
				{
					PlayerChatManager.WantToSentTextMessage(val, message, (PlayerAgent)null);
					return true;
				}
				if (SNet.HasLocalPlayer && (Object)(object)SNet.LocalPlayer != (Object)null)
				{
					PlayerChatManager.PostChatMessageLocaly(SNet.LocalPlayer, message, (SNet_Player)null);
					return true;
				}
				return false;
			}
			catch (Exception ex)
			{
				RogueLogger.Error("Failed to post KRP corruption reveal to chat.", ex);
				return false;
			}
		}
	}
	public sealed class RogueHudRoot
	{
		private readonly bool _debugEnabled;

		private readonly bool _persistentUiDefault;

		private RewardChoicePanel? _rewardPanel;

		private CardPoolPanel? _cardPoolPanel;

		private CorruptionIntroPanel? _corruptionPanel;

		private BuffBar? _buffBar;

		private MapCardStrip? _mapCardStrip;

		private ConditionalCardStatusPanel? _conditionalCardStatusPanel;

		private RewardOpportunityPrompt? _rewardOpportunityPrompt;

		private RuntimeStatusPanel? _runtimeStatusPanel;

		private DebugOverlay? _debugOverlay;

		private GameObject? _root;

		private bool _persistentUiVisible;

		private bool _hasCursorCapture;

		private bool _mapOpenLastTick;

		private bool _previousCursorVisible;

		private CursorLockMode _previousCursorLockState;

		public int RootCount => (!((Object)(object)_root == (Object)null)) ? 1 : 0;

		public int RewardPanelCount => (_rewardPanel != null) ? 1 : 0;

		public int CardViewCount => (_rewardPanel?.CardViewCount ?? 0) + (_cardPoolPanel?.CardViewCount ?? 0) + (_mapCardStrip?.CardViewCount ?? 0) + (_conditionalCardStatusPanel?.CardViewCount ?? 0);

		public RogueHudRoot(bool debugEnabled, bool persistentUiDefault)
		{
			_debugEnabled = debugEnabled;
			_persistentUiDefault = persistentUiDefault;
			_persistentUiVisible = persistentUiDefault;
		}

		public void Create()
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_0010: Expected O, but got Unknown
			//IL_0054: Unknown result type (might be due to invalid IL or missing references)
			_root = new GameObject("KainRogueProtocol.HudRoot");
			Object.DontDestroyOnLoad((Object)(object)_root);
			Canvas obj = _root.AddComponent<Canvas>();
			obj.renderMode = (RenderMode)0;
			obj.sortingOrder = 30000;
			CanvasScaler obj2 = _root.AddComponent<CanvasScaler>();
			obj2.uiScaleMode = (ScaleMode)1;
			obj2.referenceResolution = new Vector2(1920f, 1080f);
			obj2.matchWidthOrHeight = 0.5f;
			_root.AddComponent<GraphicRaycaster>();
			EnsureEventSystem();
			_rewardPanel = new RewardChoicePanel(_root.transform);
			_cardPoolPanel = new CardPoolPanel(_root.transform);
			_corruptionPanel = new CorruptionIntroPanel(_root.transform);
			_buffBar = new BuffBar(_root.transform);
			_mapCardStrip = new MapCardStrip(_root.transform);
			_conditionalCardStatusPanel = new ConditionalCardStatusPanel(_root.transform);
			_rewardOpportunityPrompt = new RewardOpportunityPrompt(_root.transform);
			_runtimeStatusPanel = new RuntimeStatusPanel(_root.transform);
			_debugOverlay = new DebugOverlay(_root.transform, _debugEnabled);
			SetPersistentUiVisible(_persistentUiDefault);
			RogueLogger.Info("Created P1 UI root.");
		}

		public void ShowRewards(RogueCard[] cards, Action<RogueCard> onSelected, Func<RogueCard[]>? onReroll = null, bool canReroll = false)
		{
			_rewardPanel?.Show(cards, onSelected, onReroll, canReroll);
			UpdateCursorCapture();
		}

		public void ShowCardPool(RogueCard[] cards, Action<RogueCard> onSelected)
		{
			_cardPoolPanel?.Show(cards, onSelected);
			UpdateCursorCapture();
		}

		public void ShowCorruptions(CorruptionCard[] cards, float durationSeconds)
		{
			_corruptionPanel?.Show(cards, durationSeconds);
		}

		public void ToggleCorruptions(CorruptionCard[] cards)
		{
			_corruptionPanel?.Toggle(cards);
		}

		public void RefreshState(RogueState state)
		{
			_rewardPanel?.RefreshState(state);
			_buffBar?.Refresh(state);
			_mapCardStrip?.Refresh(state);
			_conditionalCardStatusPanel?.Refresh(state);
			_rewardOpportunityPrompt?.Refresh(state);
			_debugOverlay?.Refresh(state);
		}

		public void Tick()
		{
			_rewardPanel?.Tick();
			_cardPoolPanel?.Tick();
			_corruptionPanel?.Tick();
			UpdateMapCloseFallback();
			_mapCardStrip?.Tick();
			_conditionalCardStatusPanel?.Tick();
			_rewardOpportunityPrompt?.Tick();
			_runtimeStatusPanel?.Tick();
			_debugOverlay?.Tick();
			UpdateCursorCapture();
		}

		public void LateTick()
		{
			if (_hasCursorCapture)
			{
				UpdateCursorCapture();
			}
		}

		public void ReleaseCursorCapture()
		{
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			if (_hasCursorCapture)
			{
				Cursor.visible = _previousCursorVisible;
				Cursor.lockState = _previousCursorLockState;
				_hasCursorCapture = false;
			}
		}

		public void TogglePersistentUi()
		{
			SetPersistentUiVisible(!_persistentUiVisible);
		}

		private void SetPersistentUiVisible(bool visible)
		{
			_persistentUiVisible = visible;
			_buffBar?.SetVisible(visible: false);
			_runtimeStatusPanel?.SetVisible(visible: false);
			_conditionalCardStatusPanel?.SetVisible(visible);
			_debugOverlay?.SetVisible(visible && _debugEnabled);
		}

		private void UpdateMapCloseFallback()
		{
			bool flag = RogueMapUiState.IsMapOpen;
			if (_mapOpenLastTick && flag && Input.GetKeyDown((KeyCode)9))
			{
				RogueMapUiState.SetMapOpen(open: false);
				flag = false;
			}
			_mapOpenLastTick = flag;
		}

		private void UpdateCursorCapture()
		{
			//IL_004b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0050: Unknown result type (might be