Decompiled source of BetterLevelStats v1.0.0

BetterLevelStats.dll

Decompiled 4 days ago
using System;
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Logging;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using PluginConfig.API;
using PluginConfig.API.Fields;
using TMPro;
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: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: AssemblyCompany("BetterLevelStats")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+648c55f3ef87bbf2de83609064437689e96d8d1f")]
[assembly: AssemblyProduct("My first plugin")]
[assembly: AssemblyTitle("BetterLevelStats")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace BetterLevelStats
{
	public class BetterCGStats : MonoBehaviour
	{
		public static BetterCGStats Instance;

		public LevelStats levelStats;

		public StatsManager statsManager;

		public VerticalLayoutGroup thisLayoutGroup;

		public VerticalLayoutGroup parentLayoutGroup;

		public GameObject levelName;

		public GameObject difficulty;

		public GameObject bar;

		public GameObject timeCurrent;

		public GameObject timePB;

		public GameObject waveCurrent;

		public GameObject wavePB;

		public GameObject enemiesLeft;

		public StatCustom killsCurrent;

		public GameObject killsPB;

		public StatCustom styleCurrent;

		public GameObject stylePB;

		public void Awake()
		{
			//IL_0077: Unknown result type (might be due to invalid IL or missing references)
			//IL_00aa: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b4: Expected O, but got Unknown
			//IL_01e7: Unknown result type (might be due to invalid IL or missing references)
			//IL_0220: Unknown result type (might be due to invalid IL or missing references)
			//IL_0259: Unknown result type (might be due to invalid IL or missing references)
			//IL_02dc: Unknown result type (might be due to invalid IL or missing references)
			//IL_0326: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)Instance == (Object)null)
			{
				Instance = this;
				levelStats = ((Component)this).GetComponent<LevelStats>();
				statsManager = MonoSingleton<StatsManager>.Instance;
				parentLayoutGroup = ((Component)((Component)this).transform.parent).gameObject.AddComponent<VerticalLayoutGroup>();
				thisLayoutGroup = ((Component)this).gameObject.AddComponent<VerticalLayoutGroup>();
				((Component)((Component)this).transform.parent).GetComponent<RectTransform>().sizeDelta = new Vector2(285f, 1000f);
				((HorizontalOrVerticalLayoutGroup)parentLayoutGroup).childForceExpandHeight = false;
				((HorizontalOrVerticalLayoutGroup)thisLayoutGroup).childForceExpandHeight = false;
				((LayoutGroup)thisLayoutGroup).padding = new RectOffset(10, 10, 10, 10);
				((HorizontalOrVerticalLayoutGroup)thisLayoutGroup).spacing = 10f;
				levelName = ((Component)((Component)this).transform.Find("Title")).gameObject;
				difficulty = Object.Instantiate<GameObject>(levelName, ((Component)this).transform);
				((Object)difficulty).name = "Difficulty";
				difficulty.transform.MoveAfterSibling(levelName.transform, true);
				difficulty.AddComponent<DifficultyTitle>().lines = true;
				bar = ((Component)((Component)this).transform.Find("Panel")).gameObject;
				bar.AddComponent<LayoutElement>().minHeight = 3f;
				timeCurrent = ((Component)((Component)this).transform.Find("Time Title")).gameObject;
				waveCurrent = ((Component)((Component)this).transform.Find("Kills Title")).gameObject;
				enemiesLeft = ((Component)((Component)this).transform.Find("Style Title")).gameObject;
				((TMP_Text)((Component)timeCurrent.transform.Find("Time")).GetComponent<TextMeshProUGUI>()).margin = new Vector4(0f, 0f, -15f, 0f);
				((TMP_Text)((Component)waveCurrent.transform.Find("Kills")).GetComponent<TextMeshProUGUI>()).margin = new Vector4(0f, 0f, -15f, 0f);
				((TMP_Text)((Component)enemiesLeft.transform.Find("Style")).GetComponent<TextMeshProUGUI>()).margin = new Vector4(0f, 0f, -15f, 0f);
				CyberRankData bestCyber = GameProgressSaver.GetBestCyber();
				int @int = MonoSingleton<PrefsManager>.Instance.GetInt("difficulty", 0);
				timePB = Object.Instantiate<GameObject>(timeCurrent, ((Component)this).transform);
				((Object)timePB).name = "Time (Personal Best)";
				TextMeshProUGUI component = timePB.GetComponent<TextMeshProUGUI>();
				((TMP_Text)component).fontSize = 18f;
				((TMP_Text)component).text = "BEST TIME:";
				((Graphic)component).color = new Color(0.6f, 0.6f, 0.6f, 0.5f);
				TextMeshProUGUI component2 = ((Component)timePB.transform.Find("Time")).GetComponent<TextMeshProUGUI>();
				((TMP_Text)component2).fontSize = 18f;
				((Graphic)component2).color = new Color(1f, 1f, 1f, 0.5f);
				((TMP_Text)component2).text = GetTimeStringFromFloat(bestCyber.time[@int]);
				timePB.transform.MoveAfterSibling(timeCurrent.transform, true);
				wavePB = Object.Instantiate<GameObject>(timePB, ((Component)this).transform);
				((Object)wavePB).name = "Wave (Personal Best)";
				((TMP_Text)wavePB.GetComponent<TextMeshProUGUI>()).text = "BEST WAVE:";
				((TMP_Text)((Component)wavePB.transform.Find("Time")).GetComponent<TextMeshProUGUI>()).text = ((int)bestCyber.preciseWavesByDifficulty[@int]).ToString();
				wavePB.transform.MoveAfterSibling(waveCurrent.transform, true);
				GameObject val = Object.Instantiate<GameObject>(waveCurrent, ((Component)this).transform);
				((Object)val).name = "Kills";
				killsCurrent = val.AddComponent<StatCustom>();
				killsCurrent.Init(((Component)killsCurrent).GetComponent<TextMeshProUGUI>(), ((Component)((Component)killsCurrent).transform.Find("Kills")).GetComponent<TextMeshProUGUI>());
				killsCurrent.SetDesc("KILLS:");
				val.transform.MoveAfterSibling(timePB.transform, true);
				killsPB = Object.Instantiate<GameObject>(timePB, ((Component)this).transform);
				((Object)killsPB).name = "Kills (Personal Best)";
				((TMP_Text)killsPB.GetComponent<TextMeshProUGUI>()).text = "BEST KILLS:";
				((TMP_Text)((Component)killsPB.transform.Find("Time")).GetComponent<TextMeshProUGUI>()).text = bestCyber.kills[@int].ToString();
				killsPB.transform.MoveAfterSibling(val.transform, true);
				GameObject val2 = Object.Instantiate<GameObject>(waveCurrent, ((Component)this).transform);
				((Object)val2).name = "Style";
				styleCurrent = val2.AddComponent<StatCustom>();
				styleCurrent.Init(((Component)styleCurrent).GetComponent<TextMeshProUGUI>(), ((Component)((Component)styleCurrent).transform.Find("Kills")).GetComponent<TextMeshProUGUI>());
				styleCurrent.SetDesc("STYLE:");
				val2.transform.MoveAfterSibling(killsPB.transform, true);
				stylePB = Object.Instantiate<GameObject>(timePB, ((Component)this).transform);
				((Object)stylePB).name = "Style (Personal Best)";
				((TMP_Text)stylePB.GetComponent<TextMeshProUGUI>()).text = "BEST STYLE:";
				((TMP_Text)((Component)stylePB.transform.Find("Time")).GetComponent<TextMeshProUGUI>()).text = bestCyber.style[@int].ToString();
				stylePB.transform.MoveAfterSibling(val2.transform, true);
				ShowName(ConfigManager.showCGName.value);
				ShowDifficulty(ConfigManager.showCGDifficulty.value);
				ShowTime(ConfigManager.showCGTime.value);
				ShowKills(ConfigManager.showCGKills.value);
				ShowStyle(ConfigManager.showCGStyle.value);
				ShowWave(ConfigManager.showCGWave.value);
				ShowEnemiesLeft(ConfigManager.showCGEnemiesLeft.value);
				ShowBests(ConfigManager.showCGBests.value);
			}
			else
			{
				Object.DestroyImmediate((Object)(object)this);
			}
		}

		public void Update()
		{
			if (Object.op_Implicit((Object)(object)killsCurrent) && ((Component)killsCurrent).gameObject.activeSelf)
			{
				killsCurrent.SetValue(statsManager.kills.ToString());
			}
			if (Object.op_Implicit((Object)(object)styleCurrent) && ((Component)styleCurrent).gameObject.activeSelf)
			{
				styleCurrent.SetValue(statsManager.stylePoints.ToString());
			}
		}

		public void ShowName(bool value)
		{
			if (value)
			{
				levelName.SetActive(true);
				bar.SetActive(true);
				return;
			}
			levelName.SetActive(false);
			if (!difficulty.activeSelf)
			{
				bar.SetActive(false);
			}
		}

		public void ShowDifficulty(bool value)
		{
			if (value)
			{
				difficulty.SetActive(true);
				bar.SetActive(true);
				return;
			}
			difficulty.SetActive(false);
			if (!levelName.activeSelf)
			{
				bar.SetActive(false);
			}
		}

		public void ShowBests(bool value)
		{
			if (value)
			{
				timePB.SetActive(timeCurrent.activeSelf);
				killsPB.SetActive(((Component)killsCurrent).gameObject.activeSelf);
				stylePB.SetActive(((Component)styleCurrent).gameObject.activeSelf);
				wavePB.SetActive(waveCurrent.activeSelf);
			}
			else
			{
				timePB.SetActive(false);
				killsPB.SetActive(false);
				stylePB.SetActive(false);
				wavePB.SetActive(false);
			}
		}

		public void ShowTime(bool value)
		{
			if (value)
			{
				timeCurrent.SetActive(true);
				ShowBests(ConfigManager.showCGBests.value);
			}
			else
			{
				timeCurrent.SetActive(false);
				timePB.SetActive(false);
			}
		}

		public void ShowKills(bool value)
		{
			if (value)
			{
				((Component)killsCurrent).gameObject.SetActive(true);
				ShowBests(ConfigManager.showCGBests.value);
			}
			else
			{
				((Component)killsCurrent).gameObject.SetActive(false);
				killsPB.SetActive(false);
			}
		}

		public void ShowStyle(bool value)
		{
			if (value)
			{
				((Component)styleCurrent).gameObject.SetActive(true);
				ShowBests(ConfigManager.showCGBests.value);
			}
			else
			{
				((Component)styleCurrent).gameObject.SetActive(false);
				stylePB.SetActive(false);
			}
		}

		public void ShowWave(bool value)
		{
			if (value)
			{
				waveCurrent.SetActive(true);
				ShowBests(ConfigManager.showCGBests.value);
			}
			else
			{
				waveCurrent.SetActive(false);
				wavePB.SetActive(false);
			}
		}

		public void ShowEnemiesLeft(bool value)
		{
			enemiesLeft.SetActive(value);
		}

		public string GetTimeStringFromFloat(float value)
		{
			int num = (int)value / 60;
			return $"{num}:" + (value - (float)(num * 60)).ToString("00.000");
		}
	}
	public class BetterLevelStats : MonoBehaviour
	{
		public static BetterLevelStats Instance;

		public LevelStats levelStats;

		public VerticalLayoutGroup thisLayoutGroup;

		public VerticalLayoutGroup parentLayoutGroup;

		public GameObject levelName;

		public GameObject difficulty;

		public GameObject bar;

		public GameObject timeCurrent;

		public StatRequirement timeS;

		public StatRequirement timeA;

		public StatRequirement timeB;

		public StatRequirement timeC;

		public StatRequirement timeNextBest;

		public GameObject killsCurrent;

		public StatRequirement killsS;

		public StatRequirement killsA;

		public StatRequirement killsB;

		public StatRequirement killsC;

		public StatRequirement killsNextBest;

		public GameObject styleCurrent;

		public StatRequirement styleS;

		public StatRequirement styleA;

		public StatRequirement styleB;

		public StatRequirement styleC;

		public StatRequirement styleNextBest;

		public GameObject secrets;

		public GameObject challengeCurrent;

		public GameObject assists;

		public StatCustom restarts;

		public StatCustom finalRank;

		public RankRequirement NextBestTime
		{
			get
			{
				float seconds = MonoSingleton<StatsManager>.Instance.seconds;
				for (int num = 3; num >= 0; num--)
				{
					if (seconds < (float)MonoSingleton<StatsManager>.Instance.timeRanks[num])
					{
						return new RankRequirement((Ranks)(num + 1), MonoSingleton<StatsManager>.Instance.timeRanks[num]);
					}
				}
				return new RankRequirement(Ranks.D, 0);
			}
		}

		public RankRequirement NextBestKills
		{
			get
			{
				int kills = MonoSingleton<StatsManager>.Instance.kills;
				for (int i = 0; i <= 3; i++)
				{
					if (kills < MonoSingleton<StatsManager>.Instance.killRanks[i])
					{
						return new RankRequirement((Ranks)(i + 1), MonoSingleton<StatsManager>.Instance.killRanks[i]);
					}
				}
				return new RankRequirement(Ranks.S, MonoSingleton<StatsManager>.Instance.killRanks[3]);
			}
		}

		public RankRequirement NextBestStyle
		{
			get
			{
				int stylePoints = MonoSingleton<StatsManager>.Instance.stylePoints;
				for (int i = 0; i <= 3; i++)
				{
					if (stylePoints < MonoSingleton<StatsManager>.Instance.styleRanks[i])
					{
						return new RankRequirement((Ranks)(i + 1), MonoSingleton<StatsManager>.Instance.styleRanks[i]);
					}
				}
				return new RankRequirement(Ranks.S, MonoSingleton<StatsManager>.Instance.styleRanks[3]);
			}
		}

		public string FinalRank
		{
			get
			{
				//IL_0014: Unknown result type (might be due to invalid IL or missing references)
				//IL_0135: Unknown result type (might be due to invalid IL or missing references)
				//IL_01c0: Unknown result type (might be due to invalid IL or missing references)
				//IL_01a1: Unknown result type (might be due to invalid IL or missing references)
				//IL_020e: Unknown result type (might be due to invalid IL or missing references)
				//IL_01ef: Unknown result type (might be due to invalid IL or missing references)
				//IL_025c: Unknown result type (might be due to invalid IL or missing references)
				//IL_023d: Unknown result type (might be due to invalid IL or missing references)
				//IL_02a7: Unknown result type (might be due to invalid IL or missing references)
				//IL_028b: Unknown result type (might be due to invalid IL or missing references)
				//IL_02ef: 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)
				if (MonoSingleton<AssistController>.Instance.cheatsEnabled)
				{
					return "<color=#" + ColorUtility.ToHtmlStringRGBA(Colors.Cheat) + ">-</color>";
				}
				int num = 0;
				for (int i = 0; i <= 3; i++)
				{
					if (MonoSingleton<StatsManager>.Instance.seconds < (float)MonoSingleton<StatsManager>.Instance.timeRanks[i])
					{
						num++;
					}
				}
				for (int j = 0; j <= 3; j++)
				{
					if (MonoSingleton<StatsManager>.Instance.kills >= MonoSingleton<StatsManager>.Instance.killRanks[j])
					{
						num++;
					}
				}
				for (int k = 0; k <= 3; k++)
				{
					if (MonoSingleton<StatsManager>.Instance.stylePoints >= MonoSingleton<StatsManager>.Instance.styleRanks[k])
					{
						num++;
					}
				}
				num -= MonoSingleton<StatsManager>.Instance.restarts;
				if (num < 0)
				{
					num = 0;
				}
				if (num == 12 && MonoSingleton<StatsManager>.Instance.majorUsed)
				{
					num = 11;
				}
				if (num == 12)
				{
					return "<color=#" + ColorUtility.ToHtmlStringRGBA(Colors.P) + ">P</color>";
				}
				float num2 = (float)num / 3f;
				switch (Mathf.RoundToInt(num2))
				{
				case 1:
					if (MonoSingleton<StatsManager>.Instance.majorUsed)
					{
						return "<color=#" + ColorUtility.ToHtmlStringRGBA(Colors.Assist) + ">C</color>*";
					}
					return "<color=#" + ColorUtility.ToHtmlStringRGBA(Colors.C) + ">C</color>";
				case 2:
					if (MonoSingleton<StatsManager>.Instance.majorUsed)
					{
						return "<color=#" + ColorUtility.ToHtmlStringRGBA(Colors.Assist) + ">B</color>*";
					}
					return "<color=#" + ColorUtility.ToHtmlStringRGBA(Colors.B) + ">B</color>";
				case 3:
					if (MonoSingleton<StatsManager>.Instance.majorUsed)
					{
						return "<color=#" + ColorUtility.ToHtmlStringRGBA(Colors.Assist) + ">A</color>*";
					}
					return "<color=#" + ColorUtility.ToHtmlStringRGBA(Colors.A) + ">A</color>";
				case 4:
				case 5:
				case 6:
					if (MonoSingleton<StatsManager>.Instance.majorUsed)
					{
						return "<color=#" + ColorUtility.ToHtmlStringRGBA(Colors.Assist) + ">S</color>*";
					}
					return "<color=#" + ColorUtility.ToHtmlStringRGBA(Colors.S) + ">S</color>";
				default:
					if (MonoSingleton<StatsManager>.Instance.majorUsed)
					{
						return "<color=#" + ColorUtility.ToHtmlStringRGBA(Colors.Assist) + ">D</color>*";
					}
					return "<color=#" + ColorUtility.ToHtmlStringRGBA(Colors.D) + ">D</color>";
				}
			}
		}

		public void Awake()
		{
			//IL_006c: Unknown result type (might be due to invalid IL or missing references)
			//IL_009f: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a9: Expected O, but got Unknown
			//IL_022d: Unknown result type (might be due to invalid IL or missing references)
			//IL_028b: Unknown result type (might be due to invalid IL or missing references)
			//IL_02e9: Unknown result type (might be due to invalid IL or missing references)
			//IL_0437: Unknown result type (might be due to invalid IL or missing references)
			//IL_0470: Unknown result type (might be due to invalid IL or missing references)
			//IL_04e2: Unknown result type (might be due to invalid IL or missing references)
			//IL_0532: Unknown result type (might be due to invalid IL or missing references)
			//IL_069e: Unknown result type (might be due to invalid IL or missing references)
			//IL_06c6: Unknown result type (might be due to invalid IL or missing references)
			//IL_06ee: Unknown result type (might be due to invalid IL or missing references)
			//IL_0716: Unknown result type (might be due to invalid IL or missing references)
			//IL_073e: Unknown result type (might be due to invalid IL or missing references)
			//IL_08a2: Unknown result type (might be due to invalid IL or missing references)
			//IL_08cd: Unknown result type (might be due to invalid IL or missing references)
			//IL_08f8: Unknown result type (might be due to invalid IL or missing references)
			//IL_0923: Unknown result type (might be due to invalid IL or missing references)
			//IL_094e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0ab2: Unknown result type (might be due to invalid IL or missing references)
			//IL_0add: Unknown result type (might be due to invalid IL or missing references)
			//IL_0b08: Unknown result type (might be due to invalid IL or missing references)
			//IL_0b33: Unknown result type (might be due to invalid IL or missing references)
			//IL_0b5e: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)Instance == (Object)null)
			{
				Instance = this;
				levelStats = ((Component)this).GetComponent<LevelStats>();
				parentLayoutGroup = ((Component)((Component)this).transform.parent).gameObject.AddComponent<VerticalLayoutGroup>();
				thisLayoutGroup = ((Component)this).gameObject.AddComponent<VerticalLayoutGroup>();
				((Component)((Component)this).transform.parent).GetComponent<RectTransform>().sizeDelta = new Vector2(285f, 1000f);
				((HorizontalOrVerticalLayoutGroup)parentLayoutGroup).childForceExpandHeight = false;
				((HorizontalOrVerticalLayoutGroup)thisLayoutGroup).childForceExpandHeight = false;
				((LayoutGroup)thisLayoutGroup).padding = new RectOffset(10, 10, 10, 10);
				((HorizontalOrVerticalLayoutGroup)thisLayoutGroup).spacing = 10f;
				levelName = ((Component)((Component)this).transform.Find("Title")).gameObject;
				difficulty = Object.Instantiate<GameObject>(levelName, ((Component)this).transform);
				((Object)difficulty).name = "Difficulty";
				difficulty.transform.MoveAfterSibling(levelName.transform, true);
				difficulty.AddComponent<DifficultyTitle>().lines = true;
				bar = ((Component)((Component)this).transform.Find("Panel")).gameObject;
				bar.AddComponent<LayoutElement>().minHeight = 3f;
				timeCurrent = ((Component)((Component)this).transform.Find("Time Title")).gameObject;
				killsCurrent = ((Component)((Component)this).transform.Find("Kills Title")).gameObject;
				styleCurrent = ((Component)((Component)this).transform.Find("Style Title")).gameObject;
				secrets = ((Component)((Component)this).transform.Find("Secrets Title")).gameObject;
				challengeCurrent = ((Component)((Component)this).transform.Find("Challenge Title")).gameObject;
				assists = ((Component)((Component)this).transform.Find("Assists Title")).gameObject;
				((TMP_Text)((Component)timeCurrent.transform.Find("Time")).GetComponent<TextMeshProUGUI>()).margin = new Vector4(0f, 0f, -15f, 0f);
				((TMP_Text)((Component)timeCurrent.transform.Find("Time Rank")).GetComponent<TextMeshProUGUI>()).alignment = (TextAlignmentOptions)516;
				((TMP_Text)((Component)killsCurrent.transform.Find("Kills")).GetComponent<TextMeshProUGUI>()).margin = new Vector4(0f, 0f, -15f, 0f);
				((TMP_Text)((Component)killsCurrent.transform.Find("Kills Rank")).GetComponent<TextMeshProUGUI>()).alignment = (TextAlignmentOptions)516;
				((TMP_Text)((Component)styleCurrent.transform.Find("Style")).GetComponent<TextMeshProUGUI>()).margin = new Vector4(0f, 0f, -15f, 0f);
				((TMP_Text)((Component)styleCurrent.transform.Find("Style Rank")).GetComponent<TextMeshProUGUI>()).alignment = (TextAlignmentOptions)516;
				((Transform)((Component)secrets.transform.Find("Secret 1")).GetComponent<RectTransform>()).Translate(20f, 0f, 0f, (Space)1);
				((Transform)((Component)secrets.transform.Find("Secret 2")).GetComponent<RectTransform>()).Translate(20f, 0f, 0f, (Space)1);
				((Transform)((Component)secrets.transform.Find("Secret 3")).GetComponent<RectTransform>()).Translate(20f, 0f, 0f, (Space)1);
				((Transform)((Component)secrets.transform.Find("Secret 4")).GetComponent<RectTransform>()).Translate(20f, 0f, 0f, (Space)1);
				((Transform)((Component)secrets.transform.Find("Secret 5")).GetComponent<RectTransform>()).Translate(20f, 0f, 0f, (Space)1);
				((TMP_Text)((Component)challengeCurrent.transform.Find("Challenge")).GetComponent<TextMeshProUGUI>()).margin = new Vector4(0f, 0f, -15f, 0f);
				((TMP_Text)((Component)assists.transform.Find("Assists")).GetComponent<TextMeshProUGUI>()).margin = new Vector4(0f, 0f, -15f, 0f);
				GameObject val = Object.Instantiate<GameObject>(timeCurrent, ((Component)this).transform);
				((Object)val).name = "Time (S)";
				Object.Destroy((Object)(object)val.GetComponent<TextMeshProUGUI>());
				val.AddComponent<LayoutElement>().minHeight = 8f;
				TextMeshProUGUI[] componentsInChildren = val.GetComponentsInChildren<TextMeshProUGUI>();
				foreach (TextMeshProUGUI val2 in componentsInChildren)
				{
					((Graphic)val2).color = new Color(1f, 1f, 1f, 0.5f);
					((TMP_Text)val2).fontSize = 18f;
				}
				((TMP_Text)((Component)val.transform.Find("Time Rank")).GetComponent<TextMeshProUGUI>()).margin = new Vector4(0f, 0f, 2f, 0f);
				val.transform.MoveAfterSibling(timeCurrent.transform, true);
				timeS = val.AddComponent<StatRequirement>();
				timeS.Init(((Component)val.transform.Find("Time")).GetComponent<TextMeshProUGUI>(), ((Component)val.transform.Find("Time Rank")).GetComponent<TextMeshProUGUI>());
				GameObject val3 = Object.Instantiate<GameObject>(val, ((Component)this).transform);
				((Object)val3).name = "Time (A)";
				val3.transform.MoveAfterSibling(val.transform, true);
				timeA = val3.GetComponent<StatRequirement>();
				GameObject val4 = Object.Instantiate<GameObject>(val3, ((Component)this).transform);
				((Object)val4).name = "Time (B)";
				val4.transform.MoveAfterSibling(val3.transform, true);
				timeB = val4.GetComponent<StatRequirement>();
				GameObject val5 = Object.Instantiate<GameObject>(val4, ((Component)this).transform);
				((Object)val5).name = "Time (C)";
				val5.transform.MoveAfterSibling(val4.transform, true);
				timeC = val5.GetComponent<StatRequirement>();
				GameObject val6 = Object.Instantiate<GameObject>(val5, ((Component)this).transform);
				((Object)val6).name = "Time (Next Best)";
				val6.transform.MoveAfterSibling(val5.transform, true);
				timeNextBest = val6.GetComponent<StatRequirement>();
				timeS.SetText(GetTimeStringFromInt(MonoSingleton<StatsManager>.Instance.timeRanks[3]), "S", Colors.S);
				timeA.SetText(GetTimeStringFromInt(MonoSingleton<StatsManager>.Instance.timeRanks[2]), "A", Colors.A);
				timeB.SetText(GetTimeStringFromInt(MonoSingleton<StatsManager>.Instance.timeRanks[1]), "B", Colors.B);
				timeC.SetText(GetTimeStringFromInt(MonoSingleton<StatsManager>.Instance.timeRanks[0]), "C", Colors.C);
				timeNextBest.SetText(GetTimeStringFromInt(MonoSingleton<StatsManager>.Instance.timeRanks[3]), "S", Colors.S);
				GameObject val7 = Object.Instantiate<GameObject>(val, ((Component)this).transform);
				((Object)val7).name = "Kills (S)";
				val7.transform.MoveAfterSibling(killsCurrent.transform, true);
				killsS = val7.GetComponent<StatRequirement>();
				GameObject val8 = Object.Instantiate<GameObject>(val7, ((Component)this).transform);
				((Object)val8).name = "Kills (A)";
				val8.transform.MoveAfterSibling(val7.transform, true);
				killsA = val8.GetComponent<StatRequirement>();
				GameObject val9 = Object.Instantiate<GameObject>(val8, ((Component)this).transform);
				((Object)val9).name = "Kills (B)";
				val9.transform.MoveAfterSibling(val8.transform, true);
				killsB = val9.GetComponent<StatRequirement>();
				GameObject val10 = Object.Instantiate<GameObject>(val9, ((Component)this).transform);
				((Object)val10).name = "Kills (C)";
				val10.transform.MoveAfterSibling(val9.transform, true);
				killsC = val10.GetComponent<StatRequirement>();
				GameObject val11 = Object.Instantiate<GameObject>(val10, ((Component)this).transform);
				((Object)val11).name = "Kills (Next Best)";
				val11.transform.MoveAfterSibling(val10.transform, true);
				killsNextBest = val11.GetComponent<StatRequirement>();
				killsS.SetText(MonoSingleton<StatsManager>.Instance.killRanks[3].ToString(), "S", Colors.S);
				killsA.SetText(MonoSingleton<StatsManager>.Instance.killRanks[2].ToString(), "A", Colors.A);
				killsB.SetText(MonoSingleton<StatsManager>.Instance.killRanks[1].ToString(), "B", Colors.B);
				killsC.SetText(MonoSingleton<StatsManager>.Instance.killRanks[0].ToString(), "C", Colors.C);
				killsNextBest.SetText(MonoSingleton<StatsManager>.Instance.killRanks[0].ToString(), "C", Colors.C);
				GameObject val12 = Object.Instantiate<GameObject>(val, ((Component)this).transform);
				((Object)val12).name = "Style (S)";
				val12.transform.MoveAfterSibling(styleCurrent.transform, true);
				styleS = val12.GetComponent<StatRequirement>();
				GameObject val13 = Object.Instantiate<GameObject>(val12, ((Component)this).transform);
				((Object)val13).name = "Style (A)";
				val13.transform.MoveAfterSibling(val12.transform, true);
				styleA = val13.GetComponent<StatRequirement>();
				GameObject val14 = Object.Instantiate<GameObject>(val13, ((Component)this).transform);
				((Object)val14).name = "Style (B)";
				val14.transform.MoveAfterSibling(val13.transform, true);
				styleB = val14.GetComponent<StatRequirement>();
				GameObject val15 = Object.Instantiate<GameObject>(val14, ((Component)this).transform);
				((Object)val15).name = "Style (C)";
				val15.transform.MoveAfterSibling(val14.transform, true);
				styleC = val15.GetComponent<StatRequirement>();
				GameObject val16 = Object.Instantiate<GameObject>(val15, ((Component)this).transform);
				((Object)val16).name = "Style (Next Best)";
				val16.transform.MoveAfterSibling(val15.transform, true);
				styleNextBest = val16.GetComponent<StatRequirement>();
				styleS.SetText(MonoSingleton<StatsManager>.Instance.styleRanks[3].ToString(), "S", Colors.S);
				styleA.SetText(MonoSingleton<StatsManager>.Instance.styleRanks[2].ToString(), "A", Colors.A);
				styleB.SetText(MonoSingleton<StatsManager>.Instance.styleRanks[1].ToString(), "B", Colors.B);
				styleC.SetText(MonoSingleton<StatsManager>.Instance.styleRanks[0].ToString(), "C", Colors.C);
				styleNextBest.SetText(MonoSingleton<StatsManager>.Instance.styleRanks[0].ToString(), "C", Colors.C);
				GameObject val17 = Object.Instantiate<GameObject>(assists, ((Component)this).transform);
				((Object)val17).name = "Restarts Title";
				restarts = val17.AddComponent<StatCustom>();
				restarts.Init(val17.GetComponent<TextMeshProUGUI>(), ((Component)val17.transform.GetChild(0)).GetComponent<TextMeshProUGUI>());
				restarts.SetDesc("RESTARTS:");
				restarts.SetValue("0");
				GameObject val18 = Object.Instantiate<GameObject>(val17, ((Component)this).transform);
				((Object)val18).name = "Final Rank Title";
				finalRank = val18.GetComponent<StatCustom>();
				((TMP_Text)finalRank.statValue).alignment = (TextAlignmentOptions)516;
				finalRank.SetDesc("FINAL RANK:");
				finalRank.SetValue(FinalRank);
				ChangeMode(ConfigManager.levelMode.value);
				if (ConfigManager.levelMode.value == RankMode.SingleRank)
				{
					ChangeTargetRank(ConfigManager.targetRank.value);
				}
				ShowName(ConfigManager.showLevelName.value);
				ShowDifficulty(ConfigManager.showLevelDifficulty.value);
				ShowSecrets(ConfigManager.showLevelSecrets.value);
				ShowChallenge(ConfigManager.showLevelChallenge.value);
				assists.SetActive(ConfigManager.showLevelAssists.value);
				((Component)restarts).gameObject.SetActive(ConfigManager.showLevelRestarts.value);
				((Component)finalRank).gameObject.SetActive(ConfigManager.showLevelFinalRank.value);
			}
			else
			{
				Object.DestroyImmediate((Object)(object)this);
			}
		}

		public void Update()
		{
			//IL_00b2: 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_0120: Unknown result type (might be due to invalid IL or missing references)
			//IL_0190: Unknown result type (might be due to invalid IL or missing references)
			if (Object.op_Implicit((Object)(object)timeNextBest) && ((Component)timeNextBest).gameObject.activeSelf)
			{
				if (NextBestTime.Rank == Ranks.D)
				{
					timeNextBest.SetText("-", NextBestTime.Rank.ToString(), Colors.GetRankColor(NextBestTime.Rank));
				}
				else
				{
					timeNextBest.SetText(GetTimeStringFromInt(NextBestTime.Value), NextBestTime.Rank.ToString(), Colors.GetRankColor(NextBestTime.Rank));
				}
			}
			if (Object.op_Implicit((Object)(object)killsNextBest) && ((Component)killsNextBest).gameObject.activeSelf)
			{
				killsNextBest.SetText(NextBestKills.Value.ToString(), NextBestKills.Rank.ToString(), Colors.GetRankColor(NextBestKills.Rank));
			}
			if (Object.op_Implicit((Object)(object)styleNextBest) && ((Component)styleNextBest).gameObject.activeSelf)
			{
				styleNextBest.SetText(NextBestStyle.Value.ToString(), NextBestStyle.Rank.ToString(), Colors.GetRankColor(NextBestStyle.Rank));
			}
			if (Object.op_Implicit((Object)(object)restarts) && ((Component)restarts).gameObject.activeSelf)
			{
				if (MonoSingleton<StatsManager>.Instance.restarts > 0)
				{
					restarts.SetValue($"<color=red>{MonoSingleton<StatsManager>.Instance.restarts}</color>");
				}
				else
				{
					restarts.SetValue("0");
				}
			}
			if (Object.op_Implicit((Object)(object)finalRank) && ((Component)finalRank).gameObject.activeSelf)
			{
				finalRank.SetValue(FinalRank);
			}
		}

		public void ChangeMode(RankMode mode)
		{
			switch (mode)
			{
			case RankMode.AllRanks:
				if (ConfigManager.showLevelTime.value)
				{
					((Component)timeS).gameObject.SetActive(true);
					((Component)timeA).gameObject.SetActive(true);
					((Component)timeB).gameObject.SetActive(true);
					((Component)timeC).gameObject.SetActive(true);
					((Component)timeNextBest).gameObject.SetActive(false);
				}
				if (ConfigManager.showLevelKills.value)
				{
					((Component)killsS).gameObject.SetActive(true);
					((Component)killsA).gameObject.SetActive(true);
					((Component)killsB).gameObject.SetActive(true);
					((Component)killsC).gameObject.SetActive(true);
					((Component)killsNextBest).gameObject.SetActive(false);
				}
				if (ConfigManager.showLevelStyle.value)
				{
					((Component)styleS).gameObject.SetActive(true);
					((Component)styleA).gameObject.SetActive(true);
					((Component)styleB).gameObject.SetActive(true);
					((Component)styleC).gameObject.SetActive(true);
					((Component)styleNextBest).gameObject.SetActive(false);
				}
				break;
			case RankMode.SingleRank:
				ChangeTargetRank(ConfigManager.targetRank.value);
				break;
			case RankMode.NextBest:
				if (ConfigManager.showLevelTime.value)
				{
					((Component)timeS).gameObject.SetActive(false);
					((Component)timeA).gameObject.SetActive(false);
					((Component)timeB).gameObject.SetActive(false);
					((Component)timeC).gameObject.SetActive(false);
					((Component)timeNextBest).gameObject.SetActive(true);
				}
				if (ConfigManager.showLevelKills.value)
				{
					((Component)killsS).gameObject.SetActive(false);
					((Component)killsA).gameObject.SetActive(false);
					((Component)killsB).gameObject.SetActive(false);
					((Component)killsC).gameObject.SetActive(false);
					((Component)killsNextBest).gameObject.SetActive(true);
				}
				if (ConfigManager.showLevelStyle.value)
				{
					((Component)styleS).gameObject.SetActive(false);
					((Component)styleA).gameObject.SetActive(false);
					((Component)styleB).gameObject.SetActive(false);
					((Component)styleC).gameObject.SetActive(false);
					((Component)styleNextBest).gameObject.SetActive(true);
				}
				break;
			case RankMode.None:
				((Component)timeS).gameObject.SetActive(false);
				((Component)timeA).gameObject.SetActive(false);
				((Component)timeB).gameObject.SetActive(false);
				((Component)timeC).gameObject.SetActive(false);
				((Component)timeNextBest).gameObject.SetActive(false);
				((Component)killsS).gameObject.SetActive(false);
				((Component)killsA).gameObject.SetActive(false);
				((Component)killsB).gameObject.SetActive(false);
				((Component)killsC).gameObject.SetActive(false);
				((Component)killsNextBest).gameObject.SetActive(false);
				((Component)styleS).gameObject.SetActive(false);
				((Component)styleA).gameObject.SetActive(false);
				((Component)styleB).gameObject.SetActive(false);
				((Component)styleC).gameObject.SetActive(false);
				((Component)styleNextBest).gameObject.SetActive(false);
				break;
			}
		}

		public void ChangeTargetRank(TargetRank targetRank)
		{
			if (ConfigManager.targetRank.value == TargetRank.S)
			{
				if (ConfigManager.showLevelTime.value)
				{
					((Component)timeS).gameObject.SetActive(true);
					((Component)timeA).gameObject.SetActive(false);
					((Component)timeB).gameObject.SetActive(false);
					((Component)timeC).gameObject.SetActive(false);
					((Component)timeNextBest).gameObject.SetActive(false);
				}
				if (ConfigManager.showLevelKills.value)
				{
					((Component)killsS).gameObject.SetActive(true);
					((Component)killsA).gameObject.SetActive(false);
					((Component)killsB).gameObject.SetActive(false);
					((Component)killsC).gameObject.SetActive(false);
					((Component)killsNextBest).gameObject.SetActive(false);
				}
				if (ConfigManager.showLevelStyle.value)
				{
					((Component)styleS).gameObject.SetActive(true);
					((Component)styleA).gameObject.SetActive(false);
					((Component)styleB).gameObject.SetActive(false);
					((Component)styleC).gameObject.SetActive(false);
					((Component)styleNextBest).gameObject.SetActive(false);
				}
			}
			else if (ConfigManager.targetRank.value == TargetRank.A)
			{
				if (ConfigManager.showLevelTime.value)
				{
					((Component)timeS).gameObject.SetActive(false);
					((Component)timeA).gameObject.SetActive(true);
					((Component)timeB).gameObject.SetActive(false);
					((Component)timeC).gameObject.SetActive(false);
					((Component)timeNextBest).gameObject.SetActive(false);
				}
				if (ConfigManager.showLevelKills.value)
				{
					((Component)killsS).gameObject.SetActive(false);
					((Component)killsA).gameObject.SetActive(true);
					((Component)killsB).gameObject.SetActive(false);
					((Component)killsC).gameObject.SetActive(false);
					((Component)killsNextBest).gameObject.SetActive(false);
				}
				if (ConfigManager.showLevelStyle.value)
				{
					((Component)styleS).gameObject.SetActive(false);
					((Component)styleA).gameObject.SetActive(true);
					((Component)styleB).gameObject.SetActive(false);
					((Component)styleC).gameObject.SetActive(false);
					((Component)styleNextBest).gameObject.SetActive(false);
				}
			}
			else if (ConfigManager.targetRank.value == TargetRank.B)
			{
				if (ConfigManager.showLevelTime.value)
				{
					((Component)timeS).gameObject.SetActive(false);
					((Component)timeA).gameObject.SetActive(false);
					((Component)timeB).gameObject.SetActive(true);
					((Component)timeC).gameObject.SetActive(false);
					((Component)timeNextBest).gameObject.SetActive(false);
				}
				if (ConfigManager.showLevelKills.value)
				{
					((Component)killsS).gameObject.SetActive(false);
					((Component)killsA).gameObject.SetActive(false);
					((Component)killsB).gameObject.SetActive(true);
					((Component)killsC).gameObject.SetActive(false);
					((Component)killsNextBest).gameObject.SetActive(false);
				}
				if (ConfigManager.showLevelStyle.value)
				{
					((Component)styleS).gameObject.SetActive(false);
					((Component)styleA).gameObject.SetActive(false);
					((Component)styleB).gameObject.SetActive(true);
					((Component)styleC).gameObject.SetActive(false);
					((Component)styleNextBest).gameObject.SetActive(false);
				}
			}
			else if (ConfigManager.targetRank.value == TargetRank.C)
			{
				if (ConfigManager.showLevelTime.value)
				{
					((Component)timeS).gameObject.SetActive(false);
					((Component)timeA).gameObject.SetActive(false);
					((Component)timeB).gameObject.SetActive(false);
					((Component)timeC).gameObject.SetActive(true);
					((Component)timeNextBest).gameObject.SetActive(false);
				}
				if (ConfigManager.showLevelKills.value)
				{
					((Component)killsS).gameObject.SetActive(false);
					((Component)killsA).gameObject.SetActive(false);
					((Component)killsB).gameObject.SetActive(false);
					((Component)killsC).gameObject.SetActive(true);
					((Component)killsNextBest).gameObject.SetActive(false);
				}
				if (ConfigManager.showLevelStyle.value)
				{
					((Component)styleS).gameObject.SetActive(false);
					((Component)styleA).gameObject.SetActive(false);
					((Component)styleB).gameObject.SetActive(false);
					((Component)styleC).gameObject.SetActive(true);
					((Component)styleNextBest).gameObject.SetActive(false);
				}
			}
		}

		public void ShowName(bool value)
		{
			if (value)
			{
				levelName.SetActive(true);
				bar.SetActive(true);
				return;
			}
			levelName.SetActive(false);
			if (!difficulty.activeSelf)
			{
				bar.SetActive(false);
			}
		}

		public void ShowDifficulty(bool value)
		{
			if (value)
			{
				difficulty.SetActive(true);
				bar.SetActive(true);
				return;
			}
			difficulty.SetActive(false);
			if (!levelName.activeSelf)
			{
				bar.SetActive(false);
			}
		}

		public void ShowTime(bool value)
		{
			if (value)
			{
				timeCurrent.SetActive(true);
				ChangeMode(ConfigManager.levelMode.value);
				return;
			}
			timeCurrent.SetActive(false);
			((Component)timeS).gameObject.SetActive(false);
			((Component)timeA).gameObject.SetActive(false);
			((Component)timeB).gameObject.SetActive(false);
			((Component)timeC).gameObject.SetActive(false);
			((Component)timeNextBest).gameObject.SetActive(false);
		}

		public void ShowKills(bool value)
		{
			if (value)
			{
				killsCurrent.SetActive(true);
				ChangeMode(ConfigManager.levelMode.value);
				return;
			}
			killsCurrent.SetActive(false);
			((Component)killsS).gameObject.SetActive(false);
			((Component)killsA).gameObject.SetActive(false);
			((Component)killsB).gameObject.SetActive(false);
			((Component)killsC).gameObject.SetActive(false);
			((Component)killsNextBest).gameObject.SetActive(false);
		}

		public void ShowStyle(bool value)
		{
			if (value)
			{
				styleCurrent.SetActive(true);
				ChangeMode(ConfigManager.levelMode.value);
				return;
			}
			styleCurrent.SetActive(false);
			((Component)styleS).gameObject.SetActive(false);
			((Component)styleA).gameObject.SetActive(false);
			((Component)styleB).gameObject.SetActive(false);
			((Component)styleC).gameObject.SetActive(false);
			((Component)styleNextBest).gameObject.SetActive(false);
		}

		public void ShowSecrets(bool value)
		{
			if (MonoSingleton<StatsManager>.Instance.secretObjects.Length != 0)
			{
				secrets.SetActive(ConfigManager.showLevelSecrets.value);
			}
			else
			{
				secrets.SetActive(false);
			}
		}

		public void ShowChallenge(bool value)
		{
			if ((Object)(object)levelStats.challenge != (Object)null)
			{
				challengeCurrent.SetActive(value);
			}
		}

		public void ShowAssists(bool value)
		{
			assists.SetActive(value);
		}

		public void ShowRestarts(bool value)
		{
			((Component)restarts).gameObject.SetActive(value);
		}

		public void ShowFinalRank(bool value)
		{
			((Component)finalRank).gameObject.SetActive(value);
		}

		public string GetTimeStringFromInt(int value)
		{
			return $"{value / 60}:{value % 60:D2}.000";
		}
	}
	public static class Colors
	{
		public static Color P => new Color(1f, 0.686f, 0f);

		public static Color S => Color.red;

		public static Color A => new Color(1f, 0.4157f, 0f);

		public static Color B => new Color(1f, 0.8471f, 0f);

		public static Color C => new Color(0.298f, 1f, 0f);

		public static Color D => new Color(0f, 0.5804f, 1f);

		public static Color Assist => new Color(0.298f, 0.6f, 0.902f);

		public static Color Cheat => new Color(0.25f, 1f, 0.25f);

		public static Color GetRankColor(Ranks rank)
		{
			//IL_0041: Unknown result type (might be due to invalid IL or missing references)
			//IL_0046: Unknown result type (might be due to invalid IL or missing references)
			//IL_0039: Unknown result type (might be due to invalid IL or missing references)
			//IL_003e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0031: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Unknown result type (might be due to invalid IL or missing references)
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Unknown result type (might be due to invalid IL or missing references)
			//IL_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)
			//IL_0051: Unknown result type (might be due to invalid IL or missing references)
			//IL_0049: Unknown result type (might be due to invalid IL or missing references)
			//IL_004e: Unknown result type (might be due to invalid IL or missing references)
			return (Color)(rank switch
			{
				Ranks.S => S, 
				Ranks.A => A, 
				Ranks.B => B, 
				Ranks.C => C, 
				Ranks.D => D, 
				_ => Color.white, 
			});
		}
	}
	public class ConfigManager
	{
		[Serializable]
		[CompilerGenerated]
		private sealed class <>c
		{
			public static readonly <>c <>9 = new <>c();

			public static PostEnumValueChangeEvent<RankMode> <>9__23_0;

			public static PostEnumValueChangeEvent<TargetRank> <>9__23_1;

			public static PostBoolValueChangeEvent <>9__23_2;

			public static PostBoolValueChangeEvent <>9__23_3;

			public static PostBoolValueChangeEvent <>9__23_4;

			public static PostBoolValueChangeEvent <>9__23_5;

			public static PostBoolValueChangeEvent <>9__23_6;

			public static PostBoolValueChangeEvent <>9__23_7;

			public static PostBoolValueChangeEvent <>9__23_8;

			public static PostBoolValueChangeEvent <>9__23_9;

			public static PostBoolValueChangeEvent <>9__23_10;

			public static PostBoolValueChangeEvent <>9__23_11;

			public static PostBoolValueChangeEvent <>9__23_12;

			public static PostBoolValueChangeEvent <>9__23_13;

			public static PostBoolValueChangeEvent <>9__23_14;

			public static PostBoolValueChangeEvent <>9__23_15;

			public static PostBoolValueChangeEvent <>9__23_16;

			public static PostBoolValueChangeEvent <>9__23_17;

			public static PostBoolValueChangeEvent <>9__23_18;

			public static PostBoolValueChangeEvent <>9__23_19;

			internal void <Init>b__23_0(RankMode value)
			{
				BetterLevelStats.Instance?.ChangeMode(value);
			}

			internal void <Init>b__23_1(TargetRank value)
			{
				if (levelMode.value == RankMode.SingleRank)
				{
					BetterLevelStats.Instance?.ChangeTargetRank(value);
				}
			}

			internal void <Init>b__23_2(bool value)
			{
				BetterLevelStats.Instance?.ShowName(value);
			}

			internal void <Init>b__23_3(bool value)
			{
				BetterLevelStats.Instance?.ShowDifficulty(value);
			}

			internal void <Init>b__23_4(bool value)
			{
				BetterLevelStats.Instance?.ShowTime(value);
			}

			internal void <Init>b__23_5(bool value)
			{
				BetterLevelStats.Instance?.ShowKills(value);
			}

			internal void <Init>b__23_6(bool value)
			{
				BetterLevelStats.Instance?.ShowStyle(value);
			}

			internal void <Init>b__23_7(bool value)
			{
				BetterLevelStats.Instance?.ShowSecrets(value);
			}

			internal void <Init>b__23_8(bool value)
			{
				BetterLevelStats.Instance?.ShowChallenge(value);
			}

			internal void <Init>b__23_9(bool value)
			{
				BetterLevelStats.Instance?.ShowAssists(value);
			}

			internal void <Init>b__23_10(bool value)
			{
				BetterLevelStats.Instance?.ShowRestarts(value);
			}

			internal void <Init>b__23_11(bool value)
			{
				BetterLevelStats.Instance?.ShowFinalRank(value);
			}

			internal void <Init>b__23_12(bool value)
			{
				BetterCGStats.Instance?.ShowBests(value);
			}

			internal void <Init>b__23_13(bool value)
			{
				BetterCGStats.Instance?.ShowName(value);
			}

			internal void <Init>b__23_14(bool value)
			{
				BetterCGStats.Instance?.ShowDifficulty(value);
			}

			internal void <Init>b__23_15(bool value)
			{
				BetterCGStats.Instance?.ShowTime(value);
			}

			internal void <Init>b__23_16(bool value)
			{
				BetterCGStats.Instance?.ShowKills(value);
			}

			internal void <Init>b__23_17(bool value)
			{
				BetterCGStats.Instance?.ShowStyle(value);
			}

			internal void <Init>b__23_18(bool value)
			{
				BetterCGStats.Instance?.ShowWave(value);
			}

			internal void <Init>b__23_19(bool value)
			{
				BetterCGStats.Instance?.ShowEnemiesLeft(value);
			}
		}

		public static PluginConfigurator config;

		public static ConfigPanel levelPanel;

		public static EnumField<RankMode> levelMode;

		public static EnumField<TargetRank> targetRank;

		public static BoolField showLevelName;

		public static BoolField showLevelDifficulty;

		public static BoolField showLevelTime;

		public static BoolField showLevelKills;

		public static BoolField showLevelStyle;

		public static BoolField showLevelSecrets;

		public static BoolField showLevelChallenge;

		public static BoolField showLevelAssists;

		public static BoolField showLevelRestarts;

		public static BoolField showLevelFinalRank;

		public static ConfigPanel cgPanel;

		public static BoolField showCGBests;

		public static BoolField showCGName;

		public static BoolField showCGDifficulty;

		public static BoolField showCGTime;

		public static BoolField showCGKills;

		public static BoolField showCGStyle;

		public static BoolField showCGWave;

		public static BoolField showCGEnemiesLeft;

		public static void Init()
		{
			//IL_0060: Unknown result type (might be due to invalid IL or missing references)
			//IL_006a: Expected O, but got Unknown
			//IL_0146: Unknown result type (might be due to invalid IL or missing references)
			//IL_0150: Expected O, but got Unknown
			//IL_018a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0194: Expected O, but got Unknown
			//IL_0169: 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: Expected O, but got Unknown
			//IL_01ce: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d8: Expected O, but got Unknown
			//IL_01ad: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b2: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b8: Expected O, but got Unknown
			//IL_0212: Unknown result type (might be due to invalid IL or missing references)
			//IL_021c: Expected O, but got Unknown
			//IL_01f1: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f6: Unknown result type (might be due to invalid IL or missing references)
			//IL_01fc: Expected O, but got Unknown
			//IL_0256: Unknown result type (might be due to invalid IL or missing references)
			//IL_0260: Expected O, but got Unknown
			//IL_0235: Unknown result type (might be due to invalid IL or missing references)
			//IL_023a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0240: Expected O, but got Unknown
			//IL_029a: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a4: Expected O, but got Unknown
			//IL_0279: Unknown result type (might be due to invalid IL or missing references)
			//IL_027e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0284: Expected O, but got Unknown
			//IL_02de: Unknown result type (might be due to invalid IL or missing references)
			//IL_02e8: Expected O, but got Unknown
			//IL_02bd: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c2: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c8: Expected O, but got Unknown
			//IL_0322: Unknown result type (might be due to invalid IL or missing references)
			//IL_032c: Expected O, but got Unknown
			//IL_0301: Unknown result type (might be due to invalid IL or missing references)
			//IL_0306: Unknown result type (might be due to invalid IL or missing references)
			//IL_030c: Expected O, but got Unknown
			//IL_0366: Unknown result type (might be due to invalid IL or missing references)
			//IL_0370: Expected O, but got Unknown
			//IL_0345: Unknown result type (might be due to invalid IL or missing references)
			//IL_034a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0350: Expected O, but got Unknown
			//IL_03aa: Unknown result type (might be due to invalid IL or missing references)
			//IL_03b4: Expected O, but got Unknown
			//IL_0389: Unknown result type (might be due to invalid IL or missing references)
			//IL_038e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0394: Expected O, but got Unknown
			//IL_03f2: Unknown result type (might be due to invalid IL or missing references)
			//IL_03fc: Expected O, but got Unknown
			//IL_040c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0416: Expected O, but got Unknown
			//IL_03cd: Unknown result type (might be due to invalid IL or missing references)
			//IL_03d2: Unknown result type (might be due to invalid IL or missing references)
			//IL_03d8: Expected O, but got Unknown
			//IL_0450: Unknown result type (might be due to invalid IL or missing references)
			//IL_045a: Expected O, but got Unknown
			//IL_042f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0434: Unknown result type (might be due to invalid IL or missing references)
			//IL_043a: Expected O, but got Unknown
			//IL_0494: Unknown result type (might be due to invalid IL or missing references)
			//IL_049e: Expected O, but got Unknown
			//IL_0473: Unknown result type (might be due to invalid IL or missing references)
			//IL_0478: Unknown result type (might be due to invalid IL or missing references)
			//IL_047e: Expected O, but got Unknown
			//IL_04d8: Unknown result type (might be due to invalid IL or missing references)
			//IL_04e2: Expected O, but got Unknown
			//IL_04b7: Unknown result type (might be due to invalid IL or missing references)
			//IL_04bc: Unknown result type (might be due to invalid IL or missing references)
			//IL_04c2: Expected O, but got Unknown
			//IL_051c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0526: Expected O, but got Unknown
			//IL_04fb: Unknown result type (might be due to invalid IL or missing references)
			//IL_0500: Unknown result type (might be due to invalid IL or missing references)
			//IL_0506: Expected O, but got Unknown
			//IL_0560: Unknown result type (might be due to invalid IL or missing references)
			//IL_056a: Expected O, but got Unknown
			//IL_053f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0544: Unknown result type (might be due to invalid IL or missing references)
			//IL_054a: Expected O, but got Unknown
			//IL_05a4: Unknown result type (might be due to invalid IL or missing references)
			//IL_05ae: Expected O, but got Unknown
			//IL_0583: Unknown result type (might be due to invalid IL or missing references)
			//IL_0588: Unknown result type (might be due to invalid IL or missing references)
			//IL_058e: Expected O, but got Unknown
			//IL_05e8: Unknown result type (might be due to invalid IL or missing references)
			//IL_05f2: Expected O, but got Unknown
			//IL_05c7: Unknown result type (might be due to invalid IL or missing references)
			//IL_05cc: Unknown result type (might be due to invalid IL or missing references)
			//IL_05d2: Expected O, but got Unknown
			//IL_060b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0610: Unknown result type (might be due to invalid IL or missing references)
			//IL_0616: Expected O, but got Unknown
			if (config != null)
			{
				return;
			}
			config = PluginConfigurator.Create("BetterLevelStats", "trpg.betterlevelstats");
			string text = Path.Combine(Core.workingDir, "icon.png");
			if (File.Exists(text))
			{
				config.SetIconWithURL(text);
			}
			levelPanel = new ConfigPanel(config.rootPanel, "LEVELS", "levelPanel");
			levelMode = new EnumField<RankMode>(levelPanel, "RANK REQUIREMENTS", "levelMode", RankMode.None);
			levelMode.SetEnumDisplayName(RankMode.AllRanks, "ALL RANKS");
			levelMode.SetEnumDisplayName(RankMode.SingleRank, "SINGLE RANK");
			levelMode.SetEnumDisplayName(RankMode.NextBest, "NEXT BEST RANK");
			levelMode.SetEnumDisplayName(RankMode.None, "NONE");
			levelMode.postValueChangeEvent += delegate(RankMode value)
			{
				BetterLevelStats.Instance?.ChangeMode(value);
			};
			targetRank = new EnumField<TargetRank>(levelPanel, "SINGLE RANK TARGET", "targetRank", TargetRank.S);
			targetRank.postValueChangeEvent += delegate(TargetRank value)
			{
				if (levelMode.value == RankMode.SingleRank)
				{
					BetterLevelStats.Instance?.ChangeTargetRank(value);
				}
			};
			showLevelName = new BoolField(levelPanel, "SHOW LEVEL NAME", "showLevelName", true);
			BoolField obj = showLevelName;
			object obj2 = <>c.<>9__23_2;
			if (obj2 == null)
			{
				PostBoolValueChangeEvent val = delegate(bool value)
				{
					BetterLevelStats.Instance?.ShowName(value);
				};
				<>c.<>9__23_2 = val;
				obj2 = (object)val;
			}
			obj.postValueChangeEvent += (PostBoolValueChangeEvent)obj2;
			showLevelDifficulty = new BoolField(levelPanel, "SHOW DIFFICULTY", "showLevelDifficulty", false);
			BoolField obj3 = showLevelDifficulty;
			object obj4 = <>c.<>9__23_3;
			if (obj4 == null)
			{
				PostBoolValueChangeEvent val2 = delegate(bool value)
				{
					BetterLevelStats.Instance?.ShowDifficulty(value);
				};
				<>c.<>9__23_3 = val2;
				obj4 = (object)val2;
			}
			obj3.postValueChangeEvent += (PostBoolValueChangeEvent)obj4;
			showLevelTime = new BoolField(levelPanel, "SHOW TIME", "showLevelTime", true);
			BoolField obj5 = showLevelTime;
			object obj6 = <>c.<>9__23_4;
			if (obj6 == null)
			{
				PostBoolValueChangeEvent val3 = delegate(bool value)
				{
					BetterLevelStats.Instance?.ShowTime(value);
				};
				<>c.<>9__23_4 = val3;
				obj6 = (object)val3;
			}
			obj5.postValueChangeEvent += (PostBoolValueChangeEvent)obj6;
			showLevelKills = new BoolField(levelPanel, "SHOW KILLS", "showLevelKills", true);
			BoolField obj7 = showLevelKills;
			object obj8 = <>c.<>9__23_5;
			if (obj8 == null)
			{
				PostBoolValueChangeEvent val4 = delegate(bool value)
				{
					BetterLevelStats.Instance?.ShowKills(value);
				};
				<>c.<>9__23_5 = val4;
				obj8 = (object)val4;
			}
			obj7.postValueChangeEvent += (PostBoolValueChangeEvent)obj8;
			showLevelStyle = new BoolField(levelPanel, "SHOW STYLE", "showLevelStyle", true);
			BoolField obj9 = showLevelStyle;
			object obj10 = <>c.<>9__23_6;
			if (obj10 == null)
			{
				PostBoolValueChangeEvent val5 = delegate(bool value)
				{
					BetterLevelStats.Instance?.ShowStyle(value);
				};
				<>c.<>9__23_6 = val5;
				obj10 = (object)val5;
			}
			obj9.postValueChangeEvent += (PostBoolValueChangeEvent)obj10;
			showLevelSecrets = new BoolField(levelPanel, "SHOW SECRETS", "showLevelSecrets", true);
			BoolField obj11 = showLevelSecrets;
			object obj12 = <>c.<>9__23_7;
			if (obj12 == null)
			{
				PostBoolValueChangeEvent val6 = delegate(bool value)
				{
					BetterLevelStats.Instance?.ShowSecrets(value);
				};
				<>c.<>9__23_7 = val6;
				obj12 = (object)val6;
			}
			obj11.postValueChangeEvent += (PostBoolValueChangeEvent)obj12;
			showLevelChallenge = new BoolField(levelPanel, "SHOW CHALLENGE", "showLevelChallenge", true);
			BoolField obj13 = showLevelChallenge;
			object obj14 = <>c.<>9__23_8;
			if (obj14 == null)
			{
				PostBoolValueChangeEvent val7 = delegate(bool value)
				{
					BetterLevelStats.Instance?.ShowChallenge(value);
				};
				<>c.<>9__23_8 = val7;
				obj14 = (object)val7;
			}
			obj13.postValueChangeEvent += (PostBoolValueChangeEvent)obj14;
			showLevelAssists = new BoolField(levelPanel, "SHOW MAJOR ASSISTS", "showLevelAssists", true);
			BoolField obj15 = showLevelAssists;
			object obj16 = <>c.<>9__23_9;
			if (obj16 == null)
			{
				PostBoolValueChangeEvent val8 = delegate(bool value)
				{
					BetterLevelStats.Instance?.ShowAssists(value);
				};
				<>c.<>9__23_9 = val8;
				obj16 = (object)val8;
			}
			obj15.postValueChangeEvent += (PostBoolValueChangeEvent)obj16;
			showLevelRestarts = new BoolField(levelPanel, "SHOW RESTARTS", "showLevelRestarts", false);
			BoolField obj17 = showLevelRestarts;
			object obj18 = <>c.<>9__23_10;
			if (obj18 == null)
			{
				PostBoolValueChangeEvent val9 = delegate(bool value)
				{
					BetterLevelStats.Instance?.ShowRestarts(value);
				};
				<>c.<>9__23_10 = val9;
				obj18 = (object)val9;
			}
			obj17.postValueChangeEvent += (PostBoolValueChangeEvent)obj18;
			showLevelFinalRank = new BoolField(levelPanel, "SHOW FINAL RANK", "showLevelFinalRank", false);
			BoolField obj19 = showLevelFinalRank;
			object obj20 = <>c.<>9__23_11;
			if (obj20 == null)
			{
				PostBoolValueChangeEvent val10 = delegate(bool value)
				{
					BetterLevelStats.Instance?.ShowFinalRank(value);
				};
				<>c.<>9__23_11 = val10;
				obj20 = (object)val10;
			}
			obj19.postValueChangeEvent += (PostBoolValueChangeEvent)obj20;
			cgPanel = new ConfigPanel(config.rootPanel, "THE CYBER GRIND", "cgPanel");
			showCGBests = new BoolField(cgPanel, "SHOW PERSONAL BESTS", "showCGBests", false);
			BoolField obj21 = showCGBests;
			object obj22 = <>c.<>9__23_12;
			if (obj22 == null)
			{
				PostBoolValueChangeEvent val11 = delegate(bool value)
				{
					BetterCGStats.Instance?.ShowBests(value);
				};
				<>c.<>9__23_12 = val11;
				obj22 = (object)val11;
			}
			obj21.postValueChangeEvent += (PostBoolValueChangeEvent)obj22;
			showCGName = new BoolField(cgPanel, "SHOW LEVEL NAME", "showCGName", true);
			BoolField obj23 = showCGName;
			object obj24 = <>c.<>9__23_13;
			if (obj24 == null)
			{
				PostBoolValueChangeEvent val12 = delegate(bool value)
				{
					BetterCGStats.Instance?.ShowName(value);
				};
				<>c.<>9__23_13 = val12;
				obj24 = (object)val12;
			}
			obj23.postValueChangeEvent += (PostBoolValueChangeEvent)obj24;
			showCGDifficulty = new BoolField(cgPanel, "SHOW DIFFICULTY", "showCGDifficulty", false);
			BoolField obj25 = showCGDifficulty;
			object obj26 = <>c.<>9__23_14;
			if (obj26 == null)
			{
				PostBoolValueChangeEvent val13 = delegate(bool value)
				{
					BetterCGStats.Instance?.ShowDifficulty(value);
				};
				<>c.<>9__23_14 = val13;
				obj26 = (object)val13;
			}
			obj25.postValueChangeEvent += (PostBoolValueChangeEvent)obj26;
			showCGTime = new BoolField(cgPanel, "SHOW TIME", "showCGTime", true);
			BoolField obj27 = showCGTime;
			object obj28 = <>c.<>9__23_15;
			if (obj28 == null)
			{
				PostBoolValueChangeEvent val14 = delegate(bool value)
				{
					BetterCGStats.Instance?.ShowTime(value);
				};
				<>c.<>9__23_15 = val14;
				obj28 = (object)val14;
			}
			obj27.postValueChangeEvent += (PostBoolValueChangeEvent)obj28;
			showCGKills = new BoolField(cgPanel, "SHOW KILLS", "showCGKills", false);
			BoolField obj29 = showCGKills;
			object obj30 = <>c.<>9__23_16;
			if (obj30 == null)
			{
				PostBoolValueChangeEvent val15 = delegate(bool value)
				{
					BetterCGStats.Instance?.ShowKills(value);
				};
				<>c.<>9__23_16 = val15;
				obj30 = (object)val15;
			}
			obj29.postValueChangeEvent += (PostBoolValueChangeEvent)obj30;
			showCGStyle = new BoolField(cgPanel, "SHOW STYLE", "showCGStyle", false);
			BoolField obj31 = showCGStyle;
			object obj32 = <>c.<>9__23_17;
			if (obj32 == null)
			{
				PostBoolValueChangeEvent val16 = delegate(bool value)
				{
					BetterCGStats.Instance?.ShowStyle(value);
				};
				<>c.<>9__23_17 = val16;
				obj32 = (object)val16;
			}
			obj31.postValueChangeEvent += (PostBoolValueChangeEvent)obj32;
			showCGWave = new BoolField(cgPanel, "SHOW WAVE", "showCGWave", true);
			BoolField obj33 = showCGWave;
			object obj34 = <>c.<>9__23_18;
			if (obj34 == null)
			{
				PostBoolValueChangeEvent val17 = delegate(bool value)
				{
					BetterCGStats.Instance?.ShowWave(value);
				};
				<>c.<>9__23_18 = val17;
				obj34 = (object)val17;
			}
			obj33.postValueChangeEvent += (PostBoolValueChangeEvent)obj34;
			showCGEnemiesLeft = new BoolField(cgPanel, "SHOW ENEMIES LEFT", "showCGEnemiesLeft", true);
			BoolField obj35 = showCGEnemiesLeft;
			object obj36 = <>c.<>9__23_19;
			if (obj36 == null)
			{
				PostBoolValueChangeEvent val18 = delegate(bool value)
				{
					BetterCGStats.Instance?.ShowEnemiesLeft(value);
				};
				<>c.<>9__23_19 = val18;
				obj36 = (object)val18;
			}
			obj35.postValueChangeEvent += (PostBoolValueChangeEvent)obj36;
		}
	}
	public enum RankMode
	{
		AllRanks,
		SingleRank,
		NextBest,
		None
	}
	public enum TargetRank
	{
		C,
		B,
		A,
		S
	}
	[BepInPlugin("trpg.betterlevelstats", "BetterLevelStats", "1.0.0")]
	public class Core : BaseUnityPlugin
	{
		public const string PluginGUID = "trpg.betterlevelstats";

		public const string PluginName = "BetterLevelStats";

		public const string PluginVersion = "1.0.0";

		public static string workingPath;

		public static string workingDir;

		internal static ManualLogSource Logger;

		private void Awake()
		{
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_0017: Expected O, but got Unknown
			Logger = ((BaseUnityPlugin)this).Logger;
			Harmony val = new Harmony("BetterLevelStats");
			val.PatchAll();
			workingPath = Assembly.GetExecutingAssembly().Location;
			workingDir = Path.GetDirectoryName(workingPath);
			ConfigManager.Init();
		}
	}
	public enum Ranks
	{
		D,
		C,
		B,
		A,
		S
	}
	public struct RankRequirement
	{
		public Ranks Rank;

		public int Value;

		public RankRequirement(Ranks rank, int value)
		{
			Rank = rank;
			Value = value;
		}

		public override string ToString()
		{
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			return $"{Value} <color=#{Colors.GetRankColor(Rank)}>{Rank.ToString()}</color>";
		}
	}
	public class StatCustom : MonoBehaviour
	{
		public TextMeshProUGUI statDesc;

		public TextMeshProUGUI statValue;

		public void Init(TextMeshProUGUI statDesc, TextMeshProUGUI statValue)
		{
			this.statDesc = statDesc;
			this.statValue = statValue;
		}

		public void SetDesc(string text)
		{
			((TMP_Text)statDesc).text = text;
		}

		public void SetValue(string text)
		{
			((TMP_Text)statValue).text = text;
		}
	}
	public class StatRequirement : MonoBehaviour
	{
		public TextMeshProUGUI statNumber;

		public TextMeshProUGUI statRank;

		public void Init(TextMeshProUGUI statNumber, TextMeshProUGUI statRank)
		{
			this.statNumber = statNumber;
			this.statRank = statRank;
		}

		public void SetText(string value, string rank, Color color)
		{
			//IL_0046: Unknown result type (might be due to invalid IL or missing references)
			if (value == "-")
			{
				((TMP_Text)statNumber).text = "-:--.---";
			}
			else
			{
				((TMP_Text)statNumber).text = value;
			}
			((TMP_Text)statRank).text = "<color=#" + ColorUtility.ToHtmlStringRGBA(color) + ">" + rank + "</color>";
		}
	}
	public static class MyPluginInfo
	{
		public const string PLUGIN_GUID = "BetterLevelStats";

		public const string PLUGIN_NAME = "My first plugin";

		public const string PLUGIN_VERSION = "1.0.0";
	}
}
namespace BetterLevelStats.Patches
{
	[HarmonyPatch(typeof(LevelStats), "Start")]
	public class LevelStats_Start_Patch
	{
		public static void Postfix(LevelStats __instance)
		{
			if (__instance.cyberGrind)
			{
				ComponentExtensions.GetOrAddComponent<BetterCGStats>((Component)(object)__instance);
			}
			else if (!__instance.secretLevel)
			{
				ComponentExtensions.GetOrAddComponent<BetterLevelStats>((Component)(object)__instance);
			}
		}
	}
}