Decompiled source of Relics of Reign v0.3.3

Relics_of_Reign.dll

Decompiled 15 hours ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using System.Text;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using EntityStates;
using EntityStates.BeetleQueenMonster;
using EntityStates.Drone.DroneCopycat;
using EntityStates.GolemMonster;
using EntityStates.TeleporterHealNovaController;
using EntityStates.VagrantMonster;
using EntityStates.VagrantNovaItem;
using HarmonyLib;
using IL.RoR2;
using Microsoft.CodeAnalysis;
using Mono.Cecil.Cil;
using MonoMod.Cil;
using MonoMod.RuntimeDetour;
using On.EntityStates;
using On.EntityStates.BeetleQueenMonster;
using On.EntityStates.TeleporterHealNovaController;
using On.RoR2;
using On.RoR2.Orbs;
using On.RoR2.Projectile;
using On.RoR2.UI;
using R2API;
using R2API.Utils;
using RoR2;
using RoR2.CharacterAI;
using RoR2.Items;
using RoR2.Orbs;
using RoR2.Projectile;
using RoR2.Skills;
using RoR2.UI;
using RoR2BepInExPack.GameAssetPaths;
using RoR2BepInExPack.GameAssetPaths.Version_1_39_0;
using RoR2BepInExPack.GameAssetPathsBetter;
using RoR2FirstMod.Deluge;
using RoR2FirstMod.RelicLoadout;
using RoR2FirstMod.RelicProgress;
using RoR2FirstMod.RelicRuntime;
using RoR2FirstMod.RelicUI;
using RoR2FirstMod.Relics;
using TMPro;
using UnityEngine;
using UnityEngine.AddressableAssets;
using UnityEngine.EventSystems;
using UnityEngine.Events;
using UnityEngine.Networking;
using UnityEngine.Rendering;
using UnityEngine.UI;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("Relics_of_Reign")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("Relics_of_Reign")]
[assembly: AssemblyTitle("Relics_of_Reign")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Embedded]
	[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace RoR2FirstMod
{
	[BepInPlugin("tick.Relics_of_Reign", "Relics_of_Reign", "0.3.3")]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[NetworkCompatibility(/*Could not decode attribute arguments.*/)]
	[BepInProcess("Risk of Rain 2.exe")]
	public class Plugin : BaseUnityPlugin
	{
		public const string PluginAuthor = "tick";

		public const string PluginName = "Relics_of_Reign";

		public const string PluginGUID = "tick.Relics_of_Reign";

		public const string PluginVersion = "0.3.3";

		internal static Plugin Instance { get; private set; }

		internal static ManualLogSource Log { get; private set; }

		private void Awake()
		{
			Instance = this;
			Log = ((BaseUnityPlugin)this).Logger;
			RelicModConfig.Bind(((BaseUnityPlugin)this).Config);
			TryInit("RelicLanguage", RelicLanguage.Register);
			TryInit("DelugeCatalog", DelugeCatalog.Register);
			TryInit("DelugeHooks", DelugeHooks.Register);
			TryInit("RelicUnlockSave", RelicUnlockSave.Load);
			TryInit("MySetSave", MySetSave.Load);
			TryInit("RelicTier", RelicTier.Register);
			TryInit("RelicCatalog", RelicCatalog.Register);
			TryInit("ApplyDefaultUnlocks", RelicUnlockSave.ApplyDefaultUnlocks);
			TryInit("RebuildUnlockIndex", RelicCatalog.RebuildUnlockIndex);
			TryInit("RelicStatHooks", RelicStatHooks.Register);
			TryInit("RelicOnHitHooks", RelicOnHitHooks.Register);
			TryInit("RelicPassiveHooks", RelicPassiveHooks.Register);
			TryInit("RelicWorldHooks", RelicWorldHooks.Register);
			TryInit("RelicSkillHooks", RelicSkillHooks.Register);
			TryInit("RelicKillHooks", RelicKillHooks.Register);
			TryInit("RelicKillPulse", RelicKillPulse.Register);
			TryInit("RelicTimedHooks", RelicTimedHooks.Register);
			TryInit("RelicReignAspectHooks", RelicReignAspectHooks.Register);
			TryInit("RelicMinionHooks", RelicMinionHooks.Register);
			TryInit("RelicMinionAllyHooks", RelicMinionAllyHooks.Register);
			TryInit("LoadLastSelection", RelicLoadoutState.LoadLastSelection);
			TryInit("RelicGrantOnRunStart", RelicGrantOnRunStart.Register);
			TryInit("RelicProtectionHooks", RelicProtectionHooks.Register);
			TryInit("RelicRunEndUnlocker", RelicRunEndUnlocker.Register);
			TryInit("RelicCharacterSelectUi", RelicCharacterSelectUi.Register);
			TryInit("RelicGameOverUi", RelicGameOverUi.Register);
			Log.LogInfo((object)string.Format("{0} 初期化完了({1} / Relic {2} 種)", "Relics_of_Reign", RelicTable.ActiveList, RelicCatalog.All.Length));
		}

		private void OnDestroy()
		{
			TryInit("RelicLanguage.Unregister", RelicLanguage.Unregister);
			TryInit("DelugeHooks.Unregister", DelugeHooks.Unregister);
			TryInit("RelicGrantOnRunStart.Unregister", RelicGrantOnRunStart.Unregister);
			TryInit("RelicProtectionHooks.Unregister", RelicProtectionHooks.Unregister);
			TryInit("RelicRunEndUnlocker.Unregister", RelicRunEndUnlocker.Unregister);
			TryInit("RelicCharacterSelectUi.Unregister", RelicCharacterSelectUi.Unregister);
			TryInit("RelicGameOverUi.Unregister", RelicGameOverUi.Unregister);
			TryInit("RelicStatHooks.Unregister", RelicStatHooks.Unregister);
			TryInit("RelicOnHitHooks.Unregister", RelicOnHitHooks.Unregister);
			TryInit("RelicPassiveHooks.Unregister", RelicPassiveHooks.Unregister);
			TryInit("RelicWorldHooks.Unregister", RelicWorldHooks.Unregister);
			TryInit("RelicSkillHooks.Unregister", RelicSkillHooks.Unregister);
			TryInit("RelicKillHooks.Unregister", RelicKillHooks.Unregister);
			TryInit("RelicKillPulse.Unregister", RelicKillPulse.Unregister);
			TryInit("RelicMinionAllyHooks.Unregister", RelicMinionAllyHooks.Unregister);
			TryInit("RelicMinionHooks.Unregister", RelicMinionHooks.Unregister);
			TryInit("RelicReignAspectHooks.Unregister", RelicReignAspectHooks.Unregister);
			TryInit("RelicTimedHooks.Unregister", RelicTimedHooks.Unregister);
		}

		private static void TryInit(string name, Action action)
		{
			try
			{
				action();
			}
			catch (Exception arg)
			{
				Log.LogError((object)$"{name} に失敗しました: {arg}");
			}
		}
	}
	internal static class RelicModConfig
	{
		internal static ConfigEntry<RelicListKind> ActiveRelicList;

		internal static ConfigEntry<bool> DebugUnlockAll;

		internal static ConfigEntry<string> DebugUnlockOnly;

		internal static ConfigEntry<float> UiUnit;

		internal static void Bind(ConfigFile config)
		{
			ActiveRelicList = config.Bind<RelicListKind>("Relics", "ActiveList", RelicListKind.Production, "読み込むレリック一覧。PerformanceTest(パフォーマンステスト)/ Pattern(パターン)/ Production(プロダクション)。同時に有効なのは1つだけ。");
			DebugUnlockAll = config.Bind<bool>("Debug", "UnlockAllRelics", false, "true なら全 Relic を解放済みとして扱う。配布・通常プレイでは false。");
			DebugUnlockOnly = config.Bind<string>("Debug", "UnlockOnlyRelics", "", "空でなければ、表示名がこのカンマ区切りリストに一致する Relic だけ解放済みにする。UnlockAllRelics より優先。");
			UiUnit = config.Bind<float>("UI", "Unit", 22f, "レリック画面の寸法単位。3*3 アイコンは 3×この値(ピクセル)。");
		}
	}
}
namespace RoR2FirstMod.RelicUI
{
	internal sealed class MySetScreen : MonoBehaviour
	{
		private sealed class SlotRow
		{
			internal Button Button;

			internal Image Image;

			internal Image Icon;

			internal HGTextMeshProUGUI Label;
		}

		private const int VisibleSlotCountTenths = 45;

		private const float SlotColWidth = 240f;

		private const float Pad = 12f;

		private const float Gap = 10f;

		private const float ButtonHeight = 48f;

		private const float TopBar = 44f;

		private const float OpenButtonWidth = 192f;

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

		private static readonly Color SlotOn = new Color(0.35f, 0.28f, 0.12f, 0.95f);

		private HGTextMeshProUGUI _template;

		private RectTransform _openButton;

		private GameObject _overlay;

		private GameObject _panel;

		private int _selectedIndex;

		private readonly SlotRow[] _slotRows = new SlotRow[20];

		private HGTextMeshProUGUI _emptyLabel;

		private GameObject _savedRoot;

		private readonly List<Image> _savedIcons = new List<Image>();

		private RelicRowView _savedLight;

		private RelicRowView _savedRain;

		private RelicRowView _savedSeed;

		private readonly List<Image> _currentIcons = new List<Image>();

		private RelicRowView _currentLight;

		private RelicRowView _currentRain;

		private RelicRowView _currentSeed;

		private readonly List<Sprite> _iconBuffer = new List<Sprite>(8);

		private CharacterSelectController _css;

		private Coroutine _applyRoutine;

		internal RectTransform OpenButton => _openButton;

		internal void SetPanelVisible(bool visible)
		{
			if (Object.op_Implicit((Object)(object)_panel))
			{
				_panel.SetActive(visible);
			}
			if (visible)
			{
				RefreshAll();
			}
		}

		private void Start()
		{
			_css = ((Component)this).GetComponent<CharacterSelectController>();
			_template = ((Component)this).GetComponentInChildren<HGTextMeshProUGUI>(true);
			if (Object.op_Implicit((Object)(object)_template))
			{
				Transform parent = ((Component)this).transform.Find("SafeArea") ?? ((TMP_Text)_template).transform.parent;
				_openButton = BuildOpenButton(parent);
				_overlay = RelicUiLayout.CreateScreenOverlay("MySetOverlay", 1000);
				BuildPanel(_overlay.transform);
				((Transform)_openButton).SetAsLastSibling();
				SetPanelVisible(visible: false);
				((MonoBehaviour)this).StartCoroutine(PlaceLeftOfRelic());
			}
		}

		private void OnDestroy()
		{
			if (Object.op_Implicit((Object)(object)_overlay))
			{
				Object.Destroy((Object)(object)_overlay);
			}
		}

		private IEnumerator PlaceLeftOfRelic()
		{
			RelicSelectScreen relic = ((Component)this).GetComponent<RelicSelectScreen>();
			for (int i = 0; i < 300; i++)
			{
				yield return null;
				if (Object.op_Implicit((Object)(object)relic) && Object.op_Implicit((Object)(object)relic.OpenButton) && RelicUiLayout.PlaceLeftOf(_openButton, relic.OpenButton, 8f))
				{
				}
			}
		}

		private RectTransform BuildOpenButton(Transform parent)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_0009: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Expected O, but got Unknown
			//IL_0044: Unknown result type (might be due to invalid IL or missing references)
			//IL_0053: Unknown result type (might be due to invalid IL or missing references)
			//IL_0062: Unknown result type (might be due to invalid IL or missing references)
			//IL_0071: Unknown result type (might be due to invalid IL or missing references)
			//IL_0080: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00aa: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00be: 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)
			Color color = RelicUiLayout.SampleExpansionRed((Component)(object)this);
			Button val = RelicUiFactory.CreateButton(parent, color, new UnityAction(TogglePanel));
			((Object)((Component)val).gameObject).name = "MySetOpenButton";
			RelicHoverBorder.Attach(((Component)val).gameObject);
			RelicUiFactory.SetRect((Component)(object)val, new Vector2(0f, 0f), new Vector2(0f, 0f), new Vector2(0f, 0f), new Vector2(36f, 96f), new Vector2(192f, 52f));
			HGTextMeshProUGUI val2 = RelicUiFactory.CreateText(((Component)val).transform, _template, "Label", 20);
			RelicUiFactory.SetRect((Component)(object)val2, Vector2.zero, Vector2.one, new Vector2(0.5f, 0.5f), Vector2.zero, Vector2.zero);
			((TMP_Text)val2).alignment = (TextAlignmentOptions)514;
			((Graphic)val2).raycastTarget = false;
			((TMP_Text)val2).text = Language.GetString("TICK_MYSET_OPEN_BUTTON");
			return ((Component)val).GetComponent<RectTransform>();
		}

		private void TogglePanel()
		{
			bool flag = Object.op_Implicit((Object)(object)_panel) && _panel.activeSelf;
			if (!flag)
			{
				((Component)this).GetComponent<RelicSelectScreen>()?.SetPanelVisible(visible: false);
			}
			SetPanelVisible(!flag);
		}

		private void BuildPanel(Transform parent)
		{
			//IL_0085: 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_00b9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00dd: Unknown result type (might be due to invalid IL or missing references)
			//IL_0107: 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_011d: Expected O, but got Unknown
			//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_0149: Unknown result type (might be due to invalid IL or missing references)
			//IL_0158: Unknown result type (might be due to invalid IL or missing references)
			//IL_0167: Unknown result type (might be due to invalid IL or missing references)
			//IL_018f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0194: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a3: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a8: 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_0207: 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_0225: Unknown result type (might be due to invalid IL or missing references)
			//IL_0231: Unknown result type (might be due to invalid IL or missing references)
			//IL_023c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0265: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c2: Unknown result type (might be due to invalid IL or missing references)
			//IL_02da: Unknown result type (might be due to invalid IL or missing references)
			//IL_02e9: Unknown result type (might be due to invalid IL or missing references)
			//IL_02f8: Unknown result type (might be due to invalid IL or missing references)
			//IL_0301: Unknown result type (might be due to invalid IL or missing references)
			//IL_0308: Unknown result type (might be due to invalid IL or missing references)
			//IL_0385: Unknown result type (might be due to invalid IL or missing references)
			//IL_038f: Expected O, but got Unknown
			//IL_03bd: Unknown result type (might be due to invalid IL or missing references)
			//IL_03c7: Expected O, but got Unknown
			//IL_03fc: Unknown result type (might be due to invalid IL or missing references)
			//IL_0414: Unknown result type (might be due to invalid IL or missing references)
			//IL_0423: Unknown result type (might be due to invalid IL or missing references)
			//IL_0432: Unknown result type (might be due to invalid IL or missing references)
			//IL_043b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0442: Unknown result type (might be due to invalid IL or missing references)
			float num = RelicUiMetrics.Row * 4f;
			float rowWidth = RelicUiMetrics.RowWidth;
			float num2 = 250f + rowWidth;
			float num3 = 250f;
			float num4 = 12f + num3 + num2 + 12f;
			float num5 = 44f + num + 10f + 48f + 10f + num + 12f;
			float num6 = RelicUiMetrics.PanelPosY + (num5 - RelicUiMetrics.PanelHeight) * 0.5f;
			Image val = RelicUiFactory.CreateImage(parent, "MySetRoot", new Color(0.05f, 0.05f, 0.07f, 0.98f));
			_panel = ((Component)val).gameObject;
			RelicUiFactory.SetRect((Component)(object)val, new Vector2(0.5f, 0.5f), new Vector2(0.5f, 0.5f), new Vector2(0.5f, 0.5f), new Vector2(0f, num6), new Vector2(num4, num5));
			Button val2 = RelicUiFactory.CreateButton(_panel.transform, new Color(0.35f, 0.12f, 0.12f, 1f), (UnityAction)delegate
			{
				SetPanelVisible(visible: false);
			});
			RelicUiFactory.SetRect((Component)(object)val2, new Vector2(1f, 1f), new Vector2(1f, 1f), new Vector2(1f, 1f), new Vector2(-8f, -8f), new Vector2(100f, 36f));
			HGTextMeshProUGUI val3 = RelicUiFactory.CreateText(((Component)val2).transform, _template, "CloseLabel");
			RelicUiFactory.SetRect((Component)(object)val3, Vector2.zero, Vector2.one, new Vector2(0.5f, 0.5f), Vector2.zero, Vector2.zero);
			((TMP_Text)val3).alignment = (TextAlignmentOptions)514;
			((TMP_Text)val3).text = Language.GetString("TICK_RELIC_CLOSE_BUTTON");
			float num7 = -44f;
			float num8 = 12f + num3;
			RectTransform content;
			ScrollRect component = RelicUiFactory.CreateScroll(_panel.transform, out content);
			RelicUiFactory.SetRect((Component)(object)component, new Vector2(0f, 1f), new Vector2(0f, 1f), new Vector2(0f, 1f), new Vector2(12f, num7), new Vector2(240f, num));
			float num9 = num * 10f / 45f;
			content.sizeDelta = new Vector2(0f, num9 * 20f);
			for (int num10 = 0; num10 < 20; num10++)
			{
				_slotRows[num10] = BuildSlotRow(content, num10, num9);
			}
			Image val4 = RelicUiFactory.CreateImage(_panel.transform, "SavedDetail", new Color(0f, 0f, 0f, 0.2f));
			RelicUiFactory.SetRect((Component)(object)val4, new Vector2(0f, 1f), new Vector2(0f, 1f), new Vector2(0f, 1f), new Vector2(num8, num7), new Vector2(num2, num));
			BuildDetail(((Graphic)val4).rectTransform, allowEmpty: true, out _emptyLabel, out _savedRoot, _savedIcons, out _savedLight, out _savedRain, out _savedSeed);
			float num11 = num7 - num - 10f;
			float num12 = (num2 - 10f) * 0.5f;
			BuildArrowButton(_panel.transform, up: true, num8, num11, num12, Language.GetString("TICK_MYSET_REGISTER"), new UnityAction(RegisterSelected));
			BuildArrowButton(_panel.transform, up: false, num8 + num12 + 10f, num11, num12, Language.GetString("TICK_MYSET_LOAD"), new UnityAction(LoadSelected));
			float num13 = num11 - 48f - 10f;
			Image val5 = RelicUiFactory.CreateImage(_panel.transform, "CurrentDetail", new Color(0f, 0f, 0f, 0.2f));
			RelicUiFactory.SetRect((Component)(object)val5, new Vector2(0f, 1f), new Vector2(0f, 1f), new Vector2(0f, 1f), new Vector2(num8, num13), new Vector2(num2, num));
			BuildDetail(((Graphic)val5).rectTransform, allowEmpty: false, out var _, out var _, _currentIcons, out _currentLight, out _currentRain, out _currentSeed);
		}

		private SlotRow BuildSlotRow(RectTransform parent, int index, float height)
		{
			//IL_0016: 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_002c: Expected O, but got Unknown
			//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_0070: 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_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_00dc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00eb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f2: Unknown result type (might be due to invalid IL or missing references)
			//IL_0123: 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_0158: Unknown result type (might be due to invalid IL or missing references)
			//IL_016a: Unknown result type (might be due to invalid IL or missing references)
			int captured = index;
			Button val = RelicUiFactory.CreateButton((Transform)(object)parent, SlotIdle, (UnityAction)delegate
			{
				_selectedIndex = captured;
				RefreshSlots();
				RefreshSaved();
			});
			RelicUiFactory.SetRect((Component)(object)val, new Vector2(0f, 1f), new Vector2(1f, 1f), new Vector2(0.5f, 1f), new Vector2(0f, (float)(-index) * height), new Vector2(0f, height));
			Image val2 = RelicUiFactory.CreateImage(((Component)val).transform, "Portrait", Color.white);
			val2.preserveAspect = true;
			((Graphic)val2).raycastTarget = false;
			float num = Mathf.Min(RelicUiMetrics.Icon, height - 8f);
			RelicUiFactory.SetRect((Component)(object)val2, new Vector2(0f, 0.5f), new Vector2(0f, 0.5f), new Vector2(0f, 0.5f), new Vector2(6f, 0f), new Vector2(num, num));
			HGTextMeshProUGUI val3 = RelicUiFactory.CreateText(((Component)val).transform, _template, "Label", 16);
			RelicUiFactory.SetRect((Component)(object)val3, new Vector2(0f, 0f), new Vector2(1f, 1f), new Vector2(0.5f, 0.5f), new Vector2((num + 10f) * 0.5f, 0f), new Vector2(0f - (num + 16f), -8f));
			((TMP_Text)val3).alignment = (TextAlignmentOptions)4097;
			((TMP_Text)val3).enableWordWrapping = false;
			((Graphic)val3).raycastTarget = false;
			((TMP_Text)val3).text = string.Format(Language.GetString("TICK_MYSET_SLOT"), index + 1);
			SlotRow slotRow = new SlotRow();
			slotRow.Button = val;
			ref Image image = ref slotRow.Image;
			Graphic targetGraphic = ((Selectable)val).targetGraphic;
			image = (Image)(object)((targetGraphic is Image) ? targetGraphic : null);
			slotRow.Icon = val2;
			slotRow.Label = val3;
			return slotRow;
		}

		private void BuildDetail(RectTransform parent, bool allowEmpty, out HGTextMeshProUGUI emptyLabel, out GameObject filledRoot, List<Image> icons, out RelicRowView light, out RelicRowView rain, out RelicRowView seed)
		{
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			//IL_0043: Unknown result type (might be due to invalid IL or missing references)
			//IL_0048: Unknown result type (might be due to invalid IL or missing references)
			//IL_004d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0091: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bd: 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_00d7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e4: 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_012f: Unknown result type (might be due to invalid IL or missing references)
			//IL_013e: Unknown result type (might be due to invalid IL or missing references)
			//IL_014d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0152: Unknown result type (might be due to invalid IL or missing references)
			//IL_0161: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a0: 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_01ff: Unknown result type (might be due to invalid IL or missing references)
			//IL_0206: Unknown result type (might be due to invalid IL or missing references)
			emptyLabel = null;
			filledRoot = ((Component)parent).gameObject;
			if (allowEmpty)
			{
				emptyLabel = RelicUiFactory.CreateText((Transform)(object)parent, _template, "Empty", 22);
				RelicUiFactory.SetRect((Component)(object)emptyLabel, Vector2.zero, Vector2.one, new Vector2(0.5f, 0.5f), Vector2.zero, Vector2.zero);
				((TMP_Text)emptyLabel).alignment = (TextAlignmentOptions)514;
				((TMP_Text)emptyLabel).text = Language.GetString("TICK_MYSET_EMPTY");
				filledRoot = ((Component)new GameObject("Filled", new Type[1] { typeof(RectTransform) }).GetComponent<RectTransform>()).gameObject;
				filledRoot.transform.SetParent((Transform)(object)parent, false);
				RectTransform component = filledRoot.GetComponent<RectTransform>();
				component.anchorMin = Vector2.zero;
				component.anchorMax = Vector2.one;
				component.offsetMin = Vector2.zero;
				component.offsetMax = Vector2.zero;
			}
			Transform parent2 = (Transform)(allowEmpty ? ((object)filledRoot.transform) : ((object)parent));
			Image val = RelicUiFactory.CreateImage(parent2, "IconRow", new Color(0.1f, 0.1f, 0.12f, 0.9f));
			RelicUiFactory.SetRect((Component)(object)val, new Vector2(0f, 1f), new Vector2(1f, 1f), new Vector2(0.5f, 1f), Vector2.zero, new Vector2(0f, RelicUiMetrics.Row));
			((Graphic)val).raycastTarget = false;
			float icon = RelicUiMetrics.Icon;
			float num = 8f;
			for (int i = 0; i < 8; i++)
			{
				Image val2 = RelicUiFactory.CreateImage(((Component)val).transform, "Icon" + i, Color.white);
				val2.preserveAspect = true;
				((Graphic)val2).raycastTarget = false;
				RelicUiFactory.SetRect((Component)(object)val2, new Vector2(0f, 0.5f), new Vector2(0f, 0.5f), new Vector2(0f, 0.5f), new Vector2(num + (float)i * (icon + 6f), 0f), new Vector2(icon, icon));
				icons.Add(val2);
			}
			light = RelicRowView.Create(parent2, _template, null);
			rain = RelicRowView.Create(parent2, _template, null);
			seed = RelicRowView.Create(parent2, _template, null);
		}

		private void BuildArrowButton(Transform parent, bool up, float x, float y, float w, string caption, UnityAction onClick)
		{
			//IL_000d: 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_0012: 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_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_005e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0066: Unknown result type (might be due to invalid IL or missing references)
			//IL_0072: Unknown result type (might be due to invalid IL or missing references)
			//IL_009e: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00da: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fc: Unknown result type (might be due to invalid IL or missing references)
			//IL_012f: Unknown result type (might be due to invalid IL or missing references)
			//IL_013e: Unknown result type (might be due to invalid IL or missing references)
			//IL_014d: Unknown result type (might be due to invalid IL or missing references)
			//IL_015c: Unknown result type (might be due to invalid IL or missing references)
			//IL_016b: Unknown result type (might be due to invalid IL or missing references)
			Color color = (up ? RelicUiLayout.SampleExpansionRed((Component)(object)this) : RelicUiLayout.SampleDifficultyBlue((Component)(object)this));
			Button val = RelicUiFactory.CreateButton(parent, new Color(0.18f, 0.18f, 0.22f, 1f), onClick);
			RelicUiFactory.SetRect((Component)(object)val, new Vector2(0f, 1f), new Vector2(0f, 1f), new Vector2(0f, 1f), new Vector2(x, y), new Vector2(w, 48f));
			float num = 97.77778f;
			float h = 40f;
			Sprite sprite = RelicUiFactory.CreateFlatArrowSprite(up);
			PlaceSideArrow(((Component)val).transform, "ArrowLeft", sprite, color, new Vector2(0f, 0.5f), new Vector2(20f + num * 0.5f, 0f), num, h);
			PlaceSideArrow(((Component)val).transform, "ArrowRight", sprite, color, new Vector2(1f, 0.5f), new Vector2(-20f - num * 0.5f, 0f), num, h);
			HGTextMeshProUGUI val2 = RelicUiFactory.CreateText(((Component)val).transform, _template, "Caption", 28);
			RelicUiFactory.SetRect((Component)(object)val2, new Vector2(0f, 0f), new Vector2(1f, 0f), new Vector2(0.5f, 0f), new Vector2(0f, 2f), new Vector2(0f, 44f));
			((TMP_Text)val2).alignment = (TextAlignmentOptions)514;
			((TMP_Text)val2).enableAutoSizing = false;
			((TMP_Text)val2).fontSize = 28f;
			((TMP_Text)val2).enableWordWrapping = false;
			((Graphic)val2).raycastTarget = false;
			((TMP_Text)val2).text = caption;
		}

		private static void PlaceSideArrow(Transform parent, string name, Sprite sprite, Color color, Vector2 anchor, Vector2 pos, float w, float h)
		{
			//IL_0003: Unknown result type (might be due to invalid IL or missing references)
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_0025: 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_0036: 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)
			Image val = RelicUiFactory.CreateImage(parent, name, color);
			val.sprite = sprite;
			val.preserveAspect = false;
			((Graphic)val).raycastTarget = false;
			RelicUiFactory.SetRect((Component)(object)val, anchor, anchor, new Vector2(0.5f, 0.5f), pos, new Vector2(w, h));
		}

		private void RegisterSelected()
		{
			MySetSlotData mySetSlotData = MySetSnapshot.Capture(_css);
			if (mySetSlotData != null)
			{
				MySetSave.Set(_selectedIndex, mySetSlotData);
				RefreshAll();
			}
		}

		private void LoadSelected()
		{
			MySetSlotData mySetSlotData = MySetSave.Get(_selectedIndex);
			if (mySetSlotData != null && mySetSlotData.filled)
			{
				if (_applyRoutine != null)
				{
					((MonoBehaviour)this).StopCoroutine(_applyRoutine);
				}
				_applyRoutine = ((MonoBehaviour)this).StartCoroutine(LoadRoutine(mySetSlotData));
			}
		}

		private IEnumerator LoadRoutine(MySetSlotData data)
		{
			yield return MySetSnapshot.Apply(_css, data);
			RefreshAll();
			_applyRoutine = null;
		}

		private void RefreshAll()
		{
			RefreshSlots();
			RefreshSaved();
			RefreshCurrent();
		}

		private void RefreshSlots()
		{
			//IL_0051: 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_00bf: Unknown result type (might be due to invalid IL or missing references)
			for (int i = 0; i < _slotRows.Length; i++)
			{
				SlotRow slotRow = _slotRows[i];
				if (slotRow != null)
				{
					MySetSlotData mySetSlotData = MySetSave.Get(i);
					if (Object.op_Implicit((Object)(object)slotRow.Image))
					{
						((Graphic)slotRow.Image).color = ((i == _selectedIndex) ? SlotOn : SlotIdle);
					}
					SurvivorDef survivor = ((mySetSlotData != null && mySetSlotData.filled) ? MySetSnapshot.FindSurvivor(mySetSlotData.survivorName) : null);
					Sprite val = MySetSnapshot.Portrait(survivor);
					if (Object.op_Implicit((Object)(object)slotRow.Icon))
					{
						((Behaviour)slotRow.Icon).enabled = Object.op_Implicit((Object)(object)val);
						slotRow.Icon.sprite = val;
						((Graphic)slotRow.Icon).color = Color.white;
					}
				}
			}
		}

		private void RefreshSaved()
		{
			MySetSlotData mySetSlotData = MySetSave.Get(_selectedIndex);
			bool flag = mySetSlotData?.filled ?? false;
			if (Object.op_Implicit((Object)(object)_emptyLabel))
			{
				((Component)_emptyLabel).gameObject.SetActive(!flag);
			}
			if (Object.op_Implicit((Object)(object)_savedRoot))
			{
				_savedRoot.SetActive(flag);
			}
			if (flag)
			{
				SurvivorDef survivor = MySetSnapshot.FindSurvivor(mySetSlotData.survivorName);
				MySetSnapshot.CollectLoadoutIcons(mySetSlotData, _iconBuffer);
				BindIconRow(_savedIcons, MySetSnapshot.Portrait(survivor), _iconBuffer);
				BindRelic(_savedLight, RelicCategory.Light, mySetSlotData.lightId, 1);
				BindRelic(_savedRain, RelicCategory.Rain, mySetSlotData.rainId, 2);
				BindRelic(_savedSeed, RelicCategory.Seed, mySetSlotData.seedId, 3);
			}
		}

		private void RefreshCurrent()
		{
			SurvivorDef survivor = MySetSnapshot.CurrentSurvivor(_css);
			Loadout loadout = MySetSnapshot.CurrentLoadout(_css, MySetSnapshot.ResolveLocalUser(_css));
			MySetSnapshot.CollectLoadoutIcons(survivor, loadout, _iconBuffer);
			BindIconRow(_currentIcons, MySetSnapshot.Portrait(survivor), _iconBuffer);
			BindRelic(_currentLight, RelicCategory.Light, RelicLoadoutState.GetSelected(RelicCategory.Light), 1);
			BindRelic(_currentRain, RelicCategory.Rain, RelicLoadoutState.GetSelected(RelicCategory.Rain), 2);
			BindRelic(_currentSeed, RelicCategory.Seed, RelicLoadoutState.GetSelected(RelicCategory.Seed), 3);
		}

		private static void BindIconRow(List<Image> images, Sprite portrait, List<Sprite> loadout)
		{
			//IL_0063: Unknown result type (might be due to invalid IL or missing references)
			for (int i = 0; i < images.Count; i++)
			{
				Image val = images[i];
				if (Object.op_Implicit((Object)(object)val))
				{
					Sprite val2 = null;
					if (i == 0)
					{
						val2 = portrait;
					}
					else if (i - 1 < loadout.Count)
					{
						val2 = loadout[i - 1];
					}
					((Behaviour)val).enabled = Object.op_Implicit((Object)(object)val2);
					val.sprite = val2;
					((Graphic)val).color = Color.white;
				}
			}
		}

		private static void BindRelic(RelicRowView row, RelicCategory category, string id, int index)
		{
			if (row != null)
			{
				RelicInfo relicInfo = RelicCatalog.Find(id);
				if (relicInfo == null)
				{
					row.ShowEmpty(category, index);
				}
				else
				{
					row.Show(relicInfo, selected: false, index);
				}
			}
		}

		private void Update()
		{
			if (Object.op_Implicit((Object)(object)_panel) && _panel.activeSelf)
			{
				RefreshCurrent();
			}
		}
	}
	internal static class MySetSnapshot
	{
		private static readonly Dictionary<int, Sprite> PortraitCache = new Dictionary<int, Sprite>();

		internal static LocalUser ResolveLocalUser(CharacterSelectController css)
		{
			if (Object.op_Implicit((Object)(object)css) && css.localUser != null)
			{
				return css.localUser;
			}
			EventSystem current = EventSystem.current;
			MPEventSystem val = (MPEventSystem)(object)((current is MPEventSystem) ? current : null);
			if (val != null && val.localUser != null)
			{
				return val.localUser;
			}
			return LocalUserManager.GetFirstLocalUser();
		}

		internal static SurvivorDef CurrentSurvivor(CharacterSelectController css)
		{
			if (Object.op_Implicit((Object)(object)css) && Object.op_Implicit((Object)(object)css.currentSurvivorDef))
			{
				return css.currentSurvivorDef;
			}
			LocalUser val = ResolveLocalUser(css);
			NetworkUser val2 = ((val != null) ? val.currentNetworkUser : null);
			return Object.op_Implicit((Object)(object)val2) ? val2.GetSurvivorPreference() : null;
		}

		internal static Loadout CurrentLoadout(CharacterSelectController css, LocalUser localUser)
		{
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			//IL_001f: Expected O, but got Unknown
			if (((localUser != null) ? localUser.userProfile : null) == null)
			{
				return null;
			}
			Loadout val = new Loadout();
			localUser.userProfile.CopyLoadout(val);
			return val;
		}

		internal static MySetSlotData Capture(CharacterSelectController css)
		{
			//IL_0030: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_003a: 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_0063: Unknown result type (might be due to invalid IL or missing references)
			//IL_0065: Invalid comparison between Unknown and I4
			//IL_0084: 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)
			SurvivorDef val = CurrentSurvivor(css);
			if (!Object.op_Implicit((Object)(object)val))
			{
				return null;
			}
			LocalUser localUser = ResolveLocalUser(css);
			Loadout val2 = CurrentLoadout(css, localUser);
			BodyIndex bodyIndexFromSurvivorIndex = SurvivorCatalog.GetBodyIndexFromSurvivorIndex(val.survivorIndex);
			GenericSkill[] bodyPrefabSkillSlots = BodyCatalog.GetBodyPrefabSkillSlots(bodyIndexFromSurvivorIndex);
			uint[] array = new uint[(bodyPrefabSkillSlots != null) ? bodyPrefabSkillSlots.Length : 0];
			uint skinIndex = 0u;
			if (val2 != null && val2.bodyLoadoutManager != null && (int)bodyIndexFromSurvivorIndex != -1)
			{
				for (int i = 0; i < array.Length; i++)
				{
					array[i] = val2.bodyLoadoutManager.GetSkillVariant(bodyIndexFromSurvivorIndex, i);
				}
				skinIndex = val2.bodyLoadoutManager.GetSkinIndex(bodyIndexFromSurvivorIndex);
			}
			return new MySetSlotData
			{
				filled = true,
				survivorName = SurvivorKey(val),
				skillVariants = array,
				skinIndex = skinIndex,
				lightId = (RelicLoadoutState.GetSelected(RelicCategory.Light) ?? ""),
				rainId = (RelicLoadoutState.GetSelected(RelicCategory.Rain) ?? ""),
				seedId = (RelicLoadoutState.GetSelected(RelicCategory.Seed) ?? "")
			};
		}

		internal static IEnumerator Apply(CharacterSelectController css, MySetSlotData data)
		{
			if ((Object)(object)css == (Object)null || data == null || !data.filled)
			{
				yield break;
			}
			SurvivorDef survivor = FindSurvivor(data.survivorName);
			LocalUser localUser = ResolveLocalUser(css);
			if (!Object.op_Implicit((Object)(object)survivor) || localUser == null)
			{
				Plugin.Log.LogWarning((object)"マイセットのキャラクターを適用できませんでした。");
				yield break;
			}
			if (Object.op_Implicit((Object)(object)PreGameController.instance) && !PreGameController.instance.IsCharacterSwitchingCurrentlyAllowed())
			{
				Plugin.Log.LogWarning((object)"いまはキャラクターを切り替えられません。");
				yield break;
			}
			CharacterSelectBarController bar = ((Component)css).GetComponentInChildren<CharacterSelectBarController>(true);
			if (Object.op_Implicit((Object)(object)bar))
			{
				bar.PickIconBySurvivorDef(survivor);
				css.SetSurvivorInfoPanelActive(true);
			}
			yield return null;
			yield return null;
			if (localUser.userProfile != null)
			{
				Loadout loadout = new Loadout();
				localUser.userProfile.CopyLoadout(loadout);
				BodyIndex bodyIndex = SurvivorCatalog.GetBodyIndexFromSurvivorIndex(survivor.survivorIndex);
				if (loadout.bodyLoadoutManager != null && (int)bodyIndex != -1)
				{
					GenericSkill[] slots = BodyCatalog.GetBodyPrefabSkillSlots(bodyIndex);
					int n = Mathf.Min((slots != null) ? slots.Length : 0, (data.skillVariants != null) ? data.skillVariants.Length : 0);
					for (int i = 0; i < n; i++)
					{
						loadout.bodyLoadoutManager.SetSkillVariant(bodyIndex, i, data.skillVariants[i]);
					}
					loadout.bodyLoadoutManager.SetSkinIndex(bodyIndex, data.skinIndex);
				}
				localUser.userProfile.SetLoadout(loadout);
			}
			RelicLoadoutState.ApplyIds(data.lightId, data.rainId, data.seedId);
		}

		internal static SurvivorDef FindSurvivor(string name)
		{
			if (string.IsNullOrEmpty(name))
			{
				return null;
			}
			foreach (SurvivorDef orderedSurvivorDef in SurvivorCatalog.orderedSurvivorDefs)
			{
				if (Object.op_Implicit((Object)(object)orderedSurvivorDef))
				{
					if (SurvivorKey(orderedSurvivorDef) == name || orderedSurvivorDef.cachedName == name)
					{
						return orderedSurvivorDef;
					}
					if (Object.op_Implicit((Object)(object)orderedSurvivorDef.bodyPrefab) && ((Object)orderedSurvivorDef.bodyPrefab).name == name)
					{
						return orderedSurvivorDef;
					}
				}
			}
			return null;
		}

		internal static string SurvivorKey(SurvivorDef survivor)
		{
			if (!Object.op_Implicit((Object)(object)survivor))
			{
				return "";
			}
			if (!string.IsNullOrEmpty(survivor.cachedName))
			{
				return survivor.cachedName;
			}
			return Object.op_Implicit((Object)(object)survivor.bodyPrefab) ? ((Object)survivor.bodyPrefab).name : survivor.cachedName;
		}

		internal static Sprite Portrait(SurvivorDef survivor)
		{
			//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)
			Texture val = null;
			if (Object.op_Implicit((Object)(object)survivor) && Object.op_Implicit((Object)(object)survivor.bodyPrefab))
			{
				CharacterBody component = survivor.bodyPrefab.GetComponent<CharacterBody>();
				if (Object.op_Implicit((Object)(object)component))
				{
					val = component.portraitIcon;
				}
			}
			if (!Object.op_Implicit((Object)(object)val))
			{
				return null;
			}
			int instanceID = ((Object)val).GetInstanceID();
			if (PortraitCache.TryGetValue(instanceID, out var value) && Object.op_Implicit((Object)(object)value))
			{
				return value;
			}
			Texture2D val2 = (Texture2D)(object)((val is Texture2D) ? val : null);
			if (val2 == null)
			{
				return null;
			}
			Sprite val3 = Sprite.Create(val2, new Rect(0f, 0f, (float)((Texture)val2).width, (float)((Texture)val2).height), new Vector2(0.5f, 0.5f), 100f);
			PortraitCache[instanceID] = val3;
			return val3;
		}

		internal static void CollectLoadoutIcons(SurvivorDef survivor, Loadout loadout, List<Sprite> dest)
		{
			//IL_001c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0021: 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_0027: 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_003c: Unknown result type (might be due to invalid IL or missing references)
			//IL_003e: Invalid comparison between Unknown and I4
			//IL_014e: 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_0139: Invalid comparison between Unknown and I4
			//IL_00a0: Unknown result type (might be due to invalid IL or missing references)
			dest.Clear();
			if (!Object.op_Implicit((Object)(object)survivor))
			{
				return;
			}
			BodyIndex bodyIndexFromSurvivorIndex = SurvivorCatalog.GetBodyIndexFromSurvivorIndex(survivor.survivorIndex);
			GenericSkill[] bodyPrefabSkillSlots = BodyCatalog.GetBodyPrefabSkillSlots(bodyIndexFromSurvivorIndex);
			if (bodyPrefabSkillSlots != null && loadout != null && loadout.bodyLoadoutManager != null && (int)bodyIndexFromSurvivorIndex != -1)
			{
				for (int i = 0; i < bodyPrefabSkillSlots.Length; i++)
				{
					GenericSkill val = bodyPrefabSkillSlots[i];
					if (!Object.op_Implicit((Object)(object)val) || (Object)(object)val.skillFamily == (Object)null || val.skillFamily.variants == null)
					{
						dest.Add(null);
						continue;
					}
					uint skillVariant = loadout.bodyLoadoutManager.GetSkillVariant(bodyIndexFromSurvivorIndex, i);
					if (skillVariant >= val.skillFamily.variants.Length)
					{
						dest.Add(null);
						continue;
					}
					SkillDef skillDef = val.skillFamily.variants[skillVariant].skillDef;
					dest.Add(Object.op_Implicit((Object)(object)skillDef) ? skillDef.icon : null);
				}
			}
			SkinDef[] bodySkinDefs = SkinCatalog.GetBodySkinDefs(bodyIndexFromSurvivorIndex);
			if (bodySkinDefs != null && bodySkinDefs.Length != 0 && loadout != null && loadout.bodyLoadoutManager != null && (int)bodyIndexFromSurvivorIndex != -1)
			{
				uint skinIndex = loadout.bodyLoadoutManager.GetSkinIndex(bodyIndexFromSurvivorIndex);
				if (skinIndex < bodySkinDefs.Length && Object.op_Implicit((Object)(object)bodySkinDefs[skinIndex]))
				{
					dest.Add(bodySkinDefs[skinIndex].icon);
				}
			}
		}

		internal static void CollectLoadoutIcons(MySetSlotData data, List<Sprite> dest)
		{
			//IL_0036: 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_0040: Unknown result type (might be due to invalid IL or missing references)
			//IL_0041: Unknown result type (might be due to invalid IL or missing references)
			//IL_0124: Unknown result type (might be due to invalid IL or missing references)
			dest.Clear();
			SurvivorDef val = FindSurvivor(data?.survivorName);
			if (!Object.op_Implicit((Object)(object)val) || data == null)
			{
				return;
			}
			BodyIndex bodyIndexFromSurvivorIndex = SurvivorCatalog.GetBodyIndexFromSurvivorIndex(val.survivorIndex);
			GenericSkill[] bodyPrefabSkillSlots = BodyCatalog.GetBodyPrefabSkillSlots(bodyIndexFromSurvivorIndex);
			if (bodyPrefabSkillSlots != null)
			{
				for (int i = 0; i < bodyPrefabSkillSlots.Length; i++)
				{
					GenericSkill val2 = bodyPrefabSkillSlots[i];
					uint num = ((data.skillVariants != null && i < data.skillVariants.Length) ? data.skillVariants[i] : 0u);
					if (!Object.op_Implicit((Object)(object)val2) || (Object)(object)val2.skillFamily == (Object)null || val2.skillFamily.variants == null || num >= val2.skillFamily.variants.Length)
					{
						dest.Add(null);
						continue;
					}
					SkillDef skillDef = val2.skillFamily.variants[num].skillDef;
					dest.Add(Object.op_Implicit((Object)(object)skillDef) ? skillDef.icon : null);
				}
			}
			SkinDef[] bodySkinDefs = SkinCatalog.GetBodySkinDefs(bodyIndexFromSurvivorIndex);
			if (bodySkinDefs != null && bodySkinDefs.Length != 0 && data.skinIndex < bodySkinDefs.Length && Object.op_Implicit((Object)(object)bodySkinDefs[data.skinIndex]))
			{
				dest.Add(bodySkinDefs[data.skinIndex].icon);
			}
		}
	}
	internal static class RelicCharacterSelectUi
	{
		[CompilerGenerated]
		private static class <>O
		{
			public static hook_Awake <0>__CharacterSelectController_Awake;
		}

		internal static void Register()
		{
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Expected O, but got Unknown
			object obj = <>O.<0>__CharacterSelectController_Awake;
			if (obj == null)
			{
				hook_Awake val = CharacterSelectController_Awake;
				<>O.<0>__CharacterSelectController_Awake = val;
				obj = (object)val;
			}
			CharacterSelectController.Awake += (hook_Awake)obj;
		}

		internal static void Unregister()
		{
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Expected O, but got Unknown
			object obj = <>O.<0>__CharacterSelectController_Awake;
			if (obj == null)
			{
				hook_Awake val = CharacterSelectController_Awake;
				<>O.<0>__CharacterSelectController_Awake = val;
				obj = (object)val;
			}
			CharacterSelectController.Awake -= (hook_Awake)obj;
		}

		private static void CharacterSelectController_Awake(orig_Awake orig, CharacterSelectController self)
		{
			orig.Invoke(self);
			if (!Object.op_Implicit((Object)(object)((Component)self).GetComponent<RelicSelectScreen>()))
			{
				((Component)self).gameObject.AddComponent<RelicSelectScreen>();
			}
			if (!Object.op_Implicit((Object)(object)((Component)self).GetComponent<MySetScreen>()))
			{
				((Component)self).gameObject.AddComponent<MySetScreen>();
			}
		}
	}
	internal sealed class RelicSelectScreen : MonoBehaviour
	{
		private static readonly Color FilterIdle = new Color(0.18f, 0.18f, 0.22f, 1f);

		private static readonly Color FilterOn = new Color(0.35f, 0.28f, 0.12f, 0.95f);

		private static readonly Color FilterDisabled = new Color(0.1f, 0.1f, 0.12f, 0.55f);

		private static readonly RelicRank[] Ranks = new RelicRank[4]
		{
			RelicRank.Normal,
			RelicRank.Powerful,
			RelicRank.Unique,
			RelicRank.Reign
		};

		private HGTextMeshProUGUI _template;

		private GameObject _overlay;

		private GameObject _panel;

		private RelicCategory _activeCategory = RelicCategory.Light;

		private readonly List<RelicRowView> _pool = new List<RelicRowView>();

		private readonly List<RelicInfo> _relics = new List<RelicInfo>();

		private RectTransform _content;

		private ScrollRect _scroll;

		private readonly List<Image> _equippedIcons = new List<Image>();

		private RelicRowView _equippedLight;

		private RelicRowView _equippedRain;

		private RelicRowView _equippedSeed;

		private readonly List<Sprite> _iconBuffer = new List<Sprite>(8);

		private CharacterSelectController _css;

		private RectTransform _openButton;

		private readonly Button[] _rankButtons = (Button[])(object)new Button[4];

		private readonly Image[] _rankImages = (Image[])(object)new Image[4];

		private readonly Button[] _drawbackButtons = (Button[])(object)new Button[2];

		private readonly Image[] _drawbackImages = (Image[])(object)new Image[2];

		private Button _groupButton;

		private Image _groupImage;

		private HGTextMeshProUGUI _groupLabel;

		private GameObject _groupMenu;

		private Button _tagButton;

		private Image _tagImage;

		private HGTextMeshProUGUI _tagLabel;

		private GameObject _tagMenu;

		private Transform _filterParent;

		private RelicRank? _rank;

		private bool? _drawback;

		private RelicFilterGroup _group = RelicFilterGroup.All;

		private RelicFilterTag _tag;

		private bool? _stashDrawback;

		private RelicFilterGroup _stashGroup = RelicFilterGroup.All;

		private RelicFilterTag _stashTag;

		private bool _reignLock;

		internal RectTransform OpenButton => _openButton;

		private void Start()
		{
			_css = ((Component)this).GetComponent<CharacterSelectController>();
			_template = ((Component)this).GetComponentInChildren<HGTextMeshProUGUI>(true);
			if (!Object.op_Implicit((Object)(object)_template))
			{
				Plugin.Log.LogWarning((object)"キャラ選択画面にテキスト雛形がありません。");
				return;
			}
			Transform parent = ((Component)this).transform.Find("SafeArea") ?? ((TMP_Text)_template).transform.parent;
			_openButton = BuildOpenButton(parent);
			_overlay = RelicUiLayout.CreateScreenOverlay("RelicSelectOverlay", 1000);
			BuildPanel(_overlay.transform);
			((Transform)_openButton).SetAsLastSibling();
			SetPanelVisible(visible: false);
			((MonoBehaviour)this).StartCoroutine(RelicUiLayout.PlaceLeftOfLabeledButton(_openButton, (Component)(object)this, 8f, "準備完了", "Ready"));
		}

		private void OnDestroy()
		{
			if (Object.op_Implicit((Object)(object)_overlay))
			{
				Object.Destroy((Object)(object)_overlay);
			}
		}

		private RectTransform BuildOpenButton(Transform parent)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_0009: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Expected O, but got Unknown
			//IL_0033: Unknown result type (might be due to invalid IL or missing references)
			//IL_0042: Unknown result type (might be due to invalid IL or missing references)
			//IL_0051: Unknown result type (might be due to invalid IL or missing references)
			//IL_0060: 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_0099: 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_00ad: 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)
			Color color = RelicUiLayout.SampleDifficultyBlue((Component)(object)this);
			Button val = RelicUiFactory.CreateButton(parent, color, new UnityAction(TogglePanel));
			RelicHoverBorder.Attach(((Component)val).gameObject);
			RelicUiFactory.SetRect((Component)(object)val, new Vector2(0f, 0f), new Vector2(0f, 0f), new Vector2(0f, 0f), new Vector2(36f, 96f), new Vector2(160f, 52f));
			HGTextMeshProUGUI val2 = RelicUiFactory.CreateText(((Component)val).transform, _template, "Label", 20);
			RelicUiFactory.SetRect((Component)(object)val2, Vector2.zero, Vector2.one, new Vector2(0.5f, 0.5f), Vector2.zero, Vector2.zero);
			((TMP_Text)val2).alignment = (TextAlignmentOptions)514;
			((Graphic)val2).raycastTarget = false;
			((TMP_Text)val2).text = Language.GetString("TICK_RELIC_OPEN_BUTTON");
			return ((Component)val).GetComponent<RectTransform>();
		}

		private void BuildPanel(Transform parent)
		{
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			//IL_003d: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_0085: 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_00bb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c5: Expected O, but got Unknown
			//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_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_0132: 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_014b: 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_01ce: Unknown result type (might be due to invalid IL or missing references)
			//IL_01dd: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ec: Unknown result type (might be due to invalid IL or missing references)
			//IL_01fd: Unknown result type (might be due to invalid IL or missing references)
			//IL_020f: Unknown result type (might be due to invalid IL or missing references)
			Image val = RelicUiFactory.CreateImage(parent, "RelicSelectRoot", new Color(0.05f, 0.05f, 0.07f, 0.98f));
			_panel = ((Component)val).gameObject;
			RelicUiFactory.SetRect((Component)(object)val, new Vector2(0.5f, 0.5f), new Vector2(0.5f, 0.5f), new Vector2(0.5f, 0.5f), new Vector2(0f, RelicUiMetrics.PanelPosY), new Vector2(RelicUiMetrics.LeftGutter + RelicUiMetrics.RowWidth + 16f, RelicUiMetrics.PanelHeight));
			Button val2 = RelicUiFactory.CreateButton(_panel.transform, new Color(0.35f, 0.12f, 0.12f, 1f), (UnityAction)delegate
			{
				SetPanelVisible(visible: false);
			});
			RelicUiFactory.SetRect((Component)(object)val2, new Vector2(1f, 1f), new Vector2(1f, 1f), new Vector2(1f, 1f), new Vector2(-8f, -8f), new Vector2(100f, 36f));
			HGTextMeshProUGUI val3 = RelicUiFactory.CreateText(((Component)val2).transform, _template, "CloseLabel");
			RelicUiFactory.SetRect((Component)(object)val3, Vector2.zero, Vector2.one, new Vector2(0.5f, 0.5f), Vector2.zero, Vector2.zero);
			((TMP_Text)val3).alignment = (TextAlignmentOptions)514;
			((TMP_Text)val3).text = Language.GetString("TICK_RELIC_CLOSE_BUTTON");
			BuildEquippedBlock(_panel.transform);
			BuildFilters(_panel.transform);
			_scroll = RelicUiFactory.CreateScroll(_panel.transform, out _content);
			float leftGutter = RelicUiMetrics.LeftGutter;
			RelicUiFactory.SetRect((Component)(object)_scroll, new Vector2(0f, 0f), new Vector2(1f, 1f), new Vector2(0.5f, 0.5f), new Vector2(leftGutter * 0.5f, RelicUiMetrics.ScrollPosY), new Vector2(0f - (leftGutter + 16f), RelicUiMetrics.ScrollSizeY));
			((UnityEvent<Vector2>)(object)_scroll.onValueChanged).AddListener((UnityAction<Vector2>)delegate
			{
				RefreshVisible();
			});
			EnsureRowPool();
		}

		private void BuildEquippedBlock(Transform parent)
		{
			//IL_001b: 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_005e: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c0: 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_00e5: 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_0103: Unknown result type (might be due to invalid IL or missing references)
			//IL_0112: 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_017b: Unknown result type (might be due to invalid IL or missing references)
			//IL_018a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0199: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b0: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b7: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f9: Unknown result type (might be due to invalid IL or missing references)
			//IL_0204: Expected O, but got Unknown
			//IL_021d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0228: Expected O, but got Unknown
			//IL_0241: Unknown result type (might be due to invalid IL or missing references)
			//IL_024c: Expected O, but got Unknown
			Image val = RelicUiFactory.CreateImage(parent, "EquippedDetail", new Color(0f, 0f, 0f, 0.2f));
			RelicUiFactory.SetRect((Component)(object)val, new Vector2(0f, 1f), new Vector2(0f, 1f), new Vector2(0f, 1f), new Vector2(RelicUiMetrics.LeftColumnX, RelicUiMetrics.EquippedTop), new Vector2(RelicUiMetrics.EquippedBlockWidth, RelicUiMetrics.EquippedBlockHeight));
			((Graphic)val).raycastTarget = false;
			AddSectionTitle(((Component)val).transform, 0f, 0f, RelicUiMetrics.EquippedBlockWidth, "セット状況");
			Image val2 = RelicUiFactory.CreateImage(((Component)val).transform, "IconRow", new Color(0.1f, 0.1f, 0.12f, 0.9f));
			RelicUiFactory.SetRect((Component)(object)val2, new Vector2(0f, 1f), new Vector2(1f, 1f), new Vector2(0.5f, 1f), new Vector2(0f, -64f), new Vector2(0f, RelicUiMetrics.Row));
			((Graphic)val2).raycastTarget = false;
			float icon = RelicUiMetrics.Icon;
			float num = 8f;
			for (int i = 0; i < 8; i++)
			{
				Image val3 = RelicUiFactory.CreateImage(((Component)val2).transform, "Icon" + i, Color.white);
				val3.preserveAspect = true;
				((Graphic)val3).raycastTarget = false;
				RelicUiFactory.SetRect((Component)(object)val3, new Vector2(0f, 0.5f), new Vector2(0f, 0.5f), new Vector2(0f, 0.5f), new Vector2(num + (float)i * (icon + 6f), 0f), new Vector2(icon, icon));
				_equippedIcons.Add(val3);
			}
			_equippedLight = RelicRowView.Create(((Component)val).transform, _template, (UnityAction)delegate
			{
				OpenCategory(RelicCategory.Light);
			}, nameHeader: true);
			_equippedRain = RelicRowView.Create(((Component)val).transform, _template, (UnityAction)delegate
			{
				OpenCategory(RelicCategory.Rain);
			}, nameHeader: true);
			_equippedSeed = RelicRowView.Create(((Component)val).transform, _template, (UnityAction)delegate
			{
				OpenCategory(RelicCategory.Seed);
			}, nameHeader: true);
		}

		private void OpenCategory(RelicCategory category)
		{
			_activeCategory = category;
			RebuildList(resetScroll: true);
		}

		private void BuildFilters(Transform parent)
		{
			//IL_0058: Unknown result type (might be due to invalid IL or missing references)
			//IL_0079: Unknown result type (might be due to invalid IL or missing references)
			//IL_0088: 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_00a3: 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_011b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0128: Unknown result type (might be due to invalid IL or missing references)
			//IL_0132: Expected O, but got Unknown
			//IL_0140: Unknown result type (might be due to invalid IL or missing references)
			//IL_014f: Unknown result type (might be due to invalid IL or missing references)
			//IL_015e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0170: Unknown result type (might be due to invalid IL or missing references)
			//IL_017c: 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_01a9: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b8: 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_01c2: Unknown result type (might be due to invalid IL or missing references)
			//IL_028b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0295: Expected O, but got Unknown
			//IL_02d5: Unknown result type (might be due to invalid IL or missing references)
			//IL_02df: Expected O, but got Unknown
			//IL_0317: Unknown result type (might be due to invalid IL or missing references)
			//IL_0323: Unknown result type (might be due to invalid IL or missing references)
			//IL_032d: Expected O, but got Unknown
			//IL_0342: Unknown result type (might be due to invalid IL or missing references)
			//IL_0351: Unknown result type (might be due to invalid IL or missing references)
			//IL_0360: Unknown result type (might be due to invalid IL or missing references)
			//IL_0368: Unknown result type (might be due to invalid IL or missing references)
			//IL_0373: Unknown result type (might be due to invalid IL or missing references)
			//IL_03bd: Unknown result type (might be due to invalid IL or missing references)
			//IL_03c2: Unknown result type (might be due to invalid IL or missing references)
			//IL_03d1: Unknown result type (might be due to invalid IL or missing references)
			//IL_03e0: Unknown result type (might be due to invalid IL or missing references)
			//IL_03ef: Unknown result type (might be due to invalid IL or missing references)
			//IL_044f: Unknown result type (might be due to invalid IL or missing references)
			//IL_045b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0465: Expected O, but got Unknown
			//IL_047a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0489: Unknown result type (might be due to invalid IL or missing references)
			//IL_0498: Unknown result type (might be due to invalid IL or missing references)
			//IL_04a0: Unknown result type (might be due to invalid IL or missing references)
			//IL_04ab: Unknown result type (might be due to invalid IL or missing references)
			//IL_04f5: Unknown result type (might be due to invalid IL or missing references)
			//IL_04fa: Unknown result type (might be due to invalid IL or missing references)
			//IL_0509: Unknown result type (might be due to invalid IL or missing references)
			//IL_0518: Unknown result type (might be due to invalid IL or missing references)
			//IL_0527: Unknown result type (might be due to invalid IL or missing references)
			_filterParent = parent;
			float filterX = RelicUiMetrics.FilterX;
			float filterHeadingWidth = RelicUiMetrics.FilterHeadingWidth;
			float num = filterX + filterHeadingWidth;
			float filterControlsWidth = RelicUiMetrics.FilterControlsWidth;
			float num2 = -8f;
			float num3 = 4f;
			float num4 = (filterControlsWidth - 3f * num3) / 4f;
			Image val = RelicUiFactory.CreateImage(parent, "FilterDetail", new Color(0f, 0f, 0f, 0.2f));
			((Graphic)val).raycastTarget = false;
			RelicUiFactory.SetRect((Component)(object)val, new Vector2(0f, 1f), new Vector2(0f, 1f), new Vector2(0f, 1f), new Vector2(RelicUiMetrics.FilterX, num2), new Vector2(RelicUiMetrics.FilterWidth, 64f + RelicUiMetrics.FilterBlockHeight));
			AddSectionTitle(parent, filterX, num2, RelicUiMetrics.FilterWidth, "絞り込み");
			num2 -= 64f;
			AddFilterHeading(parent, filterX, num2, filterHeadingWidth, "ランク:");
			for (int i = 0; i < Ranks.Length; i++)
			{
				RelicRank rank = Ranks[i];
				Button val2 = RelicUiFactory.CreateButton(parent, FilterIdle, (UnityAction)delegate
				{
					SelectRank(rank);
				});
				RelicUiFactory.SetRect((Component)(object)val2, new Vector2(0f, 1f), new Vector2(0f, 1f), new Vector2(0f, 1f), new Vector2(num + (float)i * (num4 + num3), num2), new Vector2(num4, 32f));
				HGTextMeshProUGUI val3 = RelicUiFactory.CreateText(((Component)val2).transform, _template, "Label", 14);
				RelicUiFactory.SetRect((Component)(object)val3, Vector2.zero, Vector2.one, new Vector2(0.5f, 0.5f), Vector2.zero, Vector2.zero);
				((TMP_Text)val3).alignment = (TextAlignmentOptions)514;
				((TMP_Text)val3).enableWordWrapping = false;
				((Graphic)val3).raycastTarget = false;
				((TMP_Text)val3).overflowMode = (TextOverflowModes)1;
				((TMP_Text)val3).text = RelicFilter.RankCaption(rank, japanese: true);
				_rankButtons[i] = val2;
				ref Image reference = ref _rankImages[i];
				Graphic targetGraphic = ((Selectable)val2).targetGraphic;
				reference = (Image)(object)((targetGraphic is Image) ? targetGraphic : null);
			}
			num2 -= 38f;
			AddFilterHeading(parent, filterX, num2, filterHeadingWidth, "デメリット:");
			float num5 = (filterControlsWidth - num3) / 2f;
			_drawbackButtons[0] = MakeToggleRow(parent, num, num2, num5, Language.GetString("TICK_RELIC_DRAWBACK_NONE"), (UnityAction)delegate
			{
				SelectDrawback(hasDrawback: false);
			});
			ref Image reference2 = ref _drawbackImages[0];
			Graphic targetGraphic2 = ((Selectable)_drawbackButtons[0]).targetGraphic;
			reference2 = (Image)(object)((targetGraphic2 is Image) ? targetGraphic2 : null);
			_drawbackButtons[1] = MakeToggleRow(parent, num + num5 + num3, num2, num5, Language.GetString("TICK_RELIC_DRAWBACK_HAS"), (UnityAction)delegate
			{
				SelectDrawback(hasDrawback: true);
			});
			ref Image reference3 = ref _drawbackImages[1];
			Graphic targetGraphic3 = ((Selectable)_drawbackButtons[1]).targetGraphic;
			reference3 = (Image)(object)((targetGraphic3 is Image) ? targetGraphic3 : null);
			num2 -= 38f;
			AddFilterHeading(parent, filterX, num2, filterHeadingWidth, "効果大枠:");
			_groupButton = RelicUiFactory.CreateButton(parent, FilterIdle, new UnityAction(ToggleGroupMenu));
			RelicUiFactory.SetRect((Component)(object)_groupButton, new Vector2(0f, 1f), new Vector2(0f, 1f), new Vector2(0f, 1f), new Vector2(num, num2), new Vector2(filterControlsWidth, 32f));
			ref Image groupImage = ref _groupImage;
			Graphic targetGraphic4 = ((Selectable)_groupButton).targetGraphic;
			groupImage = (Image)(object)((targetGraphic4 is Image) ? targetGraphic4 : null);
			_groupLabel = RelicUiFactory.CreateText(((Component)_groupButton).transform, _template, "Label", 14);
			RelicUiFactory.SetRect((Component)(object)_groupLabel, Vector2.zero, Vector2.one, new Vector2(0f, 0.5f), new Vector2(8f, 0f), new Vector2(-12f, 0f));
			((TMP_Text)_groupLabel).alignment = (TextAlignmentOptions)4097;
			((TMP_Text)_groupLabel).enableWordWrapping = false;
			((Graphic)_groupLabel).raycastTarget = false;
			((TMP_Text)_groupLabel).overflowMode = (TextOverflowModes)0;
			num2 -= 38f;
			AddFilterHeading(parent, filterX, num2, filterHeadingWidth, "効果詳細:");
			_tagButton = RelicUiFactory.CreateButton(parent, FilterIdle, new UnityAction(ToggleTagMenu));
			RelicUiFactory.SetRect((Component)(object)_tagButton, new Vector2(0f, 1f), new Vector2(0f, 1f), new Vector2(0f, 1f), new Vector2(num, num2), new Vector2(filterControlsWidth, 32f));
			ref Image tagImage = ref _tagImage;
			Graphic targetGraphic5 = ((Selectable)_tagButton).targetGraphic;
			tagImage = (Image)(object)((targetGraphic5 is Image) ? targetGraphic5 : null);
			_tagLabel = RelicUiFactory.CreateText(((Component)_tagButton).transform, _template, "Label", 14);
			RelicUiFactory.SetRect((Component)(object)_tagLabel, Vector2.zero, Vector2.one, new Vector2(0f, 0.5f), new Vector2(8f, 0f), new Vector2(-12f, 0f));
			((TMP_Text)_tagLabel).alignment = (TextAlignmentOptions)4097;
			((TMP_Text)_tagLabel).enableWordWrapping = false;
			((Graphic)_tagLabel).raycastTarget = false;
			((TMP_Text)_tagLabel).overflowMode = (TextOverflowModes)0;
			BuildGroupMenu(parent, num, num2 + 32f + 6f);
			RefreshFilterVisuals();
		}

		private void AddSectionTitle(Transform parent, float x, float y, float w, string text)
		{
			//IL_0020: 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_003e: 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_005d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0089: Unknown result type (might be due to invalid IL or missing references)
			HGTextMeshProUGUI val = RelicUiFactory.CreateText(parent, _template, "SectionTitle", 25);
			RelicUiFactory.SetRect((Component)(object)val, new Vector2(0f, 1f), new Vector2(0f, 1f), new Vector2(0f, 1f), new Vector2(x + 8f, y), new Vector2(w - 16f, 64f));
			((TMP_Text)val).alignment = (TextAlignmentOptions)4097;
			((TMP_Text)val).margin = new Vector4(0f, 16f, 0f, 0f);
			((TMP_Text)val).enableWordWrapping = false;
			((TMP_Text)val).enableAutoSizing = false;
			((TMP_Text)val).fontSize = 25f;
			((Graphic)val).raycastTarget = false;
			((TMP_Text)val).overflowMode = (TextOverflowModes)1;
			((TMP_Text)val).text = text;
		}

		private void AddFilterHeading(Transform parent, float x, float y, float w, string text)
		{
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0039: Unknown result type (might be due to invalid IL or missing references)
			//IL_0048: Unknown result type (might be due to invalid IL or missing references)
			//IL_0057: Unknown result type (might be due to invalid IL or missing references)
			//IL_005e: 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_008f: 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_00a3: 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)
			Image val = RelicUiFactory.CreateImage(parent, "FilterHeading", new Color(0.12f, 0.12f, 0.14f, 0.85f));
			((Graphic)val).raycastTarget = false;
			RelicUiFactory.SetRect((Component)(object)val, new Vector2(0f, 1f), new Vector2(0f, 1f), new Vector2(0f, 1f), new Vector2(x, y), new Vector2(w, 32f));
			HGTextMeshProUGUI val2 = RelicUiFactory.CreateText(((Component)val).transform, _template, "Label", 14);
			RelicUiFactory.SetRect((Component)(object)val2, Vector2.zero, Vector2.one, new Vector2(1f, 0.5f), Vector2.zero, new Vector2(-4f, 0f));
			((TMP_Text)val2).alignment = (TextAlignmentOptions)4100;
			((TMP_Text)val2).enableWordWrapping = false;
			((Graphic)val2).raycastTarget = false;
			((TMP_Text)val2).overflowMode = (TextOverflowModes)0;
			((TMP_Text)val2).text = text;
		}

		private Button MakeToggleRow(Transform parent, float x, float y, float w, string text, UnityAction onClick)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//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_003f: 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_0070: Unknown result type (might be due to invalid IL or missing references)
			//IL_0075: Unknown result type (might be due to invalid IL or missing references)
			//IL_0084: Unknown result type (might be due to invalid IL or missing references)
			//IL_0089: 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)
			Button val = RelicUiFactory.CreateButton(parent, FilterIdle, onClick);
			RelicUiFactory.SetRect((Component)(object)val, new Vector2(0f, 1f), new Vector2(0f, 1f), new Vector2(0f, 1f), new Vector2(x, y), new Vector2(w, 32f));
			HGTextMeshProUGUI val2 = RelicUiFactory.CreateText(((Component)val).transform, _template, "Label", 14);
			RelicUiFactory.SetRect((Component)(object)val2, Vector2.zero, Vector2.one, new Vector2(0.5f, 0.5f), Vector2.zero, Vector2.zero);
			((TMP_Text)val2).alignment = (TextAlignmentOptions)514;
			((TMP_Text)val2).enableWordWrapping = false;
			((Graphic)val2).raycastTarget = false;
			((TMP_Text)val2).text = text;
			return val;
		}

		private void BuildGroupMenu(Transform parent, float x, float headerY)
		{
			//IL_0049: Unknown result type (might be due to invalid IL or missing references)
			//IL_0053: Expected O, but got Unknown
			//IL_0090: Unknown result type (might be due to invalid IL or missing references)
			//IL_009a: Expected O, but got Unknown
			int num = RelicFilter.Groups.Length + 1;
			Transform parent2 = CreateFilterMenuFrame(parent, "GroupMenu", x, headerY - 32f, RelicUiMetrics.FilterControlsWidth, (float)num * 32f, out _groupMenu);
			AddMenuOption(parent2, 0, 32f, RelicFilter.GroupCaption(RelicFilterGroup.All, japanese: true), (UnityAction)delegate
			{
				SelectGroup(RelicFilterGroup.All);
			});
			for (int num2 = 0; num2 < RelicFilter.Groups.Length; num2++)
			{
				RelicFilterGroup group = RelicFilter.Groups[num2];
				AddMenuOption(parent2, num2 + 1, 32f, RelicFilter.GroupCaption(group, japanese: true), (UnityAction)delegate
				{
					SelectGroup(group);
				});
			}
			_groupMenu.SetActive(false);
		}

		private void RebuildTagMenu()
		{
			//IL_00d7: 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_0121: Unknown result type (might be due to invalid IL or missing references)
			//IL_012b: Expected O, but got Unknown
			//IL_0170: Unknown result type (might be due to invalid IL or missing references)
			//IL_017a: Expected O, but got Unknown
			if (Object.op_Implicit((Object)(object)_tagMenu))
			{
				Object.Destroy((Object)(object)_tagMenu);
				_tagMenu = null;
			}
			if ((Object)(object)_filterParent == (Object)null || (Object)(object)_tagButton == (Object)null)
			{
				return;
			}
			List<RelicFilterTag> list = new List<RelicFilterTag>();
			if (_group != RelicFilterGroup.All)
			{
				RelicFilterTag[] tags = RelicFilter.Tags;
				foreach (RelicFilterTag relicFilterTag in tags)
				{
					if (relicFilterTag.Group == _group && RelicFilter.TagExistsInCatalog(relicFilterTag))
					{
						list.Add(relicFilterTag);
					}
				}
			}
			int num = list.Count + 1;
			RectTransform component = ((Component)_tagButton).GetComponent<RectTransform>();
			Transform parent = CreateFilterMenuFrame(_filterParent, "TagMenu", component.anchoredPosition.x, component.anchoredPosition.y - 32f, RelicUiMetrics.FilterControlsWidth, (float)num * 32f, out _tagMenu);
			AddMenuOption(parent, 0, 32f, RelicFilter.TagCaption(null, japanese: true), (UnityAction)delegate
			{
				SelectTag(null);
			});
			for (int num2 = 0; num2 < list.Count; num2++)
			{
				RelicFilterTag tag = list[num2];
				AddMenuOption(parent, num2 + 1, 32f, RelicFilter.TagCaption(tag, japanese: true), (UnityAction)delegate
				{
					SelectTag(tag);
				});
			}
			_tagMenu.SetActive(false);
		}

		private Transform CreateFilterMenuFrame(Transform parent, string name, float x, float y, float w, float h, out GameObject frameGo)
		{
			//IL_0009: Unknown result type (might be due to invalid IL or missing references)
			//IL_0027: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Unknown result type (might be due to invalid IL or missing references)
			//IL_0045: Unknown result type (might be due to invalid IL or missing references)
			//IL_0051: 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_0094: 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_00bb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d9: Unknown result type (might be due to invalid IL or missing references)
			float num = 2f;
			Image val = RelicUiFactory.CreateImage(parent, name, Color.white);
			((Graphic)val).raycastTarget = false;
			RelicUiFactory.SetRect((Component)(object)val, new Vector2(0f, 1f), new Vector2(0f, 1f), new Vector2(0f, 1f), new Vector2(x - num, y + num), new Vector2(w + num * 2f, h + num * 2f));
			Image val2 = RelicUiFactory.CreateImage(((Component)val).transform, "Inner", new Color(0.08f, 0.08f, 0.1f, 0.98f));
			((Graphic)val2).raycastTarget = true;
			RectTransform rectTransform = ((Graphic)val2).rectTransform;
			rectTransform.anchorMin = Vector2.zero;
			rectTransform.anchorMax = Vector2.one;
			rectTransform.offsetMin = new Vector2(num, num);
			rectTransform.offsetMax = new Vector2(0f - num, 0f - num);
			frameGo = ((Component)val).gameObject;
			return ((Component)val2).transform;
		}

		private void AddMenuOption(Transform parent, int index, float rowH, string text, UnityAction onClick)
		{
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Unknown result type (might be due to invalid IL or missing references)
			//IL_003d: Unknown result type (might be due to invalid IL or missing references)
			//IL_004c: Unknown result type (might be due to invalid IL or missing references)
			//IL_005b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0066: Unknown result type (might be due to invalid IL or missing references)
			//IL_008b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0090: Unknown result type (might be due to invalid IL or missing references)
			//IL_009f: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ae: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bd: Unknown result type (might be due to invalid IL or missing references)
			Button val = RelicUiFactory.CreateButton(parent, new Color(0.16f, 0.16f, 0.2f, 1f), onClick);
			RelicUiFactory.SetRect((Component)(object)val, new Vector2(0f, 1f), new Vector2(1f, 1f), new Vector2(0.5f, 1f), new Vector2(0f, (float)(-index) * rowH), new Vector2(0f, rowH));
			HGTextMeshProUGUI val2 = RelicUiFactory.CreateText(((Component)val).transform, _template, "Option", 13);
			RelicUiFactory.SetRect((Component)(object)val2, Vector2.zero, Vector2.one, new Vector2(0f, 0.5f), new Vector2(8f, 0f), new Vector2(-12f, 0f));
			((TMP_Text)val2).alignment = (TextAlignmentOptions)4097;
			((TMP_Text)val2).enableWordWrapping = false;
			((Graphic)val2).raycastTarget = false;
			((TMP_Text)val2).overflowMode = (TextOverflowModes)0;
			((TMP_Text)val2).text = text;
		}

		private void SelectRank(RelicRank rank)
		{
			RelicRank? relicRank = ((_rank == rank) ? ((RelicRank?)null) : new RelicRank?(rank));
			bool flag = _rank == RelicRank.Reign;
			bool flag2 = relicRank == RelicRank.Reign;
			if (flag2 && !flag)
			{
				_stashDrawback = _drawback;
				_stashGroup = _group;
				_stashTag = _tag;
				_reignLock = true;
				_drawback = null;
				_group = RelicFilterGroup.All;
				_tag = null;
			}
			else if (!flag2 && flag && _reignLock)
			{
				_drawback = _stashDrawback;
				_group = _stashGroup;
				_tag = _stashTag;
				_reignLock = false;
			}
			_rank = relicRank;
			CloseMenus();
			RefreshFilterVisuals();
			RebuildList(resetScroll: true);
		}

		private void SelectDrawback(bool hasDrawback)
		{
			if (!_reignLock)
			{
				_drawback = ((_drawback == hasDrawback) ? ((bool?)null) : new bool?(hasDrawback));
				CloseMenus();
				RefreshFilterVisuals();
				RebuildList(resetScroll: true);
			}
		}

		private void SelectGroup(RelicFilterGroup group)
		{
			if (!_reignLock)
			{
				_group = group;
				_tag = null;
				CloseMenus();
				RebuildTagMenu();
				RefreshFilterVisuals();
				RebuildList(resetScroll: true);
			}
		}

		private void SelectTag(RelicFilterTag tag)
		{
			if (!_reignLock && _group != RelicFilterGroup.All)
			{
				_tag = tag;
				CloseMenus();
				RefreshFilterVisuals();
				RebuildList(resetScroll: true);
			}
		}

		private void ToggleGroupMenu()
		{
			if (!_reignLock)
			{
				bool flag = Object.op_Implicit((Object)(object)_groupMenu) && !_groupMenu.activeSelf;
				CloseMenus();
				if (flag && Object.op_Implicit((Object)(object)_groupMenu))
				{
					_groupMenu.SetActive(true);
					_groupMenu.transform.SetAsLastSibling();
				}
			}
		}

		private void ToggleTagMenu()
		{
			if (!_reignLock && _group != RelicFilterGroup.All)
			{
				bool flag = Object.op_Implicit((Object)(object)_tagMenu) && _tagMenu.activeSelf;
				RebuildTagMenu();
				CloseMenus();
				if (!flag && Object.op_Implicit((Object)(object)_tagMenu))
				{
					_tagMenu.SetActive(true);
					_tagMenu.transform.SetAsLastSibling();
				}
			}
		}

		private void CloseMenus()
		{
			if (Object.op_Implicit((Object)(object)_groupMenu))
			{
				_groupMenu.SetActive(false);
			}
			if (Object.op_Implicit((Object)(object)_tagMenu))
			{
				_tagMenu.SetActive(false);
			}
		}

		private void RefreshFilterVisuals()
		{
			//IL_004d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0046: Unknown result type (might be due to invalid IL or missing references)
			//IL_0178: Unknown result type (might be due to invalid IL or missing references)
			//IL_0171: 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_01cb: Unknown result type (might be due to invalid IL or missing references)
			for (int i = 0; i < Ranks.Length; i++)
			{
				if (Object.op_Implicit((Object)(object)_rankImages[i]))
				{
					((Graphic)_rankImages[i]).color = ((_rank == Ranks[i]) ? FilterOn : FilterIdle);
				}
			}
			bool flag = !_reignLock;
			SetButtonEnabled(_drawbackButtons[0], _drawbackImages[0], flag, _drawback == false);
			SetButtonEnabled(_drawbackButtons[1], _drawbackImages[1], flag, _drawback == true);
			SetButtonEnabled(_groupButton, _groupImage, flag, _group != RelicFilterGroup.All);
			bool flag2 = flag && _group != RelicFilterGroup.All;
			SetButtonEnabled(_tagButton, _tagImage, flag2, _tag != null);
			if (Object.op_Implicit((Object)(object)_groupLabel))
			{
				((TMP_Text)_groupLabel).text = RelicFilter.GroupCaption(_group, japanese: true);
				((Graphic)_groupLabel).color = (Color)(flag ? Color.white : new Color(1f, 1f, 1f, 0.4f));
			}
			if (Object.op_Implicit((Object)(object)_tagLabel))
			{
				((TMP_Text)_tagLabel).text = RelicFilter.TagCaption(_tag, japanese: true);
				((Graphic)_tagLabel).color = (Color)(flag2 ? Color.white : new Color(1f, 1f, 1f, 0.4f));
			}
		}

		private static void SetButtonEnabled(Button button, Image image, bool enabled, bool selected)
		{
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0027: Unknown result type (might be due to invalid IL or missing references)
			if (Object.op_Implicit((Object)(object)button))
			{
				((Selectable)button).interactable = enabled;
			}
			if (Object.op_Implicit((Object)(object)image))
			{
				((Graphic)image).color = ((!enabled) ? FilterDisabled : (selected ? FilterOn : FilterIdle));
			}
		}

		private void TogglePanel()
		{
			bool flag = Object.op_Implicit((Object)(object)_panel) && _panel.activeSelf;
			if (!flag)
			{
				((Component)this).GetComponent<MySetScreen>()?.SetPanelVisible(visible: false);
			}
			SetPanelVisible(!flag);
		}

		internal void SetPanelVisible(bool visible)
		{
			if (Object.op_Implicit((Object)(object)_panel))
			{
				_panel.SetActive(visible);
			}
			CloseMenus();
			if (visible)
			{
				RefreshSlots();
				RebuildList(resetScroll: true);
			}
		}

		private void Update()
		{
			if (Object.op_Implicit((Object)(object)_panel) && _panel.activeSelf)
			{
				RefreshSlots();
			}
		}

		private void RefreshSlots()
		{
			if (!Object.op_Implicit((Object)(object)_css))
			{
				_css = ((Component)this).GetComponent<CharacterSelectController>();
			}
			SurvivorDef survivor = MySetSnapshot.CurrentSurvivor(_css);
			Loadout loadout = MySetSnapshot.CurrentLoadout(_css, MySetSnapshot.ResolveLocalUser(_css));
			MySetSnapshot.CollectLoadoutIcons(survivor, loadout, _iconBuffer);
			BindIconRow(_equippedIcons, MySetSnapshot.Portrait(survivor), _iconBuffer);
			BindEquippedRelic(_equippedLight, RelicCategory.Light, RelicLoadoutState.GetSelected(RelicCategory.Light), 1, _activeCategory == RelicCategory.Light);
			BindEquippedRelic(_equippedRain, RelicCategory.Rain, RelicLoadoutState.GetSelected(RelicCategory.Rain), 2, _activeCategory == RelicCategory.Rain);
			BindEquippedRelic(_equippedSeed, RelicCategory.Seed, RelicLoadoutState.GetSelected(RelicCategory.Seed), 3, _activeCategory == RelicCategory.Seed);
		}

		private static void BindIconRow(List<Image> images, Sprite portrait, List<Sprite> loadout)
		{
			//IL_0063: Unknown result type (might be due to invalid IL or missing references)
			for (int i = 0; i < images.Count; i++)
			{
				Image val = images[i];
				if (Object.op_Implicit((Object)(object)val))
				{
					Sprite val2 = null;
					if (i == 0)
					{
						val2 = portrait;
					}
					else if (i - 1 < loadout.Count)
					{
						val2 = loadout[i - 1];
					}
					((Behaviour)val).enabled = Object.op_Implicit((Object)(object)val2);
					val.sprite = val2;
					((Graphic)val).color = Color.white;
				}
			}
		}

		private static void BindEquippedRelic(RelicRowView row, RelicCategory category, string id, int index, bool selected)
		{
			if (row != null)
			{
				float extraDown = RelicUiMetrics.EquippedNameExtra(index);
				RelicInfo relicInfo = RelicCatalog.Find(id);
				if (relicInfo == null)
				{
					row.ShowEmpty(category, index, extraDown);
				}
				else
				{
					row.Show(relicInfo, selected, index, extraDown);
				}
			}
		}

		private void RebuildList(bool resetScroll)
		{
			//IL_00a1: Unknown result type (might be due to invalid IL or missing references)
			_relics.Clear();
			foreach (RelicInfo item in RelicCatalog.UnlockedInCategory(_activeCategory))
			{
				if (RelicFilter.Matches(item, _rank, _drawback, _group, _tag))
				{
					_relics.Add(item);
				}
			}
			if (Object.op_Implicit((Object)(object)_content))
			{
				_content.sizeDelta = new Vector2(0f, (float)_relics.Count * RelicUiMetrics.Row);
			}
			EnsureRowPool();
			Canvas.ForceUpdateCanvases();
			if (resetScroll && Object.op_Implicit((Object)(object)_scroll) && !TryScrollToSelected())
			{
				_scroll.verticalNormalizedPosition = 1f;
			}
			RefreshVisible();
			RefreshSlots();
		}

		private bool TryScrollToSelected()
		{
			RelicInfo selectedRelic = RelicLoadoutState.GetSelectedRelic(_activeCategory);
			if (selectedRelic == null || (Object)(object)_scroll == (Object)null || (Object)(object)_content == (Object)null)
			{
				return false;
			}
			int num = -1;
			for (int i = 0; i < _relics.Count; i++)
			{
				if (_relics[i] != null && _relics[i].Id == selectedRelic.Id)
				{
					num = i;
					break;
				}
			}
			if (num < 0)
			{
				return false;
			}
			float listViewportHeight = RelicUiMetrics.ListViewportHeight;
			float num2 = Mathf.Max((float)_relics.Count * RelicUiMetrics.Row, listViewportHeight);
			float num3 = Mathf.Max(0f, num2 - listViewportHeight);
			if (num3 <= 0f)
			{
				_scroll.verticalNormalizedPosition = 1f;
				return true;
			}
			float num4 = (float)num * RelicUiMetrics.Row - (listViewportHeight - RelicUiMetrics.Row) * 0.5f;
			num4 = Mathf.Clamp(num4, 0f, num3);
			_scroll.verticalNormalizedPosition = 1f - num4 / num3;
			return true;
		}

		private void EnsureRowPool()
		{
			if (Object.op_Implicit((Object)(object)_content) && Object.op_Implicit((Object)(object)_template))
			{
				while (_pool.Count < RelicUiMetrics.VirtualPoolSize)
				{
					_pool.Add(BuildPooledRow((Transform)(object)_content));
				}
			}
		}

		private void RefreshVisible()
		{
			//IL_0036: 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)
			if ((Object)(object)_content == (Object)null || (Object)(object)_scroll == (Object)null)
			{
				return;
			}
			float listViewportHeight = RelicUiMetrics.ListViewportHeight;
			Rect rect = _content.rect;
			float num = Mathf.Max(((Rect)(ref rect)).height, listViewportHeight);
			float num2 = Mathf.Max(0f, num - listViewportHeight);
			float num3 = (1f - _scroll.verticalNormalizedPosition) * num2;
			int num4 = Mathf.Max(0, Mathf.FloorToInt(num3 / RelicUiMetrics.Row) - 1);
			for (int i = 0; i < _pool.Count; i++)
			{
				int num5 = num4 + i;
				RelicRowView relicRowView = _pool[i];
				if (num5 >= _relics.Count)
				{
					relicRowView.Hide();
					continue;
				}
				RelicInfo relicInfo = _relics[num5];
				bool selected = RelicLoadoutState.IsSelected(relicInfo.Id);
				relicRowView.Show(relicInfo, selected, num5);
			}
		}

		private RelicRowView BuildPooledRow(Transform parent)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002f: Expected O, but got Unknown
			RelicRowView view = null;
			view = RelicRowView.Create(parent, _template, (UnityAction)delegate
			{
				if (view.Relic != null)
				{
					RelicLoadoutState.TrySelect(view.Relic.Id);
					RefreshSlots();
					RefreshVisible();
				}
			});
			return view;
		}
	}
	internal static class RelicGameOverUi
	{
		[CompilerGenerated]
		private static class <>O
		{
			public static hook_Awake <0>__GameEndReportPanelController_Awake;
		}

		internal static void Register()
		{
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Expected O, but got Unknown
			object obj = <>O.<0>__GameEndReportPanelController_Awake;
			if (obj == null)
			{
				hook_Awake val = GameEndReportPanelController_Awake;
				<>O.<0>__GameEndReportPanelController_Awake = val;
				obj = (object)val;
			}
			GameEndReportPanelController.Awake += (hook_Awake)obj;
		}

		internal static void Unregister()
		{
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Expected O, but got Unknown
			object obj = <>O.<0>__GameEndReportPanelController_Awake;
			if (obj == null)
			{
				hook_Awake val = GameEndReportPanelController_Awake;
				<>O.<0>__GameEndReportPanelController_Awake = val;
				obj = (object)val;
			}
			GameEndReportPanelController.Awake -= (hook_Awake)obj;
		}

		private static void GameEndReportPanelController_Awake(orig_Awake orig, GameEndReportPanelController self)
		{
			orig.Invoke(self);
			if (!Object.op_Implicit((Object)(object)((Component)self).GetComponent<RelicUnlockScreen>()))
			{
				((Component)self).gameObject.AddComponent<RelicUnlockScreen>();
			}
		}
	}
	internal sealed class RelicUnlockScreen : MonoBehaviour
	{
		private const float PanelHeightScale = 1.6f;

		private GameObject _overlay;

		private GameObject _panel;

		private RectTransform _openButton;

		private Transform _content;

		private HGTextMeshProUGUI _template;

		private float _lastToggleTime;

		private void Start()
		{
			//IL_0076: Unknown result type (might be due to invalid IL or missing references)
			//IL_0080: Expected O, but got Unknown
			//IL_00ad: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c5: 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_0116: Unknown result type (might be due to invalid IL or missing references)
			//IL_0125: Unknown result type (might be due to invalid IL or missing references)
			//IL_0134: Unknown result type (might be due to invalid IL or missing references)
			//IL_0139: Unknown result type (might be due to invalid IL or missing references)
			//IL_015a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0173: Unknown result type (might be due to invalid IL or missing references)
			//IL_0178: Unknown result type (might be due to invalid IL or missing references)
			//IL_0180: Unknown result type (might be due to invalid IL or missing references)
			//IL_01af: Unknown result type (might be due to invalid IL or missing references)
			//IL_01be: Unknown result type (might be due to invalid IL or missing references)
			//IL_01cd: 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_01eb: 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_0226: Expected O, but got Unknown
			//IL_0251: Unknown result type (might be due to invalid IL or missing references)
			//IL_0256: Unknown result type (might be due to invalid IL or missing references)
			//IL_0265: Unknown result type (might be due to invalid IL or missing references)
			//IL_026a: 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_02dd: Unknown result type (might be due to invalid IL or missing references)
			//IL_02e9: Unknown result type (might be due to invalid IL or missing references)
			//IL_02f3: Expected O, but got Unknown
			//IL_0301: Unknown result type (might be due to invalid IL or missing references)
			//IL_0310: Unknown result type (might be due to invalid IL or missing references)
			//IL_031f: Unknown result type (might be due to invalid IL or missing references)
			//IL_032e: Unknown result type (might be due to invalid IL or missing references)
			//IL_033d: 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_036a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0379: Unknown result type (might be due to invalid IL or missing references)
			//IL_037e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0383: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_03ff: Unknown result type (might be due to invalid IL or missing references)
			//IL_040e: 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_0478: Unknown result type (might be due to invalid IL or missing references)
			//IL_0487: Unknown result type (might be due to invalid IL or missing references)
			//IL_0496: Unknown result type (might be due to invalid IL or missing references)
			//IL_04a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_04b4: Unknown result type (might be due to invalid IL or missing references)
			_template = ((Component)this).GetComponentInChildren<HGTextMeshProUGUI>(true);
			if (Object.op_Implicit((Object)(object)_template))
			{
				Transform parent = ((Component)this).transform.Find("SafeArea") ?? ((Component)this).transform;
				_overlay = new GameObject("RelicUnlockOverlay", new Type[3]
				{
					typeof(RectTransform),
					typeof(Canvas),
					typeof(GraphicRaycaster)
				});
				Canvas component = _overlay.GetComponent<Canvas>();
				component.renderMode = (RenderMode)0;
				component.sortingOrder = 32760;
				RectTransform component2 = _overlay.GetComponent<RectTransform>();
				component2.anchorMin = Vector2.zero;
				component2.anchorMax = Vector2.one;
				component2.sizeDelta = Vector2.zero;
				Image val = RelicUiFactory.CreateImage(_overlay.transform, "RelicUnlockRoot", new Color(0.05f, 0.05f, 0.07f, 0.98f));
				_panel = ((Component)val).gameObject;
				RelicUiFactory.SetRect((Component)(object)val, new Vector2(0.5f, 0.5f), new Vector2(0.5f, 0.5f), new Vector2(0.5f, 0.5f), Vector2.zero, new Vector2(RelicUiMetrics.RowWidth + 40f, (RelicUiMetrics.ViewportHeight + 80f) * 1.6f));
				_panel.SetActive(false);
				Color color = RelicUiLayout.SampleDifficultyBlue((Component)(object)this);
				Image val2 = RelicUiFactory.CreateImage(parent, "RelicUnlockOpenButton", color);
				_openButton = ((Graphic)val2).rectTransform;
				RelicHoverBorder.Attach(((Component)val2).gameObject);
				RelicUiFactory.SetRect((Component)(object)val2, new Vector2(1f, 0f), new Vector2(1f, 0f), new Vector2(1f, 0.5f), new Vector2(-8f, 40f), new Vector2(240f, 44f));
				HGButton val3 = ((Component)val2).gameObject.AddComponent<HGButton>();
				((Selectable)val3).targetGraphic = (Graphic)(object)val2;
				((UnityEvent)((Button)val3).onClick).AddListener(new UnityAction(TogglePanel));
				((Component)val2).transform.SetAsLastSibling();
				HGTextMeshProUGUI val4 = RelicUiFactory.CreateText(((Component)val2).tra