Decompiled source of TourneyMod v1.1.0

TourneyMod.dll

Decompiled a month ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Reflection.Emit;
using System.Runtime.CompilerServices;
using System.Security;
using System.Security.Permissions;
using System.Text;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using GameplayEntities;
using HarmonyLib;
using LLBML.Math;
using LLBML.Players;
using LLBML.Settings;
using LLBML.States;
using LLBML.Utils;
using LLGUI;
using LLHandlers;
using LLScreen;
using Microsoft.CodeAnalysis;
using ModMenu;
using TMPro;
using TinyJson;
using TourneyMod.Patches;
using TourneyMod.Rulesets;
using TourneyMod.SetTracking;
using TourneyMod.StageStriking;
using TourneyMod.UI;
using UnityEngine;
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: AssemblyCompany("TourneyMod")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.1.0.0")]
[assembly: AssemblyInformationalVersion("1.1.0+6324c34b411a94d3571e322273f7f3c485fb134d")]
[assembly: AssemblyProduct("TourneyMod")]
[assembly: AssemblyTitle("TourneyMod")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.1.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 TourneyMod
{
	public static class Configs
	{
		internal static ConfigEntry<string> SelectedRulesetId { get; private set; }

		internal static void BindConfigs()
		{
			ConfigFile config = ((BaseUnityPlugin)Plugin.Instance).Config;
			SelectedRulesetId = config.Bind<string>("Settings", "SelectedRulesetId", "standard_online", "Selected ruleset (default or custom) specified by the id field");
		}
	}
	[BepInPlugin("avgduck.plugins.llb.tourneymod", "TourneyMod", "1.1.0")]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInIncompatibility("com.github.daioutzu.stageselect")]
	[BepInProcess("LLBlaze.exe")]
	internal class Plugin : BaseUnityPlugin
	{
		public const string GUID = "avgduck.plugins.llb.tourneymod";

		internal const string DEPENDENCY_LLBML = "fr.glomzubuk.plugins.llb.llbml";

		internal const string DEPENDENCY_MODMENU = "no.mrgentle.plugins.llb.modmenu";

		internal const string DEPENDENCY_CURSORSPEED = "com.github.daioutzu.cursorspeed";

		internal const string INCOMPATIBILITY_STAGESELECT = "com.github.daioutzu.stageselect";

		internal Ruleset SelectedRuleset;

		internal TourneyMode ActiveTourneyMode = TourneyMode.NONE;

		internal bool TourneyMenuOpen = false;

		internal bool RecolorCursors = false;

		internal static Plugin Instance { get; private set; }

		internal static ManualLogSource LogGlobal { get; private set; }

		private void Awake()
		{
			Instance = this;
			LogGlobal = ((BaseUnityPlugin)this).Logger;
			SetTracker.Init();
			StageStrikeTracker.Init();
			UIUtils.Init();
			HarmonyPatches.PatchAll();
			RulesetIO.Init();
			VoteButton.ActiveVoteButtons = new List<VoteButton>();
			StageStrikeTracker.Instance.FindDefaultRuleset();
			Configs.BindConfigs();
			((BaseUnityPlugin)this).Config.SettingChanged += delegate
			{
				OnConfigChanged();
			};
			OnConfigChanged();
			ModDependenciesUtils.RegisterToModMenu(((BaseUnityPlugin)this).Info, GetModMenuText());
		}

		private void OnConfigChanged()
		{
			string value = Configs.SelectedRulesetId.Value;
			SelectedRuleset = RulesetIO.GetRulesetById(value);
			if (SelectedRuleset != null)
			{
				LogGlobal.LogInfo((object)("Loaded ruleset " + value));
			}
		}

		internal static string PrintArray<T>(T[] arr, bool includeBrackets)
		{
			string text = "";
			if (includeBrackets)
			{
				text += "[";
			}
			for (int i = 0; i < arr.Length; i++)
			{
				if (i != 0)
				{
					text += ", ";
				}
				text += arr[i].ToString();
			}
			if (includeBrackets)
			{
				text += "]";
			}
			return text;
		}

		private List<string> GetModMenuText()
		{
			List<string> text = new List<string>();
			text.Add("Choose a ruleset from those currently loaded (shown below). Default rulesets are included with the mod download, and custom rulesets can be specified in your Modding Folder.");
			text.Add("");
			text.Add("<b>Default Rulesets:</b>");
			if (RulesetIO.RulesetsDefault.Count == 0)
			{
				text.Add("none");
			}
			else
			{
				RulesetIO.RulesetsDefault.ToList().ForEach(delegate(KeyValuePair<string, Ruleset> entry)
				{
					text.Add("- " + entry.Value.name + " [<b>" + entry.Key + "</b>]");
				});
			}
			text.Add("");
			text.Add("<b>Custom Rulesets:</b>");
			if (RulesetIO.RulesetsCustom.Count == 0)
			{
				text.Add("none");
			}
			else
			{
				RulesetIO.RulesetsCustom.ToList().ForEach(delegate(KeyValuePair<string, Ruleset> entry)
				{
					text.Add("- " + entry.Value.name + " [<b>" + entry.Key + "</b>]");
				});
			}
			return text;
		}
	}
	internal enum TourneyMode
	{
		NONE,
		LOCAL_1V1,
		LOCAL_DOUBLES,
		LOCAL_CREW,
		ONLINE_1V1
	}
	public static class MyPluginInfo
	{
		public const string PLUGIN_GUID = "TourneyMod";

		public const string PLUGIN_NAME = "TourneyMod";

		public const string PLUGIN_VERSION = "1.1.0";
	}
}
namespace TourneyMod.UI
{
	internal interface ICustomScreen<T>
	{
		void Init(T screenVanilla);
	}
	internal interface IMenuTitle
	{
		string GetCustomTitle();
	}
	internal interface IStageSelect
	{
		void OnClickStage(int playerNumber, Stage stage);

		void OnStageSelected();
	}
	internal class RulesetPreviewWindow : MonoBehaviour
	{
		private static readonly Vector2 POSITION = new Vector2(530f, 200f);

		private const float FONT_SIZE = 12f;

		private const float FONT_SIZE_2 = 10f;

		private const float SPACING = 20f;

		private const float LEFTCOL = -143f;

		private const float RIGHTCOL = 63f;

		private const float LEFT = 6f;

		private RectTransform rectTransform;

		private RectTransform tfContainer;

		private Image imgBg;

		private TextMeshProUGUI lbSelected;

		private TextMeshProUGUI lbRuleset;

		private List<TextMeshProUGUI> rulesetInfo;

		private TextMeshProUGUI lbName1;

		private TextMeshProUGUI lbName2;

		private TextMeshProUGUI lbNeutralStages1;

		private TextMeshProUGUI lbNeutralStages2;

		private TextMeshProUGUI lbCounterpickStages1;

		private TextMeshProUGUI lbCounterpickStages2;

		private TextMeshProUGUI lbDsrMode1;

		private TextMeshProUGUI lbDsrMode2;

		private TextMeshProUGUI lbRandomMode1;

		private TextMeshProUGUI lbRandomMode2;

		private TextMeshProUGUI lbBanOrder1;

		private TextMeshProUGUI lbBanOrder2;

		internal static void Create(Transform tfParent)
		{
			RectTransform val = LLControl.CreatePanel(tfParent, "rulesetPreviewUI", POSITION.x, POSITION.y);
			RulesetPreviewWindow rulesetPreviewWindow = ((Component)val).gameObject.AddComponent<RulesetPreviewWindow>();
			rulesetPreviewWindow.rectTransform = val;
			rulesetPreviewWindow.Init();
		}

