Decompiled source of TourneyMod v1.2.0

TourneyMod.dll

Decompiled 2 weeks 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 TMPro;
using TinyJson;
using TourneyMod.Patches;
using TourneyMod.Rulesets;
using TourneyMod.SetTracking;
using TourneyMod.StageStriking;
using TourneyMod.UI;
using TourneyMod.UI.Lobby;
using TourneyMod.UI.Menu;
using TourneyMod.UI.StageSelect;
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.2.0.0")]
[assembly: AssemblyInformationalVersion("1.2.0+ed30bc3b2f9d960c162ba459aa7cce0f1885b4f3")]
[assembly: AssemblyProduct("TourneyMod")]
[assembly: AssemblyTitle("TourneyMod")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.2.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
{
	internal static class Assets
	{
		private static string pathAssets;

		private static Dictionary<string, FileInfo> assetFiles;

		internal static void Init()
		{
			pathAssets = Path.Combine(Path.GetDirectoryName(((BaseUnityPlugin)Plugin.Instance).Info.Location), "assets").Replace(Path.DirectorySeparatorChar, Path.AltDirectorySeparatorChar);
			DirectoryInfo directoryInfo = new DirectoryInfo(pathAssets);
			assetFiles = directoryInfo.GetFiles("*", SearchOption.AllDirectories).ToDictionary(delegate(FileInfo file)
			{
				string text = file.FullName.Replace(Path.DirectorySeparatorChar, Path.AltDirectorySeparatorChar);
				string text2 = pathAssets;
				char altDirectorySeparatorChar = Path.AltDirectorySeparatorChar;
				return text.Replace(text2 + altDirectorySeparatorChar, "");
			});
		}

		private static FileInfo GetAssetFile(string asset)
		{
			assetFiles.TryGetValue(asset, out var value);
			return value;
		}

		private static void CopyStream(Stream input, Stream output)
		{
			byte[] array = new byte[8192];
			int count;
			while ((count = input.Read(array, 0, array.Length)) > 0)
			{
				output.Write(array, 0, count);
			}
		}

		internal static Texture2D LoadTexture(string asset)
		{
			return LoadTexture(GetAssetFile(asset));
		}

		private static Texture2D LoadTexture(FileInfo file)
		{
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_001e: Expected O, but got Unknown
			using FileStream input = file.OpenRead();
			using MemoryStream memoryStream = new MemoryStream();
			CopyStream(input, memoryStream);
			Texture2D val = new Texture2D(1, 1);
			ImageConversion.LoadImage(val, memoryStream.ToArray());
			return val;
		}
	}
	public static class Configs
	{
		internal static ConfigEntry<string> RulesetLocal1v1 { get; private set; }

		internal static ConfigEntry<string> RulesetLocalDoubles { get; private set; }

		internal static ConfigEntry<string> RulesetLocalCrew { get; private set; }

		internal static ConfigEntry<string> RulesetOnline1v1 { get; private set; }

		internal static void BindConfigs()
		{
			ConfigFile config = ((BaseUnityPlugin)Plugin.Instance).Config;
			RulesetLocal1v1 = config.Bind<string>("Selected Rulesets", "RulesetLocal1v1", "standard_online", "Selected ruleset for local 1v1 mode");
			RulesetLocalDoubles = config.Bind<string>("Selected Rulesets", "RulesetLocalDoubles", "standard_online", "Selected ruleset for local doubles mode");
			RulesetLocalCrew = config.Bind<string>("Selected Rulesets", "RulesetLocalCrew", "standard_online", "Selected ruleset for crew battle mode");
			RulesetOnline1v1 = config.Bind<string>("Selected Rulesets", "RulesetOnline1v1", "standard_online", "Selected ruleset for online 1v1 mode");
		}
	}
	[BepInPlugin("avgduck.plugins.llb.tourneymod", "TourneyMod", "1.2.0")]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[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")]
	public 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 DEPENDENCY_CHARACTERREROLL = "avgduck.plugins.llb.characterreroll";

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

		private const string defaultRulesetId = "all_stages";

		internal Dictionary<TourneyMode, string> SelectedRulesetIds;

		internal Dictionary<TourneyMode, Ruleset> SelectedRulesets;

		internal bool TourneyMenuOpen = false;

		internal bool RulesetsMenuOpen = false;

		internal bool SetPreviewMenuOpen = false;

		internal bool ScoreEditMenuOpen = 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;
			Assets.Init();
			SelectedRulesetIds = new Dictionary<TourneyMode, string>();
			SelectedRulesets = new Dictionary<TourneyMode, Ruleset>();
			SetTracker.Init();
			StageStrikeTracker.Init();
			UIUtils.Init();
			Cursors.LoadCursorImages();
			HarmonyPatches.PatchAll();
			RulesetIO.Init();
			VoteButton.ActiveVoteButtons = new List<VoteButton>();
			Configs.BindConfigs();
			((BaseUnityPlugin)this).Config.SettingChanged += delegate
			{
				OnConfigChanged();
			};
			OnConfigChanged();
			ModDependenciesUtils.RegisterToModMenu(((BaseUnityPlugin)this).Info, GetModMenuText());
		}

		private void OnConfigChanged()
		{
			SelectedRulesetIds[TourneyMode.NONE] = "all_stages";
			SelectedRulesetIds[TourneyMode.LOCAL_1V1] = Configs.RulesetLocal1v1.Value;
			SelectedRulesetIds[TourneyMode.LOCAL_DOUBLES] = Configs.RulesetLocalDoubles.Value;
			SelectedRulesetIds[TourneyMode.LOCAL_CREW] = Configs.RulesetLocalCrew.Value;
			SelectedRulesetIds[TourneyMode.ONLINE_1V1] = Configs.RulesetOnline1v1.Value;
			SelectedRulesetIds.ToList().ForEach(delegate(KeyValuePair<TourneyMode, string> entry)
			{
				TourneyMode key = entry.Key;
				string value = entry.Value;
				Ruleset rulesetById = RulesetIO.GetRulesetById(value);
				if (rulesetById == null)
				{
					rulesetById = RulesetIO.GetRulesetById("all_stages");
				}
				if (!SelectedRulesets.ContainsKey(key) || SelectedRulesets[key] != rulesetById)
				{
					LogGlobal.LogInfo((object)("Loaded ruleset for tourney mode " + GetModeName(key) + ": `" + rulesetById.Id + "`"));
				}
				SelectedRulesets[key] = rulesetById;
			});
		}

		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;
		}

		internal static string GetModeName(TourneyMode tourneyMode, bool capitalized = false)
		{
			if (1 == 0)
			{
			}
			string result = tourneyMode switch
			{
				TourneyMode.LOCAL_1V1 => capitalized ? "Local 1v1" : "local 1v1", 
				TourneyMode.LOCAL_DOUBLES => capitalized ? "Local Doubles" : "local doubles", 
				TourneyMode.LOCAL_CREW => capitalized ? "Crew Battle" : "crew battle", 
				TourneyMode.ONLINE_1V1 => capitalized ? "Online 1v1" : "online 1v1", 
				_ => capitalized ? "Vanilla" : "none", 
			};
			if (1 == 0)
			{
			}
			return result;
		}

		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.2.0";
	}
}
namespace TourneyMod.UI
{
	internal static class Cursors
	{
		private static readonly Color COLOR_CURSOR_ACTIVE = Color.white;

