Decompiled source of SBGL CompPluginCheck v0.0.9

SBGL-CompPluginCheck.dll

Decompiled 5 hours ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using System.Text;
using BepInEx;
using BepInEx.Bootstrap;
using BepInEx.Configuration;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using Newtonsoft.Json.Linq;
using TMPro;
using UnityEngine;
using UnityEngine.Events;
using UnityEngine.InputSystem;
using UnityEngine.InputSystem.Controls;
using UnityEngine.Networking;
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: IgnoresAccessChecksTo("GameAssembly")]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("SBGL-CompPluginCheck")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("0.0.9.0")]
[assembly: AssemblyInformationalVersion("0.0.9+9a171ae398e246e91e136508c15c434c7e536a35")]
[assembly: AssemblyProduct("Super Battle Golf Competitive Plugin Check")]
[assembly: AssemblyTitle("SBGL-CompPluginCheck")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("0.0.9.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 SBGLCompPluginCheck
{
	public static class MyPluginInfo
	{
		public const string PLUGIN_GUID = "SBGL-CompPluginCheck";

		public const string PLUGIN_NAME = "Super Battle Golf Competitive Plugin Check";

		public const string PLUGIN_VERSION = "0.0.9";
	}
}
namespace SBGCompPluginCheck
{
	[BepInPlugin("com.kingcox.sbg.compplugincheck", "SBG-CompPluginCheck", "4.2.9")]
	public class CompPluginCheck : BaseUnityPlugin
	{
		[CompilerGenerated]
		private sealed class <>c__DisplayClass46_0
		{
			public List<string> inst;

			internal bool <CheckPluginsRoutine>b__3(string a)
			{
				<>c__DisplayClass46_1 CS$<>8__locals0 = new <>c__DisplayClass46_1
				{
					a = a
				};
				return !inst.Any((string i) => i.Equals(CS$<>8__locals0.a, StringComparison.OrdinalIgnoreCase));
			}
		}

		[CompilerGenerated]
		private sealed class <>c__DisplayClass46_1
		{
			public string a;

			internal bool <CheckPluginsRoutine>b__4(string i)
			{
				return i.Equals(a, StringComparison.OrdinalIgnoreCase);
			}
		}

		[CompilerGenerated]
		private sealed class <AutoUpdateLoop>d__43 : IEnumerator<object>, IEnumerator, IDisposable
		{
			private int <>1__state;

			private object <>2__current;

			public CompPluginCheck <>4__this;

			private float <timer>5__1;

			object IEnumerator<object>.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			object IEnumerator.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			[DebuggerHidden]
			public <AutoUpdateLoop>d__43(int <>1__state)
			{
				this.<>1__state = <>1__state;
			}

			[DebuggerHidden]
			void IDisposable.Dispose()
			{
				<>1__state = -2;
			}

			private bool MoveNext()
			{
				//IL_0088: Unknown result type (might be due to invalid IL or missing references)
				//IL_0092: Expected O, but got Unknown
				switch (<>1__state)
				{
				default:
					return false;
				case 0:
					<>1__state = -1;
					break;
				case 1:
					<>1__state = -1;
					<timer>5__1 = <>4__this._configUpdateInterval.Value * 60f;
					goto IL_00c1;
				case 2:
					{
						<>1__state = -1;
						<timer>5__1 -= 1f;
						<>4__this.UpdateUIReport();
						goto IL_00c1;
					}
					IL_00c1:
					if (<timer>5__1 > 0f)
					{
						<>4__this._timeUntilNextUpdate = <timer>5__1;
						<>2__current = (object)new WaitForSeconds(1f);
						<>1__state = 2;
						return true;
					}
					break;
				}
				<>2__current = <>4__this.TriggerFullSync();
				<>1__state = 1;
				return true;
			}

			bool IEnumerator.MoveNext()
			{
				//ILSpy generated this explicit interface implementation from .override directive in MoveNext
				return this.MoveNext();
			}

			[DebuggerHidden]
			void IEnumerator.Reset()
			{
				throw new NotSupportedException();
			}
		}

		[CompilerGenerated]
		private sealed class <CheckPluginsRoutine>d__46 : IEnumerator<object>, IEnumerator, IDisposable
		{
			private int <>1__state;

			private object <>2__current;

			public CompPluginCheck <>4__this;

			private string <url>5__1;

			private UnityWebRequest <w>5__2;

			private <>c__DisplayClass46_0 <>8__3;

			object IEnumerator<object>.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			object IEnumerator.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			[DebuggerHidden]
			public <CheckPluginsRoutine>d__46(int <>1__state)
			{
				this.<>1__state = <>1__state;
			}

			[DebuggerHidden]
			void IDisposable.Dispose()
			{
				int num = <>1__state;
				if (num == -3 || num == 1)
				{
					try
					{
					}
					finally
					{
						<>m__Finally1();
					}
				}
				<url>5__1 = null;
				<w>5__2 = null;
				<>8__3 = null;
				<>1__state = -2;
			}

			private bool MoveNext()
			{
				//IL_0091: Unknown result type (might be due to invalid IL or missing references)
				//IL_0097: Invalid comparison between Unknown and I4
				try
				{
					switch (<>1__state)
					{
					default:
						return false;
					case 0:
						<>1__state = -1;
						<url>5__1 = "https://gist.githubusercontent.com/Kingcox22/32b1bcf1bdbec4ec47d086fec70628c1/raw/allowed_mods.txt?t=" + DateTime.Now.Ticks;
						<w>5__2 = UnityWebRequest.Get(<url>5__1);
						<>1__state = -3;
						<>2__current = <w>5__2.SendWebRequest();
						<>1__state = 1;
						return true;
					case 1:
						<>1__state = -3;
						if ((int)<w>5__2.result == 1)
						{
							<>8__3 = new <>c__DisplayClass46_0();
							<>4__this._lastAllowedGuids = (from l in <w>5__2.downloadHandler.text.Split('\n')
								select l.Contains("|") ? l.Split('|')[1].Trim() : l.Trim() into l
								where !string.IsNullOrEmpty(l)
								select l).ToList();
							<>8__3.inst = Chainloader.PluginInfos.Values.Select((PluginInfo p) => p.Metadata.GUID).ToList();
							<>4__this._missingGuids = <>4__this._lastAllowedGuids.Where(delegate(string a)
							{
								<>c__DisplayClass46_1 CS$<>8__locals0 = new <>c__DisplayClass46_1
								{
									a = a
								};
								return !<>8__3.inst.Any((string i) => i.Equals(CS$<>8__locals0.a, StringComparison.OrdinalIgnoreCase));
							}).ToList();
							<>8__3 = null;
						}
						<>m__Finally1();
						<w>5__2 = null;
						return false;
					}
				}
				catch
				{
					//try-fault
					((IDisposable)this).Dispose();
					throw;
				}
			}

			bool IEnumerator.MoveNext()
			{
				//ILSpy generated this explicit interface implementation from .override directive in MoveNext
				return this.MoveNext();
			}

			private void <>m__Finally1()
			{
				<>1__state = -1;
				if (<w>5__2 != null)
				{
					((IDisposable)<w>5__2).Dispose();
				}
			}

			[DebuggerHidden]
			void IEnumerator.Reset()
			{
				throw new NotSupportedException();
			}
		}

		[CompilerGenerated]
		private sealed class <DownloadProfilePic>d__45 : IEnumerator<object>, IEnumerator, IDisposable
		{
			private int <>1__state;

			private object <>2__current;

			public string url;

			public CompPluginCheck <>4__this;

			private UnityWebRequest <request>5__1;

			object IEnumerator<object>.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			object IEnumerator.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			[DebuggerHidden]
			public <DownloadProfilePic>d__45(int <>1__state)
			{
				this.<>1__state = <>1__state;
			}

			[DebuggerHidden]
			void IDisposable.Dispose()
			{
				int num = <>1__state;
				if (num == -3 || num == 1)
				{
					try
					{
					}
					finally
					{
						<>m__Finally1();
					}
				}
				<request>5__1 = null;
				<>1__state = -2;
			}

			private bool MoveNext()
			{
				//IL_0095: Unknown result type (might be due to invalid IL or missing references)
				//IL_009b: Invalid comparison between Unknown and I4
				try
				{
					switch (<>1__state)
					{
					default:
						return false;
					case 0:
						<>1__state = -1;
						if (string.IsNullOrEmpty(url))
						{
							return false;
						}
						<request>5__1 = UnityWebRequestTexture.GetTexture(url);
						<>1__state = -3;
						<request>5__1.SetRequestHeader("User-Agent", "Mozilla/5.0");
						<>2__current = <request>5__1.SendWebRequest();
						<>1__state = 1;
						return true;
					case 1:
						<>1__state = -3;
						if ((int)<request>5__1.result == 1)
						{
							<>4__this._profileIcon.texture = (Texture)(object)DownloadHandlerTexture.GetContent(<request>5__1);
							<>4__this._profilePicContainer.SetActive(true);
						}
						<>m__Finally1();
						<request>5__1 = null;
						return false;
					}
				}
				catch
				{
					//try-fault
					((IDisposable)this).Dispose();
					throw;
				}
			}

			bool IEnumerator.MoveNext()
			{
				//ILSpy generated this explicit interface implementation from .override directive in MoveNext
				return this.MoveNext();
			}

			private void <>m__Finally1()
			{
				<>1__state = -1;
				if (<request>5__1 != null)
				{
					((IDisposable)<request>5__1).Dispose();
				}
			}

			[DebuggerHidden]
			void IEnumerator.Reset()
			{
				throw new NotSupportedException();
			}
		}

		[CompilerGenerated]
		private sealed class <FetchLeaderboardRank>d__48 : IEnumerator<object>, IEnumerator, IDisposable
		{
			private int <>1__state;

			private object <>2__current;

			public string id;

			public CompPluginCheck <>4__this;

			private string <url>5__1;

			private UnityWebRequest <r>5__2;

			private JArray <ps>5__3;

			private int <rank>5__4;

			private IEnumerator<JToken> <>s__5;

			private JToken <p>5__6;

			object IEnumerator<object>.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			object IEnumerator.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			[DebuggerHidden]
			public <FetchLeaderboardRank>d__48(int <>1__state)
			{
				this.<>1__state = <>1__state;
			}

			[DebuggerHidden]
			void IDisposable.Dispose()
			{
				int num = <>1__state;
				if (num == -3 || num == 1)
				{
					try
					{
					}
					finally
					{
						<>m__Finally1();
					}
				}
				<url>5__1 = null;
				<r>5__2 = null;
				<ps>5__3 = null;
				<>s__5 = null;
				<p>5__6 = null;
				<>1__state = -2;
			}

			private bool MoveNext()
			{
				//IL_00d1: Unknown result type (might be due to invalid IL or missing references)
				//IL_00d7: Invalid comparison between Unknown and I4
				try
				{
					switch (<>1__state)
					{
					default:
						return false;
					case 0:
						<>1__state = -1;
						if (string.IsNullOrEmpty(id) || id == "PASTE_ID_HERE")
						{
							return false;
						}
						<url>5__1 = "https://sbgleague.com/api/apps/69b0f4aba3975f2440fbf070/entities/Player?sort=-current_mmr";
						<r>5__2 = UnityWebRequest.Get(<url>5__1);
						<>1__state = -3;
						<r>5__2.SetRequestHeader("X-App-Id", "69b0f4aba3975f2440fbf070");
						<r>5__2.SetRequestHeader("api_key", "3f7c84bf7a734c6a86bbc34245a1e6e4");
						<>2__current = <r>5__2.SendWebRequest();
						<>1__state = 1;
						return true;
					case 1:
						<>1__state = -3;
						if ((int)<r>5__2.result == 1)
						{
							try
							{
								<ps>5__3 = JArray.Parse(<r>5__2.downloadHandler.text);
								<>4__this._totalPlayers = ((JContainer)<ps>5__3).Count.ToString();
								<rank>5__4 = 1;
								<>s__5 = <ps>5__3.GetEnumerator();
								try
								{
									while (<>s__5.MoveNext())
									{
										<p>5__6 = <>s__5.Current;
										if (((object)<p>5__6[(object)"id"])?.ToString() == id)
										{
											<>4__this._playerRank = <rank>5__4.ToString();
											break;
										}
										<rank>5__4++;
										<p>5__6 = null;
									}
								}
								finally
								{
									if (<>s__5 != null)
									{
										<>s__5.Dispose();
									}
								}
								<>s__5 = null;
								<ps>5__3 = null;
							}
							catch
							{
							}
						}
						<>m__Finally1();
						<r>5__2 = null;
						return false;
					}
				}
				catch
				{
					//try-fault
					((IDisposable)this).Dispose();
					throw;
				}
			}

			bool IEnumerator.MoveNext()
			{
				//ILSpy generated this explicit interface implementation from .override directive in MoveNext
				return this.MoveNext();
			}

			private void <>m__Finally1()
			{
				<>1__state = -1;
				if (<r>5__2 != null)
				{
					((IDisposable)<r>5__2).Dispose();
				}
			}

			[DebuggerHidden]
			void IEnumerator.Reset()
			{
				throw new NotSupportedException();
			}
		}

		[CompilerGenerated]
		private sealed class <FetchPlayerData>d__47 : IEnumerator<object>, IEnumerator, IDisposable
		{
			private int <>1__state;

			private object <>2__current;

			public string id;

			public CompPluginCheck <>4__this;

			private string <url>5__1;

			private UnityWebRequest <r>5__2;

			private JArray <ja>5__3;

			private JToken <p>5__4;

			private float <avg>5__5;

			private float <w>5__6;

			private float <t>5__7;

			object IEnumerator<object>.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			object IEnumerator.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			[DebuggerHidden]
			public <FetchPlayerData>d__47(int <>1__state)
			{
				this.<>1__state = <>1__state;
			}

			[DebuggerHidden]
			void IDisposable.Dispose()
			{
				int num = <>1__state;
				if (num == -3 || num == 1)
				{
					try
					{
					}
					finally
					{
						<>m__Finally1();
					}
				}
				<url>5__1 = null;
				<r>5__2 = null;
				<ja>5__3 = null;
				<p>5__4 = null;
				<>1__state = -2;
			}

			private bool MoveNext()
			{
				//IL_0101: Unknown result type (might be due to invalid IL or missing references)
				//IL_0107: Invalid comparison between Unknown and I4
				bool result;
				try
				{
					switch (<>1__state)
					{
					default:
						result = false;
						break;
					case 0:
						<>1__state = -1;
						if (string.IsNullOrEmpty(id) || id == "PASTE_ID_HERE")
						{
							<>4__this._activeUsername = "Set ID in Menu";
							result = false;
							break;
						}
						<url>5__1 = "https://sbgleague.com/api/apps/69b0f4aba3975f2440fbf070/entities/Player?q=" + UnityWebRequest.EscapeURL("{\"id\":\"" + id + "\"}");
						<r>5__2 = UnityWebRequest.Get(<url>5__1);
						<>1__state = -3;
						<r>5__2.SetRequestHeader("X-App-Id", "69b0f4aba3975f2440fbf070");
						<r>5__2.SetRequestHeader("api_key", "3f7c84bf7a734c6a86bbc34245a1e6e4");
						<>2__current = <r>5__2.SendWebRequest();
						<>1__state = 1;
						result = true;
						break;
					case 1:
						{
							<>1__state = -3;
							if ((int)<r>5__2.result == 1)
							{
								try
								{
									<ja>5__3 = JArray.Parse(<r>5__2.downloadHandler.text);
									if (((JContainer)<ja>5__3).Count != 0)
									{
										<p>5__4 = <ja>5__3[0];
										<>4__this._activeUsername = ((object)<p>5__4[(object)"display_name"])?.ToString() ?? "Player";
										<>4__this._playerMMR = ((object)<p>5__4[(object)"current_mmr"])?.ToString() ?? "0";
										<>4__this._playerPeak = ((object)<p>5__4[(object)"highest_mmr_ever"])?.ToString() ?? "0";
										<>4__this._matches = ((object)<p>5__4[(object)"matches_played"])?.ToString() ?? "0";
										<>4__this._lastChange = ((object)<p>5__4[(object)"latest_mmr_change"])?.ToString() ?? "0";
										<>4__this._top3s = ((object)<p>5__4[(object)"top_3_finishes"])?.ToString() ?? "0";
										float.TryParse(((object)<p>5__4[(object)"average_score_vs_par"])?.ToString() ?? "0", out <avg>5__5);
										<>4__this._avgScore = <avg>5__5.ToString("F1");
										<w>5__6 = 0f;
										<t>5__7 = 0f;
										float.TryParse(((object)<p>5__4[(object)"wins"])?.ToString(), out <w>5__6);
										float.TryParse(((object)<p>5__4[(object)"matches_played"])?.ToString(), out <t>5__7);
										<>4__this._winRate = ((<t>5__7 > 0f) ? $"{<w>5__6 / <t>5__7 * 100f:F0}%" : "0%");
										if (<p>5__4[(object)"profile_pic_url"] != null)
										{
											((MonoBehaviour)<>4__this).StartCoroutine(<>4__this.DownloadProfilePic(((object)<p>5__4[(object)"profile_pic_url"]).ToString()));
										}
										<ja>5__3 = null;
										<p>5__4 = null;
										goto IL_03fe;
									}
									<>4__this._activeUsername = "Invalid ID";
									result = false;
								}
								catch
								{
									<>4__this._activeUsername = "Error";
									goto IL_03fe;
								}
								<>m__Finally1();
								break;
							}
							<>4__this._activeUsername = "Offline";
							goto IL_03fe;
						}
						IL_03fe:
						<>m__Finally1();
						<r>5__2 = null;
						result = false;
						break;
					}
				}
				catch
				{
					//try-fault
					((IDisposable)this).Dispose();
					throw;
				}
				return result;
			}

			bool IEnumerator.MoveNext()
			{
				//ILSpy generated this explicit interface implementation from .override directive in MoveNext
				return this.MoveNext();
			}

			private void <>m__Finally1()
			{
				<>1__state = -1;
				if (<r>5__2 != null)
				{
					((IDisposable)<r>5__2).Dispose();
				}
			}

			[DebuggerHidden]
			void IEnumerator.Reset()
			{
				throw new NotSupportedException();
			}
		}

		[CompilerGenerated]
		private sealed class <TriggerFullSync>d__44 : IEnumerator<object>, IEnumerator, IDisposable
		{
			private int <>1__state;

			private object <>2__current;

			public CompPluginCheck <>4__this;

			object IEnumerator<object>.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			object IEnumerator.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			[DebuggerHidden]
			public <TriggerFullSync>d__44(int <>1__state)
			{
				this.<>1__state = <>1__state;
			}

			[DebuggerHidden]
			void IDisposable.Dispose()
			{
				<>1__state = -2;
			}

			private bool MoveNext()
			{
				switch (<>1__state)
				{
				default:
					return false;
				case 0:
					<>1__state = -1;
					if (<>4__this._isSyncing)
					{
						return false;
					}
					<>4__this._isSyncing = true;
					<>4__this._syncStatus = "Syncing...";
					<>4__this.ClearPlayerData();
					<>4__this.UpdateUIReport();
					<>2__current = <>4__this.CheckPluginsRoutine();
					<>1__state = 1;
					return true;
				case 1:
					<>1__state = -1;
					<>2__current = <>4__this.FetchPlayerData(<>4__this._configPlayerId.Value?.Trim());
					<>1__state = 2;
					return true;
				case 2:
					<>1__state = -1;
					<>2__current = <>4__this.FetchLeaderboardRank(<>4__this._configPlayerId.Value?.Trim());
					<>1__state = 3;
					return true;
				case 3:
					<>1__state = -1;
					<>4__this._syncStatus = "Connected";
					<>4__this._isSyncing = false;
					<>4__this.UpdateUIReport();
					return false;
				}
			}

			bool IEnumerator.MoveNext()
			{
				//ILSpy generated this explicit interface implementation from .override directive in MoveNext
				return this.MoveNext();
			}

			[DebuggerHidden]
			void IEnumerator.Reset()
			{
				throw new NotSupportedException();
			}
		}

		private const string ALLOWED_MODS_URL = "https://gist.githubusercontent.com/Kingcox22/32b1bcf1bdbec4ec47d086fec70628c1/raw/allowed_mods.txt";

		private const string APP_ID = "69b0f4aba3975f2440fbf070";

		private const string API_KEY = "3f7c84bf7a734c6a86bbc34245a1e6e4";

		private GameObject _canvasObj;

		private GameObject _profilePicContainer;

		private GameObject _bgObj;

		private TextMeshProUGUI _statsText;

		private TextMeshProUGUI _illegalWarningText;

		private TextMeshProUGUI _missingWarningText;

		private Image _bgImage;

		private RawImage _profileIcon;

		private RectTransform _bgRect;

		private RectTransform _picContainerRect;

		private List<string> _lastAllowedGuids = new List<string>();

		private List<string> _missingGuids = new List<string>();

		private bool _anyIllegalMods = false;

		private bool _isSyncing = false;

		private float _timeUntilNextUpdate = 0f;

		public ConfigEntry<float> _configX;

		public ConfigEntry<float> _configY;

		public ConfigEntry<float> _configWidth;

		public ConfigEntry<float> _configAlpha;

		public ConfigEntry<float> _configUpdateInterval;

		public ConfigEntry<bool> _configShowModList;

		public ConfigEntry<Key> _configToggleModsKey;

		public ConfigEntry<Key> _configRefreshKey;

		public ConfigEntry<string> _configPlayerId;

		public string _activeUsername = "Searching...";

		public string _playerRank = "N/A";

		public string _totalPlayers = "0";

		public string _playerMMR = "0";

		public string _matches = "0";

		public string _playerPeak = "0";

		public string _winRate = "0%";

		public string _lastChange = "0";

		public string _top3s = "0";

		public string _avgScore = "0.0";

		public string _syncStatus = "Idle";

		private void Awake()
		{
			//IL_0030: Unknown result type (might be due to invalid IL or missing references)
			//IL_003a: Expected O, but got Unknown
			//IL_006e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0078: Expected O, but got Unknown
			//IL_00ac: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b6: Expected O, but got Unknown
			//IL_00ea: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f4: Expected O, but got Unknown
			//IL_0149: Unknown result type (might be due to invalid IL or missing references)
			//IL_0153: Expected O, but got Unknown
			//IL_01c6: Unknown result type (might be due to invalid IL or missing references)
			//IL_01cc: Expected O, but got Unknown
			_configX = ((BaseUnityPlugin)this).Config.Bind<float>("UI Position", "X Offset", 20f, new ConfigDescription("Horizontal.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 4000f), Array.Empty<object>()));
			_configY = ((BaseUnityPlugin)this).Config.Bind<float>("UI Position", "Y Offset", 100f, new ConfigDescription("Vertical.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 4000f), Array.Empty<object>()));
			_configWidth = ((BaseUnityPlugin)this).Config.Bind<float>("UI Size", "Width", 200f, new ConfigDescription("Width.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(150f, 800f), Array.Empty<object>()));
			_configAlpha = ((BaseUnityPlugin)this).Config.Bind<float>("UI Appearance", "Opacity", 0.85f, new ConfigDescription("Alpha.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 1f), Array.Empty<object>()));
			_configShowModList = ((BaseUnityPlugin)this).Config.Bind<bool>("UI Appearance", "Show Mod List", false, "Toggle.");
			_configUpdateInterval = ((BaseUnityPlugin)this).Config.Bind<float>("Logic", "Update Interval", 5f, new ConfigDescription("Minutes.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(1f, 60f), Array.Empty<object>()));
			_configToggleModsKey = ((BaseUnityPlugin)this).Config.Bind<Key>("Controls", "Toggle Key", (Key)102, "F9.");
			_configRefreshKey = ((BaseUnityPlugin)this).Config.Bind<Key>("Controls", "Refresh Key", (Key)103, "F10.");
			_configPlayerId = ((BaseUnityPlugin)this).Config.Bind<string>("League", "Player ID", "PASTE_ID_HERE", "ID.");
			Harmony val = new Harmony("com.kingcox.sbg.compplugincheck");
			val.PatchAll();
		}

		private void Start()
		{
			CreateUI();
			((MonoBehaviour)this).StartCoroutine(AutoUpdateLoop());
		}

		private void Update()
		{
			//IL_001b: 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_00a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fd: Unknown result type (might be due to invalid IL or missing references)
			//IL_014e: Unknown result type (might be due to invalid IL or missing references)
			//IL_015f: Unknown result type (might be due to invalid IL or missing references)
			Keyboard current = Keyboard.current;
			if (current == null)
			{
				return;
			}
			if (((ButtonControl)current[_configToggleModsKey.Value]).wasPressedThisFrame)
			{
				_configShowModList.Value = !_configShowModList.Value;
				UpdateUIReport();
			}
			if (((ButtonControl)current[_configRefreshKey.Value]).wasPressedThisFrame)
			{
				TriggerManualSync();
			}
			if ((Object)(object)_bgRect != (Object)null)
			{
				_bgRect.anchoredPosition = new Vector2(_configX.Value, _configY.Value);
				_bgRect.sizeDelta = new Vector2(_configWidth.Value, _bgRect.sizeDelta.y);
				((Graphic)_bgImage).color = new Color(0f, 0f, 0f, _configAlpha.Value);
				if ((Object)(object)_picContainerRect != (Object)null)
				{
					_picContainerRect.anchoredPosition = new Vector2(_configX.Value + _configWidth.Value - 10f, _configY.Value + _bgRect.sizeDelta.y - 10f);
				}
			}
		}

		private void ClearPlayerData()
		{
			_activeUsername = "Searching...";
			_playerRank = "N/A";
			_totalPlayers = "0";
			_playerMMR = "0";
			_matches = "0";
			_playerPeak = "0";
			_winRate = "0%";
			_lastChange = "0";
			_top3s = "0";
			_avgScore = "0.0";
			if ((Object)(object)_profileIcon != (Object)null)
			{
				_profileIcon.texture = null;
			}
			if ((Object)(object)_profilePicContainer != (Object)null)
			{
				_profilePicContainer.SetActive(false);
			}
		}

		public void TriggerManualSync()
		{
			((MonoBehaviour)this).StopAllCoroutines();
			((MonoBehaviour)this).StartCoroutine(TriggerFullSync());
		}

		[IteratorStateMachine(typeof(<AutoUpdateLoop>d__43))]
		private IEnumerator AutoUpdateLoop()
		{
			//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
			return new <AutoUpdateLoop>d__43(0)
			{
				<>4__this = this
			};
		}

		[IteratorStateMachine(typeof(<TriggerFullSync>d__44))]
		private IEnumerator TriggerFullSync()
		{
			//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
			return new <TriggerFullSync>d__44(0)
			{
				<>4__this = this
			};
		}

		[IteratorStateMachine(typeof(<DownloadProfilePic>d__45))]
		private IEnumerator DownloadProfilePic(string url)
		{
			//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
			return new <DownloadProfilePic>d__45(0)
			{
				<>4__this = this,
				url = url
			};
		}

		[IteratorStateMachine(typeof(<CheckPluginsRoutine>d__46))]
		private IEnumerator CheckPluginsRoutine()
		{
			//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
			return new <CheckPluginsRoutine>d__46(0)
			{
				<>4__this = this
			};
		}

		[IteratorStateMachine(typeof(<FetchPlayerData>d__47))]
		private IEnumerator FetchPlayerData(string id)
		{
			//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
			return new <FetchPlayerData>d__47(0)
			{
				<>4__this = this,
				id = id
			};
		}

		[IteratorStateMachine(typeof(<FetchLeaderboardRank>d__48))]
		private IEnumerator FetchLeaderboardRank(string id)
		{
			//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
			return new <FetchLeaderboardRank>d__48(0)
			{
				<>4__this = this,
				id = id
			};
		}

		private void UpdateUIReport()
		{
			StringBuilder stringBuilder = new StringBuilder();
			_anyIllegalMods = false;
			stringBuilder.AppendLine("User: <color=#FFFFFF>" + _activeUsername + "</color>");
			stringBuilder.AppendLine("Rank: <color=#00FF00>#" + _playerRank + "</color> / " + _totalPlayers);
			stringBuilder.AppendLine("Win Rate: <color=#FFA500>" + _winRate + "</color>");
			float.TryParse(_lastChange, out var result);
			string text = ((result >= 0f) ? "#55FF55" : "#FF5555");
			stringBuilder.AppendLine("MMR: <color=#00FFFF>" + _playerMMR + "</color> (<color=" + text + ">" + ((result >= 0f) ? "+" : "") + _lastChange + "</color>) | Peak: <color=#FFD700>" + _playerPeak + "</color>");
			stringBuilder.AppendLine("Avg. Par: <color=#CC88FF>" + _avgScore + "</color>");
			stringBuilder.AppendLine("Matches: <color=#FFFFFF>" + _matches + "</color> | Top 3s: <color=#00FF00>" + _top3s + "</color>");
			foreach (PluginInfo plugin2 in Chainloader.PluginInfos.Values)
			{
				if (!(plugin2.Metadata.GUID == "com.kingcox.sbg.compplugincheck") && !plugin2.Metadata.GUID.StartsWith("BepInEx") && !_lastAllowedGuids.Any((string g) => g.Equals(plugin2.Metadata.GUID, StringComparison.OrdinalIgnoreCase)))
				{
					_anyIllegalMods = true;
				}
			}
			if (_configShowModList.Value)
			{
				stringBuilder.AppendLine("---");
				foreach (PluginInfo plugin in Chainloader.PluginInfos.Values)
				{
					if (!(plugin.Metadata.GUID == "com.kingcox.sbg.compplugincheck") && !plugin.Metadata.GUID.StartsWith("BepInEx"))
					{
						bool flag = _lastAllowedGuids.Any((string g) => g.Equals(plugin.Metadata.GUID, StringComparison.OrdinalIgnoreCase));
						stringBuilder.AppendLine((flag ? "<color=#00FF00>O</color>" : "<color=#FF0000>X</color>") + " <size=11>" + plugin.Metadata.Name + "</size>");
					}
				}
			}
			stringBuilder.AppendLine("---");
			int num = (int)_timeUntilNextUpdate / 60;
			int num2 = (int)_timeUntilNextUpdate % 60;
			stringBuilder.AppendLine($"<size=10><color=#888888>Refresh in: {num}:{num2:D2} | {_syncStatus}</color></size>");
			if ((Object)(object)_statsText != (Object)null)
			{
				((TMP_Text)_statsText).text = stringBuilder.ToString();
			}
			if ((Object)(object)_illegalWarningText != (Object)null)
			{
				((Component)_illegalWarningText).gameObject.SetActive(_anyIllegalMods);
			}
			if ((Object)(object)_missingWarningText != (Object)null)
			{
				((Component)_missingWarningText).gameObject.SetActive(_missingGuids.Count > 0);
			}
		}

		private void CreateUI()
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Expected O, but got Unknown
			//IL_0055: Unknown result type (might be due to invalid IL or missing references)
			//IL_005f: Expected O, but got Unknown
			//IL_00ad: 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_00e1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00eb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ec: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f4: Unknown result type (might be due to invalid IL or missing references)
			//IL_010f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0119: Expected O, but got Unknown
			//IL_0131: Unknown result type (might be due to invalid IL or missing references)
			//IL_0137: Expected O, but got Unknown
			//IL_0172: Unknown result type (might be due to invalid IL or missing references)
			//IL_018e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0194: Expected O, but got Unknown
			//IL_01e9: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f3: Expected O, but got Unknown
			//IL_022d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0232: Unknown result type (might be due to invalid IL or missing references)
			//IL_0233: Unknown result type (might be due to invalid IL or missing references)
			//IL_023b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0253: Unknown result type (might be due to invalid IL or missing references)
			//IL_026e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0285: Unknown result type (might be due to invalid IL or missing references)
			//IL_028c: Expected O, but got Unknown
			//IL_0342: Unknown result type (might be due to invalid IL or missing references)
			//IL_0351: Unknown result type (might be due to invalid IL or missing references)
			//IL_0378: Unknown result type (might be due to invalid IL or missing references)
			//IL_037f: Expected O, but got Unknown
			//IL_03b0: Unknown result type (might be due to invalid IL or missing references)
			//IL_03c6: Unknown result type (might be due to invalid IL or missing references)
			//IL_03dc: Unknown result type (might be due to invalid IL or missing references)
			//IL_03ec: Unknown result type (might be due to invalid IL or missing references)
			//IL_03f3: Expected O, but got Unknown
			//IL_042a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0432: Unknown result type (might be due to invalid IL or missing references)
			//IL_0446: Unknown result type (might be due to invalid IL or missing references)
			//IL_045d: Unknown result type (might be due to invalid IL or missing references)
			//IL_048c: Unknown result type (might be due to invalid IL or missing references)
			//IL_04dd: Unknown result type (might be due to invalid IL or missing references)
			//IL_04e4: Expected O, but got Unknown
			//IL_051b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0523: Unknown result type (might be due to invalid IL or missing references)
			//IL_0537: Unknown result type (might be due to invalid IL or missing references)
			//IL_054e: Unknown result type (might be due to invalid IL or missing references)
			//IL_057d: Unknown result type (might be due to invalid IL or missing references)
			//IL_029d: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ac: Unknown result type (might be due to invalid IL or missing references)
			//IL_02e0: Unknown result type (might be due to invalid IL or missing references)
			_canvasObj = new GameObject("SBG_Canvas");
			Canvas val = _canvasObj.AddComponent<Canvas>();
			val.renderMode = (RenderMode)0;
			val.sortingOrder = 99999;
			_canvasObj.AddComponent<CanvasScaler>().uiScaleMode = (ScaleMode)0;
			_canvasObj.AddComponent<GraphicRaycaster>();
			_bgObj = new GameObject("BG");
			_bgObj.transform.SetParent(_canvasObj.transform, false);
			_bgImage = _bgObj.AddComponent<Image>();
			((Graphic)_bgImage).color = new Color(0f, 0f, 0f, _configAlpha.Value);
			_bgRect = _bgObj.GetComponent<RectTransform>();
			RectTransform bgRect = _bgRect;
			RectTransform bgRect2 = _bgRect;
			Vector2 val2 = (_bgRect.pivot = Vector2.zero);
			Vector2 val5 = (bgRect.anchorMin = (bgRect2.anchorMax = val2));
			((LayoutGroup)_bgObj.AddComponent<VerticalLayoutGroup>()).padding = new RectOffset(10, 10, 10, 10);
			_bgObj.AddComponent<ContentSizeFitter>().verticalFit = (FitMode)2;
			GameObject val6 = new GameObject("H");
			val6.transform.SetParent(_bgObj.transform, false);
			TextMeshProUGUI val7 = val6.AddComponent<TextMeshProUGUI>();
			((TMP_Text)val7).fontSize = 15f;
			((Graphic)val7).color = new Color(0.16f, 0.99f, 0.75f);
			((TMP_Text)val7).text = "SBG LEAGUE";
			GameObject val8 = new GameObject("S");
			val8.transform.SetParent(_bgObj.transform, false);
			_statsText = val8.AddComponent<TextMeshProUGUI>();
			((TMP_Text)_statsText).fontSize = 13f;
			((TMP_Text)_statsText).richText = true;
			((TMP_Text)_statsText).textWrappingMode = (TextWrappingModes)0;
			_profilePicContainer = new GameObject("PicContainer");
			_profilePicContainer.transform.SetParent(_canvasObj.transform, false);
			_picContainerRect = _profilePicContainer.AddComponent<RectTransform>();
			val5 = (_picContainerRect.anchorMin = (_picContainerRect.anchorMax = Vector2.zero));
			_picContainerRect.pivot = new Vector2(1f, 1f);
			_picContainerRect.sizeDelta = new Vector2(50f, 50f);
			Texture2D val10 = new Texture2D(256, 256, (TextureFormat)4, false);
			for (int i = 0; i < 256; i++)
			{
				for (int j = 0; j < 256; j++)
				{
					float num = Vector2.Distance(new Vector2((float)j, (float)i), new Vector2(128f, 128f));
					val10.SetPixel(j, i, new Color(1f, 1f, 1f, Mathf.Clamp01((124f - num) / 1.5f)));
				}
			}
			val10.Apply();
			_profilePicContainer.AddComponent<Image>().sprite = Sprite.Create(val10, new Rect(0f, 0f, 256f, 256f), new Vector2(0.5f, 0.5f));
			_profilePicContainer.AddComponent<Mask>().showMaskGraphic = false;
			GameObject val11 = new GameObject("I");
			val11.transform.SetParent(_profilePicContainer.transform, false);
			_profileIcon = val11.AddComponent<RawImage>();
			((Component)_profileIcon).GetComponent<RectTransform>().anchorMin = Vector2.zero;
			((Component)_profileIcon).GetComponent<RectTransform>().anchorMax = Vector2.one;
			((Component)_profileIcon).GetComponent<RectTransform>().sizeDelta = Vector2.zero;
			GameObject val12 = new GameObject("RT");
			val12.transform.SetParent(_canvasObj.transform, false);
			RectTransform val13 = val12.AddComponent<RectTransform>();
			((Vector2)(ref val5))..ctor(0.5f, 0f);
			val13.anchorMax = val5;
			val13.anchorMin = val5;
			val13.anchoredPosition = new Vector2(0f, 150f);
			val13.sizeDelta = new Vector2(1000f, 50f);
			_illegalWarningText = val12.AddComponent<TextMeshProUGUI>();
			((TMP_Text)_illegalWarningText).text = "ILLEGAL MODS DETECTED";
			((Graphic)_illegalWarningText).color = Color.red;
			((TMP_Text)_illegalWarningText).fontSize = 32f;
			((TMP_Text)_illegalWarningText).alignment = (TextAlignmentOptions)514;
			((TMP_Text)_illegalWarningText).fontStyle = (FontStyles)1;
			((Component)_illegalWarningText).gameObject.SetActive(false);
			GameObject val14 = new GameObject("YT");
			val14.transform.SetParent(_canvasObj.transform, false);
			RectTransform val15 = val14.AddComponent<RectTransform>();
			((Vector2)(ref val5))..ctor(0.5f, 0f);
			val15.anchorMax = val5;
			val15.anchorMin = val5;
			val15.anchoredPosition = new Vector2(0f, 125f);
			val15.sizeDelta = new Vector2(1000f, 40f);
			_missingWarningText = val14.AddComponent<TextMeshProUGUI>();
			((TMP_Text)_missingWarningText).text = "Missing recommended SBGL approved mod";
			((Graphic)_missingWarningText).color = Color.yellow;
			((TMP_Text)_missingWarningText).fontSize = 20f;
			((TMP_Text)_missingWarningText).alignment = (TextAlignmentOptions)514;
			((TMP_Text)_missingWarningText).fontStyle = (FontStyles)1;
			((Component)_missingWarningText).gameObject.SetActive(false);
			_bgObj.SetActive(true);
			Object.DontDestroyOnLoad((Object)(object)_canvasObj);
		}
	}
	[HarmonyPatch]
	public static class MenuTabsPatch
	{
		[HarmonyPostfix]
		[HarmonyPatch(typeof(MenuTabs), "Awake")]
		public static void Postfix(MenuTabs __instance)
		{
			SBGLTabManager.Inject(__instance);
		}
	}
	public static class SBGLTabManager
	{
		[Serializable]
		[CompilerGenerated]
		private sealed class <>c
		{
			public static readonly <>c <>9 = new <>c();

			public static Func<GameObject, bool> <>9__3_0;

			public static UnityAction <>9__4_0;

			public static Func<Component, bool> <>9__8_0;

			internal bool <Inject>b__3_0(GameObject t)
			{
				return ((Object)t).name.Contains("Controls");
			}

			internal void <PopulateSBGLPage>b__4_0()
			{
				Application.OpenURL("https://sbgleague.com/AccountSettings");
			}

			internal bool <SetupButtonText>b__8_0(Component c)
			{
				return ((object)c).GetType().Name.Contains("Localize");
			}
		}

		[CompilerGenerated]
		private sealed class <LoadLocalImage>d__7 : IEnumerator<object>, IEnumerator, IDisposable
		{
			private int <>1__state;

			private object <>2__current;

			public RawImage ri;

			public string path;

			private UnityWebRequest <u>5__1;

			object IEnumerator<object>.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			object IEnumerator.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			[DebuggerHidden]
			public <LoadLocalImage>d__7(int <>1__state)
			{
				this.<>1__state = <>1__state;
			}

			[DebuggerHidden]
			void IDisposable.Dispose()
			{
				int num = <>1__state;
				if (num == -3 || num == 1)
				{
					try
					{
					}
					finally
					{
						<>m__Finally1();
					}
				}
				<u>5__1 = null;
				<>1__state = -2;
			}

			private bool MoveNext()
			{
				//IL_0073: Unknown result type (might be due to invalid IL or missing references)
				//IL_0079: Invalid comparison between Unknown and I4
				try
				{
					switch (<>1__state)
					{
					default:
						return false;
					case 0:
						<>1__state = -1;
						<u>5__1 = UnityWebRequestTexture.GetTexture("file://" + path);
						<>1__state = -3;
						<>2__current = <u>5__1.SendWebRequest();
						<>1__state = 1;
						return true;
					case 1:
						<>1__state = -3;
						if ((int)<u>5__1.result == 1)
						{
							ri.texture = (Texture)(object)DownloadHandlerTexture.GetContent(<u>5__1);
						}
						<>m__Finally1();
						<u>5__1 = null;
						return false;
					}
				}
				catch
				{
					//try-fault
					((IDisposable)this).Dispose();
					throw;
				}
			}

			bool IEnumerator.MoveNext()
			{
				//ILSpy generated this explicit interface implementation from .override directive in MoveNext
				return this.MoveNext();
			}

			private void <>m__Finally1()
			{
				<>1__state = -1;
				if (<u>5__1 != null)
				{
					((IDisposable)<u>5__1).Dispose();
				}
			}

			[DebuggerHidden]
			void IEnumerator.Reset()
			{
				throw new NotSupportedException();
			}
		}

		private const string TAB_NAME = "SBGL";

		private const string GUIDE_IMAGE = "SBGL_PlayerID_Guide.png";

		private static readonly Color SBGL_GREEN = new Color(0f, 0.71f, 0.5f);

		public static void Inject(MenuTabs menuTabs)
		{
			//IL_010a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0183: Unknown result type (might be due to invalid IL or missing references)
			//IL_018a: Expected O, but got Unknown
			//IL_023e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0294: Unknown result type (might be due to invalid IL or missing references)
			//IL_029e: Expected O, but got Unknown
			if ((Object)(object)menuTabs == (Object)null || (Object)(object)((Component)menuTabs).transform.Find("Menu/Options Tab/SBGL") != (Object)null)
			{
				return;
			}
			Transform val = ((Component)menuTabs).transform.Find("Menu/Options Tab");
			Transform val2 = val.Find("Controls");
			GameObject val3 = ((IEnumerable<GameObject>)menuTabs.tabs).FirstOrDefault((Func<GameObject, bool>)((GameObject t) => ((Object)t).name.Contains("Controls")));
			if (!((Object)(object)val2 != (Object)null) || !((Object)(object)val3 != (Object)null))
			{
				return;
			}
			((HorizontalOrVerticalLayoutGroup)((Component)val).GetComponent<HorizontalLayoutGroup>()).spacing = -45f;
			Button[] tabButtons = menuTabs.tabButtons;
			foreach (Button val4 in tabButtons)
			{
				((Component)val4).transform.localScale = new Vector3(0.8f, 0.8f, 0.8f);
			}
			GameObject val5 = Object.Instantiate<GameObject>(((Component)val2).gameObject, val);
			((Object)val5).name = "SBGL";
			SetupButtonText(val5, "SBGL");
			GameObject val6 = Object.Instantiate<GameObject>(val3, val3.transform.parent);
			((Object)val6).name = "SBGL";
			foreach (Transform item in val6.transform)
			{
				Transform val7 = item;
				Object.DestroyImmediate((Object)(object)((Component)val7).gameObject);
			}
			PopulateSBGLPage(val6);
			menuTabs.tabButtons = menuTabs.tabButtons.Append(val5.GetComponent<Button>()).ToArray();
			menuTabs.tabs = menuTabs.tabs.Append(val6).ToArray();
			menuTabs.textColors = menuTabs.textColors.Append(SBGL_GREEN).ToArray();
			int newIndex = menuTabs.tabs.Length - 1;
			((UnityEventBase)val5.GetComponent<Button>().onClick).RemoveAllListeners();
			((UnityEvent)val5.GetComponent<Button>().onClick).AddListener((UnityAction)delegate
			{
				menuTabs.SelectTab(newIndex);
			});
		}

		private static void PopulateSBGLPage(GameObject page)
		{
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Expected O, but got Unknown
			//IL_0066: Unknown result type (might be due to invalid IL or missing references)
			//IL_0095: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d2: Expected O, but got Unknown
			//IL_0183: Unknown result type (might be due to invalid IL or missing references)
			//IL_0189: Expected O, but got Unknown
			//IL_01ac: 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_022b: Unknown result type (might be due to invalid IL or missing references)
			//IL_025b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0262: Expected O, but got Unknown
			//IL_0291: 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_02d0: Unknown result type (might be due to invalid IL or missing references)
			//IL_02d7: Expected O, but got Unknown
			//IL_02fd: Unknown result type (might be due to invalid IL or missing references)
			//IL_0320: Unknown result type (might be due to invalid IL or missing references)
			//IL_011a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0121: Expected O, but got Unknown
			//IL_0146: Unknown result type (might be due to invalid IL or missing references)
			//IL_039e: Unknown result type (might be due to invalid IL or missing references)
			//IL_03c3: Unknown result type (might be due to invalid IL or missing references)
			//IL_03cd: Expected O, but got Unknown
			CompPluginCheck plugin = Object.FindFirstObjectByType<CompPluginCheck>();
			VerticalLayoutGroup val = page.GetComponent<VerticalLayoutGroup>() ?? page.AddComponent<VerticalLayoutGroup>();
			((LayoutGroup)val).padding = new RectOffset(60, 60, 20, 20);
			((HorizontalOrVerticalLayoutGroup)val).spacing = 15f;
			((LayoutGroup)val).childAlignment = (TextAnchor)1;
			((HorizontalOrVerticalLayoutGroup)val).childControlHeight = false;
			((HorizontalOrVerticalLayoutGroup)val).childForceExpandHeight = false;
			CreateText(page.transform, "<b>SBG LEAGUE INTEGRATION</b>", SBGL_GREEN, 32f, 50f);
			ButtonClickedEvent onClick = CreateButton(page.transform, "OPEN ACCOUNT SETTINGS", new Color(0.12f, 0.12f, 0.12f), 350f, 45f).GetComponent<Button>().onClick;
			object obj = <>c.<>9__4_0;
			if (obj == null)
			{
				UnityAction val2 = delegate
				{
					Application.OpenURL("https://sbgleague.com/AccountSettings");
				};
				<>c.<>9__4_0 = val2;
				obj = (object)val2;
			}
			((UnityEvent)onClick).AddListener((UnityAction)obj);
			string path = Path.Combine(Paths.PluginPath, "SBGL_PlayerID_Guide.png");
			if (File.Exists(path))
			{
				GameObject val3 = new GameObject("GuideImg", new Type[2]
				{
					typeof(RectTransform),
					typeof(RawImage)
				});
				val3.transform.SetParent(page.transform, false);
				val3.GetComponent<RectTransform>().sizeDelta = new Vector2(475f, 346f);
				((MonoBehaviour)plugin).StartCoroutine(LoadLocalImage(val3.GetComponent<RawImage>(), path));
			}
			GameObject val4 = new GameObject("InputRow", new Type[1] { typeof(RectTransform) });
			val4.transform.SetParent(page.transform, false);
			val4.GetComponent<RectTransform>().sizeDelta = new Vector2(500f, 60f);
			HorizontalLayoutGroup val5 = val4.AddComponent<HorizontalLayoutGroup>();
			((HorizontalOrVerticalLayoutGroup)val5).spacing = 5f;
			((LayoutGroup)val5).childAlignment = (TextAnchor)3;
			((HorizontalOrVerticalLayoutGroup)val5).childControlWidth = false;
			((HorizontalOrVerticalLayoutGroup)val5).childForceExpandWidth = false;
			GameObject val6 = CreateText(val4.transform, "User ID:", Color.black, 22f, 50f);
			((TMP_Text)val6.GetComponent<TextMeshProUGUI>()).alignment = (TextAlignmentOptions)513;
			val6.GetComponent<RectTransform>().sizeDelta = new Vector2(85f, 50f);
			GameObject val7 = new GameObject("IDInputBox", new Type[2]
			{
				typeof(RectTransform),
				typeof(Image)
			});
			val7.transform.SetParent(val4.transform, false);
			((Graphic)val7.GetComponent<Image>()).color = new Color(0.05f, 0.05f, 0.05f, 1f);
			val7.GetComponent<RectTransform>().sizeDelta = new Vector2(300f, 50f);
			GameObject val8 = new GameObject("Text", new Type[1] { typeof(RectTransform) });
			val8.transform.SetParent(val7.transform, false);
			val8.GetComponent<RectTransform>().sizeDelta = new Vector2(280f, 40f);
			TextMeshProUGUI val9 = val8.AddComponent<TextMeshProUGUI>();
			((TMP_Text)val9).fontSize = 20f;
			((Graphic)val9).color = Color.white;
			((TMP_Text)val9).alignment = (TextAlignmentOptions)513;
			TMP_InputField input = val7.AddComponent<TMP_InputField>();
			input.textComponent = (TMP_Text)(object)val9;
			input.text = (((Object)(object)plugin != (Object)null) ? plugin._configPlayerId.Value : "");
			((UnityEvent)CreateButton(page.transform, "SAVE & SYNC PROFILE", new Color(0.1f, 0.6f, 0.45f), 400f, 55f).GetComponent<Button>().onClick).AddListener((UnityAction)delegate
			{
				if ((Object)(object)plugin != (Object)null)
				{
					plugin._configPlayerId.Value = input.text;
					((BaseUnityPlugin)plugin).Config.Save();
					plugin.TriggerManualSync();
				}
			});
		}

		private static GameObject CreateText(Transform p, string c, Color col, float s, float h)
		{
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			//IL_001f: Expected O, but got Unknown
			//IL_003a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0055: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = new GameObject("T", new Type[1] { typeof(RectTransform) });
			val.transform.SetParent(p, false);
			val.GetComponent<RectTransform>().sizeDelta = new Vector2(600f, h);
			TextMeshProUGUI val2 = val.AddComponent<TextMeshProUGUI>();
			((TMP_Text)val2).text = c;
			((Graphic)val2).color = col;
			((TMP_Text)val2).fontSize = s;
			((TMP_Text)val2).alignment = (TextAlignmentOptions)514;
			return val;
		}

		private static GameObject CreateButton(Transform p, string l, Color bg, float w, float h)
		{
			//IL_0033: Unknown result type (might be due to invalid IL or missing references)
			//IL_0039: Expected O, but got Unknown
			//IL_0050: Unknown result type (might be due to invalid IL or missing references)
			//IL_0061: Unknown result type (might be due to invalid IL or missing references)
			//IL_0080: Unknown result type (might be due to invalid IL or missing references)
			//IL_0086: Expected O, but got Unknown
			//IL_00a9: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = new GameObject("B", new Type[3]
			{
				typeof(RectTransform),
				typeof(Image),
				typeof(Button)
			});
			val.transform.SetParent(p, false);
			val.GetComponent<RectTransform>().sizeDelta = new Vector2(w, h);
			((Graphic)val.GetComponent<Image>()).color = bg;
			GameObject val2 = new GameObject("T", new Type[1] { typeof(RectTransform) });
			val2.transform.SetParent(val.transform, false);
			TextMeshProUGUI val3 = val2.AddComponent<TextMeshProUGUI>();
			((TMP_Text)val3).text = l;
			((Graphic)val3).color = Color.white;
			((TMP_Text)val3).fontSize = 18f;
			((TMP_Text)val3).alignment = (TextAlignmentOptions)514;
			return val;
		}

		[IteratorStateMachine(typeof(<LoadLocalImage>d__7))]
		private static IEnumerator LoadLocalImage(RawImage ri, string path)
		{
			//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
			return new <LoadLocalImage>d__7(0)
			{
				ri = ri,
				path = path
			};
		}

		private static void SetupButtonText(GameObject button, string text)
		{
			TMP_Text[] componentsInChildren = button.GetComponentsInChildren<TMP_Text>();
			foreach (TMP_Text val in componentsInChildren)
			{
				val.text = text;
			}
			foreach (Component item in from c in button.GetComponentsInChildren<Component>()
				where ((object)c).GetType().Name.Contains("Localize")
				select c)
			{
				Object.DestroyImmediate((Object)(object)item);
			}
		}
	}
}
namespace System.Runtime.CompilerServices
{
	[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
	internal sealed class IgnoresAccessChecksToAttribute : Attribute
	{
		public IgnoresAccessChecksToAttribute(string assemblyName)
		{
		}
	}
}