		private void Init()
		{
			//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_00b8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00dd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ee: Unknown result type (might be due to invalid IL or missing references)
			//IL_0158: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d3: Unknown result type (might be due to invalid IL or missing references)
			//IL_0259: Unknown result type (might be due to invalid IL or missing references)
			//IL_02e6: Unknown result type (might be due to invalid IL or missing references)
			//IL_0373: Unknown result type (might be due to invalid IL or missing references)
			//IL_0400: Unknown result type (might be due to invalid IL or missing references)
			//IL_048d: Unknown result type (might be due to invalid IL or missing references)
			//IL_051a: Unknown result type (might be due to invalid IL or missing references)
			//IL_05a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_0634: Unknown result type (might be due to invalid IL or missing references)
			//IL_06c1: Unknown result type (might be due to invalid IL or missing references)
			//IL_074e: Unknown result type (might be due to invalid IL or missing references)
			//IL_07db: Unknown result type (might be due to invalid IL or missing references)
			//IL_0868: Unknown result type (might be due to invalid IL or missing references)
			tfContainer = LLControl.CreatePanel((Transform)(object)rectTransform, "container", 0f, 0f);
			imgBg = LLControl.CreateImage((Transform)(object)tfContainer, Sprite.Create(Texture2D.whiteTexture, new Rect(0f, 0f, 1f, 1f), new Vector2(0.5f, 0.5f)));
			((Graphic)imgBg).rectTransform.SetSizeWithCurrentAnchors((Axis)0, 200f);
			((Graphic)imgBg).rectTransform.SetSizeWithCurrentAnchors((Axis)1, 440f);
			((Graphic)imgBg).rectTransform.ForceUpdateRectTransforms();
			((Graphic)imgBg).rectTransform.pivot = new Vector2(0.5f, 1f);
			((Transform)((Graphic)imgBg).rectTransform).localPosition = Vector2.op_Implicit(new Vector2(0f, 30f));
			((Graphic)imgBg).color = Color.black;
			lbSelected = ((Component)LLControl.CreatePanel((Transform)(object)tfContainer, "lbSelected", -143f, 0f)).gameObject.AddComponent<TextMeshProUGUI>();
			((TMP_Text)lbSelected).fontSize = 12f;
			((TMP_Text)lbSelected).enableWordWrapping = false;
			((TMP_Text)lbSelected).alignment = (TextAlignmentOptions)260;
			((Graphic)lbSelected).color = Color.white;
			((TMP_Text)lbSelected).SetText("Ruleset:");
			lbRuleset = ((Component)LLControl.CreatePanel((Transform)(object)tfContainer, "lbRuleset", 63f, 0f)).gameObject.AddComponent<TextMeshProUGUI>();
			((TMP_Text)lbRuleset).fontSize = 12f;
			((TMP_Text)lbRuleset).enableWordWrapping = false;
			((TMP_Text)lbRuleset).alignment = (TextAlignmentOptions)257;
			((Graphic)lbRuleset).color = Color.red;
			((TMP_Text)lbRuleset).SetText("NULL");
			rulesetInfo = new List<TextMeshProUGUI>();
			lbName1 = ((Component)LLControl.CreatePanel((Transform)(object)tfContainer, "lbName1", 6f, -20f)).gameObject.AddComponent<TextMeshProUGUI>();
			((TMP_Text)lbName1).fontSize = 12f;
			((TMP_Text)lbName1).enableWordWrapping = false;
			((TMP_Text)lbName1).alignment = (TextAlignmentOptions)257;
			((Graphic)lbName1).color = Color.white;
			((TMP_Text)lbName1).SetText("Name:");
			rulesetInfo.Add(lbName1);
			lbName2 = ((Component)LLControl.CreatePanel((Transform)(object)tfContainer, "lbName2", 6f, -32f)).gameObject.AddComponent<TextMeshProUGUI>();
			((TMP_Text)lbName2).fontSize = 10f;
			((TMP_Text)lbName2).enableWordWrapping = false;
			((TMP_Text)lbName2).alignment = (TextAlignmentOptions)257;
			((Graphic)lbName2).color = Color.yellow;
			((TMP_Text)lbName2).SetText("");
			rulesetInfo.Add(lbName2);
			lbNeutralStages1 = ((Component)LLControl.CreatePanel((Transform)(object)tfContainer, "lbNeutralStages", 6f, -50f)).gameObject.AddComponent<TextMeshProUGUI>();
			((TMP_Text)lbNeutralStages1).fontSize = 12f;
			((TMP_Text)lbNeutralStages1).enableWordWrapping = false;
			((TMP_Text)lbNeutralStages1).alignment = (TextAlignmentOptions)257;
			((Graphic)lbNeutralStages1).color = Color.white;
			((TMP_Text)lbNeutralStages1).SetText("Neutral stages:");
			rulesetInfo.Add(lbNeutralStages1);
			lbNeutralStages2 = ((Component)LLControl.CreatePanel((Transform)(object)tfContainer, "lbNeutralStageCount", 6f, -62f)).gameObject.AddComponent<TextMeshProUGUI>();
			((TMP_Text)lbNeutralStages2).fontSize = 10f;
			((TMP_Text)lbNeutralStages2).enableWordWrapping = false;
			((TMP_Text)lbNeutralStages2).alignment = (TextAlignmentOptions)257;
			((Graphic)lbNeutralStages2).color = Color.yellow;
			((TMP_Text)lbNeutralStages2).SetText("");
			rulesetInfo.Add(lbNeutralStages2);
			lbCounterpickStages1 = ((Component)LLControl.CreatePanel((Transform)(object)tfContainer, "lbCounterpickStages", 6f, -170f)).gameObject.AddComponent<TextMeshProUGUI>();
			((TMP_Text)lbCounterpickStages1).fontSize = 12f;
			((TMP_Text)lbCounterpickStages1).enableWordWrapping = false;
			((TMP_Text)lbCounterpickStages1).alignment = (TextAlignmentOptions)257;
			((Graphic)lbCounterpickStages1).color = Color.white;
			((TMP_Text)lbCounterpickStages1).SetText("Counterpick stages:");
			rulesetInfo.Add(lbCounterpickStages1);
			lbCounterpickStages2 = ((Component)LLControl.CreatePanel((Transform)(object)tfContainer, "lbCounterpickStageCount", 6f, -182f)).gameObject.AddComponent<TextMeshProUGUI>();
			((TMP_Text)lbCounterpickStages2).fontSize = 10f;
			((TMP_Text)lbCounterpickStages2).enableWordWrapping = false;
			((TMP_Text)lbCounterpickStages2).alignment = (TextAlignmentOptions)257;
			((Graphic)lbCounterpickStages2).color = Color.yellow;
			((TMP_Text)lbCounterpickStages2).SetText("");
			rulesetInfo.Add(lbCounterpickStages2);
			lbDsrMode1 = ((Component)LLControl.CreatePanel((Transform)(object)tfContainer, "lbDsrMode1", 6f, -290f)).gameObject.AddComponent<TextMeshProUGUI>();
			((TMP_Text)lbDsrMode1).fontSize = 12f;
			((TMP_Text)lbDsrMode1).enableWordWrapping = false;
			((TMP_Text)lbDsrMode1).alignment = (TextAlignmentOptions)257;
			((Graphic)lbDsrMode1).color = Color.white;
			((TMP_Text)lbDsrMode1).SetText("DSR:");
			rulesetInfo.Add(lbDsrMode1);
			lbDsrMode2 = ((Component)LLControl.CreatePanel((Transform)(object)tfContainer, "lbDsrMode2", 6f, -302f)).gameObject.AddComponent<TextMeshProUGUI>();
			((TMP_Text)lbDsrMode2).fontSize = 10f;
			((TMP_Text)lbDsrMode2).enableWordWrapping = false;
			((TMP_Text)lbDsrMode2).alignment = (TextAlignmentOptions)257;
			((Graphic)lbDsrMode2).color = Color.yellow;
			((TMP_Text)lbDsrMode2).SetText("");
			rulesetInfo.Add(lbDsrMode2);
			lbRandomMode1 = ((Component)LLControl.CreatePanel((Transform)(object)tfContainer, "lbRandomMode1", 6f, -320f)).gameObject.AddComponent<TextMeshProUGUI>();
			((TMP_Text)lbRandomMode1).fontSize = 12f;
			((TMP_Text)lbRandomMode1).enableWordWrapping = false;
			((TMP_Text)lbRandomMode1).alignment = (TextAlignmentOptions)257;
			((Graphic)lbRandomMode1).color = Color.white;
			((TMP_Text)lbRandomMode1).SetText("Random:");
			rulesetInfo.Add(lbRandomMode1);
			lbRandomMode2 = ((Component)LLControl.CreatePanel((Transform)(object)tfContainer, "lbRandomMode2", 6f, -332f)).gameObject.AddComponent<TextMeshProUGUI>();
			((TMP_Text)lbRandomMode2).fontSize = 10f;
			((TMP_Text)lbRandomMode2).enableWordWrapping = false;
			((TMP_Text)lbRandomMode2).alignment = (TextAlignmentOptions)257;
			((Graphic)lbRandomMode2).color = Color.yellow;
			((TMP_Text)lbRandomMode2).SetText("");
			rulesetInfo.Add(lbRandomMode2);
			lbBanOrder1 = ((Component)LLControl.CreatePanel((Transform)(object)tfContainer, "lbBanOrder1", 6f, -350f)).gameObject.AddComponent<TextMeshProUGUI>();
			((TMP_Text)lbBanOrder1).fontSize = 12f;
			((TMP_Text)lbBanOrder1).enableWordWrapping = false;
			((TMP_Text)lbBanOrder1).alignment = (TextAlignmentOptions)257;
			((Graphic)lbBanOrder1).color = Color.white;
			((TMP_Text)lbBanOrder1).SetText("Ban order:");
			rulesetInfo.Add(lbBanOrder1);
			lbBanOrder2 = ((Component)LLControl.CreatePanel((Transform)(object)tfContainer, "lbBanOrder2", 6f, -362f)).gameObject.AddComponent<TextMeshProUGUI>();
			((TMP_Text)lbBanOrder2).fontSize = 10f;
			((TMP_Text)lbBanOrder2).enableWordWrapping = false;
			((TMP_Text)lbBanOrder2).alignment = (TextAlignmentOptions)257;
			((Graphic)lbBanOrder2).color = Color.yellow;
			((TMP_Text)lbBanOrder2).SetText("");
			rulesetInfo.Add(lbBanOrder2);
			((Component)tfContainer).gameObject.SetActive(false);
		}

		private string GetStageList(List<Stage> stages)
		{
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			string text = "";
			for (int i = 0; i < stages.Count; i++)
			{
				if (i != 0)
				{
					text = text + "," + ((i % 2 == 0) ? "\n" : " ");
				}
				text += StringUtils.GetStageReadableName(stages[i]);
			}
			return text;
		}

		private string GetBanOrder(Ruleset ruleset)
		{
			string text = "";
			if (ruleset.banAmounts.Length == 0)
			{
				text += "Free pick";
			}
			else
			{
				text += $"(Player {ruleset.game1FirstPlayer + 1} starts for G1)\n";
				int num = 0;
				int[][] banAmounts = ruleset.banAmounts;
				foreach (int[] array in banAmounts)
				{
					text += string.Format("G{0}{1} ", num + 1, (num == ruleset.banAmounts.Length - 1) ? "+" : "");
					bool flag = true;
					for (int j = 0; j < array.Length; j++)
					{
						if (array[j] == 0)
						{
							text = text + ((ruleset.laterGamesFirstPlayer == Ruleset.FirstPlayer.WINNER) ? "W" : "L") + " picks";
							break;
						}
						if (j != 0)
						{
							text += "-";
						}
						for (int k = 0; k < array[j]; k++)
						{
							text += ((j % 2 == 0) ? ((ruleset.laterGamesFirstPlayer == Ruleset.FirstPlayer.WINNER) ? "W" : "L") : ((ruleset.laterGamesFirstPlayer == Ruleset.FirstPlayer.WINNER) ? "L" : "W"));
						}
					}
					text += "\n";
					num++;
				}
			}
			return text;
		}

		private void Update()
		{
			//IL_0052: Unknown result type (might be due to invalid IL or missing references)
			//IL_004b: Unknown result type (might be due to invalid IL or missing references)
			if (!RulesetPreviewPatch.isInModMenu)
			{
				((Component)tfContainer).gameObject.SetActive(false);
				return;
			}
			Ruleset selectedRuleset = Plugin.Instance.SelectedRuleset;
			((Component)tfContainer).gameObject.SetActive(true);
			((Graphic)lbRuleset).color = ((selectedRuleset == null) ? Color.red : Color.green);
			((TMP_Text)lbRuleset).SetText((selectedRuleset == null) ? "NULL" : selectedRuleset.Id);
			if (selectedRuleset == null)
			{
				rulesetInfo.ForEach(delegate(TextMeshProUGUI lb)
				{
					((Component)lb).gameObject.SetActive(false);
				});
				return;
			}
			rulesetInfo.ForEach(delegate(TextMeshProUGUI lb)
			{
				((Component)lb).gameObject.SetActive(true);
			});
			((TMP_Text)lbName2).SetText(selectedRuleset.name);
			((TMP_Text)lbNeutralStages2).SetText(GetStageList(selectedRuleset.stagesNeutral));
			((TMP_Text)lbCounterpickStages2).SetText(GetStageList(selectedRuleset.stagesCounterpick));
			TextMeshProUGUI val = lbDsrMode2;
			Ruleset.DsrMode dsrMode = selectedRuleset.dsrMode;
			if (1 == 0)
			{
			}
			string text = default(string);
			switch (dsrMode)
			{
			case Ruleset.DsrMode.OFF:
				text = "OFF";
				break;
			case Ruleset.DsrMode.FULL_SET:
				text = "ON, includes all wins";
				break;
			case Ruleset.DsrMode.LAST_WIN:
				text = "ON, only last win";
				break;
			default:
				if (1 == 0)
				{
				}
				global::<PrivateImplementationDetails>.ThrowInvalidOperationException();
				break;
			}
			if (1 == 0)
			{
			}
			((TMP_Text)val).SetText(text);
			TextMeshProUGUI val2 = lbRandomMode2;
			Ruleset.RandomMode randomMode = selectedRuleset.randomMode;
			if (1 == 0)
			{
			}
			switch (randomMode)
			{
			case Ruleset.RandomMode.OFF:
				text = "OFF";
				break;
			case Ruleset.RandomMode.ANY_3D:
				text = "ON, any 3D stage";
				break;
			case Ruleset.RandomMode.ANY_2D:
				text = "ON, any 2D stage";
				break;
			case Ruleset.RandomMode.BOTH:
				text = "ON, both any 3D/any 2D options";
				break;
			case Ruleset.RandomMode.ANY:
				text = "ON, any stage (3D/2D)";
				break;
			case Ruleset.RandomMode.ANY_LEGAL:
				text = "ON, any legal stage";
				break;
			default:
				if (1 == 0)
				{
				}
				global::<PrivateImplementationDetails>.ThrowInvalidOperationException();
				break;
			}
			if (1 == 0)
			{
			}
			((TMP_Text)val2).SetText(text);
			((TMP_Text)lbBanOrder2).SetText(GetBanOrder(selectedRuleset));
		}
	}
	internal class ScreenLobbyTourney : ScreenPlayers, ICustomScreen<ScreenPlayers>
	{
		private static readonly Vector2 GAME_POSITION = new Vector2(0f, 250f);

		private const int GAME_FONT_SIZE = 28;

		private static readonly Vector2 SETCOUNT_POSITION = new Vector2(0f, 204f);

		private const int SETCOUNT_FONT_SIZE = 52;

		private static readonly Vector2 RESET_SCALE = new Vector2(220f, 26f);

		private static readonly Vector2 RESET_POSITION = new Vector2(0f, 346f);

		private const int RESET_FONT_SIZE = 18;

		private TextMeshProUGUI lbGame;

		private TextMeshProUGUI lbSetCount;

		private VoteButton btResetSetCount;

		public void Init(ScreenPlayers screenPlayers)
		{
			//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_0027: Unknown result type (might be due to invalid IL or missing references)
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_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_01bf: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c4: Unknown result type (might be due to invalid IL or missing references)
			//IL_01cb: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d0: Unknown result type (might be due to invalid IL or missing references)
			((ScreenBase)this).screenType = ((ScreenBase)screenPlayers).screenType;
			((ScreenBase)this).layer = ((ScreenBase)screenPlayers).layer;
			((ScreenBase)this).isActive = ((ScreenBase)screenPlayers).isActive;
			((ScreenBase)this).msgEsc = ((ScreenBase)screenPlayers).msgEsc;
			((ScreenBase)this).msgMenu = ((ScreenBase)screenPlayers).msgMenu;
			((ScreenBase)this).msgCancel = ((ScreenBase)screenPlayers).msgCancel;
			base.btBack = screenPlayers.btBack;
			base.btStart = screenPlayers.btStart;
			base.characterButtons = screenPlayers.characterButtons;
			base.playerSelections = screenPlayers.playerSelections;
			base.lbCharInfo = screenPlayers.lbCharInfo;
			base.lbCountdown = screenPlayers.lbCountdown;
			base.lbGameModeHeader = screenPlayers.lbGameModeHeader;
			base.lbGameMode = screenPlayers.lbGameMode;
			base.btGameMode = screenPlayers.btGameMode;
			base.btOptions = screenPlayers.btOptions;
			base.btInviteFriends = screenPlayers.btInviteFriends;
			base.lbStocksHeader = screenPlayers.lbStocksHeader;
			base.lbTimeHeader = screenPlayers.lbTimeHeader;
			base.lbSpeedHeader = screenPlayers.lbSpeedHeader;
			base.lbBallTypeHeader = screenPlayers.lbBallTypeHeader;
			base.lbEnergyHeader = screenPlayers.lbEnergyHeader;
			base.lbHpFactorHeader = screenPlayers.lbHpFactorHeader;
			base.lbPowerupSelectionHeader = screenPlayers.lbPowerupSelectionHeader;
			base.lbStocks = screenPlayers.lbStocks;
			base.lbTime = screenPlayers.lbTime;
			base.lbSpeed = screenPlayers.lbSpeed;
			base.lbBallType = screenPlayers.lbBallType;
			base.lbEnergy = screenPlayers.lbEnergy;
			base.lbHpFactor = screenPlayers.lbHpFactor;
			base.lbPowerupSelection = screenPlayers.lbPowerupSelection;
			base.obSettings = screenPlayers.obSettings;
			base.pfPlayerSelection = screenPlayers.pfPlayerSelection;
			base.pfCharacterButton = screenPlayers.pfCharacterButton;
			base.pnCharacterButtons = screenPlayers.pnCharacterButtons;
			base.pnPlayers = screenPlayers.pnPlayers;
			base.curCountDown = screenPlayers.curCountDown;
			base.kCountDown = screenPlayers.kCountDown;
			base.countDownState = screenPlayers.countDownState;
			base.nPlayersShown = screenPlayers.nPlayersShown;
		}