		private static readonly Color COLOR_CURSOR_INACTIVE = Color.white * 0.6f;

		private static PlayerCursor[] playerCursors;

		internal static void LoadCursorImages()
		{
			//IL_0040: Unknown result type (might be due to invalid IL or missing references)
			//IL_0047: Expected O, but got Unknown
			//IL_0052: Unknown result type (might be due to invalid IL or missing references)
			playerCursors = new PlayerCursor[4];
			for (int i = 0; i < 4; i++)
			{
				PlayerCursor playerCursor = new PlayerCursor();
				for (int j = 0; j < 5; j++)
				{
					Texture2D val = Assets.LoadTexture($"cursors/cursor{i}_{Team.op_Implicit(j)}.png");
					Texture2D destination = new Texture2D(1, 1);
					UIUtils.SetTextureCopy(ref destination, val);
					UIUtils.SetTextureColor(ref destination, COLOR_CURSOR_INACTIVE);
					playerCursor.textures[j, 0] = val;
					playerCursor.textures[j, 1] = destination;
					playerCursor.sprites[j, 0] = UIUtils.ToSprite(val);
					playerCursor.sprites[j, 1] = UIUtils.ToSprite(destination);
				}
				playerCursors[i] = playerCursor;
			}
		}

		internal static void UpdateCursorColors(Team controllingTeam)
		{
			if (!StageStrikeTracker.Instance.IsTrackingStrikeInfo || SetTracker.Instance.CurrentSet.IsFreePickMode || SetTracker.Instance.CurrentSet.IsFreePickForced)
			{
				ResetCursorColors();
				return;
			}
			Player.ForAll((Action<Player>)delegate(Player player)
			{
				//IL_0040: Unknown result type (might be due to invalid IL or missing references)
				//IL_0046: Invalid comparison between Unknown and I4
				//IL_00a4: Unknown result type (might be due to invalid IL or missing references)
				player.cursor.image.sprite = playerCursors[player.nr].GetSprite(player.Team, (EnumWrapper<BGHNEHPFHGC>)(object)player.Team == (EnumWrapper<BGHNEHPFHGC>)(object)controllingTeam);
				if ((int)player.cursor.state == 2)
				{
					Texture2D texture = playerCursors[player.nr].GetTexture(player.Team, active: true);
					Texture2D texture2 = playerCursors[player.nr].GetTexture(player.Team, active: false);
					Cursor.SetCursor(((EnumWrapper<BGHNEHPFHGC>)(object)player.Team == (EnumWrapper<BGHNEHPFHGC>)(object)controllingTeam) ? texture : texture2, new Vector2(0f, 0f), (CursorMode)1);
				}
			});
		}

		internal static void ResetCursorColors()
		{
			Player.ForAll((Action<Player>)delegate(Player player)
			{
				//IL_0030: Unknown result type (might be due to invalid IL or missing references)
				//IL_0036: Invalid comparison between Unknown and I4
				//IL_0065: Unknown result type (might be due to invalid IL or missing references)
				player.cursor.image.sprite = playerCursors[player.nr].GetSprite(player.Team, active: true);
				if ((int)player.cursor.state == 2)
				{
					Texture2D texture = playerCursors[player.nr].GetTexture(player.Team, active: true);
					Cursor.SetCursor(texture, new Vector2(0f, 0f), (CursorMode)1);
				}
			});
		}
	}
	internal interface ICustomScreen<T>
	{
		void Init(T screenVanilla);
	}
	internal class PlayerCursor
	{
		internal Texture2D[,] textures = new Texture2D[5, 2];

		internal Sprite[,] sprites = new Sprite[5, 2];

		internal Texture2D GetTexture(Team team, bool active)
		{
			return textures[(int)(EnumWrapper<BGHNEHPFHGC>)(object)team, (!active) ? 1 : 0];
		}

		internal Sprite GetSprite(Team team, bool active)
		{
			return sprites[(int)(EnumWrapper<BGHNEHPFHGC>)(object)team, (!active) ? 1 : 0];
		}
	}
	internal static class UIUtils
	{
		private static Sprite panelBG;

