Decompiled source of RoundsTheGathering v1.0.4

RoundsTheGathering.dll

Decompiled a day ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
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.Logging;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using Photon.Pun;
using RoundsTheGathering.Data;
using RoundsTheGathering.GameIntegration;
using RoundsTheGathering.Networking;
using RoundsTheGathering.UI;
using TMPro;
using UnboundLib;
using UnboundLib.GameModes;
using UnboundLib.Networking;
using UnboundLib.Utils;
using UnboundLib.Utils.UI;
using UnityEngine;
using UnityEngine.Events;
using UnityEngine.UI;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETFramework,Version=v4.7.1", FrameworkDisplayName = ".NET Framework 4.7.1")]
[assembly: AssemblyCompany("RoundsTheGathering")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+661a91535814621160b5d94d61679bade4fe1c2d")]
[assembly: AssemblyProduct("Deck picking ability for ROUNDS (like MAGIC)")]
[assembly: AssemblyTitle("RoundsTheGathering")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.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 RoundsTheGathering
{
	public static class CardPrerequisiteRegistry
	{
		private static readonly Dictionary<string, string> _prerequisites = new Dictionary<string, string>();

		public static int Count => _prerequisites.Count;

		public static void RegisterPrerequisite(string cardName, string requiredCardName)
		{
			if (!string.IsNullOrEmpty(cardName) && !string.IsNullOrEmpty(requiredCardName))
			{
				_prerequisites[cardName] = requiredCardName;
			}
		}

		public static bool HasPrerequisite(string cardName)
		{
			if (!string.IsNullOrEmpty(cardName))
			{
				return _prerequisites.ContainsKey(cardName);
			}
			return false;
		}

		public static string GetPrerequisite(string cardName)
		{
			if (string.IsNullOrEmpty(cardName) || !_prerequisites.TryGetValue(cardName, out var value))
			{
				return null;
			}
			return value;
		}

		public static bool IsUnlocked(string cardName, ICollection<string> ownedCardNames)
		{
			string prerequisite = GetPrerequisite(cardName);
			if (string.IsNullOrEmpty(prerequisite))
			{
				return true;
			}
			return ownedCardNames?.Contains(prerequisite) ?? false;
		}
	}
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInPlugin("RoundsTheGathering", "Deck picking ability for ROUNDS (like MAGIC)", "1.0.0")]
	public class Plugin : BaseUnityPlugin
	{
		internal static ManualLogSource Logger;

		private void Awake()
		{
			//IL_001a: 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_0046: Unknown result type (might be due to invalid IL or missing references)
			//IL_004c: Expected O, but got Unknown
			//IL_004c: 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)
			Logger = ((BaseUnityPlugin)this).Logger;
			RTGLog.Section("Plugin Awake");
			new Harmony("RoundsTheGathering").PatchAll();
			((Component)this).gameObject.AddComponent<DeckManager>();
			((Component)this).gameObject.AddComponent<DeckHUDOverlay>();
			GameObject val = new GameObject("RTG_UIRoot");
			Object.DontDestroyOnLoad((Object)val);
			val.AddComponent<DeckSelectorScreen>();
			val.AddComponent<CreateDeckScreen>();
			val.AddComponent<DeckEditorScreen>();
			RTGLog.Line("Plugin RoundsTheGathering loaded.");
		}
	}
	internal static class RTGLog
	{
		private const string Sep = "=====================";

		public static void Section(string title)
		{
			Plugin.Logger.LogInfo((object)"=====================");
			Plugin.Logger.LogInfo((object)("[RTG] " + title));
			Plugin.Logger.LogInfo((object)"=====================");
		}

		public static void Line(string message)
		{
			Plugin.Logger.LogInfo((object)("[RTG] " + message));
		}

		public static void Warn(string message)
		{
			Plugin.Logger.LogWarning((object)("[RTG] " + message));
		}

		public static void Error(string message)
		{
			Plugin.Logger.LogError((object)("[RTG] " + message));
		}
	}
	public static class MyPluginInfo
	{
		public const string PLUGIN_GUID = "RoundsTheGathering";

		public const string PLUGIN_NAME = "Deck picking ability for ROUNDS (like MAGIC)";

		public const string PLUGIN_VERSION = "1.0.0";
	}
}
namespace RoundsTheGathering.UI
{
	public class CreateDeckScreen : MonoBehaviour
	{
		public static CreateDeckScreen instance;

		private Canvas _canvas;

		private TMP_InputField _nameField;

		private TMP_InputField _maxSizeField;

		private Button _createBtn;

		private TextMeshProUGUI _errorText;

		private void Awake()
		{
			instance = this;
			BuildUI();
		}

		private void BuildUI()
		{
			//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_006a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0076: Unknown result type (might be due to invalid IL or missing references)
			//IL_007c: Unknown result type (might be due to invalid IL or missing references)
			//IL_007f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0085: Unknown result type (might be due to invalid IL or missing references)
			//IL_009d: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a2: 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_00af: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f7: Unknown result type (might be due to invalid IL or missing references)
			//IL_0106: 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_0113: 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_011c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0157: Unknown result type (might be due to invalid IL or missing references)
			//IL_015c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0184: 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_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_01aa: 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_01e2: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f1: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f8: Unknown result type (might be due to invalid IL or missing references)
			//IL_01fe: Unknown result type (might be due to invalid IL or missing references)
			//IL_0201: Unknown result type (might be due to invalid IL or missing references)
			//IL_0207: Unknown result type (might be due to invalid IL or missing references)
			//IL_0242: Unknown result type (might be due to invalid IL or missing references)
			//IL_0247: 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_0284: Unknown result type (might be due to invalid IL or missing references)
			//IL_028f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0294: Unknown result type (might be due to invalid IL or missing references)
			//IL_0295: Unknown result type (might be due to invalid IL or missing references)
			//IL_029b: 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_02ec: Unknown result type (might be due to invalid IL or missing references)
			//IL_02f3: Unknown result type (might be due to invalid IL or missing references)
			//IL_02f9: Unknown result type (might be due to invalid IL or missing references)
			//IL_02fc: Unknown result type (might be due to invalid IL or missing references)
			//IL_0302: Unknown result type (might be due to invalid IL or missing references)
			//IL_0334: Unknown result type (might be due to invalid IL or missing references)
			//IL_035e: Unknown result type (might be due to invalid IL or missing references)
			//IL_036d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0381: Unknown result type (might be due to invalid IL or missing references)
			//IL_03a4: Unknown result type (might be due to invalid IL or missing references)
			//IL_03ae: Expected O, but got Unknown
			//IL_03c3: Unknown result type (might be due to invalid IL or missing references)
			//IL_03d2: Unknown result type (might be due to invalid IL or missing references)
			//IL_03e6: Unknown result type (might be due to invalid IL or missing references)
			//IL_03fe: Unknown result type (might be due to invalid IL or missing references)
			//IL_0408: Expected O, but got Unknown
			_canvas = UIHelper.CreateFullscreenCanvas("RTG_CreateDeckScreen", 210);
			UIHelper.CreateDimmedBackground(((Component)_canvas).transform);
			Transform transform = ((Component)_canvas).transform;
			Vector2 anchorMin = new Vector2(0.28f, 0.12f);
			Vector2 anchorMax = new Vector2(0.72f, 0.88f);
			Color? bg = new Color(0.08f, 0.08f, 0.12f, 1f);
			RectTransform parent = UIHelper.CreatePanel(transform, "Panel", anchorMin, anchorMax, default(Vector2), default(Vector2), bg);
			UIHelper.CreateText((Transform)(object)UIHelper.CreatePanel((Transform)(object)parent, "Title", new Vector2(0f, 0.88f), Vector2.one), "TitleText", "Create New Deck", 34, (TextAlignmentOptions)514);
			UIHelper.CreateText((Transform)(object)UIHelper.CreatePanel((Transform)(object)parent, "NameLabel", new Vector2(0.05f, 0.74f), new Vector2(0.95f, 0.82f)), "Lbl", "Deck Name", 22, (TextAlignmentOptions)4097);
			_nameField = UIHelper.CreateInputField((Transform)(object)parent, "NameField", "Enter deck name...", Vector2.zero, Vector2.zero, 22, (ContentType)0);
			RectTransform component = ((Component)_nameField).GetComponent<RectTransform>();
			component.anchorMin = new Vector2(0.05f, 0.61f);
			component.anchorMax = new Vector2(0.95f, 0.73f);
			Vector2 offsetMin = (component.offsetMax = Vector2.zero);
			component.offsetMin = offsetMin;
			((UnityEvent<string>)(object)_nameField.onValueChanged).AddListener((UnityAction<string>)delegate
			{
				Validate();
			});
			UIHelper.CreateText((Transform)(object)UIHelper.CreatePanel((Transform)(object)parent, "SizeLabel", new Vector2(0.05f, 0.48f), new Vector2(0.95f, 0.57f)), "Lbl", "Max Deck Size (default 50)", 22, (TextAlignmentOptions)4097);
			_maxSizeField = UIHelper.CreateInputField((Transform)(object)parent, "MaxSizeField", "50", Vector2.zero, Vector2.zero, 22, (ContentType)2);
			RectTransform component2 = ((Component)_maxSizeField).GetComponent<RectTransform>();
			component2.anchorMin = new Vector2(0.05f, 0.35f);
			component2.anchorMax = new Vector2(0.95f, 0.47f);
			offsetMin = (component2.offsetMax = Vector2.zero);
			component2.offsetMin = offsetMin;
			_maxSizeField.text = "50";
			((UnityEvent<string>)(object)_maxSizeField.onValueChanged).AddListener((UnityAction<string>)delegate
			{
				Validate();
			});
			RectTransform parent2 = UIHelper.CreatePanel((Transform)(object)parent, "ErrorPanel", new Vector2(0.05f, 0.26f), new Vector2(0.95f, 0.34f));
			_errorText = UIHelper.CreateText((Transform)(object)parent2, "ErrorText", "", 18, (TextAlignmentOptions)514, (Color?)new Color(1f, 0.35f, 0.35f));
			_createBtn = AnchorButton(parent, "CreateBtn", "Create Deck!", new Vector2(0.12f, 0.12f), new Vector2(0.88f, 0.24f), new Color(0.15f, 0.5f, 0.15f), 26);
			((UnityEvent)_createBtn.onClick).AddListener(new UnityAction(OnCreateClicked));
			((UnityEvent)AnchorButton(parent, "BackBtn", "Back", new Vector2(0.05f, 0.02f), new Vector2(0.4f, 0.1f), new Color(0.3f, 0.3f, 0.3f), 20).onClick).AddListener(new UnityAction(OnBackClicked));
			Validate();
			((Component)_canvas).gameObject.SetActive(false);
		}

		private static Button AnchorButton(RectTransform parent, string name, string label, Vector2 anchorMin, Vector2 anchorMax, Color bgColor, int fontSize)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Expected O, but got Unknown
			//IL_001b: 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_002a: Unknown result type (might be due to invalid IL or missing references)
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0030: 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_0044: 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_0063: Unknown result type (might be due to invalid IL or missing references)
			//IL_006c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0073: Unknown result type (might be due to invalid IL or missing references)
			//IL_007f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0086: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ea: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fc: 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_010c: 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_0113: 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)
			GameObject val = new GameObject(name);
			val.transform.SetParent((Transform)(object)parent, false);
			RectTransform obj = val.AddComponent<RectTransform>();
			obj.anchorMin = anchorMin;
			obj.anchorMax = anchorMax;
			Vector2 offsetMin = (obj.offsetMax = Vector2.zero);
			obj.offsetMin = offsetMin;
			Image val2 = val.AddComponent<Image>();
			((Graphic)val2).color = bgColor;
			Button obj2 = val.AddComponent<Button>();
			((Selectable)obj2).targetGraphic = (Graphic)(object)val2;
			ColorBlock colors = default(ColorBlock);
			((ColorBlock)(ref colors)).normalColor = bgColor;
			((ColorBlock)(ref colors)).highlightedColor = bgColor * 1.3f;
			((ColorBlock)(ref colors)).pressedColor = bgColor * 0.7f;
			((ColorBlock)(ref colors)).disabledColor = new Color(0.25f, 0.25f, 0.25f, 0.6f);
			((ColorBlock)(ref colors)).colorMultiplier = 1f;
			((ColorBlock)(ref colors)).fadeDuration = 0.1f;
			((Selectable)obj2).colors = colors;
			GameObject val3 = new GameObject("Label");
			val3.transform.SetParent(val.transform, false);
			RectTransform obj3 = val3.AddComponent<RectTransform>();
			obj3.anchorMin = Vector2.zero;
			obj3.anchorMax = Vector2.one;
			offsetMin = (obj3.offsetMax = Vector2.zero);
			obj3.offsetMin = offsetMin;
			TextMeshProUGUI obj4 = val3.AddComponent<TextMeshProUGUI>();
			((TMP_Text)obj4).text = label;
			((TMP_Text)obj4).fontSize = fontSize;
			((TMP_Text)obj4).alignment = (TextAlignmentOptions)514;
			((Graphic)obj4).color = Color.white;
			return obj2;
		}

		public void Show()
		{
			RTGLog.Section("CreateDeckScreen — Show");
			_nameField.text = "";
			_maxSizeField.text = "50";
			((TMP_Text)_errorText).text = "";
			Validate();
			((Component)_canvas).gameObject.SetActive(true);
		}

		public void Hide()
		{
			RTGLog.Section("CreateDeckScreen — Hide");
			((Component)_canvas).gameObject.SetActive(false);
		}

		private void Validate()
		{
			string deckName = _nameField.text.Trim();
			bool flag = deckName.Length > 0;
			bool flag2 = DeckManager.instance?.AllDecks.Find((DeckData d) => d.name == deckName) == null;
			int result;
			bool flag3 = int.TryParse(_maxSizeField.text, out result) && result >= 1;
			string text = "";
			if (deckName.Length > 0 && !flag2)
			{
				text = "A deck with this name already exists.";
			}
			else if (_maxSizeField.text.Length > 0 && !flag3)
			{
				text = "Max size must be a number ≥ 1.";
			}
			((TMP_Text)_errorText).text = text;
			((Selectable)_createBtn).interactable = flag && flag2 && flag3;
		}

		private void OnCreateClicked()
		{
			string text = _nameField.text.Trim();
			int result;
			int num = (int.TryParse(_maxSizeField.text, out result) ? result : 50);
			RTGLog.Section("CreateDeckScreen — Create Deck '" + text + "'");
			RTGLog.Line($"maxSize={num}");
			DeckData deck = DeckManager.instance.CreateDeck(text, num);
			Hide();
			DeckEditorScreen.instance?.Open(deck);
		}

		private void OnBackClicked()
		{
			RTGLog.Section("CreateDeckScreen — Back");
			Hide();
			DeckSelectorScreen.instance?.Show();
		}
	}
	public class DeckEditorScreen : MonoBehaviour
	{
		public static DeckEditorScreen instance;

		private DeckData _deck;

		private string _currentCategory;

		private Canvas _canvas;

		private TextMeshProUGUI _viewingText;

		private TextMeshProUGUI _deckCountText;

		private Transform _cardGridContent;

		private Transform _categoryButtonParent;

		private ScrollRect _cardScrollRect;

		private GameObject _maxSizeModal;

		private TMP_InputField _maxSizeModalField;

		private TextMeshProUGUI _maxSizeModalError;

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

		private void Awake()
		{
			instance = this;
			BuildUI();
		}

		public void Open(DeckData deck)
		{
			RTGLog.Section("DeckEditorScreen — Open deck '" + deck?.name + "'");
			_deck = deck;
			((Component)_canvas).gameObject.SetActive(true);
			BuildCategoryButtons();
			ShowCategory((CardManager.categories.Count > 0) ? CardManager.categories[0] : "");
		}

		private void OnDisable()
		{
			RTGLog.Section("DeckEditorScreen — OnDisable (close)");
			if (_deck == null)
			{
				RTGLog.Line("No deck loaded — nothing to save.");
			}
			else if (_deck.TotalCount <= _deck.maxSize)
			{
				DeckManager.instance?.Save();
				RTGLog.Line($"Auto-saved '{_deck.name}' ({_deck.TotalCount}/{_deck.maxSize} cards).");
			}
			else
			{
				RTGLog.Warn($"Deck over limit ({_deck.TotalCount}/{_deck.maxSize}) — NOT saved.");
			}
		}

		private void BuildUI()
		{
			//IL_005e: Unknown result type (might be due to invalid IL or missing references)
			//IL_007e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0083: 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_00aa: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ba: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ff: Unknown result type (might be due to invalid IL or missing references)
			//IL_0114: Unknown result type (might be due to invalid IL or missing references)
			//IL_011f: 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)
			//IL_0125: Unknown result type (might be due to invalid IL or missing references)
			//IL_012c: Unknown result type (might be due to invalid IL or missing references)
			//IL_016f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0184: 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_0195: Unknown result type (might be due to invalid IL or missing references)
			//IL_019c: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ae: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c9: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f2: 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_0212: Unknown result type (might be due to invalid IL or missing references)
			//IL_0217: Unknown result type (might be due to invalid IL or missing references)
			//IL_0218: Unknown result type (might be due to invalid IL or missing references)
			//IL_021f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0232: Unknown result type (might be due to invalid IL or missing references)
			//IL_023c: Expected O, but got Unknown
			//IL_0247: Unknown result type (might be due to invalid IL or missing references)
			//IL_024c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0262: 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_02a0: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ab: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b0: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b1: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b8: Unknown result type (might be due to invalid IL or missing references)
			//IL_02cb: Unknown result type (might be due to invalid IL or missing references)
			//IL_02d5: Expected O, but got Unknown
			//IL_02db: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ea: Unknown result type (might be due to invalid IL or missing references)
			//IL_0305: Unknown result type (might be due to invalid IL or missing references)
			//IL_0311: Unknown result type (might be due to invalid IL or missing references)
			//IL_0317: Unknown result type (might be due to invalid IL or missing references)
			//IL_031b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0321: Unknown result type (might be due to invalid IL or missing references)
			//IL_033f: Unknown result type (might be due to invalid IL or missing references)
			//IL_034a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0355: Unknown result type (might be due to invalid IL or missing references)
			//IL_035a: Unknown result type (might be due to invalid IL or missing references)
			//IL_035b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0362: Unknown result type (might be due to invalid IL or missing references)
			//IL_03b2: Unknown result type (might be due to invalid IL or missing references)
			//IL_03bc: Expected O, but got Unknown
			//IL_03cc: Unknown result type (might be due to invalid IL or missing references)
			//IL_03db: Unknown result type (might be due to invalid IL or missing references)
			//IL_03f6: Unknown result type (might be due to invalid IL or missing references)
			//IL_0402: Unknown result type (might be due to invalid IL or missing references)
			//IL_0408: Unknown result type (might be due to invalid IL or missing references)
			//IL_040c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0412: 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_043d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0448: Unknown result type (might be due to invalid IL or missing references)
			//IL_044d: Unknown result type (might be due to invalid IL or missing references)
			//IL_044e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0455: Unknown result type (might be due to invalid IL or missing references)
			//IL_0477: Unknown result type (might be due to invalid IL or missing references)
			//IL_048c: Unknown result type (might be due to invalid IL or missing references)
			//IL_049f: Unknown result type (might be due to invalid IL or missing references)
			//IL_04a9: Expected O, but got Unknown
			_canvas = UIHelper.CreateFullscreenCanvas("RTG_DeckEditorScreen", 220);
			UIHelper.CreateDimmedBackground(((Component)_canvas).transform);
			RectTransform parent = UIHelper.CreateStretchPanel(((Component)_canvas).transform, "Outer", 20f, 20f, 20f, 20f, (Color?)new Color(0.06f, 0.06f, 0.09f, 0.97f));
			Vector2 anchorMin = new Vector2(0f, 0.92f);
			Vector2 one = Vector2.one;
			Color? bg = new Color(0.1f, 0.1f, 0.15f, 0.95f);
			RectTransform parent2 = UIHelper.CreatePanel((Transform)(object)parent, "TopBar", anchorMin, one, default(Vector2), default(Vector2), bg);
			_viewingText = UIHelper.CreateText((Transform)(object)parent2, "ViewingText", "Viewing: —", 22, (TextAlignmentOptions)4097);
			RectTransform component = ((Component)_viewingText).GetComponent<RectTransform>();
			component.anchorMin = new Vector2(0.01f, 0f);
			component.anchorMax = new Vector2(0.35f, 1f);
			Vector2 offsetMin = (component.offsetMax = Vector2.zero);
			component.offsetMin = offsetMin;
			_deckCountText = UIHelper.CreateText((Transform)(object)parent2, "DeckCountText", "Cards in Deck: 0", 22, (TextAlignmentOptions)4097);
			RectTransform component2 = ((Component)_deckCountText).GetComponent<RectTransform>();
			component2.anchorMin = new Vector2(0.36f, 0f);
			component2.anchorMax = new Vector2(0.65f, 1f);
			offsetMin = (component2.offsetMax = Vector2.zero);
			component2.offsetMin = offsetMin;
			Button obj = UIHelper.CreateButton((Transform)(object)parent2, "ChangeSizeBtn", "Change Max Size", Vector2.zero, Vector2.zero, 18, (Color?)new Color(0.35f, 0.2f, 0.05f), (Color?)null);
			RectTransform component3 = ((Component)obj).GetComponent<RectTransform>();
			component3.anchorMin = new Vector2(0.66f, 0.1f);
			component3.anchorMax = new Vector2(0.85f, 0.9f);
			offsetMin = (component3.offsetMax = Vector2.zero);
			component3.offsetMin = offsetMin;
			((UnityEvent)obj.onClick).AddListener(new UnityAction(OpenMaxSizeModal));
			Button obj2 = UIHelper.CreateButton((Transform)(object)parent2, "CloseBtn", "Close", Vector2.zero, Vector2.zero, 18, (Color?)new Color(0.45f, 0.1f, 0.1f), (Color?)null);
			RectTransform component4 = ((Component)obj2).GetComponent<RectTransform>();
			component4.anchorMin = new Vector2(0.87f, 0.1f);
			component4.anchorMax = new Vector2(0.99f, 0.9f);
			offsetMin = (component4.offsetMax = Vector2.zero);
			component4.offsetMin = offsetMin;
			((UnityEvent)obj2.onClick).AddListener(new UnityAction(CloseScreen));
			Vector2 zero5 = Vector2.zero;
			Vector2 anchorMax = new Vector2(0.18f, 0.92f);
			bg = new Color(0.08f, 0.08f, 0.12f, 0.9f);
			RectTransform component5 = BuildScrollRect((Transform)(object)UIHelper.CreatePanel((Transform)(object)parent, "LeftPanel", zero5, anchorMax, default(Vector2), default(Vector2), bg), "CategoryScroll", out _categoryButtonParent).GetComponent<RectTransform>();
			component5.anchorMin = Vector2.zero;
			component5.anchorMax = Vector2.one;
			offsetMin = (component5.offsetMax = Vector2.zero);
			component5.offsetMin = offsetMin;
			((object)((Component)((Component)_categoryButtonParent).GetComponent<RectTransform>()).GetComponent<VerticalLayoutGroup>())?.GetType();
			VerticalLayoutGroup obj3 = ((Component)_categoryButtonParent).gameObject.AddComponent<VerticalLayoutGroup>();
			((HorizontalOrVerticalLayoutGroup)obj3).childControlHeight = false;
			((HorizontalOrVerticalLayoutGroup)obj3).childForceExpandHeight = false;
			((HorizontalOrVerticalLayoutGroup)obj3).spacing = 4f;
			((LayoutGroup)obj3).padding = new RectOffset(4, 4, 4, 4);
			Vector2 anchorMin2 = new Vector2(0.19f, 0f);
			Vector2 anchorMax2 = new Vector2(1f, 0.92f);
			bg = new Color(0.05f, 0.05f, 0.08f, 1f);
			GameObject val = BuildScrollRect((Transform)(object)UIHelper.CreatePanel((Transform)(object)parent, "RightPanel", anchorMin2, anchorMax2, default(Vector2), default(Vector2), bg), "CardScroll", out _cardGridContent);
			RectTransform component6 = val.GetComponent<RectTransform>();
			component6.anchorMin = Vector2.zero;
			component6.anchorMax = Vector2.one;
			offsetMin = (component6.offsetMax = Vector2.zero);
			component6.offsetMin = offsetMin;
			GridLayoutGroup obj4 = ((Component)_cardGridContent).gameObject.AddComponent<GridLayoutGroup>();
			obj4.cellSize = new Vector2(220f, 300f);
			obj4.spacing = new Vector2(10f, 10f);
			((LayoutGroup)obj4).padding = new RectOffset(10, 10, 10, 10);
			obj4.startCorner = (Corner)0;
			obj4.startAxis = (Axis)0;
			((LayoutGroup)obj4).childAlignment = (TextAnchor)0;
			obj4.constraint = (Constraint)0;
			_cardScrollRect = val.GetComponent<ScrollRect>();
			BuildMaxSizeModal((Transform)(object)parent);
			((Component)_canvas).gameObject.SetActive(false);
		}

		private static GameObject BuildScrollRect(Transform parent, string name, out Transform content)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Expected O, but got Unknown
			//IL_001b: 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_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_0037: 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_0070: Unknown result type (might be due to invalid IL or missing references)
			//IL_0076: Expected O, but got Unknown
			//IL_0090: Unknown result type (might be due to invalid IL or missing references)
			//IL_009b: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ac: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ad: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ea: Unknown result type (might be due to invalid IL or missing references)
			//IL_010c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0111: 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_0135: Unknown result type (might be due to invalid IL or missing references)
			//IL_014a: Unknown result type (might be due to invalid IL or missing references)
			//IL_015f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0174: Unknown result type (might be due to invalid IL or missing references)
			//IL_017f: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = new GameObject(name);
			val.transform.SetParent(parent, false);
			RectTransform obj = val.AddComponent<RectTransform>();
			obj.anchorMin = Vector2.zero;
			obj.anchorMax = Vector2.one;
			Vector2 offsetMin = (obj.offsetMax = Vector2.zero);
			obj.offsetMin = offsetMin;
			ScrollRect obj2 = val.AddComponent<ScrollRect>();
			obj2.horizontal = false;
			obj2.vertical = true;
			obj2.movementType = (MovementType)2;
			obj2.scrollSensitivity = 80f;
			GameObject val2 = new GameObject("Viewport");
			val2.transform.SetParent(val.transform, false);
			RectTransform val3 = val2.AddComponent<RectTransform>();
			val3.anchorMin = Vector2.zero;
			val3.anchorMax = Vector2.one;
			offsetMin = (val3.offsetMax = Vector2.zero);
			val3.offsetMin = offsetMin;
			val3.pivot = new Vector2(0f, 1f);
			((Graphic)val2.AddComponent<Image>()).color = new Color(1f, 1f, 1f, 0.01f);
			val2.AddComponent<Mask>().showMaskGraphic = false;
			obj2.viewport = val3;
			GameObject val4 = new GameObject("Content");
			val4.transform.SetParent(val2.transform, false);
			RectTransform val5 = val4.AddComponent<RectTransform>();
			val5.anchorMin = new Vector2(0f, 1f);
			val5.anchorMax = new Vector2(1f, 1f);
			val5.pivot = new Vector2(0f, 1f);
			val5.sizeDelta = new Vector2(0f, 0f);
			val5.anchoredPosition = Vector2.zero;
			ContentSizeFitter obj3 = val4.AddComponent<ContentSizeFitter>();
			obj3.horizontalFit = (FitMode)0;
			obj3.verticalFit = (FitMode)2;
			obj2.content = val5;
			content = (Transform)(object)val5;
			return val;
		}

		private void BuildCategoryButtons()
		{
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f7: Unknown result type (might be due to invalid IL or missing references)
			//IL_0121: Unknown result type (might be due to invalid IL or missing references)
			//IL_0136: Unknown result type (might be due to invalid IL or missing references)
			//IL_014a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0161: Unknown result type (might be due to invalid IL or missing references)
			//IL_016b: Expected O, but got Unknown
			RTGLog.Section("DeckEditorScreen — BuildCategoryButtons");
			foreach (Transform item in _categoryButtonParent)
			{
				Object.Destroy((Object)(object)((Component)item).gameObject);
			}
			RTGLog.Line($"CardManager.categories.Count = {CardManager.categories.Count}");
			if (CardManager.categories.Count == 0)
			{
				RTGLog.Warn("No categories found in CardManager!");
			}
			foreach (string category in CardManager.categories)
			{
				RTGLog.Line("  Adding category button: '" + category + "'");
				string captured = category;
				Button obj = UIHelper.CreateButton(_categoryButtonParent, "Cat_" + category, category, Vector2.zero, new Vector2(0f, 44f), 18, (Color?)new Color(0.15f, 0.15f, 0.22f), (Color?)null);
				RectTransform component = ((Component)obj).GetComponent<RectTransform>();
				component.anchorMin = new Vector2(0f, 0f);
				component.anchorMax = new Vector2(1f, 0f);
				component.sizeDelta = new Vector2(0f, 44f);
				((UnityEvent)obj.onClick).AddListener((UnityAction)delegate
				{
					ShowCategory(captured);
				});
			}
			RTGLog.Line($"Built {CardManager.categories.Count} category button(s).");
		}

		private void ShowCategory(string category)
		{
			//IL_0220: Unknown result type (might be due to invalid IL or missing references)
			//IL_026c: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a3: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b8: Unknown result type (might be due to invalid IL or missing references)
			//IL_033b: Unknown result type (might be due to invalid IL or missing references)
			//IL_034a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0359: 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_0387: Unknown result type (might be due to invalid IL or missing references)
			RTGLog.Section("DeckEditorScreen — ShowCategory '" + category + "'");
			_currentCategory = category;
			((TMP_Text)_viewingText).text = "Viewing: " + category;
			foreach (GameObject cardRow in _cardRows)
			{
				if ((Object)(object)cardRow != (Object)null)
				{
					Object.DestroyImmediate((Object)(object)cardRow);
				}
			}
			_cardRows.Clear();
			string[] cardsInCategory = CardManager.GetCardsInCategory(category);
			RTGLog.Line($"GetCardsInCategory returned {((cardsInCategory != null) ? cardsInCategory.Length : 0)} card name(s).");
			if (cardsInCategory == null || cardsInCategory.Length == 0)
			{
				RTGLog.Warn("No cards found for category '" + category + "'.");
				UpdateDeckCountDisplay();
				return;
			}
			List<CardInfo> list = new List<CardInfo>();
			string[] array = cardsInCategory;
			for (int i = 0; i < array.Length; i++)
			{
				CardInfo cardInfoWithName = CardManager.GetCardInfoWithName(array[i]);
				if ((Object)(object)cardInfoWithName != (Object)null)
				{
					list.Add(cardInfoWithName);
				}
			}
			list.Sort((CardInfo a, CardInfo b) => ((Enum)(Rarity)(ref a.rarity)).CompareTo((object?)b.rarity));
			RTGLog.Line($"Sorted {list.Count} cards by rarity.");
			int num = 0;
			int num2 = 0;
			foreach (CardInfo item in list)
			{
				if ((Object)(object)item == (Object)null)
				{
					num2++;
					continue;
				}
				BuildCardRow(item);
				num++;
			}
			RTGLog.Line($"Built {num} card row(s), skipped {num2}. Deck total={_deck?.TotalCount ?? 0}.");
			Canvas.ForceUpdateCanvases();
			Transform cardGridContent = _cardGridContent;
			LayoutRebuilder.ForceRebuildLayoutImmediate((RectTransform)(object)((cardGridContent is RectTransform) ? cardGridContent : null));
			RTGLog.Line("=== Card Layout Diagnostics ===");
			RTGLog.Line($"CardGridContent: childCount={_cardGridContent.childCount}");
			if ((Object)(object)_cardScrollRect != (Object)null)
			{
				RectTransform component = ((Component)_cardScrollRect).GetComponent<RectTransform>();
				RTGLog.Line($"ScrollRect: rect={component.rect}, active={((Component)_cardScrollRect).gameObject.activeInHierarchy}");
				if ((Object)(object)_cardScrollRect.viewport != (Object)null)
				{
					RTGLog.Line($"Viewport: rect={_cardScrollRect.viewport.rect}");
				}
				if ((Object)(object)_cardScrollRect.content != (Object)null)
				{
					RTGLog.Line($"Content: rect={_cardScrollRect.content.rect}, sizeDelta={_cardScrollRect.content.sizeDelta}");
				}
			}
			if (_cardRows.Count > 0)
			{
				for (int j = 0; j < Mathf.Min(3, _cardRows.Count); j++)
				{
					RectTransform component2 = _cardRows[j].GetComponent<RectTransform>();
					Image component3 = _cardRows[j].GetComponent<Image>();
					RTGLog.Line($"Card[{j}] '{((Object)_cardRows[j]).name}': localPos={((Transform)component2).localPosition}, anchoredPos={component2.anchoredPosition}, sizeDelta={component2.sizeDelta}, rect={component2.rect}, imgColor={((component3 != null) ? new Color?(((Graphic)component3).color) : null)}, active={_cardRows[j].activeInHierarchy}");
				}
			}
			else
			{
				RTGLog.Warn("No card rows created!");
			}
			UpdateDeckCountDisplay();
		}

		private void BuildCardRow(CardInfo cardInfo)
		{
			//IL_003d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0043: Expected O, but got Unknown
			//IL_0065: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00df: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e5: Expected O, but got Unknown
			//IL_0108: Unknown result type (might be due to invalid IL or missing references)
			//IL_011d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0128: Unknown result type (might be due to invalid IL or missing references)
			//IL_012d: Unknown result type (might be due to invalid IL or missing references)
			//IL_012e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0135: Unknown result type (might be due to invalid IL or missing references)
			//IL_0157: Unknown result type (might be due to invalid IL or missing references)
			//IL_016c: 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_0183: 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_0195: 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_01a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a6: 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_01c6: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f2: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f7: Unknown result type (might be due to invalid IL or missing references)
			//IL_021b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0225: Expected O, but got Unknown
			//IL_0248: Unknown result type (might be due to invalid IL or missing references)
			//IL_0253: Unknown result type (might be due to invalid IL or missing references)
			//IL_025e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0263: Unknown result type (might be due to invalid IL or missing references)
			//IL_0264: Unknown result type (might be due to invalid IL or missing references)
			//IL_026b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0290: Unknown result type (might be due to invalid IL or missing references)
			//IL_0297: Expected O, but got Unknown
			//IL_02c1: Unknown result type (might be due to invalid IL or missing references)
			//IL_02d6: Unknown result type (might be due to invalid IL or missing references)
			//IL_02eb: Unknown result type (might be due to invalid IL or missing references)
			//IL_0300: Unknown result type (might be due to invalid IL or missing references)
			//IL_0314: 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_035e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0382: Unknown result type (might be due to invalid IL or missing references)
			//IL_038d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0398: Unknown result type (might be due to invalid IL or missing references)
			//IL_039d: Unknown result type (might be due to invalid IL or missing references)
			//IL_039e: Unknown result type (might be due to invalid IL or missing references)
			//IL_03a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_03d4: Unknown result type (might be due to invalid IL or missing references)
			//IL_03e3: Unknown result type (might be due to invalid IL or missing references)
			//IL_03ea: Expected O, but got Unknown
			//IL_0414: Unknown result type (might be due to invalid IL or missing references)
			//IL_0429: Unknown result type (might be due to invalid IL or missing references)
			//IL_043e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0453: Unknown result type (might be due to invalid IL or missing references)
			//IL_0467: Unknown result type (might be due to invalid IL or missing references)
			//IL_048d: Unknown result type (might be due to invalid IL or missing references)
			//IL_04a2: Unknown result type (might be due to invalid IL or missing references)
			//IL_04a9: Expected O, but got Unknown
			//IL_04c5: Unknown result type (might be due to invalid IL or missing references)
			//IL_04d0: Unknown result type (might be due to invalid IL or missing references)
			//IL_04db: Unknown result type (might be due to invalid IL or missing references)
			//IL_04e0: Unknown result type (might be due to invalid IL or missing references)
			//IL_04e1: Unknown result type (might be due to invalid IL or missing references)
			//IL_04e8: Unknown result type (might be due to invalid IL or missing references)
			//IL_053d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0558: Unknown result type (might be due to invalid IL or missing references)
			//IL_055f: Expected O, but got Unknown
			//IL_0589: Unknown result type (might be due to invalid IL or missing references)
			//IL_059e: Unknown result type (might be due to invalid IL or missing references)
			//IL_05b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_05c8: Unknown result type (might be due to invalid IL or missing references)
			//IL_05dc: Unknown result type (might be due to invalid IL or missing references)
			//IL_0605: Unknown result type (might be due to invalid IL or missing references)
			//IL_0623: Unknown result type (might be due to invalid IL or missing references)
			//IL_0647: Unknown result type (might be due to invalid IL or missing references)
			//IL_0652: Unknown result type (might be due to invalid IL or missing references)
			//IL_065d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0662: Unknown result type (might be due to invalid IL or missing references)
			//IL_0663: Unknown result type (might be due to invalid IL or missing references)
			//IL_066a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0693: Unknown result type (might be due to invalid IL or missing references)
			//IL_06c1: Unknown result type (might be due to invalid IL or missing references)
			//IL_06cb: Expected O, but got Unknown
			//IL_06d9: Unknown result type (might be due to invalid IL or missing references)
			//IL_06e3: Expected O, but got Unknown
			//IL_06ef: Unknown result type (might be due to invalid IL or missing references)
			//IL_06f9: Expected O, but got Unknown
			string name = ((Object)((Component)cardInfo).gameObject).name;
			CardEntry entry = GetOrCreateEntry(name);
			int maxCount = DeckManager.MaxCountForCard(cardInfo);
			GameObject val = new GameObject("Card_" + name);
			val.transform.SetParent(_cardGridContent, false);
			val.AddComponent<RectTransform>().sizeDelta = new Vector2(220f, 300f);
			LayoutElement obj = val.AddComponent<LayoutElement>();
			obj.preferredWidth = 220f;
			obj.preferredHeight = 300f;
			_cardRows.Add(val);
			Image bgImg = val.AddComponent<Image>();
			((Graphic)bgImg).color = new Color(0.1f, 0.1f, 0.15f, 1f);
			((Graphic)bgImg).raycastTarget = true;
			SetupCardVisual(cardInfo, val);
			GameObject val2 = new GameObject("RarityLabel");
			val2.transform.SetParent(val.transform, false);
			RectTransform obj2 = val2.AddComponent<RectTransform>();
			obj2.anchorMin = new Vector2(0f, 0f);
			obj2.anchorMax = new Vector2(1f, 0.12f);
			Vector2 offsetMin = (obj2.offsetMax = Vector2.zero);
			obj2.offsetMin = offsetMin;
			Image obj3 = val2.AddComponent<Image>();
			((Graphic)obj3).color = new Color(0f, 0f, 0f, 0.7f);
			((Graphic)obj3).raycastTarget = false;
			GameObject val3 = new GameObject("RarityText");
			val3.transform.SetParent(val2.transform, false);
			RectTransform obj4 = val3.AddComponent<RectTransform>();
			obj4.anchorMin = Vector2.zero;
			obj4.anchorMax = Vector2.one;
			offsetMin = (obj4.offsetMax = Vector2.zero);
			obj4.offsetMin = offsetMin;
			TextMeshProUGUI obj5 = val3.AddComponent<TextMeshProUGUI>();
			((TMP_Text)obj5).text = $"{cardInfo.cardName} ({cardInfo.rarity})";
			((TMP_Text)obj5).fontSize = 11f;
			((TMP_Text)obj5).alignment = (TextAlignmentOptions)514;
			((Graphic)obj5).color = RarityColor(cardInfo.rarity);
			((TMP_Text)obj5).enableWordWrapping = false;
			((TMP_Text)obj5).overflowMode = (TextOverflowModes)1;
			((Graphic)obj5).raycastTarget = false;
			GameObject controlsGo = new GameObject("Controls");
			controlsGo.transform.SetParent(val.transform, false);
			RectTransform obj6 = controlsGo.AddComponent<RectTransform>();
			obj6.anchorMin = Vector2.zero;
			obj6.anchorMax = Vector2.one;
			offsetMin = (obj6.offsetMax = Vector2.zero);
			obj6.offsetMin = offsetMin;
			controlsGo.SetActive(entry.count > 0);
			GameObject val4 = new GameObject("MinusBtn");
			val4.transform.SetParent(controlsGo.transform, false);
			RectTransform obj7 = val4.AddComponent<RectTransform>();
			obj7.anchorMin = new Vector2(0f, 0f);
			obj7.anchorMax = new Vector2(0f, 0f);
			obj7.pivot = new Vector2(0f, 0f);
			obj7.anchoredPosition = new Vector2(4f, 4f);
			obj7.sizeDelta = new Vector2(36f, 36f);
			Image val5 = val4.AddComponent<Image>();
			((Graphic)val5).color = new Color(0.7f, 0.15f, 0.15f, 0.95f);
			Button val6 = val4.AddComponent<Button>();
			((Selectable)val6).targetGraphic = (Graphic)(object)val5;
			TextMeshProUGUI obj8 = new GameObject("Text").AddComponent<TextMeshProUGUI>();
			((TMP_Text)obj8).transform.SetParent(val4.transform, false);
			RectTransform component = ((Component)obj8).GetComponent<RectTransform>();
			component.anchorMin = Vector2.zero;
			component.anchorMax = Vector2.one;
			offsetMin = (component.offsetMax = Vector2.zero);
			component.offsetMin = offsetMin;
			((TMP_Text)obj8).text = "-";
			((Graphic)obj8).raycastTarget = false;
			((TMP_Text)obj8).fontSize = 24f;
			((TMP_Text)obj8).alignment = (TextAlignmentOptions)514;
			((Graphic)obj8).color = Color.white;
			GameObject val7 = new GameObject("CountLabel");
			val7.transform.SetParent(controlsGo.transform, false);
			RectTransform obj9 = val7.AddComponent<RectTransform>();
			obj9.anchorMin = new Vector2(0.5f, 0f);
			obj9.anchorMax = new Vector2(0.5f, 0f);
			obj9.pivot = new Vector2(0.5f, 0f);
			obj9.anchoredPosition = new Vector2(0f, 4f);
			obj9.sizeDelta = new Vector2(40f, 36f);
			Image obj10 = val7.AddComponent<Image>();
			((Graphic)obj10).color = new Color(0f, 0f, 0f, 0.8f);
			((Graphic)obj10).raycastTarget = false;
			GameObject val8 = new GameObject("CountText");
			val8.transform.SetParent(val7.transform, false);
			RectTransform obj11 = val8.AddComponent<RectTransform>();
			obj11.anchorMin = Vector2.zero;
			obj11.anchorMax = Vector2.one;
			offsetMin = (obj11.offsetMax = Vector2.zero);
			obj11.offsetMin = offsetMin;
			TextMeshProUGUI countTmp = val8.AddComponent<TextMeshProUGUI>();
			((TMP_Text)countTmp).text = entry.count.ToString();
			((TMP_Text)countTmp).fontSize = 22f;
			((TMP_Text)countTmp).alignment = (TextAlignmentOptions)514;
			((Graphic)countTmp).color = Color.white;
			((Graphic)countTmp).raycastTarget = false;
			GameObject val9 = new GameObject("PlusBtn");
			val9.transform.SetParent(controlsGo.transform, false);
			RectTransform obj12 = val9.AddComponent<RectTransform>();
			obj12.anchorMin = new Vector2(1f, 0f);
			obj12.anchorMax = new Vector2(1f, 0f);
			obj12.pivot = new Vector2(1f, 0f);
			obj12.anchoredPosition = new Vector2(-4f, 4f);
			obj12.sizeDelta = new Vector2(36f, 36f);
			Image val10 = val9.AddComponent<Image>();
			((Graphic)val10).color = new Color(0.15f, 0.6f, 0.15f, 0.95f);
			Button obj13 = val9.AddComponent<Button>();
			((Selectable)obj13).targetGraphic = (Graphic)(object)val10;
			TextMeshProUGUI obj14 = new GameObject("Text").AddComponent<TextMeshProUGUI>();
			((TMP_Text)obj14).transform.SetParent(val9.transform, false);
			RectTransform component2 = ((Component)obj14).GetComponent<RectTransform>();
			component2.anchorMin = Vector2.zero;
			component2.anchorMax = Vector2.one;
			offsetMin = (component2.offsetMax = Vector2.zero);
			component2.offsetMin = offsetMin;
			((TMP_Text)obj14).text = "+";
			((TMP_Text)obj14).fontSize = 24f;
			((TMP_Text)obj14).alignment = (TextAlignmentOptions)514;
			((Graphic)obj14).color = Color.white;
			((Graphic)obj14).raycastTarget = false;
			Button obj15 = val.AddComponent<Button>();
			((Selectable)obj15).targetGraphic = (Graphic)(object)bgImg;
			((UnityEvent)obj15.onClick).AddListener((UnityAction)delegate
			{
				//IL_004f: Unknown result type (might be due to invalid IL or missing references)
				if (entry.count == 0)
				{
					entry.count = 1;
					controlsGo.SetActive(true);
					((TMP_Text)countTmp).text = "1";
					((Graphic)bgImg).color = new Color(0.15f, 0.25f, 0.15f, 0.9f);
					UpdateDeckCountDisplay();
				}
			});
			((UnityEvent)val6.onClick).AddListener((UnityAction)delegate
			{
				//IL_0070: Unknown result type (might be due to invalid IL or missing references)
				if (entry.count > 0)
				{
					entry.count--;
					((TMP_Text)countTmp).text = entry.count.ToString();
					if (entry.count == 0)
					{
						controlsGo.SetActive(false);
						((Graphic)bgImg).color = new Color(0.1f, 0.1f, 0.14f, 0.85f);
					}
					UpdateDeckCountDisplay();
				}
			});
			((UnityEvent)obj13.onClick).AddListener((UnityAction)delegate
			{
				if (entry.count < maxCount)
				{
					entry.count++;
					((TMP_Text)countTmp).text = entry.count.ToString();
					UpdateDeckCountDisplay();
				}
			});
		}

		private void SetupCardVisual(CardInfo cardInfo, GameObject parent)
		{
			//IL_0176: 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_0195: Unknown result type (might be due to invalid IL or missing references)
			//IL_01aa: Unknown result type (might be due to invalid IL or missing references)
			//IL_01bf: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d3: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ff: 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_0296: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a2: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ae: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ba: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c6: Unknown result type (might be due to invalid IL or missing references)
			//IL_02d2: Unknown result type (might be due to invalid IL or missing references)
			RTGLog.Line("SetupCardVisual '" + cardInfo.cardName + "': cardArt=" + (((Object)(object)cardInfo.cardArt != (Object)null) ? ((Object)cardInfo.cardArt).name : "NULL"));
			GameObject val = Object.Instantiate<GameObject>(((Component)cardInfo).gameObject, parent.transform);
			((Object)val).name = "CardVisual";
			val.SetActive(true);
			GameObject val2 = FindChildByName(val, "Back");
			if ((Object)(object)val2 != (Object)null)
			{
				Object.Destroy((Object)(object)val2);
			}
			GameObject val3 = FindChildByName(val, "Damagable");
			if ((Object)(object)val3 != (Object)null)
			{
				Object.Destroy((Object)(object)val3);
			}
			GameObject val4 = FindChildByName(val, "UI_ParticleSystem");
			if ((Object)(object)val4 != (Object)null)
			{
				Object.Destroy((Object)(object)val4);
			}
			GameObject val5 = FindChildByName(val, "BlockFront");
			if ((Object)(object)val5 != (Object)null)
			{
				val5.SetActive(false);
			}
			CanvasGroup[] componentsInChildren = val.GetComponentsInChildren<CanvasGroup>(true);
			for (int i = 0; i < componentsInChildren.Length; i++)
			{
				componentsInChildren[i].alpha = 1f;
			}
			CardVisuals[] componentsInChildren2 = val.GetComponentsInChildren<CardVisuals>(true);
			for (int i = 0; i < componentsInChildren2.Length; i++)
			{
				componentsInChildren2[i].firstValueToSet = true;
			}
			Animator[] componentsInChildren3 = val.GetComponentsInChildren<Animator>(true);
			for (int i = 0; i < componentsInChildren3.Length; i++)
			{
				((Behaviour)componentsInChildren3[i]).enabled = false;
			}
			CurveAnimation[] componentsInChildren4 = val.GetComponentsInChildren<CurveAnimation>(true);
			for (int i = 0; i < componentsInChildren4.Length; i++)
			{
				((Behaviour)componentsInChildren4[i]).enabled = false;
			}
			RectTransform orAddComponent = ExtensionMethods.GetOrAddComponent<RectTransform>(val, false);
			((Transform)orAddComponent).localScale = Vector3.one * 15f;
			orAddComponent.anchorMin = new Vector2(0.5f, 0.5f);
			orAddComponent.anchorMax = new Vector2(0.5f, 0.5f);
			orAddComponent.pivot = new Vector2(0.5f, 0.5f);
			orAddComponent.anchoredPosition = new Vector2(0f, 10f);
			Graphic[] componentsInChildren5 = val.GetComponentsInChildren<Graphic>(true);
			for (int i = 0; i < componentsInChildren5.Length; i++)
			{
				componentsInChildren5[i].raycastTarget = false;
			}
			if ((Object)(object)cardInfo.cardArt != (Object)null)
			{
				GameObject val6 = FindChildByName(val, "Art");
				RTGLog.Line("SetupCardVisual '" + cardInfo.cardName + "': Art transform=" + (((Object)(object)val6 != (Object)null) ? ((Object)val6).name : "NOT FOUND"));
				if ((Object)(object)val6 != (Object)null)
				{
					GameObject val7 = Object.Instantiate<GameObject>(cardInfo.cardArt, val6.transform);
					val7.transform.SetAsFirstSibling();
					RectTransform component = val7.GetComponent<RectTransform>();
					if ((Object)(object)component != (Object)null)
					{
						component.anchorMin = Vector2.zero;
						component.anchorMax = Vector2.one;
						component.offsetMin = Vector2.zero;
						component.offsetMax = Vector2.zero;
						((Transform)component).localPosition = Vector3.zero;
						((Transform)component).localScale = Vector3.one;
						RTGLog.Line("SetupCardVisual '" + cardInfo.cardName + "': Art RectTransform reset to fill parent.");
					}
					else
					{
						val7.transform.localPosition = Vector3.zero;
						val7.transform.localScale = Vector3.one;
					}
					RTGLog.Line("SetupCardVisual '" + cardInfo.cardName + "': Art placed successfully.");
				}
				else
				{
					RTGLog.Warn("SetupCardVisual '" + cardInfo.cardName + "': 'Art' child not found — cannot place card art.");
				}
			}
			else
			{
				RTGLog.Line("SetupCardVisual '" + cardInfo.cardName + "': no cardArt set, skipping art placement.");
			}
		}

		private static GameObject FindChildByName(GameObject parent, string name)
		{
			Transform[] componentsInChildren = parent.GetComponentsInChildren<Transform>(true);
			foreach (Transform val in componentsInChildren)
			{
				if (((Object)val).name == name)
				{
					return ((Component)val).gameObject;
				}
			}
			return null;
		}

		private CardEntry GetOrCreateEntry(string cardObjectName)
		{
			CardEntry cardEntry = _deck.cards.Find((CardEntry e) => e.cardObjectName == cardObjectName);
			if (cardEntry == null)
			{
				cardEntry = new CardEntry
				{
					cardObjectName = cardObjectName,
					count = 0
				};
				_deck.cards.Add(cardEntry);
			}
			return cardEntry;
		}

		private void UpdateDeckCountDisplay()
		{
			//IL_006a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0054: Unknown result type (might be due to invalid IL or missing references)
			if (_deck != null)
			{
				int totalCount = _deck.TotalCount;
				((TMP_Text)_deckCountText).text = $"Cards in Deck: {totalCount} / {_deck.maxSize}";
				((Graphic)_deckCountText).color = (Color)((totalCount > _deck.maxSize) ? new Color(1f, 0.3f, 0.3f) : Color.white);
			}
		}

		private void BuildMaxSizeModal(Transform parent)
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_0010: Expected O, but got Unknown
			//IL_0045: Unknown result type (might be due to invalid IL or missing references)
			//IL_005a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0066: Unknown result type (might be due to invalid IL or missing references)
			//IL_006b: Unknown result type (might be due to invalid IL or missing references)
			//IL_006c: 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_0097: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ee: 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_012b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0136: Unknown result type (might be due to invalid IL or missing references)
			//IL_013b: Unknown result type (might be due to invalid IL or missing references)
			//IL_013c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0142: Unknown result type (might be due to invalid IL or missing references)
			//IL_0186: 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_01c5: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d0: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d5: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d6: Unknown result type (might be due to invalid IL or missing references)
			//IL_01dc: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ed: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f2: Unknown result type (might be due to invalid IL or missing references)
			//IL_0208: Unknown result type (might be due to invalid IL or missing references)
			//IL_0231: Unknown result type (might be due to invalid IL or missing references)
			//IL_0246: Unknown result type (might be due to invalid IL or missing references)
			//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_0257: Unknown result type (might be due to invalid IL or missing references)
			//IL_025d: 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_0279: Expected O, but got Unknown
			//IL_0284: Unknown result type (might be due to invalid IL or missing references)
			//IL_0289: Unknown result type (might be due to invalid IL or missing references)
			//IL_029f: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c8: 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_02e8: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ed: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ee: Unknown result type (might be due to invalid IL or missing references)
			//IL_02f4: Unknown result type (might be due to invalid IL or missing references)
			//IL_0306: Unknown result type (might be due to invalid IL or missing references)
			//IL_0310: Expected O, but got Unknown
			_maxSizeModal = new GameObject("MaxSizeModal");
			_maxSizeModal.transform.SetParent(parent, false);
			_maxSizeModal.SetActive(false);
			RectTransform val = _maxSizeModal.AddComponent<RectTransform>();
			val.anchorMin = new Vector2(0.3f, 0.35f);
			val.anchorMax = new Vector2(0.7f, 0.65f);
			Vector2 offsetMin = (val.offsetMax = Vector2.zero);
			val.offsetMin = offsetMin;
			((Graphic)_maxSizeModal.AddComponent<Image>()).color = new Color(0.08f, 0.08f, 0.14f, 0.98f);
			UIHelper.CreateText((Transform)(object)val, "Title", "Change Max Deck Size", 26, (TextAlignmentOptions)514);
			_maxSizeModalField = UIHelper.CreateInputField((Transform)(object)val, "SizeField", _deck?.maxSize.ToString() ?? "50", Vector2.zero, Vector2.zero, 22, (ContentType)2);
			RectTransform component = ((Component)_maxSizeModalField).GetComponent<RectTransform>();
			component.anchorMin = new Vector2(0.1f, 0.38f);
			component.anchorMax = new Vector2(0.9f, 0.55f);
			offsetMin = (component.offsetMax = Vector2.zero);
			component.offsetMin = offsetMin;
			((UnityEvent<string>)(object)_maxSizeModalField.onValueChanged).AddListener((UnityAction<string>)delegate
			{
				ValidateModal();
			});
			_maxSizeModalError = UIHelper.CreateText((Transform)(object)val, "ModalError", "", 17, (TextAlignmentOptions)514, (Color?)new Color(1f, 0.35f, 0.35f));
			RectTransform component2 = ((Component)_maxSizeModalError).GetComponent<RectTransform>();
			component2.anchorMin = new Vector2(0.05f, 0.25f);
			component2.anchorMax = new Vector2(0.95f, 0.37f);
			offsetMin = (component2.offsetMax = Vector2.zero);
			component2.offsetMin = offsetMin;
			Button obj = UIHelper.CreateButton((Transform)(object)val, "ConfirmBtn", "Confirm", Vector2.zero, Vector2.zero, 22, (Color?)new Color(0.15f, 0.5f, 0.15f), (Color?)null);
			RectTransform component3 = ((Component)obj).GetComponent<RectTransform>();
			component3.anchorMin = new Vector2(0.1f, 0.06f);
			component3.anchorMax = new Vector2(0.55f, 0.23f);
			offsetMin = (component3.offsetMax = Vector2.zero);
			component3.offsetMin = offsetMin;
			((UnityEvent)obj.onClick).AddListener(new UnityAction(ConfirmMaxSize));
			Button obj2 = UIHelper.CreateButton((Transform)(object)val, "CancelBtn", "Cancel", Vector2.zero, Vector2.zero, 22, (Color?)new Color(0.45f, 0.1f, 0.1f), (Color?)null);
			RectTransform component4 = ((Component)obj2).GetComponent<RectTransform>();
			component4.anchorMin = new Vector2(0.57f, 0.06f);
			component4.anchorMax = new Vector2(0.9f, 0.23f);
			offsetMin = (component4.offsetMax = Vector2.zero);
			component4.offsetMin = offsetMin;
			((UnityEvent)obj2.onClick).AddListener((UnityAction)delegate
			{
				_maxSizeModal.SetActive(false);
			});
		}

		private void OpenMaxSizeModal()
		{
			if (_deck != null)
			{
				RTGLog.Section($"DeckEditorScreen — Change Max Size (current={_deck.maxSize})");
				_maxSizeModalField.text = _deck.maxSize.ToString();
				((TMP_Text)_maxSizeModalError).text = "";
				_maxSizeModal.SetActive(true);
			}
		}

		private void ValidateModal()
		{
			int result;
			bool flag = int.TryParse(_maxSizeModalField.text, out result) && result >= 1;
			((TMP_Text)_maxSizeModalError).text = (flag ? "" : "Must be a number ≥ 1.");
		}

		private void ConfirmMaxSize()
		{
			if (int.TryParse(_maxSizeModalField.text, out var result) && result >= 1)
			{
				RTGLog.Section($"DeckEditorScreen — Confirm Max Size {result}");
				_deck.maxSize = result;
				UpdateDeckCountDisplay();
				_maxSizeModal.SetActive(false);
				DeckManager.instance?.Save();
			}
		}

		private void CloseScreen()
		{
			RTGLog.Section("DeckEditorScreen — Close");
			((Component)_canvas).gameObject.SetActive(false);
			DeckSelectorScreen.instance?.Show();
		}

		private static Color RarityColor(Rarity rarity)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: Expected I4, but got Unknown
			//IL_0023: 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_004d: 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)
			return (Color)((int)rarity switch
			{
				0 => new Color(0.6f, 0.6f, 0.6f), 
				1 => new Color(0.2f, 0.8f, 0.2f), 
				2 => new Color(0.2f, 0.4f, 1f), 
				_ => new Color(1f, 0.65f, 0f), 
			});
		}
	}
	public class DeckSelectorScreen : MonoBehaviour
	{
		public static DeckSelectorScreen instance;

		private Canvas _canvas;

		private Button _createBtn;

		private Button _editBtn;

		private Button _deleteBtn;

		private TextMeshProUGUI _deleteBtnLabel;

		private TMP_Dropdown _deckDropdown;

		private TextMeshProUGUI _activeDeckLabel;

		private GameObject _deleteModal;

		private TextMeshProUGUI _deleteModalMessage;

		private string _pendingDeleteDeckName;

		private void Awake()
		{
			instance = this;
			BuildUI();
		}

		private void BuildUI()
		{
			//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_006a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0076: Unknown result type (might be due to invalid IL or missing references)
			//IL_007c: 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_0086: 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_00a4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ab: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bb: Unknown result type (might be due to invalid IL or missing references)
			//IL_0101: Unknown result type (might be due to invalid IL or missing references)
			//IL_0110: 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)
			//IL_0147: Unknown result type (might be due to invalid IL or missing references)
			//IL_0151: Expected O, but got Unknown
			//IL_0167: Unknown result type (might be due to invalid IL or missing references)
			//IL_0176: 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_01ad: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b7: Expected O, but got Unknown
			//IL_01c4: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d3: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f7: Unknown result type (might be due to invalid IL or missing references)
			//IL_0206: Unknown result type (might be due to invalid IL or missing references)
			//IL_021a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0232: Unknown result type (might be due to invalid IL or missing references)
			//IL_023c: Expected O, but got Unknown
			//IL_0252: Unknown result type (might be due to invalid IL or missing references)
			//IL_0261: Unknown result type (might be due to invalid IL or missing references)
			//IL_0275: Unknown result type (might be due to invalid IL or missing references)
			//IL_0298: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a2: Expected O, but got Unknown
			//IL_02a8: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ad: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c4: Unknown result type (might be due to invalid IL or missing references)
			//IL_02d4: Unknown result type (might be due to invalid IL or missing references)
			//IL_0318: Unknown result type (might be due to invalid IL or missing references)
			//IL_0327: Unknown result type (might be due to invalid IL or missing references)
			//IL_0342: Unknown result type (might be due to invalid IL or missing references)
			//IL_034e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0354: Unknown result type (might be due to invalid IL or missing references)
			//IL_0358: Unknown result type (might be due to invalid IL or missing references)
			//IL_035e: Unknown result type (might be due to invalid IL or missing references)
			//IL_03a2: Unknown result type (might be due to invalid IL or missing references)
			//IL_03b1: Unknown result type (might be due to invalid IL or missing references)
			//IL_03c5: Unknown result type (might be due to invalid IL or missing references)
			//IL_03dd: Unknown result type (might be due to invalid IL or missing references)
			//IL_03e7: Expected O, but got Unknown
			_canvas = UIHelper.CreateFullscreenCanvas("RTG_DeckSelectorScreen", 200);
			UIHelper.CreateDimmedBackground(((Component)_canvas).transform);
			Transform transform = ((Component)_canvas).transform;
			Vector2 anchorMin = new Vector2(0.3f, 0.15f);
			Vector2 anchorMax = new Vector2(0.7f, 0.85f);
			Color? bg = new Color(0.08f, 0.08f, 0.12f, 1f);
			RectTransform parent = UIHelper.CreatePanel(transform, "Panel", anchorMin, anchorMax, default(Vector2), default(Vector2), bg);
			UIHelper.CreateText((Transform)(object)UIHelper.CreatePanel((Transform)(object)parent, "Title", new Vector2(0f, 0.85f), Vector2.one), "TitleText", "Your Decks", 38, (TextAlignmentOptions)514);
			_createBtn = AnchorButton(parent, "CreateBtn", "Create New Deck", new Vector2(0.08f, 0.74f), new Vector2(0.92f, 0.85f), new Color(0.15f, 0.5f, 0.15f), 26);
			((UnityEvent)_createBtn.onClick).AddListener(new UnityAction(OnCreateClicked));
			_editBtn = AnchorButton(parent, "EditBtn", "Edit Deck", new Vector2(0.08f, 0.6f), new Vector2(0.92f, 0.72f), new Color(0.2f, 0.3f, 0.55f), 26);
			((UnityEvent)_editBtn.onClick).AddListener(new UnityAction(OnEditClicked));
			_deckDropdown = BuildDropdown(parent, new Vector2(0.08f, 0.46f), new Vector2(0.92f, 0.58f));
			((UnityEvent)AnchorButton(parent, "SetBtn", "Set Playable Deck", new Vector2(0.08f, 0.31f), new Vector2(0.5f, 0.43f), new Color(0.55f, 0.35f, 0.05f), 22).onClick).AddListener(new UnityAction(OnSetPlayableDeckClicked));
			_deleteBtn = AnchorButton(parent, "DeleteBtn", "Delete Deck", new Vector2(0.52f, 0.31f), new Vector2(0.92f, 0.43f), new Color(0.55f, 0.12f, 0.12f), 22);
			((UnityEvent)_deleteBtn.onClick).AddListener(new UnityAction(OnDeleteClicked));
			ColorBlock colors = ((Selectable)_deleteBtn).colors;
			((ColorBlock)(ref colors)).disabledColor = new Color(0.28f, 0.28f, 0.32f, 1f);
			((Selectable)_deleteBtn).colors = colors;
			Transform obj = ((Component)_deleteBtn).transform.Find("Label");
			_deleteBtnLabel = ((obj != null) ? ((Component)obj).GetComponent<TextMeshProUGUI>() : null);
			BuildDeleteModal(parent);
			Vector2 anchorMin2 = new Vector2(0.05f, 0.19f);
			Vector2 anchorMax2 = new Vector2(0.95f, 0.29f);
			bg = new Color(0.05f, 0.05f, 0.08f, 0.8f);
			RectTransform parent2 = UIHelper.CreatePanel((Transform)(object)parent, "ActiveDeckPanel", anchorMin2, anchorMax2, default(Vector2), default(Vector2), bg);
			_activeDeckLabel = UIHelper.CreateText((Transform)(object)parent2, "ActiveDeckLabel", "Active: —", 20, (TextAlignmentOptions)514);
			((UnityEvent)AnchorButton(parent, "CloseBtn", "Close", new Vector2(0.2f, 0.06f), new Vector2(0.8f, 0.16f), new Color(0.45f, 0.1f, 0.1f), 22).onClick).AddListener(new UnityAction(Hide));
			((Component)_canvas).gameObject.SetActive(false);
		}

		private static Button AnchorButton(RectTransform parent, string name, string label, Vector2 anchorMin, Vector2 anchorMax, Color bgColor, int fontSize)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Expected O, but got Unknown
			//IL_001b: 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_002a: Unknown result type (might be due to invalid IL or missing references)
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0030: 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_0044: Unknown result type (might be due to invalid IL or missing references)
			//IL_005a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0062: Unknown result type (might be due to invalid IL or missing references)
			//IL_006b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0072: Unknown result type (might be due to invalid IL or missing references)
			//IL_007e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0085: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00db: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ed: 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_00ff: Unknown result type (might be due to invalid IL or missing references)
			//IL_010a: Unknown result type (might be due to invalid IL or missing references)
			//IL_010f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0110: 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_013c: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = new GameObject(name);
			val.transform.SetParent((Transform)(object)parent, false);
			RectTransform obj = val.AddComponent<RectTransform>();
			obj.anchorMin = anchorMin;
			obj.anchorMax = anchorMax;
			Vector2 offsetMin = (obj.offsetMax = Vector2.zero);
			obj.offsetMin = offsetMin;
			Image val2 = val.AddComponent<Image>();
			((Graphic)val2).color = bgColor;
			Button obj2 = val.AddComponent<Button>();
			((Selectable)obj2).targetGraphic = (Graphic)(object)val2;
			ColorBlock val3 = default(ColorBlock);
			((ColorBlock)(ref val3)).normalColor = bgColor;
			((ColorBlock)(ref val3)).highlightedColor = bgColor * 1.3f;
			((ColorBlock)(ref val3)).pressedColor = bgColor * 0.7f;
			((ColorBlock)(ref val3)).disabledColor = new Color(0.25f, 0.25f, 0.25f, 0.6f);
			((ColorBlock)(ref val3)).colorMultiplier = 1f;
			((ColorBlock)(ref val3)).fadeDuration = 0.1f;
			ColorBlock colors = val3;
			((Selectable)obj2).colors = colors;
			GameObject val4 = new GameObject("Label");
			val4.transform.SetParent(val.transform, false);
			RectTransform obj3 = val4.AddComponent<RectTransform>();
			obj3.anchorMin = Vector2.zero;
			obj3.anchorMax = Vector2.one;
			offsetMin = (obj3.offsetMax = Vector2.zero);
			obj3.offsetMin = offsetMin;
			TextMeshProUGUI obj4 = val4.AddComponent<TextMeshProUGUI>();
			((TMP_Text)obj4).text = label;
			((TMP_Text)obj4).fontSize = fontSize;
			((TMP_Text)obj4).alignment = (TextAlignmentOptions)514;
			((Graphic)obj4).color = Color.white;
			return obj2;
		}

		private TMP_Dropdown BuildDropdown(RectTransform parent, Vector2 anchorMin, Vector2 anchorMax)
		{
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_000b: Expected O, but got Unknown
			//IL_001f: 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_002d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0032: Unknown result type (might be due to invalid IL or missing references)
			//IL_0033: 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_005d: 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_007e: 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_0097: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e7: Unknown result type (might be due to invalid IL or missing references)
			//IL_0108: Unknown result type (might be due to invalid IL or missing references)
			//IL_010d: Unknown result type (might be due to invalid IL or missing references)
			//IL_011f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0130: Unknown result type (might be due to invalid IL or missing references)
			//IL_0145: 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_016f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0183: 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_01c2: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c8: Expected O, but got Unknown
			//IL_01f5: Unknown result type (might be due to invalid IL or missing references)
			//IL_020b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0221: Unknown result type (might be due to invalid IL or missing references)
			//IL_022d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0243: Unknown result type (might be due to invalid IL or missing references)
			//IL_0285: Unknown result type (might be due to invalid IL or missing references)
			//IL_02af: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b6: Expected O, but got Unknown
			//IL_02d4: Unknown result type (might be due to invalid IL or missing references)
			//IL_02e0: Unknown result type (might be due to invalid IL or missing references)
			//IL_02f6: Unknown result type (might be due to invalid IL or missing references)
			//IL_030c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0322: Unknown result type (might be due to invalid IL or missing references)
			//IL_0347: Unknown result type (might be due to invalid IL or missing references)
			//IL_036b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0372: Expected O, but got Unknown
			//IL_039b: Unknown result type (might be due to invalid IL or missing references)
			//IL_03b1: Unknown result type (might be due to invalid IL or missing references)
			//IL_03c7: Unknown result type (might be due to invalid IL or missing references)
			//IL_03d3: Unknown result type (might be due to invalid IL or missing references)
			//IL_03e9: 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_0406: Expected O, but got Unknown
			//IL_042c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0441: Unknown result type (might be due to invalid IL or missing references)
			//IL_0456: Unknown result type (might be due to invalid IL or missing references)
			//IL_046a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0493: Unknown result type (might be due to invalid IL or missing references)
			//IL_04b5: Unknown result type (might be due to invalid IL or missing references)
			//IL_04d1: Unknown result type (might be due to invalid IL or missing references)
			//IL_04f1: Unknown result type (might be due to invalid IL or missing references)
			//IL_0511: Unknown result type (might be due to invalid IL or missing references)
			//IL_0531: Unknown result type (might be due to invalid IL or missing references)
			//IL_0553: Unknown result type (might be due to invalid IL or missing references)
			//IL_0555: Unknown result type (might be due to invalid IL or missing references)
			//IL_0558: Unknown result type (might be due to invalid IL or missing references)
			//IL_0564: Unknown result type (might be due to invalid IL or missing references)
			//IL_0569: Unknown result type (might be due to invalid IL or missing references)
			//IL_057c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0583: Unknown result type (might be due to invalid IL or missing references)
			//IL_058e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0599: Unknown result type (might be due to invalid IL or missing references)
			//IL_05a3: Unknown result type (might be due to invalid IL or missing references)
			//IL_05ca: Unknown result type (might be due to invalid IL or missing references)
			//IL_05e0: Unknown result type (might be due to invalid IL or missing references)
			//IL_05e5: Unknown result type (might be due to invalid IL or missing references)
			//IL_05f8: Unknown result type (might be due to invalid IL or missing references)
			//IL_05ff: Unknown result type (might be due to invalid IL or missing references)
			//IL_060a: Unknown result type (might be due to invalid IL or missing references)
			//IL_061f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0633: Unknown result type (might be due to invalid IL or missing references)
			//IL_0652: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = new GameObject("DeckDropdown");
			val.transform.SetParent((Transform)(object)parent, false);
			RectTransform obj = val.AddComponent<RectTransform>();
			obj.anchorMin = anchorMin;
			obj.anchorMax = anchorMax;
			Vector2 offsetMin = (obj.offsetMax = Vector2.zero);
			obj.offsetMin = offsetMin;
			Image val2 = val.AddComponent<Image>();
			((Graphic)val2).color = new Color(0.12f, 0.12f, 0.18f, 0.95f);
			TMP_Dropdown obj2 = val.AddComponent<TMP_Dropdown>();
			((Selectable)obj2).targetGraphic = (Graphic)(object)val2;
			GameObject val3 = new GameObject("Label");
			val3.transform.SetParent(val.transform, false);
			RectTransform obj3 = val3.AddComponent<RectTransform>();
			obj3.anchorMin = Vector2.zero;
			obj3.anchorMax = Vector2.one;
			obj3.offsetMin = new Vector2(10f, 4f);
			obj3.offsetMax = new Vector2(-30f, -4f);
			TextMeshProUGUI val4 = val3.AddComponent<TextMeshProUGUI>();
			((TMP_Text)val4).fontSize = 20f;
			((Graphic)val4).color = Color.white;
			((TMP_Text)val4).alignment = (TextAlignmentOptions)4097;
			obj2.captionText = (TMP_Text)(object)val4;
			GameObject val5 = new GameObject("Arrow");
			val5.transform.SetParent(val.transform, false);
			RectTransform obj4 = val5.AddComponent<RectTransform>();
			obj4.anchorMin = new Vector2(1f, 0f);
			obj4.anchorMax = new Vector2(1f, 1f);
			obj4.pivot = new Vector2(1f, 0.5f);
			obj4.sizeDelta = new Vector2(30f, 0f);
			obj4.anchoredPosition = new Vector2(-5f, 0f);
			TextMeshProUGUI obj5 = val5.AddComponent<TextMeshProUGUI>();
			((TMP_Text)obj5).text = "v";
			((TMP_Text)obj5).fontSize = 18f;
			((Graphic)obj5).color = Color.white;
			((TMP_Text)obj5).alignment = (TextAlignmentOptions)514;
			GameObject val6 = new GameObject("Template");
			val6.transform.SetParent(val.transform, false);
			val6.SetActive(false);
			RectTransform val7 = val6.AddComponent<RectTransform>();
			val7.anchorMin = new Vector2(0f, 0f);
			val7.anchorMax = new Vector2(1f, 0f);
			val7.pivot = new Vector2(0.5f, 1f);
			val7.anchoredPosition = Vector2.zero;
			val7.sizeDelta = new Vector2(0f, 400f);
			Canvas obj6 = val6.AddComponent<Canvas>();
			obj6.overrideSorting = true;
			obj6.sortingOrder = 500;
			val6.AddComponent<GraphicRaycaster>();
			((Graphic)val6.AddComponent<Image>()).color = new Color(0.08f, 0.08f, 0.12f, 1f);
			ScrollRect obj7 = val6.AddComponent<ScrollRect>();
			obj7.horizontal = false;
			obj7.vertical = true;
			obj7.movementType = (MovementType)2;
			GameObject val8 = new GameObject("Viewport");
			val8.transform.SetParent(val6.transform, false);
			RectTransform val9 = val8.AddComponent<RectTransform>();
			val9.anchorMin = Vector2.zero;
			val9.anchorMax = Vector2.one;
			val9.offsetMin = new Vector2(2f, 2f);
			val9.offsetMax = new Vector2(-2f, -2f);
			val9.pivot = new Vector2(0f, 1f);
			((Graphic)val8.AddComponent<Image>()).color = new Color(0.08f, 0.08f, 0.12f, 1f);
			val8.AddComponent<Mask>().showMaskGraphic = false;
			obj7.viewport = val9;
			GameObject val10 = new GameObject("Content");
			val10.transform.SetParent(val8.transform, false);
			RectTransform val11 = val10.AddComponent<RectTransform>();
			val11.anchorMin = new Vector2(0f, 1f);
			val11.anchorMax = new Vector2(1f, 1f);
			val11.pivot = new Vector2(0.5f, 1f);
			val11.anchoredPosition = Vector2.zero;
			val11.sizeDelta = new Vector2(0f, 56f);
			obj7.content = val11;
			GameObject val12 = new GameObject("Item");
			val12.transform.SetParent(val10.transform, false);
			RectTransform obj8 = val12.AddComponent<RectTransform>();
			obj8.anchorMin = new Vector2(0f, 0.5f);
			obj8.anchorMax = new Vector2(1f, 0.5f);
			obj8.pivot = new Vector2(0.5f, 0.5f);
			obj8.sizeDelta = new Vector2(0f, 54f);
			Image val13 = val12.AddComponent<Image>();
			((Graphic)val13).color = new Color(0.15f, 0.15f, 0.2f, 1f);
			Toggle obj9 = val12.AddComponent<Toggle>();
			((Selectable)obj9).targetGraphic = (Graphic)(object)val13;
			obj9.isOn = true;
			ColorBlock val14 = default(ColorBlock);
			((ColorBlock)(ref val14)).normalColor = new Color(0.15f, 0.15f, 0.2f, 1f);
			((ColorBlock)(ref val14)).highlightedColor = new Color(0.25f, 0.3f, 0.4f, 1f);
			((ColorBlock)(ref val14)).pressedColor = new Color(0.3f, 0.35f, 0.5f, 1f);
			((ColorBlock)(ref val14)).disabledColor = new Color(0.2f, 0.2f, 0.2f, 0.5f);
			((ColorBlock)(ref val14)).colorMultiplier = 1f;
			((ColorBlock)(ref val14)).fadeDuration = 0.1f;
			ColorBlock colors = val14;
			((Selectable)obj9).colors = colors;
			GameObject val15 = new GameObject("Item Background");
			val15.transform.SetParent(val12.transform, false);
			RectTransform obj10 = val15.AddComponent<RectTransform>();
			obj10.anchorMin = Vector2.zero;
			obj10.anchorMax = Vector2.one;
			obj10.offsetMin = Vector2.zero;
			obj10.offsetMax = Vector2.zero;
			Image val16 = val15.AddComponent<Image>();
			((Graphic)val16).color = new Color(0.2f, 0.45f, 0.65f, 1f);
			obj9.graphic = (Graphic)(object)val16;
			GameObject val17 = new GameObject("Item Label");
			val17.transform.SetParent(val12.transform, false);
			RectTransform obj11 = val17.AddComponent<RectTransform>();
			obj11.anchorMin = Vector2.zero;
			obj11.anchorMax = Vector2.one;
			obj11.offsetMin = new Vector2(8f, 4f);
			obj11.offsetMax = new Vector2(-8f, -4f);
			TextMeshProUGUI val18 = val17.AddComponent<TextMeshProUGUI>();
			((TMP_Text)val18).fontSize = 22f;
			((Graphic)val18).color = Color.white;
			((TMP_Text)val18).alignment = (TextAlignmentOptions)514;
			((Graphic)val18).raycastTarget = false;
			obj2.itemText = (TMP_Text)(object)val18;
			obj2.template = val7;
			((UnityEvent<int>)(object)obj2.onValueChanged).AddListener((UnityAction<int>)delegate
			{
				UpdateDeleteButtonState();
			});
			return obj2;
		}

		private void BuildDeleteModal(RectTransform parent)
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_0010: Expected O, but got Unknown
			//IL_003a: 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_0050: Unknown result type (might be due to invalid IL or missing references)
			//IL_0055: Unknown result type (might be due to invalid IL or missing references)
			//IL_0056: Unknown result type (might be due to invalid IL or missing references)
			//IL_005c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0082: 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_009c: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c5: 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_00e6: 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_00ec: 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_0111: Unknown result type (might be due to invalid IL or missing references)
			//IL_013c: Unknown result type (might be due to invalid IL or missing references)
			//IL_015b: 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_017b: 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_0181: Unknown result type (might be due to invalid IL or missing references)
			//IL_0187: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c9: Unknown result type (might be due to invalid IL or missing references)
			//IL_01de: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e9: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ee: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ef: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f5: Unknown result type (might be due to invalid IL or missing references)
			//IL_0212: Unknown result type (might be due to invalid IL or missing references)
			//IL_0217: Unknown result type (might be due to invalid IL or missing references)
			//IL_022d: 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_026b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0276: Unknown result type (might be due to invalid IL or missing references)
			//IL_027b: Unknown result type (might be due to invalid IL or missing references)
			//IL_027c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0282: Unknown result type (might be due to invalid IL or missing references)
			//IL_0294: Unknown result type (might be due to invalid IL or missing references)
			//IL_029e: Expected O, but got Unknown
			//IL_02a9: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ae: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c4: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ed: Unknown result type (might be due to invalid IL or missing references)
			//IL_0302: Unknown result type (might be due to invalid IL or missing references)
			//IL_030d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0312: Unknown result type (might be due to invalid IL or missing references)
			//IL_0313: Unknown result type (might be due to invalid IL or missing references)
			//IL_0319: Unknown result type (might be due to invalid IL or missing references)
			//IL_032b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0335: Expected O, but got Unknown
			_deleteModal = new GameObject("DeleteDeckModal");
			_deleteModal.transform.SetParent((Transform)(object)parent, false);
			_deleteModal.SetActive(false);
			RectTransform obj = _deleteModal.AddComponent<RectTransform>();
			obj.anchorMin = Vector2.zero;
			obj.anchorMax = Vector2.one;
			Vector2 offsetMin = (obj.offsetMax = Vector2.zero);
			obj.offsetMin = offsetMin;
			Image obj2 = _deleteModal.AddComponent<Image>();
			((Graphic)obj2).color = new Color(0.06f, 0.06f, 0.09f, 1f);
			((Graphic)obj2).raycastTarget = true;
			GameObject val = new GameObject("Dialog");
			val.transform.SetParent(_deleteModal.transform, false);
			RectTransform val2 = val.AddComponent<RectTransform>();
			val2.anchorMin = new Vector2(0.06f, 0.3f);
			val2.anchorMax = new Vector2(0.94f, 0.7f);
			offsetMin = (val2.offsetMax = Vector2.zero);
			val2.offsetMin = offsetMin;
			((Graphic)val.AddComponent<Image>()).color = new Color(0.08f, 0.08f, 0.14f, 1f);
			RectTransform component = ((Component)UIHelper.CreateText((Transform)(object)val2, "Title", "Delete Deck?", 26, (TextAlignmentOptions)514, (Color?)new Color(0.85f, 0.2f, 0.2f))).GetComponent<RectTransform>();
			component.anchorMin = new Vector2(0f, 0.74f);
			component.anchorMax = new Vector2(1f, 1f);
			offsetMin = (component.offsetMax = Vector2.zero);
			component.offsetMin = offsetMin;
			_deleteModalMessage = UIHelper.CreateText((Transform)(object)val2, "Message", "", 19, (TextAlignmentOptions)514);
			RectTransform component2 = ((Component)_deleteModalMessage).GetComponent<RectTransform>();
			component2.anchorMin = new Vector2(0.06f, 0.32f);
			component2.anchorMax = new Vector2(0.94f, 0.74f);
			offsetMin = (component2.offsetMax = Vector2.zero);
			component2.offsetMin = offsetMin;
			((TMP_Text)_deleteModalMessage).enableWordWrapping = true;
			Button obj3 = UIHelper.CreateButton((Transform)(object)val2, "ConfirmBtn", "Delete", Vector2.zero, Vector2.zero, 22, (Color?)new Color(0.55f, 0.12f, 0.12f), (Color?)null);
			RectTransform component3 = ((Component)obj3).GetComponent<RectTransform>();
			component3.anchorMin = new Vector2(0.08f, 0.08f);
			component3.anchorMax = new Vector2(0.48f, 0.28f);
			offsetMin = (component3.offsetMax = Vector2.zero);
			component3.offsetMin = offsetMin;
			((UnityEvent)obj3.onClick).AddListener(new UnityAction(ConfirmDeleteDeck));
			Button obj4 = UIHelper.CreateButton((Transform)(object)val2, "CancelBtn", "Cancel", Vector2.zero, Vector2.zero, 22, (Color?)new Color(0.25f, 0.25f, 0.3f), (Color?)null);
			RectTransform component4 = ((Component)obj4).GetComponent<RectTransform>();
			component4.anchorMin = new Vector2(0.52f, 0.08f);
			component4.anchorMax = new Vector2(0.92f, 0.28f);
			offsetMin = (component4.offsetMax = Vector2.zero);
			component4.offsetMin = offsetMin;
			((UnityEvent)obj4.onClick).AddListener(new UnityAction(CancelDeleteDeck));
			_deleteModal.transform.SetAsLastSibling();
		}

		public void Show()
		{
			RTGLog.Section("DeckSelectorScreen — Show");
			RefreshDropdown();
			((Component)_canvas).gameObject.SetActive(true);
		}

		public void Hide()
		{
			RTGLog.Section("DeckSelectorScreen — Hide");
			CancelDeleteDeck();
			((Component)_canvas).gameObject.SetActive(false);
		}

		private void RefreshDropdown()
		{
			//IL_00dc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e6: Expected O, but got Unknown
			//IL_0098: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a2: Expected O, but got Unknown
			RTGLog.Line("RefreshDropdown: DeckManager.instance is " + (((Object)(object)DeckManager.instance == (Object)null) ? "NULL" : "valid"));
			List<DeckData> list = DeckManager.instance?.AllDecks ?? new List<DeckData>();
			RTGLog.Line($"RefreshDropdown: {list.Count} custom deck(s).");
			_deckDropdown.ClearOptions();
			List<OptionData> list2 = new List<OptionData>();
			if (list.Count > 0)
			{
				foreach (DeckData item in list)
				{
					list2.Add(new OptionData(item.name));
					RTGLog.Line("  Added custom deck: '" + item.name + "'");
				}
			}
			list2.Add