		public override void OnOpen(ScreenType screenTypePrev)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0047: 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_0079: Unknown result type (might be due to invalid IL or missing references)
			((ScreenPlayers)this).OnOpen(screenTypePrev);
			UIUtils.CreateText(ref lbGame, "lbGame", ((Component)this).transform, GAME_POSITION);
			((TMP_Text)lbGame).fontSize = 28f;
			UIUtils.CreateText(ref lbSetCount, "lbSetCount", ((Component)this).transform, SETCOUNT_POSITION);
			((TMP_Text)lbSetCount).fontSize = 52f;
			UIUtils.CreateVoteButton(ref btResetSetCount, "btResetSetCount", ((Component)this).transform, RESET_POSITION, RESET_SCALE);
			VoteButton.ActiveVoteButtons.Add(btResetSetCount);
			UIUtils.SetButtonBGVisibility((LLButton)(object)btResetSetCount, visible: false);
			((TMP_Text)((LLButton)btResetSetCount).textMesh).fontSize = 18f;
			btResetSetCount.label = "Reset set count";
			btResetSetCount.onVote = OnVoteReset;
			UpdateSetCount();
		}

		public override void OnClose(ScreenType screenTypeNext)
		{
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			VoteButton.ActiveVoteButtons.Remove(btResetSetCount);
			((ScreenPlayers)this).OnClose(screenTypeNext);
		}

		public override void DoUpdate()
		{
			((ScreenPlayers)this).DoUpdate();
			((ScreenPlayers)this).ShowCpuButtons(false);
		}

		private void UpdateSetCount()
		{
			int gameNumber = SetTracker.Instance.CurrentSet.GameNumber;
			int[] winCounts = SetTracker.Instance.CurrentSet.WinCounts;
			TextHandler.SetText((TMP_Text)(object)lbGame, $"Game {gameNumber}");
			TextHandler.SetText((TMP_Text)(object)lbSetCount, $"({winCounts[0]}-{winCounts[1]})");
		}