		private static Sprite buttonBG;

		internal static Sprite spriteStageSelected;

		internal static Sprite spriteLock;

		internal static readonly Color[] COLOR_TEAM = (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)
		};

		internal static void Init()
		{
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_0051: Unknown result type (might be due to invalid IL or missing references)
			//IL_0060: Unknown result type (might be due to invalid IL or missing references)
			//IL_006f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0098: 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)
			panelBG = Sprite.Create(Texture2D.whiteTexture, new Rect(0f, 0f, 1f, 1f), new Vector2(0.5f, 0.5f));
			buttonBG = Sprite.Create(Texture2D.whiteTexture, new Rect(0f, 0f, 1f, 1f), new Vector2(0.5f, 0.5f));
			spriteStageSelected = Sprite.Create(CreateBorderTexture(Color.yellow, 8, 500, 250), new Rect(0f, 0f, 500f, 250f), new Vector2(0.5f, 0.5f));
			spriteLock = ToSprite(Assets.LoadTexture("lock.png"));
		}

		internal static Texture2D CreateBorderTexture(Color color, int thickness, int width, int height)
		{
			//IL_0003: Unknown result type (might be due to invalid IL or missing references)
			//IL_0009: Expected O, but got Unknown
			//IL_0044: 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)
			Texture2D val = new Texture2D(width, height);
			for (int i = 0; i < width; i++)
			{
				for (int j = 0; j < height; j++)
				{
					if (i <= thickness || i >= width - thickness - 1 || j <= thickness || j >= height - thickness - 1)
					{
						val.SetPixel(i, j, color);
					}
					else
					{
						val.SetPixel(i, j, Color.clear);
					}
				}
			}
			val.Apply();
			return val;
		}

		internal static void CreateImage(ref Image image, Sprite sprite, string name, Transform parent, Vector2 position, Vector2 scale)
		{
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_0045: Unknown result type (might be due to invalid IL or missing references)
			//IL_0058: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0081: Unknown result type (might be due to invalid IL or missing references)
			image = LLControl.CreateImage(parent, sprite);
			((Object)((Graphic)image).rectTransform).name = name;
			((Graphic)image).rectTransform.anchorMin = new Vector2(0f, 0f);
			((Graphic)image).rectTransform.anchorMax = new Vector2(1f, 1f);
			((Graphic)image).rectTransform.SetSizeWithCurrentAnchors((Axis)0, scale.x);
			((Graphic)image).rectTransform.SetSizeWithCurrentAnchors((Axis)1, scale.y);
			((Graphic)image).rectTransform.anchoredPosition = position;
		}

		internal static void CreatePanel(ref RectTransform panel, string name, Transform parent, Vector2 position, Vector2 scale)
		{
			//IL_0004: Unknown result type (might be due to invalid IL or missing references)
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			CreatePanel(ref panel, name, parent, position, scale, Color.black);
		}

		internal static void CreatePanel(ref RectTransform panel, string name, Transform parent, Vector2 position, Vector2 scale, Color bgColor)
		{
			//IL_000e: 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_004a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0058: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_0077: Unknown result type (might be due to invalid IL or missing references)
			Image val = LLControl.CreateImage(parent, buttonBG);
			((Graphic)val).color = bgColor;
			panel = ((Graphic)val).rectTransform;
			((Object)panel).name = name;
			panel.anchorMin = new Vector2(0f, 0f);
			panel.anchorMax = new Vector2(1f, 1f);
			panel.SetSizeWithCurrentAnchors((Axis)0, scale.x);
			panel.SetSizeWithCurrentAnchors((Axis)1, scale.y);
			panel.anchoredPosition = position;
		}

		internal static void CreateBorderPanel(ref RectTransform panel, string name, Transform parent, Vector2 position, Vector2 scale, Color bgColor, Color borderColor, int borderThickness)
		{
			//IL_0004: Unknown result type (might be due to invalid IL or missing references)
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: 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_0053: Unknown result type (might be due to invalid IL or missing references)
			CreatePanel(ref panel, name, parent, position, scale, bgColor);
			Texture2D val = CreateBorderTexture(borderColor, borderThickness, (int)scale.x, (int)scale.y);
			Image val2 = LLControl.CreateImage((Transform)(object)panel, Sprite.Create(val, new Rect(0f, 0f, (float)((Texture)val).width, (float)((Texture)val).height), new Vector2(0.5f, 0.5f)));
		}

		internal static void CreateImageBorderPanel(ref Image panel, string name, Transform parent, Vector2 position, Vector2 scale, Color bgColor, Color borderColor, int borderThickness)
		{
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			//IL_0037: Unknown result type (might be due to invalid IL or missing references)
			//IL_0053: Unknown result type (might be due to invalid IL or missing references)
			//IL_0066: Unknown result type (might be due to invalid IL or missing references)
			//IL_007b: 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_0096: Unknown result type (might be due to invalid IL or missing references)
			//IL_009a: 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_00d0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00df: Unknown result type (might be due to invalid IL or missing references)
			panel = LLControl.CreateImage(parent, buttonBG);
			((Graphic)panel).color = bgColor;
			((Object)((Graphic)panel).rectTransform).name = name;
			((Graphic)panel).rectTransform.anchorMin = new Vector2(0f, 0f);
			((Graphic)panel).rectTransform.anchorMax = new Vector2(1f, 1f);
			((Graphic)panel).rectTransform.SetSizeWithCurrentAnchors((Axis)0, scale.x);
			((Graphic)panel).rectTransform.SetSizeWithCurrentAnchors((Axis)1, scale.y);
			((Graphic)panel).rectTransform.anchoredPosition = position;
			Texture2D val = CreateBorderTexture(borderColor, borderThickness, (int)scale.x, (int)scale.y);
			Image val2 = LLControl.CreateImage((Transform)(object)((Graphic)panel).rectTransform, Sprite.Create(val, new Rect(0f, 0f, (float)((Texture)val).width, (float)((Texture)val).height), new Vector2(0.5f, 0.5f)));
		}

