Decompiled source of Rounds The GATHERING v1.0.2

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.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETFramework,Version=v4.7.1", FrameworkDisplayName = ".NET Framework 4.7.1")]
[assembly: AssemblyCompany("RoundsTheGathering")]
[assembly: AssemblyConfiguration("Debug")]
[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
{
	[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_001c: 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_004a: Expected O, but got Unknown
			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)(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_0041: 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_006b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0077: Unknown result type (might be due to invalid IL or missing references)
			//IL_007d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0081: Unknown result type (might be due to invalid IL or missing references)
			//IL_0087: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ad: 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_00b7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bd: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_0117: 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_0121: Unknown result type (might be due to invalid IL or missing references)
			//IL_0127: Unknown result type (might be due to invalid IL or missing references)
			//IL_0167: Unknown result type (might be due to invalid IL or missing references)
			//IL_016c: 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_01ab: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b8: Unknown result type (might be due to invalid IL or missing references)
			//IL_01bd: Unknown result type (might be due to invalid IL or missing references)
			//IL_01be: 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_01fb: Unknown result type (might be due to invalid IL or missing references)
			//IL_020a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0211: Unknown result type (might be due to invalid IL or missing references)
			//IL_0217: 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_0221: 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_0268: Unknown result type (might be due to invalid IL or missing references)
			//IL_0293: Unknown result type (might be due to invalid IL or missing references)
			//IL_02aa: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b9: Unknown result type (might be due to invalid IL or missing references)
			//IL_02be: Unknown result type (might be due to invalid IL or missing references)
			//IL_02bf: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c7: 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_031c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0323: Unknown result type (might be due to invalid IL or missing references)
			//IL_0329: Unknown result type (might be due to invalid IL or missing references)
			//IL_032d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0333: Unknown result type (might be due to invalid IL or missing references)
			//IL_0369: Unknown result type (might be due to invalid IL or missing references)
			//IL_0393: 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_03b6: Unknown result type (might be due to invalid IL or missing references)
			//IL_03d9: Unknown result type (might be due to invalid IL or missing references)
			//IL_03e3: Expected O, but got Unknown
			//IL_03f9: 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_041c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0438: Unknown result type (might be due to invalid IL or missing references)
			//IL_0442: 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);
			RectTransform parent2 = UIHelper.CreatePanel((Transform)(object)parent, "Title", new Vector2(0f, 0.88f), Vector2.one);
			UIHelper.CreateText((Transform)(object)parent2, "TitleText", "Create New Deck", 34, (TextAlignmentOptions)514);
			RectTransform parent3 = UIHelper.CreatePanel((Transform)(object)parent, "NameLabel", new Vector2(0.05f, 0.74f), new Vector2(0.95f, 0.82f));
			UIHelper.CreateText((Transform)(object)parent3, "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();
			});
			RectTransform parent4 = UIHelper.CreatePanel((Transform)(object)parent, "SizeLabel", new Vector2(0.05f, 0.48f), new Vector2(0.95f, 0.57f));
			UIHelper.CreateText((Transform)(object)parent4, "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 parent5 = UIHelper.CreatePanel((Transform)(object)parent, "ErrorPanel", new Vector2(0.05f, 0.26f), new Vector2(0.95f, 0.34f));
			_errorText = UIHelper.CreateText((Transform)(object)parent5, "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));
			Button val = 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);
			((UnityEvent)val.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_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Expected O, but got Unknown
			//IL_001e: 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_0030: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: 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_004e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_0070: Unknown result type (might be due to invalid IL or missing references)
			//IL_007a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0081: Unknown result type (might be due to invalid IL or missing references)
			//IL_008e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0095: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b6: 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_00e8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ef: Expected O, but got Unknown
			//IL_010e: Unknown result type (might be due to invalid IL or missing references)
			//IL_011b: Unknown result type (might be due to invalid IL or missing references)
			//IL_012a: Unknown result type (might be due to invalid IL or missing references)
			//IL_012f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0130: Unknown result type (might be due to invalid IL or missing references)
			//IL_0138: 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)
			GameObject val = new GameObject(name);
			val.transform.SetParent((Transform)(object)parent, false);
			RectTransform val2 = val.AddComponent<RectTransform>();
			val2.anchorMin = anchorMin;
			val2.anchorMax = anchorMax;
			Vector2 offsetMin = (val2.offsetMax = Vector2.zero);
			val2.offsetMin = offsetMin;
			Image val3 = val.AddComponent<Image>();
			((Graphic)val3).color = bgColor;
			Button val4 = val.AddComponent<Button>();
			((Selectable)val4).targetGraphic = (Graphic)(object)val3;
			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)val4).colors = colors;
			GameObject val5 = new GameObject("Label");
			val5.transform.SetParent(val.transform, false);
			RectTransform val6 = val5.AddComponent<RectTransform>();
			val6.anchorMin = Vector2.zero;
			val6.anchorMax = Vector2.one;
			offsetMin = (val6.offsetMax = Vector2.zero);
			val6.offsetMin = offsetMin;
			TextMeshProUGUI val7 = val5.AddComponent<TextMeshProUGUI>();
			((TMP_Text)val7).text = label;
			((TMP_Text)val7).fontSize = fontSize;
			((TMP_Text)val7).alignment = (TextAlignmentOptions)514;
			((Graphic)val7).color = Color.white;
			return val4;
		}

		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_005f: 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_0084: 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_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_0103: Unknown result type (might be due to invalid IL or missing references)
			//IL_0119: Unknown result type (might be due to invalid IL or missing references)
			//IL_0126: Unknown result type (might be due to invalid IL or missing references)
			//IL_012b: Unknown result type (might be due to invalid IL or missing references)
			//IL_012c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0134: Unknown result type (might be due to invalid IL or missing references)
			//IL_017a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0190: Unknown result type (might be due to invalid IL or missing references)
			//IL_019d: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a2: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a3: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ab: Unknown result type (might be due to invalid IL or missing references)
			//IL_01be: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c3: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d9: Unknown result type (might be due to invalid IL or missing references)
			//IL_0209: Unknown result type (might be due to invalid IL or missing references)
			//IL_0220: Unknown result type (might be due to invalid IL or missing references)
			//IL_022f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0234: Unknown result type (might be due to invalid IL or missing references)
			//IL_0235: Unknown result type (might be due to invalid IL or missing references)
			//IL_023d: 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_025d: Expected O, but got Unknown
			//IL_0269: Unknown result type (might be due to invalid IL or missing references)
			//IL_026e: 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_02b4: 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_02da: Unknown result type (might be due to invalid IL or missing references)
			//IL_02df: 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_02e8: Unknown result type (might be due to invalid IL or missing references)
			//IL_02fe: Unknown result type (might be due to invalid IL or missing references)
			//IL_0308: Expected O, but got Unknown
			//IL_030f: Unknown result type (might be due to invalid IL or missing references)
			//IL_031e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0339: Unknown result type (might be due to invalid IL or missing references)
			//IL_0345: Unknown result type (might be due to invalid IL or missing references)
			//IL_034b: Unknown result type (might be due to invalid IL or missing references)
			//IL_034f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0355: Unknown result type (might be due to invalid IL or missing references)
			//IL_037f: Unknown result type (might be due to invalid IL or missing references)
			//IL_038c: Unknown result type (might be due to invalid IL or missing references)
			//IL_039b: Unknown result type (might be due to invalid IL or missing references)
			//IL_03a0: Unknown result type (might be due to invalid IL or missing references)
			//IL_03a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_03a9: Unknown result type (might be due to invalid IL or missing references)
			//IL_0404: Unknown result type (might be due to invalid IL or missing references)
			//IL_040e: Expected O, but got Unknown
			//IL_041f: Unknown result type (might be due to invalid IL or missing references)
			//IL_042e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0449: 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_045b: Unknown result type (might be due to invalid IL or missing references)
			//IL_045f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0465: Unknown result type (might be due to invalid IL or missing references)
			//IL_048f: Unknown result type (might be due to invalid IL or missing references)
			//IL_049c: Unknown result type (might be due to invalid IL or missing references)
			//IL_04ab: Unknown result type (might be due to invalid IL or missing references)
			//IL_04b0: Unknown result type (might be due to invalid IL or missing references)
			//IL_04b1: Unknown result type (might be due to invalid IL or missing references)
			//IL_04b9: Unknown result type (might be due to invalid IL or missing references)
			//IL_04df: Unknown result type (might be due to invalid IL or missing references)
			//IL_04f6: Unknown result type (might be due to invalid IL or missing references)
			//IL_050b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0515: 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 val = 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)val).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)val.onClick).AddListener(new UnityAction(OpenMaxSizeModal));
			Button val2 = 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)val2).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)val2.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 parent3 = UIHelper.CreatePanel((Transform)(object)parent, "LeftPanel", zero5, anchorMax, default(Vector2), default(Vector2), bg);
			GameObject val3 = BuildScrollRect((Transform)(object)parent3, "CategoryScroll", out _categoryButtonParent);
			RectTransform component5 = val3.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 val4 = ((Component)_categoryButtonParent).gameObject.AddComponent<VerticalLayoutGroup>();
			((HorizontalOrVerticalLayoutGroup)val4).childControlHeight = false;
			((HorizontalOrVerticalLayoutGroup)val4).childForceExpandHeight = false;
			((HorizontalOrVerticalLayoutGroup)val4).spacing = 4f;
			((LayoutGroup)val4).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);
			RectTransform parent4 = UIHelper.CreatePanel((Transform)(object)parent, "RightPanel", anchorMin2, anchorMax2, default(Vector2), default(Vector2), bg);
			GameObject val5 = BuildScrollRect((Transform)(object)parent4, "CardScroll", out _cardGridContent);
			RectTransform component6 = val5.GetComponent<RectTransform>();
			component6.anchorMin = Vector2.zero;
			component6.anchorMax = Vector2.one;
			offsetMin = (component6.offsetMax = Vector2.zero);
			component6.offsetMin = offsetMin;
			GridLayoutGroup val6 = ((Component)_cardGridContent).gameObject.AddComponent<GridLayoutGroup>();
			val6.cellSize = new Vector2(220f, 300f);
			val6.spacing = new Vector2(10f, 10f);
			((LayoutGroup)val6).padding = new RectOffset(10, 10, 10, 10);
			val6.startCorner = (Corner)0;
			val6.startAxis = (Axis)0;
			((LayoutGroup)val6).childAlignment = (TextAnchor)0;
			val6.constraint = (Constraint)0;
			_cardScrollRect = val5.GetComponent<ScrollRect>();
			BuildMaxSizeModal((Transform)(object)parent);
			((Component)_canvas).gameObject.SetActive(false);
		}

		private static GameObject BuildScrollRect(Transform parent, string name, out Transform content)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Expected O, but got Unknown
			//IL_001e: 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_0037: Unknown result type (might be due to invalid IL or missing references)
			//IL_003c: Unknown result type (might be due to invalid IL or missing references)
			//IL_003d: 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_007d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0083: Expected O, but got Unknown
			//IL_00a0: 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_00bc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ca: Unknown result type (might be due to invalid IL or missing references)
			//IL_00de: 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_0131: Unknown result type (might be due to invalid IL or missing references)
			//IL_0138: Expected O, but got Unknown
			//IL_0161: Unknown result type (might be due to invalid IL or missing references)
			//IL_0178: Unknown result type (might be due to invalid IL or missing references)
			//IL_018f: 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_01b3: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = new GameObject(name);
			val.transform.SetParent(parent, false);
			RectTransform val2 = val.AddComponent<RectTransform>();
			val2.anchorMin = Vector2.zero;
			val2.anchorMax = Vector2.one;
			Vector2 offsetMin = (val2.offsetMax = Vector2.zero);
			val2.offsetMin = offsetMin;
			ScrollRect val3 = val.AddComponent<ScrollRect>();
			val3.horizontal = false;
			val3.vertical = true;
			val3.movementType = (MovementType)2;
			val3.scrollSensitivity = 80f;
			GameObject val4 = new GameObject("Viewport");
			val4.transform.SetParent(val.transform, false);
			RectTransform val5 = val4.AddComponent<RectTransform>();
			val5.anchorMin = Vector2.zero;
			val5.anchorMax = Vector2.one;
			offsetMin = (val5.offsetMax = Vector2.zero);
			val5.offsetMin = offsetMin;
			val5.pivot = new Vector2(0f, 1f);
			Image val6 = val4.AddComponent<Image>();
			((Graphic)val6).color = new Color(1f, 1f, 1f, 0.01f);
			Mask val7 = val4.AddComponent<Mask>();
			val7.showMaskGraphic = false;
			val3.viewport = val5;
			GameObject val8 = new GameObject("Content");
			val8.transform.SetParent(val4.transform, false);
			RectTransform val9 = val8.AddComponent<RectTransform>();
			val9.anchorMin = new Vector2(0f, 1f);
			val9.anchorMax = new Vector2(1f, 1f);
			val9.pivot = new Vector2(0f, 1f);
			val9.sizeDelta = new Vector2(0f, 0f);
			val9.anchoredPosition = Vector2.zero;
			ContentSizeFitter val10 = val8.AddComponent<ContentSizeFitter>();
			val10.horizontalFit = (FitMode)0;
			val10.verticalFit = (FitMode)2;
			val3.content = val9;
			content = (Transform)(object)val9;
			return val;
		}

		private void BuildCategoryButtons()
		{
			//IL_0021: Unknown result type (might be due to invalid IL or missing references)
			//IL_0027: Expected O, but got Unknown
			//IL_00eb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fa: Unknown result type (might be due to invalid IL or missing references)
			//IL_0110: Unknown result type (might be due to invalid IL or missing references)
			//IL_0140: 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_016e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0188: Unknown result type (might be due to invalid IL or missing references)
			//IL_0192: Expected O, but got Unknown
			RTGLog.Section("DeckEditorScreen — BuildCategoryButtons");
			foreach (Transform item in _categoryButtonParent)
			{
				Transform val = item;
				Object.Destroy((Object)(object)((Component)val).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 val2 = 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)val2).GetComponent<RectTransform>();
				component.anchorMin = new Vector2(0f, 0f);
				component.anchorMax = new Vector2(1f, 0f);
				component.sizeDelta = new Vector2(0f, 44f);
				((UnityEvent)val2.onClick).AddListener((UnityAction)delegate
				{
					ShowCategory(captured);
				});
			}
			RTGLog.Line($"Built {CardManager.categories.Count} category button(s).");
		}

		private void ShowCategory(string category)
		{
			//IL_0251: 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_02e1: 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_0384: Unknown result type (might be due to invalid IL or missing references)
			//IL_0393: 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_03d0: 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)
			{
				Object.Destroy((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;
			foreach (string text in array)
			{
				CardInfo cardInfoWithName = CardManager.GetCardInfoWithName(text);
				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_003e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0044: Expected O, but got Unknown
			//IL_0069: 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_00ef: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f6: Expected O, but got Unknown
			//IL_011f: 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_0145: 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_014b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0153: Unknown result type (might be due to invalid IL or missing references)
			//IL_017a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0193: Unknown result type (might be due to invalid IL or missing references)
			//IL_019a: Expected O, but got Unknown
			//IL_01ba: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c7: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d6: Unknown result type (might be due to invalid IL or missing references)
			//IL_01db: 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_01e4: Unknown result type (might be due to invalid IL or missing references)
			//IL_0203: Unknown result type (might be due to invalid IL or missing references)
			//IL_0235: Unknown result type (might be due to invalid IL or missing references)
			//IL_023a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0266: Unknown result type (might be due to invalid IL or missing references)
			//IL_0270: Expected O, but got Unknown
			//IL_0297: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a4: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b3: 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_02b9: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c1: 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_02ef: Expected O, but got Unknown
			//IL_031d: 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_034b: 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_0379: Unknown result type (might be due to invalid IL or missing references)
			//IL_03a3: Unknown result type (might be due to invalid IL or missing references)
			//IL_03c6: Unknown result type (might be due to invalid IL or missing references)
			//IL_03f2: Unknown result type (might be due to invalid IL or missing references)
			//IL_03ff: Unknown result type (might be due to invalid IL or missing references)
			//IL_040e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0413: Unknown result type (might be due to invalid IL or missing references)
			//IL_0414: Unknown result type (might be due to invalid IL or missing references)
			//IL_041c: 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_0466: Unknown result type (might be due to invalid IL or missing references)
			//IL_046d: Expected O, but got Unknown
			//IL_049b: Unknown result type (might be due to invalid IL or missing references)
			//IL_04b2: Unknown result type (might be due to invalid IL or missing references)
			//IL_04c9: Unknown result type (might be due to invalid IL or missing references)
			//IL_04e0: Unknown result type (might be due to invalid IL or missing references)
			//IL_04f7: Unknown result type (might be due to invalid IL or missing references)
			//IL_0521: Unknown result type (might be due to invalid IL or missing references)
			//IL_053a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0541: Expected O, but got Unknown
			//IL_0561: Unknown result type (might be due to invalid IL or missing references)
			//IL_056e: Unknown result type (might be due to invalid IL or missing references)
			//IL_057d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0582: 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_058b: Unknown result type (might be due to invalid IL or missing references)
			//IL_05e4: Unknown result type (might be due to invalid IL or missing references)
			//IL_0601: Unknown result type (might be due to invalid IL or missing references)
			//IL_0608: Expected O, but got Unknown
			//IL_0636: Unknown result type (might be due to invalid IL or missing references)
			//IL_064d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0664: Unknown result type (might be due to invalid IL or missing references)
			//IL_067b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0692: Unknown result type (might be due to invalid IL or missing references)
			//IL_06bc: Unknown result type (might be due to invalid IL or missing references)
			//IL_06df: Unknown result type (might be due to invalid IL or missing references)
			//IL_070b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0718: Unknown result type (might be due to invalid IL or missing references)
			//IL_0727: Unknown result type (might be due to invalid IL or missing references)
			//IL_072c: Unknown result type (might be due to invalid IL or missing references)
			//IL_072d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0735: Unknown result type (might be due to invalid IL or missing references)
			//IL_0766: Unknown result type (might be due to invalid IL or missing references)
			//IL_079e: Unknown result type (might be due to invalid IL or missing references)
			//IL_07a8: Expected O, but got Unknown
			//IL_07b7: Unknown result type (might be due to invalid IL or missing references)
			//IL_07c1: Expected O, but got Unknown
			//IL_07d0: Unknown result type (might be due to invalid IL or missing references)
			//IL_07da: 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);
			RectTransform val2 = val.AddComponent<RectTransform>();
			val2.sizeDelta = new Vector2(220f, 300f);
			LayoutElement val3 = val.AddComponent<LayoutElement>();
			val3.preferredWidth = 220f;
			val3.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 val4 = new GameObject("RarityLabel");
			val4.transform.SetParent(val.transform, false);
			RectTransform val5 = val4.AddComponent<RectTransform>();
			val5.anchorMin = new Vector2(0f, 0f);
			val5.anchorMax = new Vector2(1f, 0.12f);
			Vector2 offsetMin = (val5.offsetMax = Vector2.zero);
			val5.offsetMin = offsetMin;
			Image val6 = val4.AddComponent<Image>();
			((Graphic)val6).color = new Color(0f, 0f, 0f, 0.7f);
			((Graphic)val6).raycastTarget = false;
			GameObject val7 = new GameObject("RarityText");
			val7.transform.SetParent(val4.transform, false);
			RectTransform val8 = val7.AddComponent<RectTransform>();
			val8.anchorMin = Vector2.zero;
			val8.anchorMax = Vector2.one;
			offsetMin = (val8.offsetMax = Vector2.zero);
			val8.offsetMin = offsetMin;
			TextMeshProUGUI val9 = val7.AddComponent<TextMeshProUGUI>();
			((TMP_Text)val9).text = $"{cardInfo.cardName} ({cardInfo.rarity})";
			((TMP_Text)val9).fontSize = 11f;
			((TMP_Text)val9).alignment = (TextAlignmentOptions)514;
			((Graphic)val9).color = RarityColor(cardInfo.rarity);
			((TMP_Text)val9).enableWordWrapping = false;
			((TMP_Text)val9).overflowMode = (TextOverflowModes)1;
			((Graphic)val9).raycastTarget = false;
			GameObject controlsGo = new GameObject("Controls");
			controlsGo.transform.SetParent(val.transform, false);
			RectTransform val10 = controlsGo.AddComponent<RectTransform>();
			val10.anchorMin = Vector2.zero;
			val10.anchorMax = Vector2.one;
			offsetMin = (val10.offsetMax = Vector2.zero);
			val10.offsetMin = offsetMin;
			controlsGo.SetActive(entry.count > 0);
			GameObject val11 = new GameObject("MinusBtn");
			val11.transform.SetParent(controlsGo.transform, false);
			RectTransform val12 = val11.AddComponent<RectTransform>();
			val12.anchorMin = new Vector2(0f, 0f);
			val12.anchorMax = new Vector2(0f, 0f);
			val12.pivot = new Vector2(0f, 0f);
			val12.anchoredPosition = new Vector2(4f, 4f);
			val12.sizeDelta = new Vector2(36f, 36f);
			Image val13 = val11.AddComponent<Image>();
			((Graphic)val13).color = new Color(0.7f, 0.15f, 0.15f, 0.95f);
			Button val14 = val11.AddComponent<Button>();
			((Selectable)val14).targetGraphic = (Graphic)(object)val13;
			TextMeshProUGUI val15 = new GameObject("Text").AddComponent<TextMeshProUGUI>();
			((TMP_Text)val15).transform.SetParent(val11.transform, false);
			RectTransform component = ((Component)val15).GetComponent<RectTransform>();
			component.anchorMin = Vector2.zero;
			component.anchorMax = Vector2.one;
			offsetMin = (component.offsetMax = Vector2.zero);
			component.offsetMin = offsetMin;
			((TMP_Text)val15).text = "-";
			((Graphic)val15).raycastTarget = false;
			((TMP_Text)val15).fontSize = 24f;
			((TMP_Text)val15).alignment = (TextAlignmentOptions)514;
			((Graphic)val15).color = Color.white;
			GameObject val16 = new GameObject("CountLabel");
			val16.transform.SetParent(controlsGo.transform, false);
			RectTransform val17 = val16.AddComponent<RectTransform>();
			val17.anchorMin = new Vector2(0.5f, 0f);
			val17.anchorMax = new Vector2(0.5f, 0f);
			val17.pivot = new Vector2(0.5f, 0f);
			val17.anchoredPosition = new Vector2(0f, 4f);
			val17.sizeDelta = new Vector2(40f, 36f);
			Image val18 = val16.AddComponent<Image>();
			((Graphic)val18).color = new Color(0f, 0f, 0f, 0.8f);
			((Graphic)val18).raycastTarget = false;
			GameObject val19 = new GameObject("CountText");
			val19.transform.SetParent(val16.transform, false);
			RectTransform val20 = val19.AddComponent<RectTransform>();
			val20.anchorMin = Vector2.zero;
			val20.anchorMax = Vector2.one;
			offsetMin = (val20.offsetMax = Vector2.zero);
			val20.offsetMin = offsetMin;
			TextMeshProUGUI countTmp = val19.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 val21 = new GameObject("PlusBtn");
			val21.transform.SetParent(controlsGo.transform, false);
			RectTransform val22 = val21.AddComponent<RectTransform>();
			val22.anchorMin = new Vector2(1f, 0f);
			val22.anchorMax = new Vector2(1f, 0f);
			val22.pivot = new Vector2(1f, 0f);
			val22.anchoredPosition = new Vector2(-4f, 4f);
			val22.sizeDelta = new Vector2(36f, 36f);
			Image val23 = val21.AddComponent<Image>();
			((Graphic)val23).color = new Color(0.15f, 0.6f, 0.15f, 0.95f);
			Button val24 = val21.AddComponent<Button>();
			((Selectable)val24).targetGraphic = (Graphic)(object)val23;
			TextMeshProUGUI val25 = new GameObject("Text").AddComponent<TextMeshProUGUI>();
			((TMP_Text)val25).transform.SetParent(val21.transform, false);
			RectTransform component2 = ((Component)val25).GetComponent<RectTransform>();
			component2.anchorMin = Vector2.zero;
			component2.anchorMax = Vector2.one;
			offsetMin = (component2.offsetMax = Vector2.zero);
			component2.offsetMin = offsetMin;
			((TMP_Text)val25).text = "+";
			((TMP_Text)val25).fontSize = 24f;
			((TMP_Text)val25).alignment = (TextAlignmentOptions)514;
			((Graphic)val25).color = Color.white;
			((Graphic)val25).raycastTarget = false;
			Button val26 = val.AddComponent<Button>();
			((Selectable)val26).targetGraphic = (Graphic)(object)bgImg;
			((UnityEvent)val26.onClick).AddListener((UnityAction)delegate
			{
				//IL_0058: 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)val14.onClick).AddListener((UnityAction)delegate
			{
				//IL_0084: 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)val24.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_0175: 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)
			//IL_0196: 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_01c4: Unknown result type (might be due to invalid IL or missing references)
			//IL_01db: Unknown result type (might be due to invalid IL or missing references)
			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);
			foreach (CanvasGroup val6 in componentsInChildren)
			{
				val6.alpha = 1f;
			}
			CardVisuals[] componentsInChildren2 = val.GetComponentsInChildren<CardVisuals>(true);
			foreach (CardVisuals val7 in componentsInChildren2)
			{
				val7.firstValueToSet = true;
			}
			Animator[] componentsInChildren3 = val.GetComponentsInChildren<Animator>(true);
			foreach (Animator val8 in componentsInChildren3)
			{
				((Behaviour)val8).enabled = false;
			}
			CurveAnimation[] componentsInChildren4 = val.GetComponentsInChildren<CurveAnimation>(true);
			foreach (CurveAnimation val9 in componentsInChildren4)
			{
				((Behaviour)val9).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);
			foreach (Graphic val10 in componentsInChildren5)
			{
				val10.raycastTarget = false;
			}
		}

		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_0072: 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)
			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_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Expected O, but got Unknown
			//IL_0048: Unknown result type (might be due to invalid IL or missing references)
			//IL_005e: Unknown result type (might be due to invalid IL or missing references)
			//IL_006b: 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_0071: 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_00a2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fb: Unknown result type (might be due to invalid IL or missing references)
			//IL_0124: Unknown result type (might be due to invalid IL or missing references)
			//IL_013a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0147: Unknown result type (might be due to invalid IL or missing references)
			//IL_014c: Unknown result type (might be due to invalid IL or missing references)
			//IL_014d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0155: 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_01c7: Unknown result type (might be due to invalid IL or missing references)
			//IL_01dd: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ea: 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_01f0: 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_020b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0210: Unknown result type (might be due to invalid IL or missing references)
			//IL_0226: 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_026d: 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_0281: 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_028a: 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_02aa: Expected O, but got Unknown
			//IL_02b6: Unknown result type (might be due to invalid IL or missing references)
			//IL_02bb: Unknown result type (might be due to invalid IL or missing references)
			//IL_02d1: Unknown result type (might be due to invalid IL or missing references)
			//IL_0301: 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_032c: Unknown result type (might be due to invalid IL or missing references)
			//IL_032d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0335: Unknown result type (might be due to invalid IL or missing references)
			//IL_034b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0355: 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;
			Image val2 = _maxSizeModal.AddComponent<Image>();
			((Graphic)val2).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 val3 = 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)val3).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)val3.onClick).AddListener(new UnityAction(ConfirmMaxSize));
			Button val4 = 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)val4).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)val4.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_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0003: Unknown result type (might be due to invalid IL or missing references)
			//IL_0004: Unknown result type (might be due to invalid IL or missing references)
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_0017: Expected I4, but got Unknown
			//IL_0028: Unknown result type (might be due to invalid IL or missing references)
			//IL_002d: Unknown result type (might be due to invalid IL or missing references)
			//IL_003f: 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_0056: 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_0075: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0072: 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 TMP_Dropdown _deckDropdown;

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

		private void BuildUI()
		{
			//IL_0041: 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_006b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0077: Unknown result type (might be due to invalid IL or missing references)
			//IL_007d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0081: Unknown result type (might be due to invalid IL or missing references)
			//IL_0087: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ac: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b6: 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_0104: 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_0127: 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_0154: Expected O, but got Unknown
			//IL_016b: Unknown result type (might be due to invalid IL or missing references)
			//IL_017a: Unknown result type (might be due to invalid IL or missing references)
			//IL_018e: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b1: Unknown result type (might be due to invalid IL or missing references)
			//IL_01bb: Expected O, but got Unknown
			//IL_01c9: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d8: Unknown result type (might be due to invalid IL or missing references)
			//IL_01fc: 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_021f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0239: Unknown result type (might be due to invalid IL or missing references)
			//IL_0243: 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);
			RectTransform parent2 = UIHelper.CreatePanel((Transform)(object)parent, "Title", new Vector2(0f, 0.85f), Vector2.one);
			UIHelper.CreateText((Transform)(object)parent2, "TitleText", "Your Decks", 38, (TextAlignmentOptions)514);
			_createBtn = AnchorButton(parent, "CreateBtn", "Create New Deck", new Vector2(0.08f, 0.68f), new Vector2(0.92f, 0.81f), 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.52f), new Vector2(0.92f, 0.65f), new Color(0.2f, 0.3f, 0.55f), 26);
			((UnityEvent)_editBtn.onClick).AddListener(new UnityAction(OnEditClicked));
			_deckDropdown = BuildDropdown(parent, new Vector2(0.08f, 0.38f), new Vector2(0.92f, 0.51f));
			Button val = AnchorButton(parent, "CloseBtn", "Close", new Vector2(0.2f, 0.07f), new Vector2(0.8f, 0.18f), new Color(0.45f, 0.1f, 0.1f), 22);
			((UnityEvent)val.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_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Expected O, but got Unknown
			//IL_001e: 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_0030: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: 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_004e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0067: Unknown result type (might be due to invalid IL or missing references)
			//IL_006f: 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_0080: Unknown result type (might be due to invalid IL or missing references)
			//IL_008d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0094: 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_00da: Unknown result type (might be due to invalid IL or missing references)
			//IL_00dc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00df: 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_00f3: Expected O, but got Unknown
			//IL_0112: 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_012e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0133: Unknown result type (might be due to invalid IL or missing references)
			//IL_0134: 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_0170: 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 val2 = val.AddComponent<RectTransform>();
			val2.anchorMin = anchorMin;
			val2.anchorMax = anchorMax;
			Vector2 offsetMin = (val2.offsetMax = Vector2.zero);
			val2.offsetMin = offsetMin;
			Image val3 = val.AddComponent<Image>();
			((Graphic)val3).color = bgColor;
			Button val4 = val.AddComponent<Button>();
			((Selectable)val4).targetGraphic = (Graphic)(object)val3;
			ColorBlock val5 = default(ColorBlock);
			((ColorBlock)(ref val5)).normalColor = bgColor;
			((ColorBlock)(ref val5)).highlightedColor = bgColor * 1.3f;
			((ColorBlock)(ref val5)).pressedColor = bgColor * 0.7f;
			((ColorBlock)(ref val5)).disabledColor = new Color(0.25f, 0.25f, 0.25f, 0.6f);
			((ColorBlock)(ref val5)).colorMultiplier = 1f;
			((ColorBlock)(ref val5)).fadeDuration = 0.1f;
			ColorBlock colors = val5;
			((Selectable)val4).colors = colors;
			GameObject val6 = new GameObject("Label");
			val6.transform.SetParent(val.transform, false);
			RectTransform val7 = val6.AddComponent<RectTransform>();
			val7.anchorMin = Vector2.zero;
			val7.anchorMax = Vector2.one;
			offsetMin = (val7.offsetMax = Vector2.zero);
			val7.offsetMin = offsetMin;
			TextMeshProUGUI val8 = val6.AddComponent<TextMeshProUGUI>();
			((TMP_Text)val8).text = label;
			((TMP_Text)val8).fontSize = fontSize;
			((TMP_Text)val8).alignment = (TextAlignmentOptions)514;
			((Graphic)val8).color = Color.white;
			return val4;
		}

		private TMP_Dropdown BuildDropdown(RectTransform parent, Vector2 anchorMin, Vector2 anchorMax)
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Expected O, but got Unknown
			//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_0033: 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_0039: 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_0065: Unknown result type (might be due to invalid IL or missing references)
			//IL_0084: Unknown result type (might be due to invalid IL or missing references)
			//IL_008b: Expected O, but got Unknown
			//IL_00aa: 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_00ce: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e5: Unknown result type (might be due to invalid IL or missing references)
			//IL_0108: 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: Expected O, but got Unknown
			//IL_015e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0175: Unknown result type (might be due to invalid IL or missing references)
			//IL_018c: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a3: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ba: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ea: 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_020e: Expected O, but got Unknown
			//IL_0240: 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_026e: 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_0292: Unknown result type (might be due to invalid IL or missing references)
			//IL_02e3: 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_031e: Expected O, but got Unknown
			//IL_033e: Unknown result type (might be due to invalid IL or missing references)
			//IL_034b: 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_0379: Unknown result type (might be due to invalid IL or missing references)
			//IL_0390: Unknown result type (might be due to invalid IL or missing references)
			//IL_03ba: Unknown result type (might be due to invalid IL or missing references)
			//IL_03e2: Unknown result type (might be due to invalid IL or missing references)
			//IL_03e9: Expected O, but got Unknown
			//IL_0413: Unknown result type (might be due to invalid IL or missing references)
			//IL_042a: 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_044e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0465: Unknown result type (might be due to invalid IL or missing references)
			//IL_047f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0486: Expected O, but got Unknown
			//IL_04b0: Unknown result type (might be due to invalid IL or missing references)
			//IL_04c7: Unknown result type (might be due to invalid IL or missing references)
			//IL_04de: Unknown result type (might be due to invalid IL or missing references)
			//IL_04f5: Unknown result type (might be due to invalid IL or missing references)
			//IL_051f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0548: 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_0585: Unknown result type (might be due to invalid IL or missing references)
			//IL_05a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_05c7: Unknown result type (might be due to invalid IL or missing references)
			//IL_05ec: Unknown result type (might be due to invalid IL or missing references)
			//IL_05ee: Unknown result type (might be due to invalid IL or missing references)
			//IL_05f2: 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_0606: Expected O, but got Unknown
			//IL_0626: 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_0640: Unknown result type (might be due to invalid IL or missing references)
			//IL_064d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0677: Unknown result type (might be due to invalid IL or missing references)
			//IL_0690: Unknown result type (might be due to invalid IL or missing references)
			//IL_0697: Expected O, but got Unknown
			//IL_06b7: Unknown result type (might be due to invalid IL or missing references)
			//IL_06c4: Unknown result type (might be due to invalid IL or missing references)
			//IL_06db: Unknown result type (might be due to invalid IL or missing references)
			//IL_06f2: Unknown result type (might be due to invalid IL or missing references)
			//IL_0715: 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 val2 = val.AddComponent<RectTransform>();
			val2.anchorMin = anchorMin;
			val2.anchorMax = anchorMax;
			Vector2 offsetMin = (val2.offsetMax = Vector2.zero);
			val2.offsetMin = offsetMin;
			Image val3 = val.AddComponent<Image>();
			((Graphic)val3).color = new Color(0.12f, 0.12f, 0.18f, 0.95f);
			TMP_Dropdown val4 = val.AddComponent<TMP_Dropdown>();
			((Selectable)val4).targetGraphic = (Graphic)(object)val3;
			GameObject val5 = new GameObject("Label");
			val5.transform.SetParent(val.transform, false);
			RectTransform val6 = val5.AddComponent<RectTransform>();
			val6.anchorMin = Vector2.zero;
			val6.anchorMax = Vector2.one;
			val6.offsetMin = new Vector2(10f, 4f);
			val6.offsetMax = new Vector2(-30f, -4f);
			TextMeshProUGUI val7 = val5.AddComponent<TextMeshProUGUI>();
			((TMP_Text)val7).fontSize = 20f;
			((Graphic)val7).color = Color.white;
			((TMP_Text)val7).alignment = (TextAlignmentOptions)4097;
			val4.captionText = (TMP_Text)(object)val7;
			GameObject val8 = new GameObject("Arrow");
			val8.transform.SetParent(val.transform, false);
			RectTransform val9 = val8.AddComponent<RectTransform>();
			val9.anchorMin = new Vector2(1f, 0f);
			val9.anchorMax = new Vector2(1f, 1f);
			val9.pivot = new Vector2(1f, 0.5f);
			val9.sizeDelta = new Vector2(30f, 0f);
			val9.anchoredPosition = new Vector2(-5f, 0f);
			TextMeshProUGUI val10 = val8.AddComponent<TextMeshProUGUI>();
			((TMP_Text)val10).text = "v";
			((TMP_Text)val10).fontSize = 18f;
			((Graphic)val10).color = Color.white;
			((TMP_Text)val10).alignment = (TextAlignmentOptions)514;
			GameObject val11 = new GameObject("Template");
			val11.transform.SetParent(val.transform, false);
			val11.SetActive(false);
			RectTransform val12 = val11.AddComponent<RectTransform>();
			val12.anchorMin = new Vector2(0f, 0f);
			val12.anchorMax = new Vector2(1f, 0f);
			val12.pivot = new Vector2(0.5f, 1f);
			val12.anchoredPosition = Vector2.zero;
			val12.sizeDelta = new Vector2(0f, 400f);
			Canvas val13 = val11.AddComponent<Canvas>();
			val13.overrideSorting = true;
			val13.sortingOrder = 500;
			val11.AddComponent<GraphicRaycaster>();
			Image val14 = val11.AddComponent<Image>();
			((Graphic)val14).color = new Color(0.08f, 0.08f, 0.12f, 1f);
			ScrollRect val15 = val11.AddComponent<ScrollRect>();
			val15.horizontal = false;
			val15.vertical = true;
			val15.movementType = (MovementType)2;
			GameObject val16 = new GameObject("Viewport");
			val16.transform.SetParent(val11.transform, false);
			RectTransform val17 = val16.AddComponent<RectTransform>();
			val17.anchorMin = Vector2.zero;
			val17.anchorMax = Vector2.one;
			val17.offsetMin = new Vector2(2f, 2f);
			val17.offsetMax = new Vector2(-2f, -2f);
			val17.pivot = new Vector2(0f, 1f);
			Image val18 = val16.AddComponent<Image>();
			((Graphic)val18).color = new Color(0.08f, 0.08f, 0.12f, 1f);
			val16.AddComponent<Mask>().showMaskGraphic = false;
			val15.viewport = val17;
			GameObject val19 = new GameObject("Content");
			val19.transform.SetParent(val16.transform, false);
			RectTransform val20 = val19.AddComponent<RectTransform>();
			val20.anchorMin = new Vector2(0f, 1f);
			val20.anchorMax = new Vector2(1f, 1f);
			val20.pivot = new Vector2(0.5f, 1f);
			val20.anchoredPosition = Vector2.zero;
			val20.sizeDelta = new Vector2(0f, 56f);
			val15.content = val20;
			GameObject val21 = new GameObject("Item");
			val21.transform.SetParent(val19.transform, false);
			RectTransform val22 = val21.AddComponent<RectTransform>();
			val22.anchorMin = new Vector2(0f, 0.5f);
			val22.anchorMax = new Vector2(1f, 0.5f);
			val22.pivot = new Vector2(0.5f, 0.5f);
			val22.sizeDelta = new Vector2(0f, 54f);
			Image val23 = val21.AddComponent<Image>();
			((Graphic)val23).color = new Color(0.15f, 0.15f, 0.2f, 1f);
			Toggle val24 = val21.AddComponent<Toggle>();
			((Selectable)val24).targetGraphic = (Graphic)(object)val23;
			val24.isOn = true;
			ColorBlock val25 = default(ColorBlock);
			((ColorBlock)(ref val25)).normalColor = new Color(0.15f, 0.15f, 0.2f, 1f);
			((ColorBlock)(ref val25)).highlightedColor = new Color(0.25f, 0.3f, 0.4f, 1f);
			((ColorBlock)(ref val25)).pressedColor = new Color(0.3f, 0.35f, 0.5f, 1f);
			((ColorBlock)(ref val25)).disabledColor = new Color(0.2f, 0.2f, 0.2f, 0.5f);
			((ColorBlock)(ref val25)).colorMultiplier = 1f;
			((ColorBlock)(ref val25)).fadeDuration = 0.1f;
			ColorBlock colors = val25;
			((Selectable)val24).colors = colors;
			GameObject val26 = new GameObject("Item Background");
			val26.transform.SetParent(val21.transform, false);
			RectTransform val27 = val26.AddComponent<RectTransform>();
			val27.anchorMin = Vector2.zero;
			val27.anchorMax = Vector2.one;
			val27.offsetMin = Vector2.zero;
			val27.offsetMax = Vector2.zero;
			Image val28 = val26.AddComponent<Image>();
			((Graphic)val28).color = new Color(0.2f, 0.45f, 0.65f, 1f);
			val24.graphic = (Graphic)(object)val28;
			GameObject val29 = new GameObject("Item Label");
			val29.transform.SetParent(val21.transform, false);
			RectTransform val30 = val29.AddComponent<RectTransform>();
			val30.anchorMin = Vector2.zero;
			val30.anchorMax = Vector2.one;
			val30.offsetMin = new Vector2(8f, 4f);
			val30.offsetMax = new Vector2(-8f, -4f);
			TextMeshProUGUI val31 = val29.AddComponent<TextMeshProUGUI>();
			((TMP_Text)val31).fontSize = 22f;
			((Graphic)val31).color = Color.white;
			((TMP_Text)val31).alignment = (TextAlignmentOptions)514;
			((Graphic)val31).raycastTarget = false;
			val4.itemText = (TMP_Text)(object)val31;
			val4.template = val12;
			return val4;
		}

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

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

		private void RefreshDropdown()
		{
			//IL_00ee: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f8: Expected O, but got Unknown
			//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00af: 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(new OptionData("Default Deck"));
			RTGLog.Line("  Added: 'Default Deck'");
			RTGLog.Line($"RefreshDropdown: total options = {list2.Count}");
			_deckDropdown.AddOptions(list2);
			((Selectable)_editBtn).interactable = true;
			string activeName = DeckManager.instance?.ActiveDeckName ?? "Default Deck";
			RTGLog.Line("RefreshDropdown: activeName = '" + activeName + "'");
			int num = list2.FindIndex((OptionData o) => o.text == activeName);
			if (num < 0)
			{
				num = list2.Count - 1;
			}
			_deckDropdown.value = num;
			RTGLog.Line($"RefreshDropdown: selected '{list2[num].text}' (index {num}), dropdown.options.Count={_deckDropdown.options.Count}");
		}

		private void OnCreateClicked()
		{
			RTGLog.Section("DeckSelectorScreen — Create clicked");
			Hide();
			CreateDeckScreen.instance?.Show();
		}

		private void OnEditClicked()
		{
			RTGLog.Section("DeckSelectorScreen — Edit clicked");
			if ((Object)(object)DeckManager.instance == (Object)null)
			{
				RTGLog.Warn("DeckManager.instance is null.");
				return;
			}
			int value = _deckDropdown.value;
			string selectedName = _deckDropdown.options[value].text;
			if (selectedName == "Default Deck")
			{
				RTGLog.Line("Selected Default Deck — setting as active (vanilla behavior).");
				DeckManager.instance.SetActiveDeck("Default Deck");
				Hide();
				return;
			}
			List<DeckData> allDecks = DeckManager.instance.AllDecks;
			DeckData deckData = allDecks.Find((DeckData d) => d.name == selectedName);
			if (deckData == null)
			{
				RTGLog.Warn("Deck '" + selectedName + "' not found.");
				return;
			}
			DeckManager.instance.SetActiveDeck(deckData.name);
			RTGLog.Line($"Opening editor for '{deckData.name}' (dropdown index {value}).");
			RTGLog.Line("DeckEditorScreen.instance is " + (((Object)(object)DeckEditorScreen.instance == (Object)null) ? "NULL" : "valid"));
			Hide();
			if ((Object)(object)DeckEditorScreen.instance != (Object)null)
			{
				DeckEditorScreen.instance.Open(deckData);
			}
			else
			{
				RTGLog.Error("Cannot open editor — DeckEditorScreen.instance is null!");
			}
		}
	}
	internal static class UIHelper
	{
		public static Canvas CreateFullscreenCanvas(string name, int sortOrder = 100)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Expected O, but got Unknown
			//IL_0048: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = new GameObject(name);
			Object.DontDestroyOnLoad((Object)(object)val);
			val.SetActive(false);
			Canvas val2 = val.AddComponent<Canvas>();
			val2.renderMode = (RenderMode)0;
			val2.sortingOrder = sortOrder;
			CanvasScaler val3 = val.AddComponent<CanvasScaler>();
			val3.uiScaleMode = (ScaleMode)1;
			val3.referenceResolution = new Vector2(1920f, 1080f);
			val.AddComponent<GraphicRaycaster>();
			return val2;
		}

		public static RectTransform CreatePanel(Transform parent, string name, Vector2 anchorMin, Vector2 anchorMax, Vector2 offsetMin = default(Vector2), Vector2 offsetMax = default(Vector2), Color? bg = null)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Expected O, but got Unknown
			//IL_001e: 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_002e: 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_0055: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = new GameObject(name);
			val.transform.SetParent(parent, false);
			RectTransform val2 = val.AddComponent<RectTransform>();
			val2.anchorMin = anchorMin;
			val2.anchorMax = anchorMax;
			val2.offsetMin = offsetMin;
			val2.offsetMax = offsetMax;
			if (bg.HasValue)
			{
				Image val3 = val.AddComponent<Image>();
				((Graphic)val3).color = bg.Value;
			}
			return val2;
		}

		public static RectTransform CreateStretchPanel(Transform parent, string name, float padLeft = 0f, float padRight = 0f, float padTop = 0f, float padBottom = 0f, Color? bg = null)
		{
			//IL_0003: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			return CreatePanel(parent, name, Vector2.zero, Vector2.one, new Vector2(padLeft, padBottom), new Vector2(0f - padRight, 0f - padTop), bg);
		}

		public static TextMeshProUGUI CreateText(Transform parent, string name, string text, int fontSize = 24, TextAlignmentOptions alignment = 514, Color? color = null)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Expected O, but got Unknown
			//IL_001e: 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_0036: Unknown result type (might be due to invalid IL or missing references)
			//IL_0042: Unknown result type (might be due to invalid IL or missing references)
			//IL_0066: Unknown result type (might be due to invalid IL or missing references)
			//IL_0084: Unknown result type (might be due to invalid IL or missing references)
			//IL_007b: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = new GameObject(name);
			val.transform.SetParent(parent, false);
			RectTransform val2 = val.AddComponent<RectTransform>();
			val2.anchorMin = Vector2.zero;
			val2.anchorMax = Vector2.one;
			val2.offsetMin = Vector2.zero;
			val2.offsetMax = Vector2.zero;
			TextMeshProUGUI val3 = val.AddComponent<TextMeshProUGUI>();
			((TMP_Text)val3).text = text;
			((TMP_Text)val3).fontSize = fontSize;
			((TMP_Text)val3).alignment = alignment;
			((Graphic)val3).color = (Color)(((??)color) ?? Color.white);
			return val3;
		}

		public static Button CreateButton(Transform parent, string name, string label, Vector2 anchoredPos, Vector2 sizeDelta, int fontSize = 24, Color? bgColor = null, Color? textColor = null)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Expected O, but got Unknown
			//IL_001e: 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_0060: Unknown result type (might be due to invalid IL or missing references)
			//IL_0057: Unknown result type (might be due to invalid IL or missing references)
			//IL_0074: Unknown result type (might be due to invalid IL or missing references)
			//IL_007d: Unknown result type (might be due to invalid IL or missing references)
			//IL_008b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0095: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ad: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ce: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f8: Unknown result type (might be due to invalid IL or missing references)
			//IL_010d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0114: Expected O, but got Unknown
			//IL_0133: Unknown result type (might be due to invalid IL or missing references)
			//IL_0140: Unknown result type (might be due to invalid IL or missing references)
			//IL_014d: Unknown result type (might be due to invalid IL or missing references)
			//IL_015a: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_019e: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = new GameObject(name);
			val.transform.SetParent(parent, false);
			RectTransform val2 = val.AddComponent<RectTransform>();
			val2.anchoredPosition = anchoredPos;
			val2.sizeDelta = sizeDelta;
			Image val3 = val.AddComponent<Image>();
			((Graphic)val3).color = (Color)(((??)bgColor) ?? new Color(0.2f, 0.2f, 0.2f, 0.9f));
			Button val4 = val.AddComponent<Button>();
			ColorBlock val5 = default(ColorBlock);
			((ColorBlock)(ref val5)).normalColor = ((Graphic)val3).color;
			((ColorBlock)(ref val5)).highlightedColor = ((Graphic)val3).color * 1.3f;
			((ColorBlock)(ref val5)).pressedColor = ((Graphic)val3).color * 0.7f;
			((ColorBlock)(ref val5)).disabledColor = new Color(0.3f, 0.3f, 0.3f, 0.5f);
			((ColorBlock)(ref val5)).colorMultiplier = 1f;
			((ColorBlock)(ref val5)).fadeDuration = 0.1f;
			ColorBlock colors = val5;
			((Selectable)val4).colors = colors;
			((Selectable)val4).targetGraphic = (Graphic)(object)val3;
			GameObject val6 = new GameObject("Label");
			val6.transform.SetParent(val.transform, false);
			RectTransform val7 = val6.AddComponent<RectTransform>();
			val7.anchorMin = Vector2.zero;
			val7.anchorMax = Vector2.one;
			val7.offsetMin = Vector2.zero;
			val7.offsetMax = Vector2.zero;
			TextMeshProUGUI val8 = val6.AddComponent<TextMeshProUGUI>();
			((TMP_Text)val8).text = label;
			((TMP_Text)val8).fontSize = fontSize;
			((TMP_Text)val8).alignment = (TextAlignmentOptions)514;
			((Graphic)val8).color = (Color)(((??)textColor) ?? Color.white);
			return val4;
		}

		public static TMP_InputField CreateInputField(Transform parent, string name, string placeholder, Vector2 anchoredPos, Vector2 sizeDelta, int fontSize = 22, ContentType contentType = 0)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Expected O, but got Unknown
			//IL_001e: 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_004a: 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_0060: Expected O, but got Unknown
			//IL_007d: Unknown result type (might be due to invalid IL or missing references)
			//IL_008a: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a1: 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_00cf: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d6: Expected O, but got Unknown
			//IL_00f5: Unknown result type (might be due to invalid IL or missing references)
			//IL_0102: Unknown result type (might be due to invalid IL or missing references)
			//IL_010f: 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_013d: 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_0161: Expected O, but got Unknown
			//IL_0180: Unknown result type (might be due to invalid IL or missing references)
			//IL_018d: Unknown result type (might be due to invalid IL or missing references)
			//IL_019a: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e0: Unknown result type (might be due to invalid IL or missing references)
			//IL_0229: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = new GameObject(name);
			val.transform.SetParent(parent, false);
			RectTransform val2 = val.AddComponent<RectTransform>();
			val2.anchoredPosition = anchoredPos;
			val2.sizeDelta = sizeDelta;
			Image val3 = val.AddComponent<Image>();
			((Graphic)val3).color = new Color(0.1f, 0.1f, 0.1f, 0.9f);
			GameObject val4 = new GameObject("Viewport");
			val4.transform.SetParent(val.transform, false);
			RectTransform val5 = val4.AddComponent<RectTransform>();
			val5.anchorMin = Vector2.zero;
			val5.anchorMax = Vector2.one;
			val5.offsetMin = new Vector2(8f, 1f);
			val5.offsetMax = new Vector2(-8f, -1f);
			val4.AddComponent<RectMask2D>();
			GameObject val6 = new GameObject("Text");
			val6.transform.SetParent(val4.transform, false);
			RectTransform val7 = val6.AddComponent<RectTransform>();
			val7.anchorMin = Vector2.zero;
			val7.anchorMax = Vector2.one;
			val7.offsetMin = Vector2.zero;
			val7.offsetMax = Vector2.zero;
			TextMeshProUGUI val8 = val6.AddComponent<TextMeshProUGUI>();
			((TMP_Text)val8).fontSize = fontSize;
			((Graphic)val8).color = Color.white;
			((TMP_Text)val8).alignment = (TextAlignmentOptions)4097;
			GameObject val9 = new GameObject("Placeholder");
			val9.transform.SetParent(val4.transform, false);
			RectTransform val10 = val9.AddComponent<RectTransform>();
			val10.anchorMin = Vector2.zero;
			val10.anchorMax = Vector2.one;
			val10.offsetMin = Vector2.zero;
			val10.offsetMax = Vector2.zero;
			TextMeshProUGUI val11 = val9.AddComponent<TextMeshProUGUI>();
			((TMP_Text)val11).text = placeholder;
			((TMP_Text)val11).fontSize = fontSize;
			((Graphic)val11).color = new Color(0.5f, 0.5f, 0.5f);
			((TMP_Text)val11).fontStyle = (FontStyles)2;
			((TMP_Text)val11).alignment = (TextAlignmentOptions)4097;
			TMP_InputField val12 = val.AddComponent<TMP_InputField>();
			val12.textViewport = val5;
			val12.textComponent = (TMP_Text)(object)val8;
			val12.placeholder = (Graphic)(object)val11;
			val12.contentType = contentType;
			((Selectable)val12).targetGraphic = (Graphic)(object)val3;
			return val12;