		private void OnVoteReset()
		{
			SetTracker.Instance.Reset();
			UpdateSetCount();
		}
	}
	internal class ScreenMenuMain : ScreenMenuMain, ICustomScreen<ScreenMenuMain>
	{
		[Serializable]
		[CompilerGenerated]
		private sealed class <>c
		{
			public static readonly <>c <>9 = new <>c();

			public static ControlDelegate <>9__3_0;

			internal void <OnOpen>b__3_0(int playerNr)
			{
				Plugin.Instance.TourneyMenuOpen = true;
				GameStates.Send((Msg)11, playerNr, -1);
			}
		}

		private static readonly Vector3 OFFSET_RIGHTCOL = Vector2.op_Implicit(new Vector2(412.3f, 0f));

		internal LLButton btTourney;

		public void Init(ScreenMenuMain screenVanilla)
		{
			//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_0027: Unknown result type (might be due to invalid IL or missing references)
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_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_0098: Unknown result type (might be due to invalid IL or missing references)
			//IL_009d: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ae: Unknown result type (might be due to invalid IL or missing references)
			((ScreenBase)this).screenType = ((ScreenBase)screenVanilla).screenType;
			((ScreenBase)this).layer = ((ScreenBase)screenVanilla).layer;
			((ScreenBase)this).isActive = ((ScreenBase)screenVanilla).isActive;
			((ScreenBase)this).msgEsc = ((ScreenBase)screenVanilla).msgEsc;
			((ScreenBase)this).msgMenu = ((ScreenBase)screenVanilla).msgMenu;
			((ScreenBase)this).msgCancel = ((ScreenBase)screenVanilla).msgCancel;
			base.btOnline = screenVanilla.btOnline;
			base.btVersus = screenVanilla.btVersus;
			base.btSingle = screenVanilla.btSingle;
			base.btOptions = screenVanilla.btOptions;
			base.btUnlocks = screenVanilla.btUnlocks;
			base.onlineGray = screenVanilla.onlineGray;
			base.onlineColDefault = screenVanilla.btOnline.colDefault;
			base.onlineColDisabled = screenVanilla.btOnline.colDisabled;
		}

		public override void OnOpen(ScreenType screenTypePrev)
		{
			//IL_0002: 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_0042: Unknown result type (might be due to invalid IL or missing references)
			//IL_0047: Unknown result type (might be due to invalid IL or missing references)
			//IL_006c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0071: Unknown result type (might be due to invalid IL or missing references)
			//IL_0077: Expected O, but got Unknown
			((ScreenMenuMain)this).OnOpen(screenTypePrev);
			btTourney = Object.Instantiate<LLButton>(base.btOnline, ((Component)this).transform);
			((Object)btTourney).name = "btTourney";
			Transform transform = ((Component)btTourney).transform;
			transform.localPosition += OFFSET_RIGHTCOL;
			LLButton obj = btTourney;
			object obj2 = <>c.<>9__3_0;
			if (obj2 == null)
			{
				ControlDelegate val = delegate(int playerNr)
				{
					Plugin.Instance.TourneyMenuOpen = true;
					GameStates.Send((Msg)11, playerNr, -1);
				};
				<>c.<>9__3_0 = val;
				obj2 = (object)val;
			}
			((LLClickable)obj).onClick = (ControlDelegate)obj2;
			btTourney.SetText("tournament", -1, false);
		}

		public override void GetControls(ref List<LLClickable> list, bool vert, LLClickable curFocus, LLCursor cursor)
		{
			((ScreenMenuMain)this).GetControls(ref list, vert, curFocus, cursor);
			list.Add((LLClickable)(object)btTourney);
		}

		public override bool DirectMove(Vector2 move, LLClickable curFocus, bool shouldMove)
		{
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0039: Unknown result type (might be due to invalid IL or missing references)
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			if (!shouldMove)
			{
				return false;
			}
			bool flag = Mathf.Abs(move.y) > Mathf.Abs(move.x);
			float num = (flag ? Mathf.Sign(move.y) : Mathf.Sign(move.x));
			if (flag)
			{
				return false;
			}
			if ((Object)(object)curFocus == (Object)(object)btTourney)
			{
				UIScreen.SetFocus((LLClickable)(object)(((LLControl)base.btOnline).visible ? base.btOnline : base.btVersus));
				AudioHandler.PlayMenuSfx((Sfx)5);
				return true;
			}
			UIScreen.SetFocus((LLClickable)(object)btTourney);
			AudioHandler.PlayMenuSfx((Sfx)5);
			return true;
		}
	}
	internal class ScreenMenuTourney : ScreenMenuVersus, ICustomScreen<ScreenMenuVersus>, IMenuTitle
	{
		[Serializable]
		[CompilerGenerated]
		private sealed class <>c
		{
			public static readonly <>c <>9 = new <>c();

			public static ControlDelegate <>9__7_0;

			public static ControlDelegate <>9__7_1;

			public static ControlDelegate <>9__7_2;

			public static ControlDelegate <>9__7_3;

			internal void <OnOpen>b__7_0(int playerNr)
			{
				Plugin.Instance.ActiveTourneyMode = TourneyMode.LOCAL_1V1;
				GameStates.Send((Msg)25, playerNr, -1);
			}

			internal void <OnOpen>b__7_1(int playerNr)
			{
				Plugin.Instance.ActiveTourneyMode = TourneyMode.LOCAL_DOUBLES;
				GameStates.Send((Msg)26, playerNr, -1);
			}

			internal void <OnOpen>b__7_2(int playerNr)
			{
				Plugin.Instance.ActiveTourneyMode = TourneyMode.LOCAL_CREW;
				GameStates.Send((Msg)25, playerNr, -1);
			}

			internal void <OnOpen>b__7_3(int playerNr)
			{
				Plugin.Instance.ActiveTourneyMode = TourneyMode.ONLINE_1V1;
				GameStates.Send((Msg)39, playerNr, -1);
			}
		}

		private static readonly Vector3 OFFSET_RIGHTCOL = Vector2.op_Implicit(new Vector2(412.3f, 0f));

		private LLButton btLocal1v1;

		private LLButton btLocalDoubles;

		private LLButton btLocalCrew;

		private LLButton btOnline1v1;

		public string GetCustomTitle()
		{
			return "TOURNAMENT";
		}

		public void Init(ScreenMenuVersus screenVanilla)
		{
			//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_0027: Unknown result type (might be due to invalid IL or missing references)
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_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)
			((ScreenBase)this).screenType = ((ScreenBase)screenVanilla).screenType;
			((ScreenBase)this).layer = ((ScreenBase)screenVanilla).layer;
			((ScreenBase)this).isActive = ((ScreenBase)screenVanilla).isActive;
			((ScreenBase)this).msgEsc = ((ScreenBase)screenVanilla).msgEsc;
			((ScreenBase)this).msgMenu = ((ScreenBase)screenVanilla).msgMenu;
			((ScreenBase)this).msgCancel = ((ScreenBase)screenVanilla).msgCancel;
			base.btRoyale = screenVanilla.btRoyale;
			base.bt1v1 = screenVanilla.bt1v1;
			base.btTeams = screenVanilla.btTeams;
			base.btVolley = screenVanilla.btVolley;
			base.btStrikers = screenVanilla.btStrikers;
		}

		public override void OnOpen(ScreenType screenTypePrev)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_004b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0050: Unknown result type (might be due to invalid IL or missing references)
			//IL_0056: Expected O, but got Unknown
			//IL_00b0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bb: Expected O, but got Unknown
			//IL_015b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0160: Unknown result type (might be due to invalid IL or missing references)
			//IL_0165: Unknown result type (might be due to invalid IL or missing references)
			//IL_0115: Unknown result type (might be due to invalid IL or missing references)
			//IL_011a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0120: Expected O, but got Unknown
			//IL_019b: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a0: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a6: Expected O, but got Unknown
			((ScreenMenuVersus)this).OnOpen(screenTypePrev);
			btLocal1v1 = Object.Instantiate<LLButton>(base.btRoyale, ((Component)this).transform);
			((Object)btLocal1v1).name = "btLocal1v1";
			LLButton obj = btLocal1v1;
			object obj2 = <>c.<>9__7_0;
			if (obj2 == null)
			{
				ControlDelegate val = delegate(int playerNr)
				{
					Plugin.Instance.ActiveTourneyMode = TourneyMode.LOCAL_1V1;
					GameStates.Send((Msg)25, playerNr, -1);
				};
				<>c.<>9__7_0 = val;
				obj2 = (object)val;
			}
			((LLClickable)obj).onClick = (ControlDelegate)obj2;
			btLocal1v1.SetText("local 1v1", -1, false);
			btLocalDoubles = Object.Instantiate<LLButton>(base.bt1v1, ((Component)this).transform);
			((Object)btLocalDoubles).name = "btLocalDoubles";
			LLButton obj3 = btLocalDoubles;
			object obj4 = <>c.<>9__7_1;
			if (obj4 == null)
			{
				ControlDelegate val2 = delegate(int playerNr)
				{
					Plugin.Instance.ActiveTourneyMode = TourneyMode.LOCAL_DOUBLES;
					GameStates.Send((Msg)26, playerNr, -1);
				};
				<>c.<>9__7_1 = val2;
				obj4 = (object)val2;
			}
			((LLClickable)obj3).onClick = (ControlDelegate)obj4;
			btLocalDoubles.SetText("local doubles", -1, false);
			btLocalCrew = Object.Instantiate<LLButton>(base.btTeams, ((Component)this).transform);
			((Object)btLocalCrew).name = "btLocalCrew";
			LLButton obj5 = btLocalCrew;
			object obj6 = <>c.<>9__7_2;
			if (obj6 == null)
			{
				ControlDelegate val3 = delegate(int playerNr)
				{
					Plugin.Instance.ActiveTourneyMode = TourneyMode.LOCAL_CREW;
					GameStates.Send((Msg)25, playerNr, -1);
				};
				<>c.<>9__7_2 = val3;
				obj6 = (object)val3;
			}
			((LLClickable)obj5).onClick = (ControlDelegate)obj6;
			btLocalCrew.SetText("crew battle", -1, false);
			btOnline1v1 = Object.Instantiate<LLButton>(base.btRoyale, ((Component)this).transform);
			Transform transform = ((Component)btOnline1v1).transform;
			transform.localPosition += OFFSET_RIGHTCOL;
			((Object)btOnline1v1).name = "btOnline1v1";
			LLButton obj7 = btOnline1v1;
			object obj8 = <>c.<>9__7_3;
			if (obj8 == null)
			{
				ControlDelegate val4 = delegate(int playerNr)
				{
					Plugin.Instance.ActiveTourneyMode = TourneyMode.ONLINE_1V1;
					GameStates.Send((Msg)39, playerNr, -1);
				};
				<>c.<>9__7_3 = val4;
				obj8 = (object)val4;
			}
			((LLClickable)obj7).onClick = (ControlDelegate)obj8;
			btOnline1v1.SetText("online 1v1", -1, false);
			((LLClickable)btLocalDoubles).SetActive(false);
			((LLClickable)btLocalCrew).SetActive(false);
			((LLClickable)btOnline1v1).SetActive(false);
			((LLControl)base.btRoyale).visible = false;
			((LLControl)base.bt1v1).visible = false;
			((LLControl)base.btTeams).visible = false;
			((LLControl)base.btVolley).visible = false;
			((LLControl)base.btStrikers).visible = false;
		}

		public override void GetControls(ref List<LLClickable> list, bool vert, LLClickable curFocus, LLCursor cursor)
		{
			list.Add((LLClickable)(object)btLocal1v1);
			list.Add((LLClickable)(object)btLocalDoubles);
			list.Add((LLClickable)(object)btLocalCrew);
			list.Add((LLClickable)(object)btOnline1v1);
		}

		public override LLClickable GetDefaultFocus(LLCursor cursor)
		{
			return (LLClickable)(object)btLocal1v1;
		}

		public override bool DirectMove(Vector2 move, LLClickable curFocus, bool shouldMove)
		{
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0039: Unknown result type (might be due to invalid IL or missing references)
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			if (!shouldMove)
			{
				return false;
			}
			bool flag = Mathf.Abs(move.y) > Mathf.Abs(move.x);
			float num = (flag ? Mathf.Sign(move.y) : Mathf.Sign(move.x));
			if (flag)
			{
				return false;
			}
			if ((Object)(object)curFocus == (Object)(object)btOnline1v1)
			{
				UIScreen.SetFocus((LLClickable)(object)btLocal1v1);
				AudioHandler.PlayMenuSfx((Sfx)5);
				return true;
			}
			UIScreen.SetFocus((LLClickable)(object)btOnline1v1);
			AudioHandler.PlayMenuSfx((Sfx)5);
			return true;
		}
	}
	internal class ScreenStageStrike : ScreenPlayersStage, ICustomScreen<ScreenPlayersStage>, IStageSelect
	{
		[Serializable]
		[CompilerGenerated]
		private sealed class <>c
		{
			public static readonly <>c <>9 = new <>c();

			public static ControlDelegate <>9__37_0;

			public static Action<StageContainer> <>9__46_0;

			internal void <OnOpen>b__37_0(int playerNumber)
			{
				GameStates.Send((Msg)2, playerNumber, -1);
			}

			internal void <OnStageSelected>b__46_0(StageContainer container)
			{
				((LLClickable)container.Button).OnHoverOut(-1);
				((LLClickable)container.Button).SetActive(false);
				container.Button.UpdateDisplay();
			}
		}

		private static readonly Vector2 BG_SCALE = new Vector2(1f, 2f);

		private static readonly Vector2 BG_POSITION = new Vector2(0f, -20f);

		private static readonly Vector2 TITLE_SCALE = new Vector2(1f, 0.6f);

		private static readonly Vector2 TITLE_POSITION = new Vector2(0f, 328f);

		private const int TITLE_FONT_SIZE = 36;

		private static readonly Vector2 BACK_SCALE = new Vector2(0.6f, 0.5f);

		private static readonly Vector2 BACK_POSITION = new Vector2(-570f, -336f);

		private const int BACK_FONT_SIZE = 22;

		private static readonly Vector2 SETCOUNT_POSITION = new Vector2(0f, 270f);

		private const int SETCOUNT_FONT_SIZE = 32;

		private static readonly Vector2 BANSREMAINING_POSITION = new Vector2(0f, -276f);

		private const int BANSREMAINING_FONT_SIZE = 18;

		private static readonly Vector2 BANSTATUS_POSITION = new Vector2(0f, -310f);

		private const int BANSTATUS_FONT_SIZE = 42;

		private static readonly Vector2 FREEPICK_POSITION = new Vector2(506f, -336f);

		private static readonly Vector2 FREEPICK_SCALE = new Vector2(234f, 27.5f);

		private const int FREEPICK_FONT_SIZE = 18;

		private static readonly Vector2 RANDOM_POSITION = new Vector2(-378f, -336f);

		private static readonly Vector2 RANDOM_SCALE = new Vector2(255.6f, 27.5f);

		private const int RANDOM_FONT_SIZE = 18;

		private static readonly Vector2 RANDOM_BOTH_OFFSET = new Vector2(60f, 0f);

		private static readonly Vector2 RANDOM_BOTH_SCALE = new Vector2(100f, 34f);

		private const int RANDOM_BOTH_FONT_SIZE = 16;

		private static readonly Color[] COLOR_PLAYER = (Color[])(object)new Color[4]
		{
			new Color(1f, 0.2509804f, 0.08627451f),
			new Color(0.050980393f, 8f / 15f, 1f),
			new Color(1f, 1f, 0.23921569f),
			new Color(0.3529412f, 0.95686275f, 0.3529412f)
		};

		private List<StageContainer> stageContainersNeutral;

		private List<StageContainer> stageContainersCounterpick;

		private List<StageContainer> stageContainers;

		private TextMeshProUGUI lbSetCount;

		private TextMeshProUGUI lbBansRemaining;

		private TextMeshProUGUI lbBanStatus;

		private VoteButton btFreePick;

		private VoteButton btRandomMain;

		private VoteButton btRandomBoth3D;

		private VoteButton btRandomBoth2D;

		private Stage selectedStage = (Stage)0;

		private Ruleset.RandomMode selectedRandom = Ruleset.RandomMode.OFF;

		public void Init(ScreenPlayersStage screenPlayersStage)
		{
			//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_0027: Unknown result type (might be due to invalid IL or missing references)
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_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_00b7: 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_00c3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cf: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00db: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e7: 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: 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_00ff: 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)
			((ScreenBase)this).screenType = ((ScreenBase)screenPlayersStage).screenType;
			((ScreenBase)this).layer = ((ScreenBase)screenPlayersStage).layer;
			((ScreenBase)this).isActive = ((ScreenBase)screenPlayersStage).isActive;
			((ScreenBase)this).msgEsc = ((ScreenBase)screenPlayersStage).msgEsc;
			((ScreenBase)this).msgMenu = ((ScreenBase)screenPlayersStage).msgMenu;
			((ScreenBase)this).msgCancel = ((ScreenBase)screenPlayersStage).msgCancel;
			base.btBack = screenPlayersStage.btBack;
			base.btLeft = screenPlayersStage.btLeft;
			base.btRight = screenPlayersStage.btRight;
			base.lbTitle = screenPlayersStage.lbTitle;
			base.lbPlayersSelectingStage = screenPlayersStage.lbPlayersSelectingStage;
			base.obSpectator = screenPlayersStage.obSpectator;
			base.obNotSpectator = screenPlayersStage.obNotSpectator;
			base.stageButtonsContainer = screenPlayersStage.stageButtonsContainer;
			base.btStages = screenPlayersStage.btStages;
			base.posMid = screenPlayersStage.posMid;
			base.posLeft = screenPlayersStage.posLeft;
			base.posLeft2 = screenPlayersStage.posLeft2;
			base.posRight = screenPlayersStage.posRight;
			base.posRight2 = screenPlayersStage.posRight2;
			base.scaleSmall = screenPlayersStage.scaleSmall;
			base.scaleBig = screenPlayersStage.scaleBig;
			base.nButtons = screenPlayersStage.nButtons;
			base.curIndex = screenPlayersStage.curIndex;
			base.isMoving = screenPlayersStage.isMoving;
			base.queuedMove = screenPlayersStage.queuedMove;
		}

		public override void OnOpen(ScreenType screenTypePrev)
		{
			//IL_0038: Unknown result type (might be due to invalid IL or missing references)
			//IL_0054: Unknown result type (might be due to invalid IL or missing references)
			//IL_0060: 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_009b: 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_00d3: 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_00e4: Unknown result type (might be due to invalid IL or missing references)
			//IL_013e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0143: Unknown result type (might be due to invalid IL or missing references)
			//IL_0159: Unknown result type (might be due to invalid IL or missing references)
			//IL_015e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0199: Unknown result type (might be due to invalid IL or missing references)
			//IL_019e: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d0: Unknown result type (might be due to invalid IL or missing references)
			//IL_0123: Unknown result type (might be due to invalid IL or missing references)
			//IL_0128: Unknown result type (might be due to invalid IL or missing references)
			//IL_012e: Expected O, but got Unknown
			//IL_0235: Unknown result type (might be due to invalid IL or missing references)
			//IL_0273: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b1: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b6: Unknown result type (might be due to invalid IL or missing references)
			//IL_0361: Unknown result type (might be due to invalid IL or missing references)
			//IL_0366: Unknown result type (might be due to invalid IL or missing references)
			//IL_0494: Unknown result type (might be due to invalid IL or missing references)
			//IL_0499: Unknown result type (might be due to invalid IL or missing references)
			//IL_049e: Unknown result type (might be due to invalid IL or missing references)
			//IL_04a3: Unknown result type (might be due to invalid IL or missing references)
			//IL_0562: Unknown result type (might be due to invalid IL or missing references)
			//IL_0567: Unknown result type (might be due to invalid IL or missing references)
			//IL_056c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0571: Unknown result type (might be due to invalid IL or missing references)
			StageStrikeTracker.Instance.Start();
			Plugin.Instance.RecolorCursors = true;
			if (TextHandler.isInited)
			{
				((ScreenBase)this).UpdateText();
			}
			((ScreenBase)this).msgMenu = (Msg)0;
			RectTransform component = ((Component)((Component)this).transform.Find("bar_top")).GetComponent<RectTransform>();
			component.anchoredPosition = TITLE_POSITION;
			((Transform)component).localScale = Vector2.op_Implicit(TITLE_SCALE);
			((Transform)base.lbTitle.rectTransform).localScale = Vector2.op_Implicit(new Vector2(1f / TITLE_SCALE.x, 1f / TITLE_SCALE.y));
			base.lbTitle.fontSize = 36f;
			RectTransform component2 = ((Component)((Component)this).transform.Find("bar_mid")).GetComponent<RectTransform>();
			component2.anchoredPosition = BG_POSITION;
			((Transform)component2).localScale = Vector2.op_Implicit(BG_SCALE);
			((LLControl)base.btLeft).visible = false;
			((LLControl)base.btRight).visible = false;
			LLButton btBack = base.btBack;
			object obj = <>c.<>9__37_0;
			if (obj == null)
			{
				ControlDelegate val = delegate(int playerNumber)
				{
					GameStates.Send((Msg)2, playerNumber, -1);
				};
				<>c.<>9__37_0 = val;
				obj = (object)val;
			}
			((LLClickable)btBack).onClick = (ControlDelegate)obj;
			((Component)base.btBack).transform.localPosition = Vector2.op_Implicit(BACK_POSITION);
			((Component)base.btBack).transform.localScale = Vector2.op_Implicit(BACK_SCALE);
			((Transform)((TMP_Text)base.btBack.textMesh).rectTransform).localScale = Vector2.op_Implicit(new Vector2(1f / BACK_SCALE.x, 1f / BACK_SCALE.y));
			((TMP_Text)base.btBack.textMesh).fontSize = 22f;
			UIUtils.CreateText(ref lbSetCount, "lbSetCount", ((Component)this).transform, SETCOUNT_POSITION);
			((TMP_Text)lbSetCount).fontSize = 32f;
			TextHandler.SetText((TMP_Text)(object)lbSetCount, "");
			if (Plugin.Instance.ActiveTourneyMode == TourneyMode.NONE)
			{
				((Component)lbSetCount).gameObject.SetActive(false);
			}
			UIUtils.CreateText(ref lbBansRemaining, "lbBansRemaining", ((Component)this).transform, BANSREMAINING_POSITION);
			((TMP_Text)lbBansRemaining).fontSize = 18f;
			TextHandler.SetText((TMP_Text)(object)lbBansRemaining, "");
			UIUtils.CreateText(ref lbBanStatus, "lbBanStatus", ((Component)this).transform, BANSTATUS_POSITION);
			((TMP_Text)lbBanStatus).fontSize = 42f;
			TextHandler.SetText((TMP_Text)(object)lbBanStatus, "");
			UIUtils.CreateVoteButton(ref btFreePick, "btFreePick", ((Component)this).transform, FREEPICK_POSITION, FREEPICK_SCALE);
			VoteButton.ActiveVoteButtons.Add(btFreePick);
			btFreePick.label = "Toggle free pick";
			((TMP_Text)((LLButton)btFreePick).textMesh).fontSize = 18f;
			btFreePick.onVote = OnVoteFreePick;
			if (StageStrikeTracker.Instance.CurrentStrikeInfo.IsFreePickForced)
			{
				((Component)btFreePick).gameObject.SetActive(false);
			}
			Ruleset.RandomMode randomMode = StageStrikeTracker.Instance.CurrentStrikeInfo.ActiveRuleset.randomMode;
			UIUtils.CreateVoteButton(ref btRandomMain, "btRandomMain", ((Component)this).transform, RANDOM_POSITION, RANDOM_SCALE);
			VoteButton.ActiveVoteButtons.Add(btRandomMain);
			VoteButton voteButton = btRandomMain;
			if (1 == 0)
			{
			}
			string text = randomMode switch
			{
				Ruleset.RandomMode.ANY => "(any 3D/2D)", 
				Ruleset.RandomMode.ANY_3D => "(any 3D)", 
				Ruleset.RandomMode.ANY_2D => "(any 2D)", 
				Ruleset.RandomMode.ANY_LEGAL => "(any legal)", 
				_ => "", 
			};
			if (1 == 0)
			{
			}
			voteButton.label = "Random " + text;
			((TMP_Text)((LLButton)btRandomMain).textMesh).fontSize = 18f;
			btRandomMain.onVote = delegate
			{
				OnVoteRandom(randomMode);
			};
			btRandomMain.enableVoting = !SetTracker.Instance.CurrentSet.IsFreePickMode && !StageStrikeTracker.Instance.CurrentStrikeInfo.IsFreePickForced;
			if (randomMode == Ruleset.RandomMode.OFF || randomMode == Ruleset.RandomMode.BOTH)
			{
				((Component)btRandomMain).gameObject.SetActive(false);
			}
			UIUtils.CreateVoteButton(ref btRandomBoth3D, "btRandomBoth3D", ((Component)this).transform, RANDOM_POSITION - RANDOM_BOTH_OFFSET, RANDOM_BOTH_SCALE);
			VoteButton.ActiveVoteButtons.Add(btRandomBoth3D);
			btRandomBoth3D.label = "Random\n(3D)";
			((TMP_Text)((LLButton)btRandomBoth3D).textMesh).fontSize = 16f;
			btRandomBoth3D.onVote = delegate
			{
				OnVoteRandom(Ruleset.RandomMode.ANY_3D);
			};
			btRandomBoth3D.enableVoting = !SetTracker.Instance.CurrentSet.IsFreePickMode && !StageStrikeTracker.Instance.CurrentStrikeInfo.IsFreePickForced;
			if (randomMode != Ruleset.RandomMode.BOTH)
			{
				((Component)btRandomBoth3D).gameObject.SetActive(false);
			}
			UIUtils.CreateVoteButton(ref btRandomBoth2D, "btRandomBoth2D", ((Component)this).transform, RANDOM_POSITION + RANDOM_BOTH_OFFSET, RANDOM_BOTH_SCALE);
			VoteButton.ActiveVoteButtons.Add(btRandomBoth2D);
			btRandomBoth2D.label = "Random\n(2D)";
			((TMP_Text)((LLButton)btRandomBoth2D).textMesh).fontSize = 16f;
			btRandomBoth2D.onVote = delegate
			{
				OnVoteRandom(Ruleset.RandomMode.ANY_2D);
			};
			btRandomBoth2D.enableVoting = !SetTracker.Instance.CurrentSet.IsFreePickMode && !StageStrikeTracker.Instance.CurrentStrikeInfo.IsFreePickForced;
			if (randomMode != Ruleset.RandomMode.BOTH)
			{
				((Component)btRandomBoth2D).gameObject.SetActive(false);
			}
			CreateStageContainers();
			UpdateStageBans();
			UpdateSetInfo();
		}

		public override void OnClose(ScreenType screenTypeNext)
		{
			//IL_005c: Unknown result type (might be due to invalid IL or missing references)
			StageStrikeTracker.Instance.End();
			Plugin.Instance.RecolorCursors = false;
			VoteButton.ActiveVoteButtons.Remove(btFreePick);
			VoteButton.ActiveVoteButtons.Remove(btRandomMain);
			VoteButton.ActiveVoteButtons.Remove(btRandomBoth3D);
			VoteButton.ActiveVoteButtons.Remove(btRandomBoth2D);
			((ScreenBase)this).OnClose(screenTypeNext);
		}

		public override void DoUpdate()
		{
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a4: Unknown result type (might be due to invalid IL or missing references)
			//IL_01aa: Invalid comparison between Unknown and I4
			//IL_0038: 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_01c9: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ce: Unknown result type (might be due to invalid IL or missing references)
			//IL_0040: Unknown result type (might be due to invalid IL or missing references)
			//IL_0046: Invalid comparison between Unknown and I4
			//IL_0053: Unknown result type (might be due to invalid IL or missing references)
			//IL_0059: Invalid comparison between Unknown and I4
			//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_0152: 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_0145: 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: Invalid comparison between Unknown and I4
			//IL_0187: Unknown result type (might be due to invalid IL or missing references)
			//IL_008f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0095: Invalid comparison between Unknown and I4
			//IL_00be: 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)
			Controller all;
			if (!UIScreen.blockGlobalInput)
			{
				all = Controller.all;
				if (((Controller)(ref all)).GetButtonDown(InputAction.ESC))
				{
					((ScreenBase)this).SendGlobal(((ScreenBase)this).msgEsc, -1);
				}
				if ((int)((ScreenBase)this).msgMenu != 0 || (int)((ScreenBase)this).msgCancel > 0)
				{
					if ((int)UIInput.uiControl == 2)
					{
						for (int i = 0; i < 4; i++)
						{
							ALDOKEMAOMB val = ALDOKEMAOMB.BJDPHEHJJJK(i);
							if ((int)UIInput.uiControl != 2 || (val.OBELDJGOOIJ != null && (int)val.OBELDJGOOIJ.state > 0))
							{
								if (((Controller)(ref val.GDEMBCKIDMA)).GetButtonDown(InputAction.MENU))
								{
									((ScreenBase)this).SendGlobal(((ScreenBase)this).msgMenu, i);
								}
								if (((Controller)(ref val.GDEMBCKIDMA)).GetButtonDown(InputAction.BACK) || (((Controller)(ref val.GDEMBCKIDMA)).IncludesMouse() && Input.GetMouseButtonDown(1)))
								{
									((ScreenBase)this).SendGlobal(((ScreenBase)this).msgCancel, i);
								}
							}
						}
					}
					else
					{
						all = Controller.all;
						if (((Controller)(ref all)).GetButtonDown(InputAction.MENU))
						{
							((ScreenBase)this).SendGlobal(((ScreenBase)this).msgMenu, -1);
						}
						all = Controller.all;
						if (((Controller)(ref all)).GetButtonDown(InputAction.BACK) || (CGLLJHHAJAK.GIGAKBJGFDI.hasMouseKeyboard && Input.GetMouseButtonDown(1)))
						{
							((ScreenBase)this).SendGlobal(((ScreenBase)this).msgCancel, -1);
						}
					}
				}
			}
			if (UIScreen.blockGlobalInput)
			{
				return;
			}
			if ((int)UIInput.uiControl == 2)
			{
				Player.ForAll((Action<Player>)delegate(Player player)
				{
					//IL_000f: Unknown result type (might be due to invalid IL or missing references)
					//IL_0015: Invalid comparison between Unknown and I4
					//IL_0021: Unknown result type (might be due to invalid IL or missing references)
					//IL_0026: Unknown result type (might be due to invalid IL or missing references)
					if (player.cursor != null && (int)player.cursor.state != 0)
					{
						Controller controller = player.controller;
						if (((Controller)(ref controller)).GetButtonDown(InputAction.MENU))
						{
							LLClickable defaultFocus2 = ((ScreenBase)this).GetDefaultFocus(player.cursor);
							if ((Object)(object)defaultFocus2 != (Object)null && defaultFocus2.isActive)
							{
								defaultFocus2.OnClick(player.nr);
							}
						}
					}
				});
				return;
			}
			all = Controller.all;
			if (((Controller)(ref all)).GetButtonDown(InputAction.MENU))
			{
				LLClickable defaultFocus = ((ScreenBase)this).GetDefaultFocus(UIInput.mainCursor);
				if ((Object)(object)defaultFocus != (Object)null && defaultFocus.isActive)
				{
					defaultFocus.OnClick(-1);
				}
			}
		}

		public override LLClickable GetDefaultFocus(LLCursor cursor)
		{
			Ruleset.RandomMode randomMode = StageStrikeTracker.Instance.CurrentStrikeInfo.ActiveRuleset.randomMode;
			if (1 == 0)
			{
			}
			VoteButton result = randomMode switch
			{
				Ruleset.RandomMode.OFF => null, 
				Ruleset.RandomMode.BOTH => btRandomBoth3D, 
				_ => btRandomMain, 
			};
			if (1 == 0)
			{
			}
			return (LLClickable)(object)result;
		}

		public override void GetControls(ref List<LLClickable> list, bool vert, LLClickable curFocus, LLCursor cursor)
		{
			list.AddRange((IEnumerable<LLClickable>)(object)base.btStages);
			list.Add((LLClickable)(object)base.btBack);
			switch (StageStrikeTracker.Instance.CurrentStrikeInfo.ActiveRuleset.randomMode)
			{
			case Ruleset.RandomMode.BOTH:
				list.Add((LLClickable)(object)btRandomBoth3D);
				list.Add((LLClickable)(object)btRandomBoth2D);
				break;
			default:
				list.Add((LLClickable)(object)btRandomMain);
				break;
			case Ruleset.RandomMode.OFF:
				break;
			}
			if (!StageStrikeTracker.Instance.CurrentStrikeInfo.IsFreePickForced)
			{
				list.Add((LLClickable)(object)btFreePick);
			}
		}

		private void CreateStageContainers()
		{
			//IL_003a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0052: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ee: 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_00f7: Unknown result type (might be due to invalid IL or missing references)
			//IL_0118: Unknown result type (might be due to invalid IL or missing references)
			//IL_0132: Unknown result type (might be due to invalid IL or missing references)
			//IL_015d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0168: Unknown result type (might be due to invalid IL or missing references)
			//IL_017b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0186: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a9: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b6: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c1: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c6: Unknown result type (might be due to invalid IL or missing references)
			//IL_0259: Unknown result type (might be due to invalid IL or missing references)
			//IL_025e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0262: Unknown result type (might be due to invalid IL or missing references)
			//IL_0283: Unknown result type (might be due to invalid IL or missing references)
			//IL_029d: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c8: Unknown result type (might be due to invalid IL or missing references)
			//IL_02d3: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ef: Unknown result type (might be due to invalid IL or missing references)
			//IL_02fa: 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_0341: Unknown result type (might be due to invalid IL or missing references)
			//IL_034c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0351: Unknown result type (might be due to invalid IL or missing references)
			StageLayout stageLayout = StageLayout.Create(StageStrikeTracker.Instance.CurrentStrikeInfo.ActiveRuleset.stagesNeutral.Count, StageStrikeTracker.Instance.CurrentStrikeInfo.ActiveRuleset.stagesCounterpick.Count);
			float num = stageLayout.position.y + stageLayout.totalHeight / 2f - stageLayout.stageSize.y / 2f;
			base.nButtons = StageStrikeTracker.Instance.CurrentStrikeInfo.ActiveRuleset.stagesNeutral.Count + StageStrikeTracker.Instance.CurrentStrikeInfo.ActiveRuleset.stagesCounterpick.Count;
			base.btStages = (LLButton[])(object)new LLButton[base.nButtons];
			int num2 = 0;
			int num3 = 0;
			int num4 = 0;
			stageContainers = new List<StageContainer>();
			stageContainersNeutral = new List<StageContainer>();
			foreach (Stage item in StageStrikeTracker.Instance.CurrentStrikeInfo.ActiveRuleset.stagesNeutral)
			{
				float num5 = stageLayout.position.x - stageLayout.GetRowWidth(stageLayout.rowLengthsNeutral[num3]) / 2f + stageLayout.stageSize.x / 2f;
				StageContainer stageContainer = new StageContainer(this, base.stageButtonsContainer, item);
				stageContainers.Add(stageContainer);
				stageContainersNeutral.Add(stageContainer);
				float num6 = num5 + (float)num4 * (stageLayout.stageSize.x + stageLayout.spacing.x);
				float num7 = num - (float)num3 * (stageLayout.stageSize.y + stageLayout.spacing.y);
				RectTransform component = ((Component)stageContainer.Button).GetComponent<RectTransform>();
				component.anchoredPosition = new Vector2(num6, num7);
				((Transform)component).localScale = Vector2.op_Implicit(Vector2.one * stageLayout.stageScaleFactor);
				base.btStages[num2] = (LLButton)(object)stageContainer.Button;
				num2++;
				num4++;
				if (num4 >= stageLayout.rowLengthsNeutral[num3])
				{
					num3++;
					num4 = 0;
				}
			}
			num3 = 0;
			num4 = 0;
			stageContainersCounterpick = new List<StageContainer>();
			foreach (Stage item2 in StageStrikeTracker.Instance.CurrentStrikeInfo.ActiveRuleset.stagesCounterpick)
			{
				float num8 = stageLayout.position.x - stageLayout.GetRowWidth(stageLayout.rowLengthsCounterpick[num3]) / 2f + stageLayout.stageSize.x / 2f;
				StageContainer stageContainer2 = new StageContainer(this, base.stageButtonsContainer, item2);
				stageContainers.Add(stageContainer2);
				stageContainersCounterpick.Add(stageContainer2);
				float num9 = num8 + (float)num4 * (stageLayout.stageSize.x + stageLayout.spacing.x);
				float num10 = num - (float)(num3 + stageLayout.rowLengthsNeutral.Length) * (stageLayout.stageSize.y + stageLayout.spacing.y);
				if (stageLayout.useBothCategories)
				{
					num10 -= stageLayout.stageCategorySpacing;
				}
				RectTransform component2 = ((Component)stageContainer2.Button).GetComponent<RectTransform>();
				component2.anchoredPosition = new Vector2(num9, num10);
				((Transform)component2).localScale = Vector2.op_Implicit(Vector2.one * stageLayout.stageScaleFactor);
				base.btStages[num2] = (LLButton)(object)stageContainer2.Button;
				num2++;
				num4++;
				if (num4 >= stageLayout.rowLengthsCounterpick[num3])
				{
					num3++;
					num4 = 0;
				}
			}
		}

		private void UpdateStageBans()
		{
			List<StageBan> stageBans = StageStrikeTracker.Instance.CurrentStrikeInfo.StageBans;
			stageBans.ForEach(delegate(StageBan ban)
			{
				stageContainers.Find((StageContainer container) => container.StoredStage == ban.stage)?.Button.SetBan((SetTracker.Instance.CurrentSet.IsFreePickMode || StageStrikeTracker.Instance.CurrentStrikeInfo.IsFreePickForced) ? null : ban);
			});
		}

		private void UpdateSetInfo()
		{
			//IL_0140: 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)
			int num = 0;
			int[] array = new int[4];
			if (SetTracker.Instance.IsTrackingSet)
			{
				num = SetTracker.Instance.CurrentSet.GameNumber;
				array = SetTracker.Instance.CurrentSet.WinCounts;
			}
			TextHandler.SetText((TMP_Text)(object)lbSetCount, $"Game {num} ({array[0]}-{array[1]})");
			if (SetTracker.Instance.CurrentSet.IsFreePickMode || StageStrikeTracker.Instance.CurrentStrikeInfo.IsFreePickForced)
			{
				TextHandler.SetText((TMP_Text)(object)lbBansRemaining, "Free pick mode");
				((Graphic)lbBanStatus).color = Color.white;
				TextHandler.SetText((TMP_Text)(object)lbBanStatus, (StageStrikeTracker.Instance.CurrentStrikeInfo.CurrentInteractMode == StrikeInfo.InteractMode.PICK) ? "Picking..." : "Banning...");
			}
			else
			{
				TextHandler.SetText((TMP_Text)(object)lbBansRemaining, $"Bans remaining: P1 {StageStrikeTracker.Instance.CurrentStrikeInfo.TotalBansRemaining[0]}, P2 {StageStrikeTracker.Instance.CurrentStrikeInfo.TotalBansRemaining[1]}");
				int controllingPlayer = StageStrikeTracker.Instance.CurrentStrikeInfo.ControllingPlayer;
				((Graphic)lbBanStatus).color = COLOR_PLAYER[controllingPlayer];
				TextHandler.SetText((TMP_Text)(object)lbBanStatus, (StageStrikeTracker.Instance.CurrentStrikeInfo.CurrentInteractMode == StrikeInfo.InteractMode.BAN) ? $"P{controllingPlayer + 1} banning {StageStrikeTracker.Instance.CurrentStrikeInfo.CurrentBansRemaining}..." : $"P{controllingPlayer + 1} picking...");
			}
		}

		public void OnClickStage(int playerNumber, Stage stage)
		{
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0064: Unknown result type (might be due to invalid IL or missing references)
			//IL_004a: Unknown result type (might be due to invalid IL or missing references)
			//IL_004c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0051: Unknown result type (might be due to invalid IL or missing references)
			if (StageStrikeTracker.Instance.CurrentStrikeInfo.CheckPlayerInteraction(stage, playerNumber))
			{
				if (StageStrikeTracker.Instance.CurrentStrikeInfo.CurrentInteractMode == StrikeInfo.InteractMode.PICK)
				{
					UIScreen.blockGlobalInput = false;
					AudioHandler.PlaySfx((Sfx)4);
					selectedStage = StageStrikeTracker.Instance.CurrentStrikeInfo.PickStage(stage, playerNumber);
				}
				else
				{
					StageStrikeTracker.Instance.CurrentStrikeInfo.BanStage(stage, playerNumber);
					UpdateStageBans();
				}
				UpdateSetInfo();
			}
		}

		public void OnStageSelected()
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Invalid comparison between Unknown and I4
			//IL_01b5: Unknown result type (might be due to invalid IL or missing references)
			//IL_01cc: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d1: Unknown result type (might be due to invalid IL or missing references)
			//IL_012d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0144: Unknown result type (might be due to invalid IL or missing references)
			//IL_0149: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_0194: Unknown result type (might be due to invalid IL or missing references)
			if ((int)selectedStage == 0)
			{
				return;
			}
			TextHandler.SetTextCode(base.lbTitle, "PLAYER_STAGE_VOTED");
			stageContainers.ForEach(delegate(StageContainer container)
			{
				((LLClickable)container.Button).OnHoverOut(-1);
				((LLClickable)container.Button).SetActive(false);
				container.Button.UpdateDisplay();
			});
			((LLClickable)btRandomMain).SetActive(false);
			((LLClickable)btRandomBoth3D).SetActive(false);
			((LLClickable)btRandomBoth2D).SetActive(false);
			((LLClickable)btFreePick).SetActive(false);
			if (selectedRandom == Ruleset.RandomMode.OFF || selectedRandom == Ruleset.RandomMode.BOTH)
			{
				StageContainer stageContainer = stageContainers.Find((StageContainer container) => container.StoredStage == selectedStage);
				Plugin.LogGlobal.LogInfo((object)stageContainer);
				if (stageContainer == null)
				{
					return;
				}
				stageContainer.Button.Select(selected: true);
				stageContainer.Button.UpdateDisplay();
			}
			else
			{
				Ruleset.RandomMode randomMode = StageStrikeTracker.Instance.CurrentStrikeInfo.ActiveRuleset.randomMode;
				if (randomMode == Ruleset.RandomMode.BOTH)
				{
					if (selectedRandom == Ruleset.RandomMode.ANY_3D)
					{
						((Graphic)btRandomBoth3D.imgBorder).color = Color.white;
						((LLButton)btRandomBoth3D).colDisabled = ((LLButton)btRandomBoth3D).colHover;
						((LLButton)btRandomBoth3D).UpdateColor();
					}
					else if (selectedRandom == Ruleset.RandomMode.ANY_2D)
					{
						((Graphic)btRandomBoth2D.imgBorder).color = Color.white;
						((LLButton)btRandomBoth2D).colDisabled = ((LLButton)btRandomBoth2D).colHover;
						((LLButton)btRandomBoth2D).UpdateColor();
					}
				}
				else
				{
					((Graphic)btRandomMain.imgBorder).color = Color.white;
					((LLButton)btRandomMain).colDisabled = ((LLButton)btRandomMain).colHover;
					((LLButton)btRandomMain).UpdateColor();
				}
			}
			Plugin.LogGlobal.LogWarning((object)"OnStageSelected");
		}

		private void OnVoteFreePick()
		{
			StageStrikeTracker.Instance.CurrentStrikeInfo.ToggleFreePickMode();
			btRandomMain.enableVoting = !SetTracker.Instance.CurrentSet.IsFreePickMode && !StageStrikeTracker.Instance.CurrentStrikeInfo.IsFreePickForced;
			btRandomBoth3D.enableVoting = !SetTracker.Instance.CurrentSet.IsFreePickMode && !StageStrikeTracker.Instance.CurrentStrikeInfo.IsFreePickForced;
			btRandomBoth2D.enableVoting = !SetTracker.Instance.CurrentSet.IsFreePickMode && !StageStrikeTracker.Instance.CurrentStrikeInfo.IsFreePickForced;
			UpdateStageBans();
			UpdateSetInfo();
		}

		private void OnVoteRandom(Ruleset.RandomMode randomMode)
		{
			//IL_002a: Unknown result type (might be due to invalid IL or missing references)
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			if (randomMode != 0 && randomMode != Ruleset.RandomMode.BOTH)
			{
				UIScreen.blockGlobalInput = false;
				AudioHandler.PlaySfx((Sfx)4);
				selectedStage = StageStrikeTracker.Instance.CurrentStrikeInfo.PickRandomStage(randomMode);
				selectedRandom = randomMode;
			}
		}
	}
	internal class ScreenStageStrikeRanked : ScreenPlayersStageComp, ICustomScreen<ScreenPlayersStageComp>, IStageSelect
	{
		[Serializable]
		[CompilerGenerated]
		private sealed class <>c
		{
			public static readonly <>c <>9 = new <>c();

			public static ControlDelegate <>9__37_0;

			public static Action<StageContainer> <>9__47_0;

			internal void <OnOpen>b__37_0(int playerNumber)
			{
				GameStates.Send((Msg)2, playerNumber, -1);
			}

			internal void <OnStageSelected>b__47_0(StageContainer container)
			{
				((LLClickable)container.Button).OnHoverOut(-1);
				((LLClickable)container.Button).SetActive(false);
				container.Button.UpdateDisplay();
			}
		}

		private static readonly Vector2 BG_SCALE = new Vector2(1f, 2f);

		private static readonly Vector2 BG_POSITION = new Vector2(0f, -20f);

		private static readonly Vector2 TITLE_SCALE = new Vector2(1f, 0.6f);

		private static readonly Vector2 TITLE_POSITION = new Vector2(0f, 328f);

		private const int TITLE_FONT_SIZE = 36;

		private static readonly Vector2 SETCOUNT_POSITION = new Vector2(0f, 270f);

		private const int SETCOUNT_FONT_SIZE = 32;

		private static readonly Vector2 BANSREMAINING_POSITION = new Vector2(0f, -276f);

		private const int BANSREMAINING_FONT_SIZE = 18;

		private static readonly Vector2 BANSTATUS_POSITION = new Vector2(0f, -310f);

		private const int BANSTATUS_FONT_SIZE = 42;

		private static readonly Vector2 FREEPICK_POSITION = new Vector2(506f, -336f);

		private static readonly Vector2 FREEPICK_SCALE = new Vector2(234f, 27.5f);

		private const int FREEPICK_FONT_SIZE = 18;

		private static readonly Vector2 RANDOM_POSITION = new Vector2(-378f, -336f);

		private static readonly Vector2 RANDOM_SCALE = new Vector2(255.6f, 27.5f);

		private const int RANDOM_FONT_SIZE = 18;

		private static readonly Vector2 RANDOM_BOTH_OFFSET = new Vector2(60f, 0f);

		private static readonly Vector2 RANDOM_BOTH_SCALE = new Vector2(100f, 34f);

		private const int RANDOM_BOTH_FONT_SIZE = 16;

		private static readonly Vector2 USER_INFO_POSITION = new Vector2(-580f, -250f);

		private static readonly Vector2 OPPONENT_INFO_POSITION = new Vector2(580f, -250f);

		private static readonly Vector2 INFO_SCALE = Vector2.one * 0.65f;

		private static readonly Color[] COLOR_PLAYER = (Color[])(object)new Color[4]
		{
			new Color(1f, 0.2509804f, 0.08627451f),
			new Color(0.050980393f, 8f / 15f, 1f),
			new Color(1f, 1f, 0.23921569f),
			new Color(0.3529412f, 0.95686275f, 0.3529412f)
		};

		private List<StageContainer> stageContainersNeutral;

		private List<StageContainer> stageContainersCounterpick;

		private List<StageContainer> stageContainers;

		private TextMeshProUGUI lbSetCount;

		private TextMeshProUGUI lbBansRemaining;

		private TextMeshProUGUI lbBanStatus;

		private VoteButton btFreePick;

		private VoteButton btRandomMain;

		private VoteButton btRandomBoth3D;

		private VoteButton btRandomBoth2D;

		private Stage selectedStage = (Stage)0;

		private Ruleset.RandomMode selectedRandom = Ruleset.RandomMode.OFF;

		public void Init(ScreenPlayersStageComp screenPlayersStageComp)
		{
			//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_0027: Unknown result type (might be due to invalid IL or missing references)
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_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_00b7: 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_00c3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cf: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00db: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e7: 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: 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_00ff: 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)
			((ScreenBase)this).screenType = ((ScreenBase)screenPlayersStageComp).screenType;
			((ScreenBase)this).layer = ((ScreenBase)screenPlayersStageComp).layer;
			((ScreenBase)this).isActive = ((ScreenBase)screenPlayersStageComp).isActive;
			((ScreenBase)this).msgEsc = ((ScreenBase)screenPlayersStageComp).msgEsc;
			((ScreenBase)this).msgMenu = ((ScreenBase)screenPlayersStageComp).msgMenu;
			((ScreenBase)this).msgCancel = ((ScreenBase)screenPlayersStageComp).msgCancel;
			((ScreenPlayersStage)this).btBack = ((ScreenPlayersStage)screenPlayersStageComp).btBack;
			((ScreenPlayersStage)this).btLeft = ((ScreenPlayersStage)screenPlayersStageComp).btLeft;
			((ScreenPlayersStage)this).btRight = ((ScreenPlayersStage)screenPlayersStageComp).btRight;
			((ScreenPlayersStage)this).lbTitle = ((ScreenPlayersStage)screenPlayersStageComp).lbTitle;
			((ScreenPlayersStage)this).lbPlayersSelectingStage = ((ScreenPlayersStage)screenPlayersStageComp).lbPlayersSelectingStage;
			((ScreenPlayersStage)this).obSpectator = ((ScreenPlayersStage)screenPlayersStageComp).obSpectator;
			((ScreenPlayersStage)this).obNotSpectator = ((ScreenPlayersStage)screenPlayersStageComp).obNotSpectator;
			((ScreenPlayersStage)this).stageButtonsContainer = ((ScreenPlayersStage)screenPlayersStageComp).stageButtonsContainer;
			((ScreenPlayersStage)this).btStages = ((ScreenPlayersStage)screenPlayersStageComp).btStages;
			((ScreenPlayersStage)this).posMid = ((ScreenPlayersStage)screenPlayersStageComp).posMid;
			((ScreenPlayersStage)this).posLeft = ((ScreenPlayersStage)screenPlayersStageComp).posLeft;
			((ScreenPlayersStage)this).posLeft2 = ((ScreenPlayersStage)screenPlayersStageComp).posLeft2;
			((ScreenPlayersStage)this).posRight = ((ScreenPlayersStage)screenPlayersStageComp).posRight;
			((ScreenPlayersStage)this).posRight2 = ((ScreenPlayersStage)screenPlayersStageComp).posRight2;
			((ScreenPlayersStage)this).scaleSmall = ((ScreenPlayersStage)screenPlayersStageComp).scaleSmall;
			((ScreenPlayersStage)this).scaleBig = ((ScreenPlayersStage)screenPlayersStageComp).scaleBig;
			((ScreenPlayersStage)this).nButtons = ((ScreenPlayersStage)screenPlayersStageComp).nButtons;
			((ScreenPlayersStage)this).curIndex = ((ScreenPlayersStage)screenPlayersStageComp).curIndex;
			((ScreenPlayersStage)this).isMoving = ((ScreenPlayersStage)screenPlayersStageComp).isMoving;
			((ScreenPlayersStage)this).queuedMove = ((ScreenPlayersStage)screenPlayersStageComp).queuedMove;
			base.userInfo = screenPlayersStageComp.userInfo;
			base.opponentInfo = screenPlayersStageComp.opponentInfo;
			base.userNameLabel = screenPlayersStageComp.userNameLabel;
			base.userPlayerRender = screenPlayersStageComp.userPlayerRender;
			base.userCharacterIcon = screenPlayersStageComp.userCharacterIcon;
			base.opponentNameLabel = screenPlayersStageComp.opponentNameLabel;
			base.opponentPlayerRender = screenPlayersStageComp.opponentPlayerRender;
			base.opponentCharacterIcon = screenPlayersStageComp.opponentCharacterIcon;
		}

		public override void OnOpen(ScreenType screenTypePrev)
		{
			//IL_003f: 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_0067: Unknown result type (might be due to invalid IL or missing references)
			//IL_006c: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00da: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00eb: Unknown result type (might be due to invalid IL or missing references)
			//IL_014b: 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_0135: Expected O, but got Unknown
			//IL_01b0: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ee: Unknown result type (might be due to invalid IL or missing references)
			//IL_022c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0231: Unknown result type (might be due to invalid IL or missing references)
			//IL_02dc: 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_040f: 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_0419: Unknown result type (might be due to invalid IL or missing references)
			//IL_041e: Unknown result type (might be due to invalid IL or missing references)
			//IL_04dd: Unknown result type (might be due to invalid IL or missing references)
			//IL_04e2: Unknown result type (might be due to invalid IL or missing references)
			//IL_04e7: Unknown result type (might be due to invalid IL or missing references)
			//IL_04ec: Unknown result type (might be due to invalid IL or missing references)
			StageStrikeTracker.Instance.Start();
			Plugin.Instance.RecolorCursors = true;
			if (TextHandler.isInited)
			{
				((ScreenBase)this).UpdateText();
			}
			RankedOnOpen();
			((ScreenBase)this).msgMenu = (Msg)0;
			RectTransform component = ((Component)((Component)this).transform.Find("bar_top")).GetComponent<RectTransform>();
			component.anchoredPosition = TITLE_POSITION;
			((Transform)component).localScale = Vector2.op_Implicit(TITLE_SCALE);
			((Transform)((ScreenPlayersStage)this).lbTitle.rectTransform).localScale = Vector2.op_Implicit(new Vector2(1f / TITLE_SCALE.x, 1f / TITLE_SCALE.y));
			((ScreenPlayersStage)this).lbTitle.fontSize = 36f;
			RectTransform component2 = ((Component)((Component)this).transform.Find("bar_mid")).GetComponent<RectTransform>();
			component2.anchoredPosition = BG_POSITION;
			((Transform)component2).localScale = Vector2.op_Implicit(BG_SCALE);
			((LLControl)((ScreenPlayersStage)this).btLeft).visible = false;
			((LLControl)((ScreenPlayersStage)this).btRight).visible = false;
			LLButton btBack = ((ScreenPlayersStage)this).btBack;
			object obj = <>c.<>9__37_0;
			if (obj == null)
			{
				ControlDelegate val = delegate(int playerNumber)
				{
					GameStates.Send((Msg)2, playerNumber, -1);
				};
				<>c.<>9__37_0 = val;
				obj = (object)val;
			}
			((LLClickable)btBack).onClick = (ControlDelegate)obj;
			UIUtils.CreateText(ref lbSetCount, "lbSetCount", ((Component)this).transform, SETCOUNT_POSITION);
			((TMP_Text)lbSetCount).fontSize = 32f;
			TextHandler.SetText((TMP_Text)(object)lbSetCount, "");
			if (Plugin.Instance.ActiveTourneyMode == TourneyMode.NONE)
			{
				((Component)lbSetCount).gameObject.SetActive(false);
			}
			UIUtils.CreateText(ref lbBansRemaining, "lbBansRemaining", ((Component)this).transform, BANSREMAINING_POSITION);
			((TMP_Text)lbBansRemaining).fontSize = 18f;
			TextHandler.SetText((TMP_Text)(object)lbBansRemaining, "");
			UIUtils.CreateText(ref lbBanStatus, "lbBanStatus", ((Component)this).transform, BANSTATUS_POSITION);
			((TMP_Text)lbBanStatus).fontSize = 42f;
			TextHandler.SetText((TMP_Text)(object)lbBanStatus, "");
			UIUtils.CreateVoteButton(ref btFreePick, "btFreePick", ((Component)this).transform, FREEPICK_POSITION, FREEPICK_SCALE);
			VoteButton.ActiveVoteButtons.Add(btFreePick);
			btFreePick.label = "Toggle free pick";
			((TMP_Text)((LLButton)btFreePick).textMesh).fontSize = 18f;
			btFreePick.onVote = OnVoteFreePick;
			if (StageStrikeTracker.Instance.CurrentStrikeInfo.IsFreePickForced)
			{
				((Component)btFreePick).gameObject.SetActive(false);
			}
			Ruleset.RandomMode randomMode = StageStrikeTracker.Instance.CurrentStrikeInfo.ActiveRuleset.randomMode;
			UIUtils.CreateVoteButton(ref btRandomMain, "btRandomMain", ((Component)this).transform, RANDOM_POSITION, RANDOM_SCALE);
			VoteButton.ActiveVoteButtons.Add(btRandomMain);
			VoteButton voteButton = btRandomMain;
			if (1 == 0)
			{
			}
			string text = randomMode switch
			{
				Ruleset.RandomMode.ANY => "(any 3D/2D)", 
				Ruleset.RandomMode.ANY_3D => "(any 3D)", 
				Ruleset.RandomMode.ANY_2D => "(any 2D)", 
				Ruleset.RandomMode.ANY_LEGAL => "(any legal)", 
				_ => "", 
			};
			if (1 == 0)
			{
			}
			voteButton.label = "Random " + text;
			((TMP_Text)((LLButton)btRandomMain).textMesh).fontSize = 18f;
			btRandomMain.onVote = delegate
			{
				OnVoteRandom(randomMode);
			};
			btRandomMain.enableVoting = !SetTracker.Instance.CurrentSet.IsFreePickMode && !StageStrikeTracker.Instance.CurrentStrikeInfo.IsFreePickForced;
			if (randomMode == Ruleset.RandomMode.OFF || randomMode == Ruleset.RandomMode.BOTH)
			{
				((Component)btRandomMain).gameObject.SetActive(false);
			}
			UIUtils.CreateVoteButton(ref btRandomBoth3D, "btRandomBoth3D", ((Component)this).transform, RANDOM_POSITION - RANDOM_BOTH_OFFSET, RANDOM_BOTH_SCALE);
			VoteButton.ActiveVoteButtons.Add(btRandomBoth3D);
			btRandomBoth3D.label = "Random\n(3D)";
			((TMP_Text)((LLButton)btRandomBoth3D).textMesh).fontSize = 16f;
			btRandomBoth3D.onVote = delegate
			{
				OnVoteRandom(Ruleset.RandomMode.ANY_3D);
			};
			btRandomBoth3D.enableVoting = !SetTracker.Instance.CurrentSet.IsFreePickMode && !StageStrikeTracker.Instance.CurrentStrikeInfo.IsFreePickForced;
			if (randomMode != Ruleset.RandomMode.BOTH)
			{
				((Component)btRandomBoth3D).gameObject.SetActive(false);
			}
			UIUtils.CreateVoteButton(ref btRandomBoth2D, "btRandomBoth2D", ((Component)this).transform, RANDOM_POSITION + RANDOM_BOTH_OFFSET, RANDOM_BOTH_SCALE);
			VoteButton.ActiveVoteButtons.Add(btRandomBoth2D);
			btRandomBoth2D.label = "Random\n(2D)";
			((TMP_Text)((LLButton)btRandomBoth2D).textMesh).fontSize = 16f;
			btRandomBoth2D.onVote = delegate
			{
				OnVoteRandom(Ruleset.RandomMode.ANY_2D);
			};
			btRandomBoth2D.enableVoting = !SetTracker.Instance.CurrentSet.IsFreePickMode && !StageStrikeTracker.Instance.CurrentStrikeInfo.IsFreePickForced;
			if (randomMode != Ruleset.RandomMode.BOTH)
			{
				((Component)btRandomBoth2D).gameObject.SetActive(false);
			}
			CreateStageContainers();
			UpdateStageBans();
			UpdateSetInfo();
		}

		private void RankedOnOpen()
		{
			//IL_002a: Unknown result type (might be due to invalid IL or missing references)
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ba: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00eb: Unknown result type (might be due to invalid IL or missing references)
			//IL_010d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0110: Invalid comparison between Unknown and I4
			//IL_011c: Unknown result type (might be due to invalid IL or missing references)
			//IL_016b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0170: 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_0212: Unknown result type (might be due to invalid IL or missing references)
			//IL_0216: Unknown result type (might be due to invalid IL or missing references)
			//IL_022c: Unknown result type (might be due to invalid IL or missing references)
			//IL_024f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0252: Invalid comparison between Unknown and I4
			//IL_025e: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ad: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b2: 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_02e8: Unknown result type (might be due to invalid IL or missing references)
			//IL_02f9: Unknown result type (might be due to invalid IL or missing references)
			//IL_02fe: Unknown result type (might be due to invalid IL or missing references)
			//IL_030f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0314: Unknown result type (might be due to invalid IL or missing references)
			//IL_0325: Unknown result type (might be due to invalid IL or missing references)
			//IL_032a: Unknown result type (might be due to invalid IL or missing references)
			ScreenPlayers val = Object.FindObjectOfType<ScreenPlayers>();
			if ((Object)(object)val == (Object)null)
			{
				Plugin.LogGlobal.LogFatal((object)"Could not find lobby screen ScreenPlayers");
			}
			Character characterSelected = Player.GetPlayer(0).CharacterSelected;
			base.userNameLabel = ((Component)base.userInfo.Find("lbName")).GetComponent<TextMeshProUGUI>();
			((TMP_Text)base.userNameLabel).text = val.playerSelections[0].btPlayerName.GetText();
			base.userPlayerRender = ((Component)base.userInfo).GetComponentInChildren<RawImage>();
			base.userPlayerRender.texture = (Texture)(object)val.playerSelections[0].modelPreview.renderTex;
			((Graphic)base.userPlayerRender).rectTransform.sizeDelta = ((Graphic)val.playerSelections[0].modelPreview.image).rectTransform.sizeDelta;
			Vector3 localScale = default(Vector3);
			((Graphic)base.userPlayerRender).rectTransform.anchoredPosition = ((ScreenPlayersStageComp)this).GetCharacterRenderCustomPosition(characterSelected, ref localScale, (Side)1);
			((Transform)((Graphic)base.userPlayerRender).rectTransform).localScale = localScale;
			base.userCharacterIcon = ((Component)base.userInfo.Find("characterIcon")).GetComponent<Image>();
			if ((int)characterSelected != 102)
			{
				int num = JPLELOFJOOH.LPCPPJOIIEF(characterSelected);
				((Component)base.userCharacterIcon).gameObject.SetActive(true);
				base.userCharacterIcon.sprite = JPLELOFJOOH.BNFIDCAPPDK("_spriteCharacterSymbols", num);
			}
			else
			{
				((Component)base.userCharacterIcon).gameObject.SetActive(false);
			}
			Character characterSelected2 = Player.GetPlayer(1).CharacterSelected;
			base.opponentNameLabel = ((Component)base.opponentInfo.Find("lbName")).GetComponent<TextMeshProUGUI>();
			((TMP_Text)base.opponentNameLabel).text = val.playerSelections[1].btPlayerName.GetText();
			base.opponentPlayerRender = ((Component)base.opponentInfo).GetComponentInChildren<RawImage>();
			base.opponentPlayerRender.texture = (Texture)(object)val.playerSelections[1].modelPreview.renderTex;
			((Graphic)base.opponentPlayerRender).rectTransform.sizeDelta = ((Graphic)val.playerSelections[1].modelPreview.image).rectTransform.sizeDelta;
			Vector3 localScale2 = default(Vector3);
			((Graphic)base.opponentPlayerRender).rectTransform.anchoredPosition = ((ScreenPlayersStageComp)this).GetCharacterRenderCustomPosition(characterSelected2, ref localScale2, (Side)0);
			((Transform)((Graphic)base.opponentPlayerRender).rectTransform).localScale = localScale2;
			base.opponentCharacterIcon = ((Component)base.opponentInfo.Find("characterIcon")).GetComponent<Image>();
			if ((int)characterSelected2 != 102)
			{
				int num2 = JPLELOFJOOH.LPCPPJOIIEF(characterSelected2);
				((Component)base.opponentCharacterIcon).gameObject.SetActive(true);
				base.opponentCharacterIcon.sprite = JPLELOFJOOH.BNFIDCAPPDK("_spriteCharacterSymbols", num2);
			}
			else
			{
				((Component)base.opponentCharacterIcon).gameObject.SetActive(false);
			}
			((ScreenPlayersStage)this).stageButtonsContainer.localPosition = Vector2.op_Implicit(Vector2.zero);
			Transform val2 = ((Component)this).transform.Find("lbVersus");
			((Component)val2).gameObject.SetActive(false);
			base.userInfo.localPosition = Vector2.op_Implicit(USER_INFO_POSITION);
			base.userInfo.localScale = Vector2.op_Implicit(INFO_SCALE);
			base.opponentInfo.localPosition = Vector2.op_Implicit(OPPONENT_INFO_POSITION);
			base.opponentInfo.localScale = Vector2.op_Implicit(INFO_SCALE);
		}

		public override void OnClose(ScreenType screenTypeNext)
		{
			//IL_005c: Unknown result type (might be due to invalid IL or missing references)
			StageStrikeTracker.Instance.End();
			Plugin.Instance.RecolorCursors = false;
			VoteButton.ActiveVoteButtons.Remove(btFreePick);
			VoteButton.ActiveVoteButtons.Remove(btRandomMain);
			VoteButton.ActiveVoteButtons.Remove(btRandomBoth3D);
			VoteButton.ActiveVoteButtons.Remove(btRandomBoth2D);
			((ScreenPlayersStageComp)this).OnClose(screenTypeNext);
		}

		public override void DoUpdate()
		{
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a4: Unknown result type (might be due to invalid IL or missing references)
			//IL_01aa: Invalid comparison between Unknown and I4
			//IL_0038: 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_01c9: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ce: Unknown result type (might be due to invalid IL or missing references)
			//IL_0040: Unknown result type (might be due to invalid IL or missing references)
			//IL_0046: Invalid comparison between Unknown and I4
			//IL_0053: Unknown result type (might be due to invalid IL or missing references)
			//IL_0059: Invalid comparison between Unknown and I4
			//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_0152: 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_0145: 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: Invalid comparison between Unknown and I4
			//IL_0187: Unknown result type (might be due to invalid IL or missing references)
			//IL_008f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0095: Invalid comparison between Unknown and I4
			//IL_00be: 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)
			Controller all;
			if (!UIScreen.blockGlobalInput)
			{
				all = Controller.all;
				if (((Controller)(ref all)).GetButtonDown(InputAction.ESC))
				{
					((ScreenBase)this).SendGlobal(((ScreenBase)this).msgEsc, -1);
				}
				if ((int)((ScreenBase)this).msgMenu != 0 || (int)((ScreenBase)this).msgCancel > 0)
				{
					if ((int)UIInput.uiControl == 2)
					{
						for (int i = 0; i < 4; i++)
						{
							ALDOKEMAOMB val = ALDOKEMAOMB.BJDPHEHJJJK(i);
							if ((int)UIInput.uiControl != 2 || (val.OBELDJGOOIJ != null && (int)val.OBELDJGOOIJ.state > 0))
							{
								if (((Controller)(ref val.GDEMBCKIDMA)).GetButtonDown(InputAction.MENU))
								{
									((ScreenBase)this).SendGlobal(((ScreenBase)this).msgMenu, i);
								}
								if (((Controller)(ref val.GDEMBCKIDMA)).GetButtonDown(InputAction.BACK) || (((Controller)(ref val.GDEMBCKIDMA)).IncludesMouse() && Input.GetMouseButtonDown(1)))
								{
									((ScreenBase)this).SendGlobal(((ScreenBase)this).msgCancel, i);
								}
							}
						}
					}
					else
					{
						all = Controller.all;
						if (((Controller)(ref all)).GetButtonDown(InputAction.MENU))
						{
							((ScreenBase)this).SendGlobal(((ScreenBase)this).msgMenu, -1);
						}
						all = Controller.all;
						if (((Controller)(ref all)).GetButtonDown(InputAction.BACK) || (CGLLJHHAJAK.GIGAKBJGFDI.hasMouseKeyboard && Input.GetMouseButtonDown(1)))
						{
							((ScreenBase)this).SendGlobal(((ScreenBase)this).msgCancel, -1);
						}
					}
				}
			}
			if (UIScreen.blockGlobalInput)
			{
				return;
			}
			if ((int)UIInput.uiControl == 2)
			{
				Player.ForAll((Action<Player>)delegate(Player player)
				{
					//IL_000f: Unknown result type (might be due to invalid IL or missing references)
					//IL_0015: Invalid comparison between Unknown and I4
					//IL_0021: Unknown result type (might be due to invalid IL or missing references)
					//IL_0026: Unknown result type (might be due to invalid IL or missing references)
					if (player.cursor != null && (int)player.cursor.state != 0)
					{
						Controller controller = player.controller;
						if (((Controller)(ref controller)).GetButtonDown(InputAction.MENU))
						{
							LLClickable defaultFocus2 = ((ScreenBase)this).GetDefaultFocus(player.cursor);
							if ((Object)(object)defaultFocus2 != (Object)null && defaultFocus2.isActive)
							{
								defaultFocus2.OnClick(player.nr);
							}
						}
					}
				});
				return;
			}
			all = Controller.all;
			if (((Controller)(ref all)).GetButtonDown(InputAction.MENU))
			{
				LLClickable defaultFocus = ((ScreenBase)this).GetDefaultFocus(UIInput.mainCursor);
				if ((Object)(object)defaultFocus != (Object)null && defaultFocus.isActive)
				{
					defaultFocus.OnClick(-1);
				}
			}
		}

		public override LLClickable GetDefaultFocus(LLCursor cursor)
		{
			Ruleset.RandomMode randomMode = StageStrikeTracker.Instance.CurrentStrikeInfo.ActiveRuleset.randomMode;
			if (1 == 0)
			{
			}
			VoteButton result = randomMode switch
			{
				Ruleset.RandomMode.OFF => null, 
				Ruleset.RandomMode.BOTH => btRandomBoth3D, 
				_ => btRandomMain, 
			};
			if (1 == 0)
			{
			}
			return (LLClickable)(object)result;
		}

		public override void GetControls(ref List<LLClickable> list, bool vert, LLClickable curFocus, LLCursor cursor)
		{
			list.AddRange((IEnumerable<LLClickable>)(object)((ScreenPlayersStage)this).btStages);
			list.Add((LLClickable)(object)((ScreenPlayersStage)this).btBack);
			switch (StageStrikeTracker.Instance.CurrentStrikeInfo.ActiveRuleset.randomMode)
			{
			case Ruleset.RandomMode.BOTH:
				list.Add((LLClickable)(object)btRandomBoth3D);
				list.Add((LLClickable)(object)btRandomBoth2D);
				break;
			default:
				list.Add((LLClickable)(object)btRandomMain);
				break;
			case Ruleset.RandomMode.OFF:
				break;
			}
			if (!StageStrikeTracker.Instance.CurrentStrikeInfo.IsFreePickForced)
			{
				list.Add((LLClickable)(object)btFreePick);
			}
		}

		private void CreateStageContainers()
		{
			//IL_003a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0052: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ee: 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_00f7: Unknown result type (might be due to invalid IL or missing references)
			//IL_0118: Unknown result type (might be due to invalid IL or missing references)
			//IL_0132: Unknown result type (might be due to invalid IL or missing references)
			//IL_015d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0168: Unknown result type (might be due to invalid IL or missing references)
			//IL_017b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0186: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a9: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b6: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c1: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c6: Unknown result type (might be due to invalid IL or missing references)
			//IL_0259: Unknown result type (might be due to invalid IL or missing references)
			//IL_025e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0262: Unknown result ty