		internal static void CreateText(ref TextMeshProUGUI text, string name, Transform parent)
		{
			//IL_0004: Unknown result type (might be due to invalid IL or missing references)
			CreateText(ref text, name, parent, Vector2.zero);
		}

		internal static void CreateText(ref TextMeshProUGUI text, string name, Transform parent, Vector2 position)
		{
			//IL_0004: Unknown result type (might be due to invalid IL or missing references)
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			CreateText(ref text, name, parent, position, Vector2.zero);
		}

		internal static void CreateText(ref TextMeshProUGUI text, string name, Transform parent, Vector2 position, Vector2 scale)
		{
			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
			//IL_002a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0037: Unknown result type (might be due to invalid IL or missing references)
			//IL_0046: 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_0080: Unknown result type (might be due to invalid IL or missing references)
			RectTransform val = LLControl.CreatePanel(parent, name);
			val.anchorMin = new Vector2(0f, 0f);
			val.anchorMax = new Vector2(1f, 1f);
			val.SetSizeWithCurrentAnchors((Axis)0, scale.x);
			val.SetSizeWithCurrentAnchors((Axis)1, scale.y);
			val.anchoredPosition = position;
			text = ((Component)val).gameObject.AddComponent<TextMeshProUGUI>();
			((Graphic)text).raycastTarget = false;
			((TMP_Text)text).SetText("");
			((Graphic)text).color = Color.white;
			((TMP_Text)text).fontSize = 32f;
			((TMP_Text)text).alignment = (TextAlignmentOptions)514;
			((TMP_Text)text).enableWordWrapping = false;
			((TMP_Text)text).overflowMode = (TextOverflowModes)0;
		}

		internal static void CreateButton(ref LLButton button, string name, Transform parent, Vector2 position, Vector2 scale)
		{
			//IL_0004: Unknown result type (might be due to invalid IL or missing references)
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			CreateButton(ref button, name, parent, position, scale, Color.black);
		}

		internal static void CreateButton(ref LLButton button, string name, Transform parent, Vector2 position, Vector2 scale, Color bgColor)
		{
			//IL_0022: 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_005d: Unknown result type (might be due to invalid IL or missing references)
			//IL_006a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0079: Unknown result type (might be due to invalid IL or missing references)
			//IL_0087: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e8: Unknown result type (might be due to invalid IL or missing references)
			//IL_0103: Unknown result type (might be due to invalid IL or missing references)
			//IL_0115: Unknown result type (might be due to invalid IL or missing references)
			//IL_0129: Unknown result type (might be due to invalid IL or missing references)
			//IL_0137: Unknown result type (might be due to invalid IL or missing references)
			//IL_0176: Unknown result type (might be due to invalid IL or missing references)
			//IL_0197: 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)
			Image val = LLControl.CreateImage(parent, buttonBG);
			((Graphic)val).color = new Color(1f, 1f, 0f, 0f);
			RectTransform rectTransform = ((Graphic)val).rectTransform;
			((Object)rectTransform).name = name;
			rectTransform.anchorMin = new Vector2(0f, 0f);
			rectTransform.anchorMax = new Vector2(1f, 1f);
			rectTransform.SetSizeWithCurrentAnchors((Axis)0, scale.x);
			rectTransform.SetSizeWithCurrentAnchors((Axis)1, scale.y);
			rectTransform.anchoredPosition = position;
			button = ((Component)rectTransform).gameObject.AddComponent<LLButton>();
			button.keepIconColor = true;
			button.colHover = new Color(0.902f, 0.9529f, 0.051f);
			button.soundClick = true;
			Image val2 = LLControl.CreateImage(((Component)button).transform, buttonBG);
			((Graphic)val2).rectTransform.anchorMin = new Vector2(0.5f, 0.5f);
			((Graphic)val2).rectTransform.anchorMax = new Vector2(0.5f, 0.5f);
			((Graphic)val2).rectTransform.SetSizeWithCurrentAnchors((Axis)0, scale.x);
			((Graphic)val2).rectTransform.SetSizeWithCurrentAnchors((Axis)1, scale.y);
			((Graphic)val2).color = bgColor;
			((Graphic)val2).raycastTarget = false;
			CreateText(ref button.textMesh, "Text", ((Component)button).transform);
			((TMP_Text)button.textMesh).rectTransform.anchorMin = new Vector2(0f, 0f);
			((TMP_Text)button.textMesh).rectTransform.anchorMax = new Vector2(1f, 1f);
			((Graphic)button.textMesh).raycastTarget = false;
			button.SetText("", -1, false);
			((Graphic)button.textMesh).color = Color.white;
			((TMP_Text)button.textMesh).alignment = (TextAlignmentOptions)514;
			((LLControl)button).Init();
		}

		internal static void CreateVoteButton(ref VoteButton button, string name, Transform parent, Vector2 position, Vector2 scale)
		{
			//IL_0022: 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_005d: Unknown result type (might be due to invalid IL or missing references)
			//IL_006a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0079: Unknown result type (might be due to invalid IL or missing references)
			//IL_0087: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b9: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_0103: Unknown result type (might be due to invalid IL or missing references)
			//IL_011e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0130: 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_0152: Unknown result type (might be due to invalid IL or missing references)
			//IL_016e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0174: Unknown result type (might be due to invalid IL or missing references)
			//IL_017c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0193: Unknown result type (might be due to invalid IL or missing references)
			//IL_019c: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b4: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d6: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f2: Unknown result type (might be due to invalid IL or missing references)
			//IL_0205: Unknown result type (might be due to invalid IL or missing references)
			//IL_021a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0229: Unknown result type (might be due to invalid IL or missing references)
			//IL_0275: Unknown result type (might be due to invalid IL or missing references)
			//IL_0296: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c5: Unknown result type (might be due to invalid IL or missing references)
			Image val = LLControl.CreateImage(parent, buttonBG);
			((Graphic)val).color = new Color(1f, 1f, 0f, 0f);
			RectTransform rectTransform = ((Graphic)val).rectTransform;
			((Object)rectTransform).name = name;
			rectTransform.anchorMin = new Vector2(0f, 0f);
			rectTransform.anchorMax = new Vector2(1f, 1f);
			rectTransform.SetSizeWithCurrentAnchors((Axis)0, scale.x);
			rectTransform.SetSizeWithCurrentAnchors((Axis)1, scale.y);
			rectTransform.anchoredPosition = position;
			button = ((Component)rectTransform).gameObject.AddComponent<VoteButton>();
			((LLButton)button).keepIconColor = true;
			((LLButton)button).colHover = new Color(0.902f, 0.9529f, 0.051f);
			((LLButton)button).colDisabled = new Color(0.5f, 0.5f, 0.5f);
			((LLButton)button).soundClick = true;
			Image val2 = LLControl.CreateImage(((Component)button).transform, buttonBG);
			((Graphic)val2).rectTransform.anchorMin = new Vector2(0.5f, 0.5f);
			((Graphic)val2).rectTransform.anchorMax = new Vector2(0.5f, 0.5f);
			((Graphic)val2).rectTransform.SetSizeWithCurrentAnchors((Axis)0, scale.x);
			((Graphic)val2).rectTransform.SetSizeWithCurrentAnchors((Axis)1, scale.y);
			((Graphic)val2).color = Color.black;
			((Graphic)val2).raycastTarget = false;
			int thickness = 2;
			Image val3 = LLControl.CreateImage(((Component)button).transform, Sprite.Create(CreateBorderTexture(Color.white, thickness, (int)scale.x, (int)scale.y), new Rect(0f, 0f, (float)(int)scale.x, (float)(int)scale.y), new Vector2(0.5f, 0.5f)));
			((Graphic)val3).rectTransform.anchorMin = new Vector2(0.5f, 0.5f);
			((Graphic)val3).rectTransform.anchorMax = new Vector2(0.5f, 0.5f);
			((Graphic)val3).rectTransform.SetSizeWithCurrentAnchors((Axis)0, scale.x);
			((Graphic)val3).rectTransform.SetSizeWithCurrentAnchors((Axis)1, scale.y);
			((Graphic)val3).color = Color.clear;
			((Graphic)val3).raycastTarget = false;
			button.imgBorder = val3;
			CreateText(ref ((LLButton)button).textMesh, "Text", ((Component)button).transform);
			((TMP_Text)((LLButton)button).textMesh).rectTransform.anchorMin = new Vector2(0f, 0f);
			((TMP_Text)((LLButton)button).textMesh).rectTransform.anchorMax = new Vector2(1f, 1f);
			((Graphic)((LLButton)button).textMesh).raycastTarget = false;
			((LLButton)button).SetText("", -1, false);
			((Graphic)((LLButton)button).textMesh).color = Color.white;
			((TMP_Text)((LLButton)button).textMesh).alignment = (TextAlignmentOptions)514;
			((LLControl)button).Init();
		}

		internal static void SetButtonBGVisibility(LLButton button, bool visible)
		{
			Transform val = ((Component)button).transform.Find("Image");
			if (!((Object)(object)val == (Object)null))
			{
				((Component)val).gameObject.SetActive(visible);
			}
		}

		internal static void SetTextureCopy(ref Texture2D destination, Texture2D source)
		{
			//IL_0039: 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_0045: Expected O, but got Unknown
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			RenderTexture temporary = RenderTexture.GetTemporary(((Texture)source).width, ((Texture)source).height, 0, (RenderTextureFormat)7, (RenderTextureReadWrite)1);
			Graphics.Blit((Texture)(object)source, temporary);
			RenderTexture active = RenderTexture.active;
			RenderTexture.active = temporary;
			destination = new Texture2D(((Texture)source).width, ((Texture)source).height, source.format, false);
			destination.ReadPixels(new Rect(0f, 0f, (float)((Texture)temporary).width, (float)((Texture)temporary).height), 0, 0);
			destination.Apply();
			RenderTexture.active = active;
			RenderTexture.ReleaseTemporary(temporary);
		}

		internal static void SetTextureColor(ref Texture2D texture, Color color)
		{
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			//IL_002b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0032: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_0045: 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)
			Color[] pixels = texture.GetPixels();
			for (int i = 0; i < pixels.Length; i++)
			{
				Color val = pixels[i];
				pixels[i] = new Color(val.r * color.r, val.g * color.g, val.b * color.b, val.a * color.a);
			}
			texture.SetPixels(pixels);
			texture.Apply();
		}

		internal static Sprite ToSprite(Texture2D tex)
		{
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			return Sprite.Create(tex, new Rect(0f, 0f, (float)((Texture)tex).width, (float)((Texture)tex).height), new Vector2(0.5f, 0.5f));
		}
	}
	internal class VoteButton : LLButton
	{
		private bool[] votes;

		internal Action onVote;

		internal bool enableVoting;

		internal string label;

		internal Image imgBorder;

		internal static List<VoteButton> ActiveVoteButtons;

		internal VoteButton()
		{
			//IL_002e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0038: Expected O, but got Unknown
			votes = new bool[4];
			enableVoting = true;
			label = "";
			((LLClickable)this).onClick = (ControlDelegate)delegate(int playerNr)
			{
				SetPlayerVote(playerNr, vote: true);
			};
		}

		private void SetPlayerVote(int playerNr, bool vote)
		{
			if (playerNr == -1)
			{
				SetAllVotes(vote);
			}
			else
			{
				votes[playerNr] = vote;
			}
		}

		private void SetAllVotes(bool vote)
		{
			for (int i = 0; i < 4; i++)
			{
				votes[i] = vote;
			}
		}

		private void LateUpdate()
		{
			((LLButton)this).SetText(label + (enableVoting ? $" {votes.Count((bool vote) => vote)}/{SetTracker.Instance.NumPlayersInMatch}" : ""), -1, false);
			UpdateVoteStatus();
		}

		private void UpdateVoteStatus()
		{
			int numPlayersInMatch = SetTracker.Instance.NumPlayersInMatch;
			if (numPlayersInMatch >= 1)
			{
				int num = ((!enableVoting) ? 1 : numPlayersInMatch);
				if (votes.Count((bool vote) => vote) >= num)
				{
					OnVote();
				}
			}
		}

		private void OnVote()
		{
			SetAllVotes(vote: false);
			onVote();
		}

		internal static void RemovePlayer(int playerNr)
		{
			ActiveVoteButtons.ForEach(delegate(VoteButton button)
			{
				button.SetPlayerVote(playerNr, vote: false);
			});
		}
	}
}
namespace TourneyMod.UI.StageSelect
{
	internal interface IStageSelect
	{
		void OnClickStage(int playerNumber, Stage stage);

		void OnStageSelected();
	}
	internal class ScreenStageStrike : ScreenPlayersStage, ICustomScreen<ScreenPlayersStage>, IStageSelect
	{
		[Serializable]
		[CompilerGenerated]
		private sealed class <>c
		{
			public static readonly <>c <>9 = new <>c();

			public static ControlDelegate <>9__36_0;

			public static Action<StageContainer> <>9__45_0;

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

			internal void <OnStageSelected>b__45_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 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.RandomStageMode _selectedRandomStage = Ruleset.RandomStageMode.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_021b: 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_0297: Unknown result type (might be due to invalid IL or missing references)
			//IL_029c: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_0347: 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_047a: Unknown result type (might be due to invalid IL or missing references)
			//IL_047f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0484: Unknown result type (might be due to invalid IL or missing references)
			//IL_0489: Unknown result type (might be due to invalid IL or missing references)
			//IL_0548: Unknown result type (might be due to invalid IL or missing references)
			//IL_054d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0552: Unknown result type (might be due to invalid IL or missing references)
			//IL_0557: Unknown result type (might be due to invalid IL or missing references)
			//IL_061b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0667: Unknown result type (might be due to invalid IL or missing references)
			//IL_066d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0672: 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__36_0;
			if (obj == null)
			{
				ControlDelegate val = delegate(int playerNumber)
				{
					GameStates.Send((Msg)2, playerNumber, -1);
				};
				<>c.<>9__36_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;
			((TMP_Text)lbSetCount).richText = true;
			TextHandler.SetText((TMP_Text)(object)lbSetCount, "");
			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 (SetTracker.Instance.CurrentSet.IsFreePickForced)
			{
				((Component)btFreePick).gameObject.SetActive(false);
			}
			Ruleset.RandomStageMode randomStageMode = SetTracker.Instance.CurrentSet.ActiveRuleset.randomStageMode;
			UIUtils.CreateVoteButton(ref btRandomMain, "btRandomMain", ((Component)this).transform, RANDOM_POSITION, RANDOM_SCALE);
			VoteButton.ActiveVoteButtons.Add(btRandomMain);
			VoteButton voteButton = btRandomMain;
			if (1 == 0)
			{
			}
			string text = randomStageMode switch
			{
				Ruleset.RandomStageMode.ANY => "(any 3D/2D)", 
				Ruleset.RandomStageMode.ANY_3D => "(any 3D)", 
				Ruleset.RandomStageMode.ANY_2D => "(any 2D)", 
				Ruleset.RandomStageMode.ANY_LEGAL => "(any legal)", 
				_ => "", 
			};
			if (1 == 0)
			{
			}
			voteButton.label = "Random " + text;
			((TMP_Text)((LLButton)btRandomMain).textMesh).fontSize = 18f;
			btRandomMain.onVote = delegate
			{
				OnVoteRandom(randomStageMode);
			};
			btRandomMain.enableVoting = !SetTracker.Instance.CurrentSet.IsFreePickMode && !SetTracker.Instance.CurrentSet.IsFreePickForced;
			if (randomStageMode == Ruleset.RandomStageMode.OFF || randomStageMode == Ruleset.RandomStageMode.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.RandomStageMode.ANY_3D);
			};
			btRandomBoth3D.enableVoting = !SetTracker.Instance.CurrentSet.IsFreePickMode && !SetTracker.Instance.CurrentSet.IsFreePickForced;
			if (randomStageMode != Ruleset.RandomStageMode.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.RandomStageMode.ANY_2D);
			};
			btRandomBoth2D.enableVoting = !SetTracker.Instance.CurrentSet.IsFreePickMode && !SetTracker.Instance.CurrentSet.IsFreePickForced;
			if (randomStageMode != Ruleset.RandomStageMode.BOTH)
			{
				((Component)btRandomBoth2D).gameObject.SetActive(false);
			}
			if (SetTracker.Instance.ActiveTourneyMode != 0 && (int)SetTracker.Instance.CurrentSet.StageLock != 0 && (EnumWrapper<BGHNEHPFHGC>)(object)SetTracker.Instance.CurrentSet.LastWinnerOverride == (EnumWrapper<BGHNEHPFHGC>)(object)Team.NONE)
			{
				UIScreen.blockGlobalInput = false;
				AudioHandler.PlaySfx((Sfx)4);
				selectedStage = StageStrikeTracker.Instance.CurrentStrikeInfo.PickStage(SetTracker.Instance.CurrentSet.StageLock, -1);
			}
			else
			{
				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.RandomStageMode randomStageMode = SetTracker.Instance.CurrentSet.ActiveRuleset.randomStageMode;
			if (1 == 0)
			{
			}
			VoteButton result = randomStageMode switch
			{
				Ruleset.RandomStageMode.OFF => null, 
				Ruleset.RandomStageMode.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 (SetTracker.Instance.CurrentSet.ActiveRuleset.randomStageMode)
			{
			case Ruleset.RandomStageMode.BOTH:
				list.Add((LLClickable)(object)btRandomBoth3D);
				list.Add((LLClickable)(object)btRandomBoth2D);
				break;
			default:
				list.Add((LLClickable)(object)btRandomMain);
				break;
			case Ruleset.RandomStageMode.OFF:
				break;
			}
			if (!SetTracker.Instance.CurrentSet.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(SetTracker.Instance.CurrentSet.ActiveRuleset.stagesNeutral.Count, SetTracker.Instance.CurrentSet.ActiveRuleset.stagesCounterpick.Count);
			float num = stageLayout.position.y + stageLayout.totalHeight / 2f - stageLayout.stageSize.y / 2f;
			base.nButtons = SetTracker.Instance.CurrentSet.ActiveRuleset.stagesNeutral.Count + SetTracker.Instance.CurrentSet.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 SetTracker.Instance.CurrentSet.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 SetTracker.Instance.CurrentSet.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 || SetTracker.Instance.CurrentSet.IsFreePickForced) ? null : ban);
			});
		}

		private void UpdateSetInfo()
		{
			//IL_0079: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ba: 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)
			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, (SetTracker.Instance.ActiveTourneyMode == TourneyMode.NONE) ? "" : $"Game {SetTracker.Instance.CurrentSet.GameNumber} (<color=#{ColorUtility.ToHtmlStringRGB(UIUtils.COLOR_TEAM[0])}>{SetTracker.Instance.CurrentSet.WinCounts[0]}</color>-<color=#{ColorUtility.ToHtmlStringRGB(UIUtils.COLOR_TEAM[1])}>{SetTracker.Instance.CurrentSet.WinCounts[1]}</color>)");
			if (SetTracker.Instance.CurrentSet.IsFreePickMode || SetTracker.Instance.CurrentSet.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: RED {StageStrikeTracker.Instance.CurrentStrikeInfo.TotalBansRemaining[0]}, BLUE {StageStrikeTracker.Instance.CurrentStrikeInfo.TotalBansRemaining[1]}");
				Team controllingTeam = StageStrikeTracker.Instance.CurrentStrikeInfo.ControllingTeam;
				((Graphic)lbBanStatus).color = UIUtils.COLOR_TEAM[(int)(EnumWrapper<BGHNEHPFHGC>)(object)controllingTeam];
				TextHandler.SetText((TMP_Text)(object)lbBanStatus, (StageStrikeTracker.Instance.CurrentStrikeInfo.CurrentInteractMode == StrikeInfo.InteractMode.BAN) ? $"{controllingTeam} banning {StageStrikeTracker.Instance.CurrentStrikeInfo.CurrentBansRemaining}..." : $"{controllingTeam} 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 (_selectedRandomStage == Ruleset.RandomStageMode.OFF || _selectedRandomStage == Ruleset.RandomStageMode.BOTH)
			{
				StageContainer stageContainer = stageContainers.Find((StageContainer container) => container.StoredStage == selectedStage);
				Plugin.LogGlobal.LogInfo((object)stageContainer);
				if (stageContainer != null)
				{
					stageContainer.Button.Select(selected: true);
					stageContainer.Button.UpdateDisplay();
				}
				return;
			}
			Ruleset.RandomStageMode randomStageMode = SetTracker.Instance.CurrentSet.ActiveRuleset.randomStageMode;
			if (randomStageMode == Ruleset.RandomStageMode.BOTH)
			{
				if (_selectedRandomStage == Ruleset.RandomStageMode.ANY_3D)
				{
					((Graphic)btRandomBoth3D.imgBorder).color = Color.white;
					((LLButton)btRandomBoth3D).colDisabled = ((LLButton)btRandomBoth3D).colHover;
					((LLButton)btRandomBoth3D).UpdateColor();
				}
				else if (_selectedRandomStage == Ruleset.RandomStageMode.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();
			}
		}

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

		private void OnVoteRandom(Ruleset.RandomStageMode randomStageMode)
		{
			//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 (randomStageMode != 0 && randomStageMode != Ruleset.RandomStageMode.BOTH)
			{
				UIScreen.blockGlobalInput = false;
				AudioHandler.PlaySfx((Sfx)4);
				selectedStage = StageStrikeTracker.Instance.CurrentStrikeInfo.PickRandomStage(randomStageMode);
				_selectedRandomStage = randomStageMode;
			}
		}
	}
	internal class ScreenStageStrikeRanked : ScreenPlayersStageComp, ICustomScreen<ScreenPlayersStageComp>, IStageSelect
	{
		[Serializable]
		[CompilerGenerated]
		private sealed class <>c
		{
			public static readonly <>c <>9 = new <>c();

			public static ControlDelegate <>9__36_0;

			public static Action<StageContainer> <>9__46_0;

			internal void <OnOpen>b__36_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 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 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.RandomStageMode _selectedRandomStage = Ruleset.RandomStageMode.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_0196: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d4: Unknown result type (might be due to invalid IL or missing references)
			//IL_0212: Unknown result type (might be due to invalid IL or missing references)
			//IL_0217: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_02c2: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c7: Unknown result type (might be due to invalid IL or missing references)
			//IL_03f5: Unknown result type (might be due to invalid IL or missing references)
			//IL_03fa: Unknown result type (might be due to invalid IL or missing references)
			//IL_03ff: Unknown result type (might be due to invalid IL or missing references)
			//IL_0404: Unknown result type (might be due to invalid IL or missing references)
			//IL_04c3: Unknown result type (might be due to invalid IL or missing references)
			//IL_04c8: Unknown result type (might be due to invalid IL or missing references)
			//IL_04cd: Unknown result type (might be due to invalid IL or missing references)
			//IL_04d2: 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__36_0;
			if (obj == null)
			{
				ControlDelegate val = delegate(int playerNumber)
				{
					GameStates.Send((Msg)2, playerNumber, -1);
				};
				<>c.<>9__36_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;
			((TMP_Text)lbSetCount).richText = true;
			TextHandler.SetText((TMP_Text)(object)lbSetCount, "");
			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 (SetTracker.Instance.CurrentSet.IsFreePickForced)
			{
				((Component)btFreePick).gameObject.SetActive(false);
			}
			Ruleset.RandomStageMode randomStageMode = SetTracker.Instance.CurrentSet.ActiveRuleset.randomStageMode;
			UIUtils.CreateVoteButton(ref btRandomMain, "btRandomMain", ((Component)this).transform, RANDOM_POSITION, RANDOM_SCALE);
			VoteButton.ActiveVoteButtons.Add(btRandomMain);
			VoteButton voteButton = btRandomMain;
			if (1 == 0)
			{
			}
			string text = randomStageMode switch
			{
				Ruleset.RandomStageMode.ANY => "(any 3D/2D)", 
				Ruleset.RandomStageMode.ANY_3D => "(any 3D)", 
				Ruleset.RandomStageMode.ANY_2D => "(any 2D)", 
				Ruleset.RandomStageMode.ANY_LEGAL => "(any legal)", 
				_ => "", 
			};
			if (1 == 0)
			{
			}
			voteButton.label = "Random " + text;
			((TMP_Text)((LLButton)btRandomMain).textMesh).fontSize = 18f;
			btRandomMain.onVote = delegate
			{
				OnVoteRandom(randomStageMode);
			};
			btRandomMain.enableVoting = !SetTracker.Instance.CurrentSet.IsFreePickMode && !SetTracker.Instance.CurrentSet.IsFreePickForced;
			if (randomStageMode == Ruleset.RandomStageMode.OFF || randomStageMode == Ruleset.RandomStageMode.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.RandomStageMode.ANY_3D);
			};
			btRandomBoth3D.enableVoting = !SetTracker.Instance.CurrentSet.IsFreePickMode && !SetTracker.Instance.CurrentSet.IsFreePickForced;
			if (randomStageMode != Ruleset.RandomStageMode.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.RandomStageMode.ANY_2D);
			};
			btRandomBoth2D.enableVoting = !SetTracker.Instance.CurrentSet.IsFreePickMode && !SetTracker.Instance.CurrentSet.IsFreePickForced;
			if (randomStageMode != Ruleset.RandomStageMode.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.RandomStageMode randomStageMode = SetTracker.Instance.CurrentSet.ActiveRuleset.randomStageMode;
			if (1 == 0)
			{
			}
			VoteButton result = randomStageMode switch
			{
				Ruleset.RandomStageMode.OFF => null, 
				Ruleset.RandomStageMode.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 (SetTracker.Instance.CurrentSet.ActiveRuleset.randomStageMode)
			{
			case Ruleset.RandomStageMode.BOTH:
				list.Add((LLClickable)(object)btRandomBoth3D);
				list.Add((LLClickable)(object)btRandomBoth2D);
				break;
			default:
				list.Add((LLClickable)(object)btRandomMain);
				break;
			case Ruleset.RandomStageMode.OFF:
				break;
			}
			if (!SetTracker.Instance.CurrentSet.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(SetTracker.Instance.CurrentSet.ActiveRuleset.stagesNeutral.Count, SetTracker.Instance.CurrentSet.ActiveRuleset.stagesCounterpick.Count);
			float num = stageLayout.position.y + stageLayout.totalHeight / 2f - stageLayout.stageSize.y / 2f;
			((ScreenPlayersStage)this).nButtons = SetTracker.Instance.CurrentSet.ActiveRuleset.stagesNeutral.Count + SetTracker.Instance.CurrentSet.ActiveRuleset.stagesCounterpick.Count;
			((ScreenPlayersStage)this).btStages = (LLButton[])(object)new LLButton[((ScreenPlayersStage)this).nButtons];
			int num2 = 0;
			int num3 = 0;
			int num4 = 0;
			stageContainers = new List<StageContainer>();
			stageContainersNeutral = new List<StageContainer>();
			foreach (Stage item in SetTracker.Instance.CurrentSet.ActiveRuleset.stagesNeutral)
			{
				float num5 = stageLayout.position.x - stageLayout.GetRowWidth(stageLayout.rowLengthsNeutral[num3]) / 2f + stageLayout.stageSize.x / 2f;
				StageContainer stageContainer = new Sta