Decompiled source of ReportCard v1.3.0

ReportCard.dll

Decompiled a month ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Globalization;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using ComfyLib;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using TMPro;
using UnityEngine;
using UnityEngine.Events;
using UnityEngine.UI;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: AssemblyTitle("ReportCard")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("ReportCard")]
[assembly: AssemblyCopyright("Copyright © 2023")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("1fc9c6da-195e-43d3-869b-a6526767bcc4")]
[assembly: AssemblyFileVersion("1.3.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.3.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 ReportCard
{
	public static class PluginConfig
	{
		public static ConfigEntry<bool> IsModEnabled { get; private set; }

		public static ConfigEntry<bool> OpenStatsPanelOnCharacterSelect { get; private set; }

		public static ConfigEntry<bool> ExploredStatsPanelShowStatsButton { get; private set; }

		public static ConfigEntry<bool> ExploredStatsPanelShowRawValues { get; private set; }

		public static void BindConfig(ConfigFile config)
		{
			IsModEnabled = config.BindInOrder("_Global", "isModEnabled", defaultValue: true, "Globally enable or disable this mod (restart required).");
			OpenStatsPanelOnCharacterSelect = config.BindInOrder("StatsPanel", "openStatsPanelOnCharacterSelect", defaultValue: true, "If set, opens the StatsPanel on the Character Select screen.");
			ExploredStatsPanelShowStatsButton = config.BindInOrder("ExploredStatsPanel", "showStatsButton", defaultValue: true, "If set, enables the 'Stats' button in the Minimap.");
			ExploredStatsPanelShowStatsButton.OnSettingChanged<bool>(ExploredStatsController.ToggleStatsButton);
			ExploredStatsPanelShowRawValues = config.BindInOrder("ExploredStatsPanel", "showRawValues", defaultValue: false, "If set, will show raw values in the ExploredStatsPanel.");
		}
	}
	public sealed class ExploredStats
	{
		public readonly Dictionary<Biome, int> BiomeTotalCount = new Dictionary<Biome, int>();

		public readonly Dictionary<Biome, int> BiomeExploredCount = new Dictionary<Biome, int>();

		public static readonly float GenerateRadius = 10000f;

		private Coroutine _generateCoroutine;

		public ExploredStats()
		{
			Reset();
		}

		public int TotalCount()
		{
			return BiomeTotalCount.Values.Sum();
		}

		public int ExploredCount()
		{
			return BiomeExploredCount.Values.Sum();
		}

		public int TotalCount(Biome biome)
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			return BiomeTotalCount[biome];
		}

		public int ExploredCount(Biome biome)
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			return BiomeExploredCount[biome];
		}

		private void Reset()
		{
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_002a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0037: Unknown result type (might be due to invalid IL or missing references)
			BiomeTotalCount.Clear();
			BiomeExploredCount.Clear();
			Biome[] heightmapBiomes = GetHeightmapBiomes();
			foreach (Biome key in heightmapBiomes)
			{
				BiomeTotalCount[key] = 0;
				BiomeExploredCount[key] = 0;
			}
		}

		public void Generate(Minimap minimap, TextMeshProUGUI label, Action<ExploredStats> onCompleteAction)
		{
			if (_generateCoroutine != null)
			{
				((MonoBehaviour)minimap).StopCoroutine(_generateCoroutine);
				_generateCoroutine = null;
			}
			Reset();
			_generateCoroutine = ((MonoBehaviour)minimap).StartCoroutine(GenerateCoroutine(minimap, label, onCompleteAction));
		}

		private IEnumerator GenerateCoroutine(Minimap minimap, TextMeshProUGUI label, Action<ExploredStats> onCompleteAction)
		{
			((TMP_Text)label).text = "Generating stats...";
			yield return null;
			float pixelSize = minimap.m_pixelSize;
			float pixelHalfSize = pixelSize / 2f;
			int textureSize = minimap.m_textureSize;
			int textureHalfSize = textureSize / 2;
			int radius = Mathf.CeilToInt(GenerateRadius / pixelSize);
			int radiusSquared = radius * radius;
			int px = default(int);
			int py = default(int);
			minimap.WorldToPixel(Vector3.zero, ref px, ref py);
			int counter = 0;
			WorldGenerator worldGenerator = WorldGenerator.m_instance;
			bool[] explored = minimap.m_explored;
			for (int y = py - radius; y <= py + radius; y++)
			{
				for (int x = px - radius; x <= px + radius; x++)
				{
					if (x < 0 || y < 0 || x >= textureSize || y >= textureSize || (x - px) * (x - px) + (y - py) * (y - py) >= radiusSquared)
					{
						continue;
					}
					float num = (float)(x - textureHalfSize) * pixelSize + pixelHalfSize;
					float num2 = (float)(y - textureHalfSize) * pixelSize + pixelHalfSize;
					Biome biome = worldGenerator.GetBiome(num, num2, 0.02f, false);
					BiomeTotalCount[biome]++;
					if (explored[y * textureSize + x])
					{
						BiomeExploredCount[biome]++;
					}
					counter++;
					if (counter % 15000 == 0)
					{
						if (Object.op_Implicit((Object)(object)label))
						{
							float num3 = (float)(y * textureSize + x) * 1f / ((float)explored.Length * 1f) * 100f;
							((TMP_Text)label).text = $"Generating stats... ({num3:F2}%)";
						}
						yield return null;
					}
				}
			}
			onCompleteAction?.Invoke(this);
		}

		public static Biome[] GetHeightmapBiomes()
		{
			return (Biome[])Enum.GetValues(typeof(Biome));
		}
	}
	public static class ExploredStatsController
	{
		[CompilerGenerated]
		private static class <>O
		{
			public static UnityAction <0>__HideStatsPanel;

			public static Action<ExploredStats> <1>__UpdateStatsPanel;

			public static UnityAction <2>__ToggleStatsPanel;
		}

		private static readonly ExploredStats _exploredStats = new ExploredStats();

		public static ExploredStatsPanel StatsPanel { get; private set; }

		public static LabelButton StatsButton { get; private set; }

		public static bool IsStatsPanelValid()
		{
			return Object.op_Implicit((Object)(object)StatsPanel?.Panel);
		}

		public static void CreateStatsPanel(Minimap minimap)
		{
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_003d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0051: Unknown result type (might be due to invalid IL or missing references)
			//IL_005b: Unknown result type (might be due to invalid IL or missing references)
			//IL_006f: Unknown result type (might be due to invalid IL or missing references)
			//IL_009e: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a9: Expected O, but got Unknown
			StatsPanel = new ExploredStatsPanel(minimap.m_largeRoot.transform);
			StatsPanel.RectTransform.SetAnchorMin(new Vector2(0.5f, 0.5f)).SetAnchorMax(new Vector2(0.5f, 0.5f)).SetPivot(new Vector2(0.5f, 0.5f))
				.SetPosition(Vector2.zero)
				.SetSizeDelta(new Vector2(400f, 600f));
			ButtonClickedEvent onClick = StatsPanel.CloseButton.Button.onClick;
			object obj = <>O.<0>__HideStatsPanel;
			if (obj == null)
			{
				UnityAction val = HideStatsPanel;
				<>O.<0>__HideStatsPanel = val;
				obj = (object)val;
			}
			((UnityEvent)onClick).AddListener((UnityAction)obj);
			HideStatsPanel();
		}

		public static void ToggleStatsPanel()
		{
			if (IsStatsPanelValid())
			{
				if (StatsPanel.Panel.activeSelf)
				{
					HideStatsPanel();
				}
				else
				{
					ShowStatsPanel();
				}
			}
		}

		public static void ShowStatsPanel()
		{
			if (IsStatsPanelValid())
			{
				StatsPanel.Panel.SetActive(true);
				StatsPanel.ResetStatsList();
				StatsPanel.UpdateStatus(string.Empty);
				_exploredStats.Generate(Minimap.m_instance, StatsPanel.StatusLabel, UpdateStatsPanel);
			}
		}

		public static void HideStatsPanel()
		{
			if (IsStatsPanelValid())
			{
				StatsPanel.Panel.SetActive(false);
			}
		}

		private static void UpdateStatsPanel(ExploredStats explorerStats)
		{
			if (IsStatsPanelValid())
			{
				StatsPanel.ResetStatsList();
				StatsPanel.UpdateStatsList(explorerStats);
				StatsPanel.UpdateStatus(GenerateStatusString(Player.m_localPlayer, ZNet.m_world, EnvMan.s_instance));
			}
		}

		private static string GenerateStatusString(Player player, World world, EnvMan envManager)
		{
			if (!Object.op_Implicit((Object)(object)player) || world == null || !Object.op_Implicit((Object)(object)envManager))
			{
				return string.Empty;
			}
			return "<align=left>" + player.GetPlayerName() + "<line-height=0>\n<align=right>" + world.m_name + "<line-height=1em>\n" + $"<align=left><color=#D3D3D3>{player.GetPlayerID()}</color><line-height=0>\n" + $"<align=right>Day <color=#FFD600>{envManager.GetCurrentDay()}</color><line-height=1em>";
		}

		public static bool IsStatsButtonValid()
		{
			return Object.op_Implicit((Object)(object)StatsButton?.Container);
		}

		public static void ToggleStatsButton(bool toggleOn)
		{
			if (IsStatsButtonValid())
			{
				StatsButton.Container.SetActive(toggleOn);
			}
		}

		public static void CreateStatsButton(Minimap minimap)
		{
			//IL_0056: Unknown result type (might be due to invalid IL or missing references)
			//IL_0060: Unknown result type (might be due to invalid IL or missing references)
			//IL_006a: Unknown result type (might be due to invalid IL or missing references)
			//IL_007e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0092: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c7: Expected O, but got Unknown
			StatsButton = new LabelButton(minimap.m_largeRoot.transform);
			((Object)StatsButton.Container).name = "StatsButton";
			StatsButton.Label.SetFontSize<TMP_Text>(20f).SetText("Stats");
			StatsButton.Container.GetComponent<RectTransform>().SetAnchorMin(Vector2.up).SetAnchorMax(Vector2.up)
				.SetPivot(Vector2.up)
				.SetPosition(new Vector2(25f, -20f))
				.SetSizeDelta(new Vector2(100f, 42.5f));
			ButtonClickedEvent onClick = StatsButton.Button.onClick;
			object obj = <>O.<2>__ToggleStatsPanel;
			if (obj == null)
			{
				UnityAction val = ToggleStatsPanel;
				<>O.<2>__ToggleStatsPanel = val;
				obj = (object)val;
			}
			((UnityEvent)onClick).AddListener((UnityAction)obj);
		}
	}
	public static class PlayerStatsController
	{
		[CompilerGenerated]
		private static class <>O
		{
			public static UnityAction <0>__HideStatsPanel;

			public static UnityAction <1>__ToggleStatsPanel;

			public static UnityAction <2>__OnStatsButtonClick;
		}

		public static PlayerStatsPanel StatsPanel { get; private set; }

		public static bool IsStatsPanelValid()
		{
			return Object.op_Implicit((Object)(object)StatsPanel?.Panel);
		}

		public static void CreateStatsPanel(FejdStartup fejdStartup)
		{
			//IL_002e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0042: Unknown result type (might be due to invalid IL or missing references)
			//IL_0056: 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_007e: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ad: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b8: Expected O, but got Unknown
			DestroyStatsPanel();
			StatsPanel = new PlayerStatsPanel(fejdStartup.m_characterSelectScreen.transform);
			StatsPanel.RectTransform.SetAnchorMin(new Vector2(1f, 0.5f)).SetAnchorMax(new Vector2(1f, 0.5f)).SetPivot(new Vector2(1f, 0.5f))
				.SetPosition(new Vector2(-25f, 0f))
				.SetSizeDelta(new Vector2(400f, 600f));
			ButtonClickedEvent onClick = StatsPanel.CloseButton.Button.onClick;
			object obj = <>O.<0>__HideStatsPanel;
			if (obj == null)
			{
				UnityAction val = HideStatsPanel;
				<>O.<0>__HideStatsPanel = val;
				obj = (object)val;
			}
			((UnityEvent)onClick).AddListener((UnityAction)obj);
			HideStatsPanel();
		}

		public static void CreateStatsPanel(SkillsDialog skillsDialog)
		{
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_003d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0051: Unknown result type (might be due to invalid IL or missing references)
			//IL_005b: Unknown result type (might be due to invalid IL or missing references)
			//IL_006f: Unknown result type (might be due to invalid IL or missing references)
			//IL_009e: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a9: Expected O, but got Unknown
			DestroyStatsPanel();
			StatsPanel = new PlayerStatsPanel(((Component)skillsDialog).transform);
			StatsPanel.RectTransform.SetAnchorMin(new Vector2(0.5f, 0.5f)).SetAnchorMax(new Vector2(0.5f, 0.5f)).SetPivot(new Vector2(0.5f, 0.5f))
				.SetPosition(Vector2.zero)
				.SetSizeDelta(new Vector2(450f, 660f));
			ButtonClickedEvent onClick = StatsPanel.CloseButton.Button.onClick;
			object obj = <>O.<0>__HideStatsPanel;
			if (obj == null)
			{
				UnityAction val = HideStatsPanel;
				<>O.<0>__HideStatsPanel = val;
				obj = (object)val;
			}
			((UnityEvent)onClick).AddListener((UnityAction)obj);
			HideStatsPanel();
		}

		public static void DestroyStatsPanel()
		{
			if (IsStatsPanelValid())
			{
				Object.Destroy((Object)(object)StatsPanel.Panel);
				StatsPanel = null;
			}
		}

		public static void ShowStatsPanel()
		{
			if (IsStatsPanelValid())
			{
				StatsPanel.Panel.SetActive(true);
			}
		}

		public static void HideStatsPanel()
		{
			if (IsStatsPanelValid())
			{
				StatsPanel.Panel.SetActive(false);
			}
		}

		public static void ToggleStatsPanel()
		{
			if (IsStatsPanelValid())
			{
				StatsPanel.Panel.SetActive(!StatsPanel.Panel.activeSelf);
			}
		}

		public static void UpdateStatsPanel(PlayerProfile profile)
		{
			if (IsStatsPanelValid())
			{
				if (profile?.m_playerStats == null)
				{
					ReportCard.LogInfo("PlayerProfile (" + ((profile != null) ? profile.GetName() : null) + ") has no valid PlayerStats.");
					HideStatsPanel();
				}
				else
				{
					StatsPanel.UpdateStatsList(profile);
				}
			}
		}

		private static LabelButton CreateStatsButton(Transform parentTransform)
		{
			LabelButton labelButton = new LabelButton(parentTransform);
			((Object)labelButton.Container).name = "StatsButton";
			labelButton.Label.SetFontSize<TMP_Text>(20f).SetText("Stats");
			return labelButton;
		}

		public static void CreateStatsButton(FejdStartup fejdStartup)
		{
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0043: Unknown result type (might be due to invalid IL or missing references)
			//IL_0057: Unknown result type (might be due to invalid IL or missing references)
			//IL_007c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0081: Unknown result type (might be due to invalid IL or missing references)
			//IL_0087: Expected O, but got Unknown
			LabelButton labelButton = CreateStatsButton(fejdStartup.m_characterSelectScreen.transform);
			labelButton.Container.GetComponent<RectTransform>().SetAnchorMin(Vector2.right).SetAnchorMax(Vector2.right)
				.SetPivot(Vector2.right)
				.SetPosition(new Vector2(-25f, 20f))
				.SetSizeDelta(new Vector2(120f, 45f));
			ButtonClickedEvent onClick = labelButton.Button.onClick;
			object obj = <>O.<1>__ToggleStatsPanel;
			if (obj == null)
			{
				UnityAction val = ToggleStatsPanel;
				<>O.<1>__ToggleStatsPanel = val;
				obj = (object)val;
			}
			((UnityEvent)onClick).AddListener((UnityAction)obj);
		}

		public static void CreateStatsButton(SkillsDialog skillsDialog)
		{
			//IL_0030: Unknown result type (might be due to invalid IL or missing references)
			//IL_003a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0044: Unknown result type (might be due to invalid IL or missing references)
			//IL_0058: Unknown result type (might be due to invalid IL or missing references)
			//IL_006c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0091: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: Unknown result type (might be due to invalid IL or missing references)
			//IL_009c: Expected O, but got Unknown
			LabelButton labelButton = CreateStatsButton(((Component)skillsDialog).transform.Find("SkillsFrame"));
			((Object)labelButton.Button).name = "StatsButton";
			labelButton.Container.GetComponent<RectTransform>().SetAnchorMin(Vector2.one).SetAnchorMax(Vector2.one)
				.SetPivot(Vector2.one)
				.SetPosition(new Vector2(-25f, -2.5f))
				.SetSizeDelta(new Vector2(100f, 42.5f));
			ButtonClickedEvent onClick = labelButton.Button.onClick;
			object obj = <>O.<2>__OnStatsButtonClick;
			if (obj == null)
			{
				UnityAction val = OnStatsButtonClick;
				<>O.<2>__OnStatsButtonClick = val;
				obj = (object)val;
			}
			((UnityEvent)onClick).AddListener((UnityAction)obj);
		}

		private static void OnStatsButtonClick()
		{
			UpdateStatsPanel(Game.instance.Ref<Game>()?.m_playerProfile);
			ShowStatsPanel();
		}
	}
	public sealed class ExploredStatsPanel
	{
		public GameObject Panel { get; }

		public RectTransform RectTransform { get; }

		public TextMeshProUGUI Title { get; }

		public ListView StatsList { get; }

		public TextMeshProUGUI StatusLabel { get; }

		public LabelButton CloseButton { get; }

		public ExploredStatsPanel(Transform parentTransform)
		{
			Panel = CreatePanel(parentTransform);
			RectTransform = Panel.GetComponent<RectTransform>();
			Title = CreateTitle((Transform)(object)RectTransform);
			StatsList = CreateStatsList((Transform)(object)RectTransform);
			StatusLabel = CreateStatusLabel((Transform)(object)RectTransform);
			CloseButton = CreateCloseButton((Transform)(object)RectTransform);
		}

		public TextMeshProUGUI AddStatLabel()
		{
			return CreateStatLabel(StatsList.Content.transform);
		}

		public void ResetStatsList()
		{
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			foreach (Transform item in StatsList.Content.transform)
			{
				Object.Destroy((Object)(object)((Component)item).gameObject);
			}
		}

		public void UpdateStatsList(ExploredStats exploredStats)
		{
			//IL_001d: 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_0039: Unknown result type (might be due to invalid IL or missing references)
			//IL_0043: Unknown result type (might be due to invalid IL or missing references)
			//IL_005b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0069: Unknown result type (might be due to invalid IL or missing references)
			//IL_006b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0070: Unknown result type (might be due to invalid IL or missing references)
			//IL_0080: Unknown result type (might be due to invalid IL or missing references)
			int num = exploredStats.ExploredCount();
			int num2 = exploredStats.TotalCount();
			AddExploredStatsLabel("World", num, num2, num2);
			AddExploredStatsSlider(Color.white, num, num2);
			Biome[] heightmapBiomes = ExploredStats.GetHeightmapBiomes();
			foreach (Biome val in heightmapBiomes)
			{
				int num3 = exploredStats.ExploredCount(val);
				int num4 = exploredStats.TotalCount(val);
				if (num4 > 0)
				{
					string name = Enum.GetName(typeof(Biome), val);
					Color color = BiomeToSliderColor(val);
					AddExploredStatsLabel(name, num3, num4, num2);
					AddExploredStatsSlider(color, num3, num4);
				}
			}
		}

		public void UpdateStatus(string status)
		{
			((TMP_Text)StatusLabel).text = status;
		}

		private static Color BiomeToSliderColor(Biome biome)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0003: Invalid comparison between Unknown and I4
			//IL_002e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0031: Invalid comparison between Unknown and I4
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_001d: Expected I4, but got Unknown
			//IL_00ed: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f2: 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_003c: Invalid comparison between Unknown and I4
			//IL_005d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0062: Unknown result type (might be due to invalid IL or missing references)
			//IL_0091: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: Unknown result type (might be due to invalid IL or missing references)
			//IL_010c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0111: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ad: Unknown result type (might be due to invalid IL or missing references)
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			//IL_001f: Invalid comparison between Unknown and I4
			//IL_0112: Unknown result type (might be due to invalid IL or missing references)
			//IL_0104: Unknown result type (might be due to invalid IL or missing references)
			//IL_0109: Unknown result type (might be due to invalid IL or missing references)
			//IL_0041: Unknown result type (might be due to invalid IL or missing references)
			//IL_0047: Invalid comparison between Unknown and I4
			//IL_0077: Unknown result type (might be due to invalid IL or missing references)
			//IL_007c: 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_0024: Invalid comparison between Unknown and I4
			//IL_00d6: 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_00bf: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c4: Unknown result type (might be due to invalid IL or missing references)
			if ((int)biome <= 16)
			{
				switch (biome - 1)
				{
				default:
					if ((int)biome != 8)
					{
						if ((int)biome != 16)
						{
							break;
						}
						return new Color(1f, 1f, 0f);
					}
					return new Color(0f, 0.46f, 0.33f);
				case 0:
					return new Color(0f, 1f, 0.4f);
				case 1:
					return new Color(1f, 0.6f, 0.46f);
				case 3:
					return new Color(0.26f, 1f, 1f);
				case 2:
					break;
				}
			}
			else
			{
				if ((int)biome == 32)
				{
					return new Color(1f, 0f, 0f);
				}
				if ((int)biome == 256)
				{
					return new Color(0f, 0.46f, 1f);
				}
				if ((int)biome == 512)
				{
					return new Color(0.6f, 0f, 0.66f);
				}
			}
			return Color.white;
		}

		private void AddExploredStatsLabel(string biomeName, int biomeExplored, int biomeTotal, int worldTotal)
		{
			TextMeshProUGUI val = CreateStatLabel(StatsList.Content.transform);
			if (PluginConfig.ExploredStatsPanelShowRawValues.Value)
			{
				float num = (float)biomeTotal * 1f / ((float)worldTotal * 1f) * 100f;
				TextMeshProUGUI val2 = val;
				((TMP_Text)val2).text = ((TMP_Text)val2).text + "<align=left><color=#FFD600>" + biomeName + "</color> " + $"(<color=#FFD600>{num:F2}%</color>)<line-height=0>\n" + $"<align=right>{biomeExplored:D}/<color=#FFD600>{biomeTotal:D}</color><line-height=1em>";
			}
			else
			{
				float num2 = (float)biomeExplored * 1f / ((float)biomeTotal * 1f) * 100f;
				((TMP_Text)val).text = "<align=left><color=#FFD600>" + biomeName + "</color><line-height=0>\n" + $"<align=right>{num2:F2}%<line-height=1em>";
			}
		}

		private void AddExploredStatsSlider(Color color, int explored, int total)
		{
			//IL_0020: Unknown result type (might be due to invalid IL or missing references)
			Slider obj = CreateStatSlider(StatsList.Content.transform);
			((Component)obj.fillRect).GetComponent<Image>().SetColor(color);
			obj.SetInteractable<Slider>(interactable: false).SetWholeNumbers<Slider>(wholeNumbers: true).SetMinValue<Slider>(0f)
				.SetMaxValue<Slider>((float)total)
				.SetValueWithoutNotify((float)explored);
		}

		private static GameObject CreatePanel(Transform parentTransform)
		{
			GameObject obj = UIBuilder.CreatePanel(parentTransform);
			((Object)obj).name = "ExploredStatsPanel";
			obj.AddComponent<MinimapFocus>();
			return obj;
		}

		private static TextMeshProUGUI CreateTitle(Transform parentTransform)
		{
			//IL_002c: 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_004a: Unknown result type (might be due to invalid IL or missing references)
			//IL_005e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0072: Unknown result type (might be due to invalid IL or missing references)
			TextMeshProUGUI obj = UIBuilder.CreateTMPHeaderLabel(parentTransform);
			((Object)obj).name = "Title";
			((TMP_Text)obj.SetAlignment<TextMeshProUGUI>((TextAlignmentOptions)258)).SetText("Explored");
			((TMP_Text)obj).rectTransform.SetAnchorMin(Vector2.up).SetAnchorMax(Vector2.one).SetPivot(new Vector2(0.5f, 1f))
				.SetPosition(new Vector2(0f, -15f))
				.SetSizeDelta(new Vector2(0f, 40f));
			return obj;
		}

		private static ListView CreateStatsList(Transform parentTransform)
		{
			//IL_0021: Unknown result type (might be due to invalid IL or missing references)
			//IL_002b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: 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_005d: Unknown result type (might be due to invalid IL or missing references)
			ListView listView = new ListView(parentTransform);
			((Object)listView.Container).name = "StatsListView";
			listView.Container.GetComponent<RectTransform>().SetAnchorMin(Vector2.zero).SetAnchorMax(Vector2.one)
				.SetPivot(Vector2.up)
				.SetPosition(new Vector2(20f, -60f))
				.SetSizeDelta(new Vector2(-40f, -135f));
			listView.ContentLayoutGroup.SetPadding<VerticalLayoutGroup>((int?)10, (int?)20, (int?)null, (int?)null).SetSpacing<VerticalLayoutGroup>(2.5f);
			return listView;
		}

		private static TextMeshProUGUI CreateStatusLabel(Transform parentTransform)
		{
			//IL_0017: 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_002b: Unknown result type (might be due to invalid IL or missing references)
			//IL_003f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0053: Unknown result type (might be due to invalid IL or missing references)
			TextMeshProUGUI obj = UIBuilder.CreateTMPLabel(parentTransform);
			((Object)obj).name = "StatusLabel";
			((TMP_Text)obj).rectTransform.SetAnchorMin(Vector2.zero).SetAnchorMax(Vector2.right).SetPivot(Vector2.zero)
				.SetPosition(new Vector2(20f, 20f))
				.SetSizeDelta(new Vector2(-155f, 42.5f));
			((TMP_Text)obj.SetAlignment<TextMeshProUGUI>((TextAlignmentOptions)4097).SetLineSpacing<TextMeshProUGUI>(10f)).SetText("Status");
			return obj;
		}

		private static LabelButton CreateCloseButton(Transform parentTransform)
		{
			//IL_0021: Unknown result type (might be due to invalid IL or missing references)
			//IL_002b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: 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_005d: Unknown result type (might be due to invalid IL or missing references)
			LabelButton labelButton = new LabelButton(parentTransform);
			((Object)labelButton.Button).name = "CloseButton";
			labelButton.Container.GetComponent<RectTransform>().SetAnchorMin(Vector2.right).SetAnchorMax(Vector2.right)
				.SetPivot(Vector2.right)
				.SetPosition(new Vector2(-20f, 20f))
				.SetSizeDelta(new Vector2(100f, 42.5f));
			labelButton.Label.SetFontSize<TMP_Text>(18f).SetText("Close");
			return labelButton;
		}

		private static TextMeshProUGUI CreateStatLabel(Transform parentTransform)
		{
			//IL_0017: 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_002b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_003f: Unknown result type (might be due to invalid IL or missing references)
			TextMeshProUGUI obj = UIBuilder.CreateTMPLabel(parentTransform);
			((Object)obj).name = "StatLabel";
			((TMP_Text)obj).rectTransform.SetAnchorMin(Vector2.zero).SetAnchorMax(Vector2.right).SetPivot(Vector2.zero)
				.SetPosition(Vector2.zero)
				.SetSizeDelta(Vector2.zero);
			obj.SetFontSize<TextMeshProUGUI>(18f).SetAlignment<TextMeshProUGUI>((TextAlignmentOptions)513);
			LayoutElement layoutElement = ((Component)obj).gameObject.AddComponent<LayoutElement>().SetFlexible(1f);
			float? height = 30f;
			layoutElement.SetPreferred(null, height);
			return obj;
		}

		private static Slider CreateStatSlider(Transform parentTransform)
		{
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_001e: Expected O, but got Unknown
			//IL_0031: Unknown result type (might be due to invalid IL or missing references)
			//IL_003b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0045: Unknown result type (might be due to invalid IL or missing references)
			//IL_004f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0063: Unknown result type (might be due to invalid IL or missing references)
			//IL_0086: Unknown result type (might be due to invalid IL or missing references)
			//IL_008b: Unknown result type (might be due to invalid IL or missing references)
			//IL_009d: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ef: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f9: Unknown result type (might be due to invalid IL or missing references)
			//IL_011c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0122: Expected O, but got Unknown
			//IL_013a: Unknown result type (might be due to invalid IL or missing references)
			//IL_014b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0155: Unknown result type (might be due to invalid IL or missing references)
			//IL_0169: Unknown result type (might be due to invalid IL or missing references)
			//IL_0173: Unknown result type (might be due to invalid IL or missing references)
			//IL_017d: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = new GameObject("StatSlider", new Type[1] { typeof(RectTransform) });
			val.transform.SetParent(parentTransform, false);
			val.GetComponent<RectTransform>().SetAnchorMin(Vector2.zero).SetAnchorMax(Vector2.right)
				.SetPivot(Vector2.zero)
				.SetPosition(Vector2.zero)
				.SetSizeDelta(new Vector2(0f, 20f));
			GameObject val2 = new GameObject("Background", new Type[1] { typeof(RectTransform) });
			val2.transform.SetParent(val.transform, false);
			val2.AddComponent<Image>().SetColor(new Color(0.271f, 0.271f, 0.271f, 1f));
			val2.GetComponent<RectTransform>().SetAnchorMin(Vector2.zero).SetAnchorMax(Vector2.one)
				.SetPivot(new Vector2(0.5f, 0.5f))
				.SetPosition(Vector2.zero)
				.SetSizeDelta(Vector2.zero);
			GameObject val3 = new GameObject("Fill", new Type[1] { typeof(RectTransform) });
			val3.transform.SetParent(val.transform, false);
			val3.AddComponent<Image>().SetColor(Color.white);
			val3.GetComponent<RectTransform>().SetAnchorMin(Vector2.zero).SetAnchorMax(Vector2.one)
				.SetPivot(new Vector2(0.5f, 0.5f))
				.SetPosition(Vector2.zero)
				.SetSizeDelta(Vector2.zero);
			Slider obj = val.AddComponent<Slider>();
			obj.SetDirection<Slider>((Direction)0).SetFillRect<Slider>(val3.GetComponent<RectTransform>()).SetTargetGraphic<Slider>((Graphic)(object)val3.GetComponent<Image>())
				.SetTransition<Slider>((Transition)0);
			LayoutElement layoutElement = val.AddComponent<LayoutElement>().SetFlexible(1f);
			float? height = 10f;
			layoutElement.SetPreferred(null, height);
			return obj;
		}
	}
	public sealed class MinimapFocus : MonoBehaviour
	{
		private void Update()
		{
			Minimap.m_instance.m_wasFocused = true;
		}

		private void OnDisable()
		{
			Minimap.m_instance.m_wasFocused = false;
		}

		private void OnEnable()
		{
			Minimap.m_instance.m_wasFocused = true;
		}
	}
	public sealed class PlayerStatsPanel
	{
		public GameObject Panel { get; private set; }

		public RectTransform RectTransform { get; }

		public TMP_Text Title { get; private set; }

		public ListView StatsList { get; private set; }

		public LabelButton CloseButton { get; private set; }

		public List<TMP_Text> StatLabels { get; } = new List<TMP_Text>();


		public PlayerStatsPanel(Transform parentTransform)
		{
			Panel = CreatePanel(parentTransform);
			RectTransform = Panel.GetComponent<RectTransform>();
			Title = CreateTitle(Panel.transform);
			StatsList = CreateStatsList(Panel.transform);
			CloseButton = CreateCloseButton(Panel.transform);
		}

		public void UpdateStatsList(PlayerProfile profile)
		{
			//IL_006e: Unknown result type (might be due to invalid IL or missing references)
			List<KeyValuePair<PlayerStatType, float>> list = profile.m_playerStats.m_stats.ToList();
			for (int i = StatLabels.Count; i < list.Count; i++)
			{
				TMP_Text item = CreateStatLabel(StatsList.Content.transform);
				StatLabels.Add(item);
			}
			for (int j = 0; j < list.Count; j++)
			{
				KeyValuePair<PlayerStatType, float> pair = list[j];
				StatLabels[j].SetText($"<align=left><color=#FFD600>{pair.Key}</color><line-height=0>\n" + "<align=right>" + GetFormattedValue(pair) + "<line-height=1em>");
			}
		}

		private static string GetFormattedValue(KeyValuePair<PlayerStatType, float> pair)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			//IL_000d: Invalid comparison between Unknown and I4
			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			//IL_0014: Invalid comparison between Unknown and I4
			PlayerStatType key = pair.Key;
			if (key - 16 > 4)
			{
				if (key - 21 <= 1)
				{
					return GetFormattedValue(TimeSpan.FromSeconds(pair.Value));
				}
				return $"{pair.Value}";
			}
			return $"{pair.Value:N2}";
		}

		private static string GetFormattedValue(TimeSpan duration)
		{
			if (duration.Days < 1)
			{
				return $"{duration.Hours:D2}:{duration.Minutes:D2}:{duration.Seconds:D2}";
			}
			return $"{duration.Days}d {duration.Hours:D2}:{duration.Minutes:D2}:{duration.Seconds:D2}";
		}

		private static TMP_Text CreateStatLabel(Transform parentTransform)
		{
			//IL_0017: 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_002b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_003f: Unknown result type (might be due to invalid IL or missing references)
			TextMeshProUGUI obj = UIBuilder.CreateTMPLabel(parentTransform);
			((Object)obj).name = "StatLabel";
			((TMP_Text)obj).rectTransform.SetAnchorMin(Vector2.zero).SetAnchorMax(Vector2.right).SetPivot(Vector2.zero)
				.SetPosition(Vector2.zero)
				.SetSizeDelta(Vector2.zero);
			((TMP_Text)(object)obj).SetFontSize<TMP_Text>(18f).SetAlignment<TMP_Text>((TextAlignmentOptions)513);
			LayoutElement layoutElement = ((Component)obj).gameObject.AddComponent<LayoutElement>().SetFlexible(1f);
			float? height = 30f;
			layoutElement.SetPreferred(null, height);
			return (TMP_Text)(object)obj;
		}

		private static GameObject CreatePanel(Transform parentTransform)
		{
			//IL_0021: Unknown result type (might be due to invalid IL or missing references)
			GameObject obj = UIBuilder.CreatePanel(parentTransform);
			((Object)obj).name = "PlayerStatsPanel";
			obj.GetComponent<RectTransform>().SetSizeDelta(new Vector2(400f, 600f));
			return obj;
		}

		private static TMP_Text CreateTitle(Transform parentTransform)
		{
			//IL_002c: 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_004a: Unknown result type (might be due to invalid IL or missing references)
			//IL_005e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0072: Unknown result type (might be due to invalid IL or missing references)
			TextMeshProUGUI obj = UIBuilder.CreateTMPHeaderLabel(parentTransform);
			((Object)obj).name = "Title";
			((TMP_Text)(object)obj).SetAlignment<TMP_Text>((TextAlignmentOptions)258).SetText("Stats");
			((TMP_Text)obj).rectTransform.SetAnchorMin(Vector2.up).SetAnchorMax(Vector2.one).SetPivot(new Vector2(0.5f, 1f))
				.SetPosition(new Vector2(0f, -15f))
				.SetSizeDelta(new Vector2(0f, 40f));
			return (TMP_Text)(object)obj;
		}

		private static ListView CreateStatsList(Transform parentTransform)
		{
			//IL_0021: Unknown result type (might be due to invalid IL or missing references)
			//IL_002b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: 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_005d: Unknown result type (might be due to invalid IL or missing references)
			ListView listView = new ListView(parentTransform);
			((Object)listView.Container).name = "StatsListView";
			listView.Container.GetComponent<RectTransform>().SetAnchorMin(Vector2.zero).SetAnchorMax(Vector2.one)
				.SetPivot(Vector2.up)
				.SetPosition(new Vector2(20f, -60f))
				.SetSizeDelta(new Vector2(-40f, -135f));
			listView.ContentLayoutGroup.SetPadding<VerticalLayoutGroup>((int?)10, (int?)20, (int?)null, (int?)null);
			return listView;
		}

		private static LabelButton CreateCloseButton(Transform parentTransform)
		{
			//IL_0021: Unknown result type (might be due to invalid IL or missing references)
			//IL_002b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: 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_005d: Unknown result type (might be due to invalid IL or missing references)
			LabelButton labelButton = new LabelButton(parentTransform);
			((Object)labelButton.Button).name = "CloseButton";
			labelButton.Container.GetComponent<RectTransform>().SetAnchorMin(Vector2.right).SetAnchorMax(Vector2.right)
				.SetPivot(Vector2.right)
				.SetPosition(new Vector2(-20f, 20f))
				.SetSizeDelta(new Vector2(100f, 42.5f));
			labelButton.Label.SetFontSize<TMP_Text>(18f).SetText("Close");
			return labelButton;
		}
	}
	[HarmonyPatch(typeof(FejdStartup))]
	internal static class FejdStartupPatch
	{
		[HarmonyPostfix]
		[HarmonyPatch("SetupGui")]
		private static void SetupGuiPostfix(FejdStartup __instance)
		{
			if (PluginConfig.IsModEnabled.Value)
			{
				PlayerStatsController.CreateStatsPanel(__instance);
				PlayerStatsController.CreateStatsButton(__instance);
			}
		}

		[HarmonyPostfix]
		[HarmonyPatch("ShowCharacterSelection")]
		private static void ShowCharacterSelectionPostfix()
		{
			if (PluginConfig.IsModEnabled.Value && PluginConfig.OpenStatsPanelOnCharacterSelect.Value)
			{
				PlayerStatsController.ShowStatsPanel();
			}
		}

		[HarmonyPostfix]
		[HarmonyPatch("SetupCharacterPreview")]
		private static void SetupCharacterPreview(PlayerProfile profile)
		{
			if (PluginConfig.IsModEnabled.Value)
			{
				PlayerStatsController.UpdateStatsPanel(profile);
			}
		}
	}
	[HarmonyPatch(typeof(InventoryGui))]
	internal static class InventoryGuiPatch
	{
		public static readonly int VisibleId = Animator.StringToHash("visible");

		[HarmonyPrefix]
		[HarmonyPatch("OnDestroy")]
		private static void OnDestroyPrefix()
		{
			if (PluginConfig.IsModEnabled.Value)
			{
				PlayerStatsController.DestroyStatsPanel();
			}
		}

		[HarmonyPrefix]
		[HarmonyPatch("Hide")]
		private static void HidePrefix(InventoryGui __instance)
		{
			if (PluginConfig.IsModEnabled.Value && __instance.m_animator.GetBool(VisibleId))
			{
				PlayerStatsController.HideStatsPanel();
			}
		}
	}
	[HarmonyPatch(typeof(Minimap))]
	internal static class MinimapPatch
	{
		[HarmonyPostfix]
		[HarmonyPatch("Start")]
		private static void StartPostfix(Minimap __instance)
		{
			if (PluginConfig.IsModEnabled.Value)
			{
				ExploredStatsController.CreateStatsPanel(__instance);
				ExploredStatsController.CreateStatsButton(__instance);
				ExploredStatsController.ToggleStatsButton(PluginConfig.ExploredStatsPanelShowStatsButton.Value);
			}
		}
	}
	[HarmonyPatch(typeof(SkillsDialog))]
	internal static class SkillsDialogPatch
	{
		[HarmonyPostfix]
		[HarmonyPatch("Awake")]
		private static void AwakePostfix(SkillsDialog __instance)
		{
			if (PluginConfig.IsModEnabled.Value)
			{
				PlayerStatsController.CreateStatsPanel(__instance);
				PlayerStatsController.CreateStatsButton(__instance);
			}
		}

		[HarmonyPostfix]
		[HarmonyPatch("OnClose")]
		private static void OnClosePostfix()
		{
			if (PluginConfig.IsModEnabled.Value)
			{
				PlayerStatsController.HideStatsPanel();
			}
		}
	}
	[BepInPlugin("redseiko.valheim.reportcard", "ReportCard", "1.3.0")]
	public sealed class ReportCard : BaseUnityPlugin
	{
		public const string PluginGuid = "redseiko.valheim.reportcard";

		public const string PluginName = "ReportCard";

		public const string PluginVersion = "1.3.0";

		private static ManualLogSource _logger;

		private void Awake()
		{
			_logger = ((BaseUnityPlugin)this).Logger;
			PluginConfig.BindConfig(((BaseUnityPlugin)this).Config);
			Harmony.CreateAndPatchAll(Assembly.GetExecutingAssembly(), "redseiko.valheim.reportcard");
		}

		public static void LogInfo(object obj)
		{
			_logger.LogInfo((object)$"[{DateTime.Now.ToString(DateTimeFormatInfo.InvariantInfo)}] {obj}");
		}
	}
}
namespace ComfyLib
{
	public static class ConfigFileExtensions
	{
		internal sealed class ConfigurationManagerAttributes
		{
			public Action<ConfigEntryBase> CustomDrawer;

			public bool? Browsable;

			public bool? HideDefaultButton;

			public bool? HideSettingName;

			public bool? IsAdvanced;

			public int? Order;

			public bool? ReadOnly;
		}

		private static readonly Dictionary<string, int> _sectionToSettingOrder = new Dictionary<string, int>();

		private static int GetSettingOrder(string section)
		{
			if (!_sectionToSettingOrder.TryGetValue(section, out var value))
			{
				value = 0;
			}
			_sectionToSettingOrder[section] = value - 1;
			return value;
		}

		public static ConfigEntry<T> BindInOrder<T>(this ConfigFile config, string section, string key, T defaultValue, string description, AcceptableValueBase acceptableValues, bool browsable = true, bool hideDefaultButton = false, bool hideSettingName = false, bool isAdvanced = false, bool readOnly = false)
		{
			//IL_006f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0079: Expected O, but got Unknown
			return config.Bind<T>(section, key, defaultValue, new ConfigDescription(description, acceptableValues, new object[1]
			{
				new ConfigurationManagerAttributes
				{
					Browsable = browsable,
					CustomDrawer = null,
					HideDefaultButton = hideDefaultButton,
					HideSettingName = hideSettingName,
					IsAdvanced = isAdvanced,
					Order = GetSettingOrder(section),
					ReadOnly = readOnly
				}
			}));
		}

		public static ConfigEntry<T> BindInOrder<T>(this ConfigFile config, string section, string key, T defaultValue, string description, Action<ConfigEntryBase> customDrawer = null, bool browsable = true, bool hideDefaultButton = false, bool hideSettingName = false, bool isAdvanced = false, bool readOnly = false)
		{
			//IL_006f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0079: Expected O, but got Unknown
			return config.Bind<T>(section, key, defaultValue, new ConfigDescription(description, (AcceptableValueBase)null, new object[1]
			{
				new ConfigurationManagerAttributes
				{
					Browsable = browsable,
					CustomDrawer = customDrawer,
					HideDefaultButton = hideDefaultButton,
					HideSettingName = hideSettingName,
					IsAdvanced = isAdvanced,
					Order = GetSettingOrder(section),
					ReadOnly = readOnly
				}
			}));
		}

		public static void OnSettingChanged<T>(this ConfigEntry<T> configEntry, Action settingChangedHandler)
		{
			configEntry.SettingChanged += delegate
			{
				settingChangedHandler();
			};
		}

		public static void OnSettingChanged<T>(this ConfigEntry<T> configEntry, Action<T> settingChangedHandler)
		{
			configEntry.SettingChanged += delegate(object _, EventArgs eventArgs)
			{
				//IL_0007: Unknown result type (might be due to invalid IL or missing references)
				settingChangedHandler((T)((SettingChangedEventArgs)eventArgs).ChangedSetting.BoxedValue);
			};
		}

		public static void OnSettingChanged<T>(this ConfigEntry<T> configEntry, Action<ConfigEntry<T>> settingChangedHandler)
		{
			configEntry.SettingChanged += delegate(object _, EventArgs eventArgs)
			{
				//IL_0007: Unknown result type (might be due to invalid IL or missing references)
				settingChangedHandler((ConfigEntry<T>)((SettingChangedEventArgs)eventArgs).ChangedSetting.BoxedValue);
			};
		}
	}
	public static class ObjectExtensions
	{
		public static T FirstByNameOrThrow<T>(this IEnumerable<T> unityObjects, string name) where T : Object
		{
			foreach (T unityObject in unityObjects)
			{
				if (((Object)unityObject).name == name)
				{
					return unityObject;
				}
			}
			throw new InvalidOperationException($"Could not find Unity object of type {typeof(T)} with name: {name}");
		}

		public static T Ref<T>(this T unityObject) where T : Object
		{
			if (!Object.op_Implicit((Object)(object)unityObject))
			{
				return default(T);
			}
			return unityObject;
		}
	}
	public sealed class LabelButton
	{
		public GameObject Container { get; private set; }

		public TMP_Text Label { get; private set; }

		public Button Button { get; private set; }

		public LabelButton(Transform parentTransform)
		{
			Container = CreateContainer(parentTransform);
			Label = CreateLabel(Container.transform);
			Button = CreateButton(Container);
		}

		private static GameObject CreateContainer(Transform parentTransform)
		{
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			//IL_002a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0045: Unknown result type (might be due to invalid IL or missing references)
			//IL_0050: Unknown result type (might be due to invalid IL or missing references)
			//IL_0060: Unknown result type (might be due to invalid IL or missing references)
			//IL_0074: Unknown result type (might be due to invalid IL or missing references)
			//IL_0088: Unknown result type (might be due to invalid IL or missing references)
			//IL_0092: 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_00b2: Expected O, but got Unknown
			GameObject val = new GameObject("Button", new Type[1] { typeof(RectTransform) });
			val.transform.SetParent(parentTransform, false);
			val.AddComponent<Image>().SetType((Type)1).SetSprite(UIResources.GetSprite("button"))
				.SetColor(Color.white);
			val.GetComponent<RectTransform>().SetAnchorMin(new Vector2(0.5f, 0.5f)).SetAnchorMax(new Vector2(0.5f, 0.5f))
				.SetPivot(new Vector2(0.5f, 0.5f))
				.SetPosition(Vector2.zero)
				.SetSizeDelta(new Vector2(120f, 45f));
			return val;
		}

		private static TMP_Text CreateLabel(Transform parentTransform)
		{
			//IL_002b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_0049: Unknown result type (might be due to invalid IL or missing references)
			//IL_0053: Unknown result type (might be due to invalid IL or missing references)
			//IL_005d: Unknown result type (might be due to invalid IL or missing references)
			TextMeshProUGUI obj = UIBuilder.CreateTMPLabel(parentTransform);
			((TMP_Text)(object)obj).SetFontSize<TMP_Text>(16f).SetAlignment<TMP_Text>((TextAlignmentOptions)514).SetText("Button");
			((TMP_Text)obj).rectTransform.SetAnchorMin(Vector2.zero).SetAnchorMax(Vector2.one).SetPivot(new Vector2(0.5f, 0.5f))
				.SetPosition(Vector2.zero)
				.SetSizeDelta(Vector2.zero);
			return (TMP_Text)(object)obj;
		}

		private static Button CreateButton(GameObject container)
		{
			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0059: Unknown result type (might be due to invalid IL or missing references)
			Button obj = container.AddComponent<Button>();
			Button selectable = obj.SetTransition<Button>((Transition)2);
			SpriteState spriteState = default(SpriteState);
			((SpriteState)(ref spriteState)).disabledSprite = UIResources.GetSprite("button_disabled");
			((SpriteState)(ref spriteState)).highlightedSprite = UIResources.GetSprite("button_highlight");
			((SpriteState)(ref spriteState)).pressedSprite = UIResources.GetSprite("button_pressed");
			((SpriteState)(ref spriteState)).selectedSprite = UIResources.GetSprite("button_highlight");
			selectable.SetSpriteState<Button>(spriteState);
			return obj;
		}
	}
	public sealed class ListView
	{
		public GameObject Container { get; private set; }

		public Image Background { get; private set; }

		public GameObject Viewport { get; private set; }

		public GameObject Content { get; private set; }

		public VerticalLayoutGroup ContentLayoutGroup { get; private set; }

		public ScrollRect ScrollRect { get; private set; }

		public ListView(Transform parentTransform)
		{
			Container = CreateContainer(parentTransform);
			Background = Container.GetComponent<Image>();
			Viewport = CreateViewport(Container.transform);
			Content = CreateContent(Viewport.transform);
			ContentLayoutGroup = Content.GetComponent<VerticalLayoutGroup>();
			ScrollRect = CreateScrollRect(Container, Viewport, Content);
		}

		private static GameObject CreateContainer(Transform parentTransform)
		{
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			//IL_002a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0030: Unknown result type (might be due to invalid IL or missing references)
			//IL_003b: 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_0076: Expected O, but got Unknown
			GameObject val = new GameObject("ListView", new Type[1] { typeof(RectTransform) });
			val.transform.SetParent(parentTransform, false);
			val.GetComponent<RectTransform>().SetSizeDelta(Vector2.zero);
			val.AddComponent<Image>().SetType((Type)1).SetSprite(UIResources.GetSprite("item_background"))
				.SetColor(new Color(0f, 0f, 0f, 0.5f));
			return val;
		}

		private static GameObject CreateViewport(Transform parentTransform)
		{
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			//IL_002a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0030: Unknown result type (might be due to invalid IL or missing references)
			//IL_003a: Unknown result type (might be due to invalid IL or missing references)
			//IL_004e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0058: Unknown result type (might be due to invalid IL or missing references)
			//IL_006c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0077: Unknown result type (might be due to invalid IL or missing references)
			//IL_007f: Expected O, but got Unknown
			GameObject val = new GameObject("Viewport", new Type[1] { typeof(RectTransform) });
			val.transform.SetParent(parentTransform, false);
			val.GetComponent<RectTransform>().SetAnchorMin(Vector2.zero).SetAnchorMax(Vector2.one)
				.SetPivot(new Vector2(0.5f, 0.5f))
				.SetPosition(Vector2.zero)
				.SetSizeDelta(new Vector2(-10f, -10f));
			val.AddComponent<RectMask2D>();
			return val;
		}

		private static GameObject CreateContent(Transform parentTransform)
		{
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			//IL_002a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0030: Unknown result type (might be due to invalid IL or missing references)
			//IL_003a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0044: Unknown result type (might be due to invalid IL or missing references)
			//IL_004e: 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_0063: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: Unknown result type (might be due to invalid IL or missing references)
			//IL_00aa: Expected O, but got Unknown
			GameObject val = new GameObject("Content", new Type[1] { typeof(RectTransform) });
			val.transform.SetParent(parentTransform, false);
			val.GetComponent<RectTransform>().SetAnchorMin(Vector2.up).SetAnchorMax(Vector2.one)
				.SetPivot(Vector2.up)
				.SetPosition(Vector2.zero)
				.SetSizeDelta(Vector2.zero);
			val.AddComponent<VerticalLayoutGroup>().SetChildControl<VerticalLayoutGroup>((bool?)true, (bool?)true).SetChildForceExpand<VerticalLayoutGroup>((bool?)false, (bool?)false)
				.SetSpacing<VerticalLayoutGroup>(0f);
			val.AddComponent<ContentSizeFitter>().SetHorizontalFit((FitMode)0).SetVerticalFit((FitMode)2);
			return val;
		}

		private static ScrollRect CreateScrollRect(GameObject view, GameObject viewport, GameObject content)
		{
			ScrollRect obj = view.AddComponent<ScrollRect>().SetViewport<ScrollRect>(viewport.GetComponent<RectTransform>()).SetContent<ScrollRect>(content.GetComponent<RectTransform>())
				.SetHorizontal<ScrollRect>(horizontal: false)
				.SetVertical<ScrollRect>(vertical: true)
				.SetScrollSensitivity<ScrollRect>(20f)
				.SetMovementType<ScrollRect>((MovementType)2);
			Scrollbar val = UIBuilder.CreateScrollbar(view.transform);
			val.direction = (Direction)2;
			obj.SetVerticalScrollbar<ScrollRect>(val).SetVerticalScrollbarVisibility<ScrollRect>((ScrollbarVisibility)0);
			return obj;
		}
	}
	public static class UIBuilder
	{
		public static readonly ColorBlock ScrollbarColors;

		public static TextMeshProUGUI CreateTMPLabel(Transform parentTransform)
		{
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			TextMeshProUGUI obj = Object.Instantiate<TextMeshProUGUI>(UnifiedPopup.instance.bodyText, parentTransform, false);
			((Object)obj).name = "Label";
			((TMP_Text)obj).fontSize = 16f;
			((TMP_Text)obj).richText = true;
			((Graphic)obj).color = Color.white;
			((TMP_Text)obj).enableAutoSizing = false;
			((TMP_Text)obj).textWrappingMode = (TextWrappingModes)0;
			((TMP_Text)obj).overflowMode = (TextOverflowModes)0;
			((TMP_Text)obj).text = string.Empty;
			return obj;
		}

		public static TextMeshProUGUI CreateTMPHeaderLabel(Transform parentTransform)
		{
			TextMeshProUGUI obj = Object.Instantiate<TextMeshProUGUI>(UnifiedPopup.instance.headerText, parentTransform, false);
			((Object)obj).name = "Label";
			((TMP_Text)obj).fontSize = 32f;
			((TMP_Text)obj).richText = true;
			((TMP_Text)obj).enableAutoSizing = false;
			((TMP_Text)obj).textWrappingMode = (TextWrappingModes)0;
			((TMP_Text)obj).overflowMode = (TextOverflowModes)0;
			((TMP_Text)obj).text = string.Empty;
			return obj;
		}

		public static GameObject CreatePanel(Transform parentTransform)
		{
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			//IL_002a: Unknown result type (might be due to invalid IL or missing references)
			//IL_003a: Unknown result type (might be due to invalid IL or missing references)
			//IL_004e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0062: Unknown result type (might be due to invalid IL or missing references)
			//IL_006c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0080: Unknown result type (might be due to invalid IL or missing references)
			//IL_008b: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c1: Expected O, but got Unknown
			GameObject val = new GameObject("Panel", new Type[1] { typeof(RectTransform) });
			val.transform.SetParent(parentTransform, false);
			val.GetComponent<RectTransform>().SetAnchorMin(new Vector2(0.5f, 0.5f)).SetAnchorMax(new Vector2(0.5f, 0.5f))
				.SetPivot(new Vector2(0.5f, 0.5f))
				.SetPosition(Vector2.zero)
				.SetSizeDelta(new Vector2(275f, 350f));
			val.AddComponent<Image>().SetType((Type)1).SetSprite(UIResources.GetSprite("woodpanel_trophys"))
				.SetMaterial(UIResources.GetMaterial("litpanel"))
				.SetColor(Color.white);
			return val;
		}

		public static Scrollbar CreateScrollbar(Transform parentTransform)
		{
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_001e: Expected O, but got Unknown
			//IL_0031: Unknown result type (might be due to invalid IL or missing references)
			//IL_003b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0045: Unknown result type (might be due to invalid IL or missing references)
			//IL_004f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0063: Unknown result type (might be due to invalid IL or missing references)
			//IL_0089: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b8: Expected O, but got Unknown
			//IL_00d0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00da: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ee: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f8: Unknown result type (might be due to invalid IL or missing references)
			//IL_0102: Unknown result type (might be due to invalid IL or missing references)
			//IL_0125: Unknown result type (might be due to invalid IL or missing references)
			//IL_012a: Unknown result type (might be due to invalid IL or missing references)
			//IL_013c: Unknown result type (might be due to invalid IL or missing references)
			//IL_014c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0160: Unknown result type (might be due to invalid IL or missing references)
			//IL_0174: Unknown result type (might be due to invalid IL or missing references)
			//IL_017e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0188: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ad: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d4: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = new GameObject("Scrollbar", new Type[1] { typeof(RectTransform) });
			val.transform.SetParent(parentTransform, false);
			val.GetComponent<RectTransform>().SetAnchorMin(Vector2.right).SetAnchorMax(Vector2.one)
				.SetPivot(Vector2.one)
				.SetPosition(Vector2.zero)
				.SetSizeDelta(new Vector2(10f, 0f));
			val.AddComponent<Image>().SetType((Type)1).SetSprite(UIResources.GetSprite("Background"))
				.SetColor(Color.black)
				.SetRaycastTarget(raycastTarget: true);
			GameObject val2 = new GameObject("SlidingArea", new Type[1] { typeof(RectTransform) });
			val2.transform.SetParent(val.transform, false);
			val2.GetComponent<RectTransform>().SetAnchorMin(Vector2.zero).SetAnchorMax(Vector2.one)
				.SetPivot(new Vector2(0.5f, 0.5f))
				.SetPosition(Vector2.zero)
				.SetSizeDelta(Vector2.zero);
			GameObject val3 = new GameObject("Handle", new Type[1] { typeof(RectTransform) });
			val3.transform.SetParent(val2.transform, false);
			RectTransform handleRect = val3.GetComponent<RectTransform>().SetAnchorMin(new Vector2(0.5f, 0.5f)).SetAnchorMax(new Vector2(0.5f, 0.5f))
				.SetPivot(new Vector2(0.5f, 0.5f))
				.SetPosition(Vector2.zero)
				.SetSizeDelta(Vector2.zero);
			Image graphic = val3.AddComponent<Image>().SetType((Type)1).SetSprite(UIResources.GetSprite("UISprite"))
				.SetColor(Color.white)
				.SetPixelsPerUnitMultiplier(0.7f);
			return ScrollbarExtensions.SetHandleRect<Scrollbar>(val.AddComponent<Scrollbar>().SetTargetGraphic<Scrollbar>((Graphic)(object)graphic).SetTransition<Scrollbar>((Transition)1)
				.SetColors<Scrollbar>(ScrollbarColors)
				.SetDirection<Scrollbar>((Direction)3), handleRect);
		}

		public static Slider CreateSlider(Transform parentTransform)
		{
			Slider obj = Object.Instantiate<Slider>(InventoryGui.m_instance.m_splitSlider, parentTransform);
			((Object)obj).name = "Slider";
			return obj;
		}

		static UIBuilder()
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_000a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			//IL_0040: Unknown result type (might be due to invalid IL or missing references)
			//IL_005b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0067: Unknown result type (might be due to invalid IL or missing references)
			//IL_0089: Unknown result type (might be due to invalid IL or missing references)
			//IL_008a: Unknown result type (might be due to invalid IL or missing references)
			ColorBlock scrollbarColors = default(ColorBlock);
			((ColorBlock)(ref scrollbarColors)).normalColor = Color.white;
			((ColorBlock)(ref scrollbarColors)).highlightedColor = new Color(1f, 0.75f, 0f);
			((ColorBlock)(ref scrollbarColors)).selectedColor = new Color(1f, 0.75f, 0f);
			((ColorBlock)(ref scrollbarColors)).pressedColor = new Color(1f, 0.67f, 0.11f);
			((ColorBlock)(ref scrollbarColors)).disabledColor = Color.gray;
			((ColorBlock)(ref scrollbarColors)).colorMultiplier = 1f;
			((ColorBlock)(ref scrollbarColors)).fadeDuration = 0.15f;
			ScrollbarColors = scrollbarColors;
		}
	}
	public static class CanvasGroupExtensions
	{
		public static CanvasGroup SetAlpha(this CanvasGroup canvasGroup, float alpha)
		{
			canvasGroup.alpha = alpha;
			return canvasGroup;
		}

		public static CanvasGroup SetBlocksRaycasts(this CanvasGroup canvasGroup, bool blocksRaycasts)
		{
			canvasGroup.blocksRaycasts = blocksRaycasts;
			return canvasGroup;
		}
	}
	public static class ColorExtensions
	{
		public static Color SetAlpha(this Color color, float alpha)
		{
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			color.a = alpha;
			return color;
		}
	}
	public static class ContentSizeFitterExtensions
	{
		public static ContentSizeFitter SetHorizontalFit(this ContentSizeFitter fitter, FitMode fitMode)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			fitter.horizontalFit = fitMode;
			return fitter;
		}

		public static ContentSizeFitter SetVerticalFit(this ContentSizeFitter fitter, FitMode fitMode)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			fitter.verticalFit = fitMode;
			return fitter;
		}
	}
	public static class LayoutGroupExtensions
	{
		public static T SetChildAlignment<T>(this T layoutGroup, TextAnchor alignment) where T : HorizontalOrVerticalLayoutGroup
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			((LayoutGroup)(object)layoutGroup).childAlignment = alignment;
			return layoutGroup;
		}

		public static T SetChildControl<T>(this T layoutGroup, bool? width = null, bool? height = null) where T : HorizontalOrVerticalLayoutGroup
		{
			if (!width.HasValue && !height.HasValue)
			{
				throw new ArgumentException("Value for width or height must be provided.");
			}
			if (width.HasValue)
			{
				((HorizontalOrVerticalLayoutGroup)layoutGroup).childControlWidth = width.Value;
			}
			if (height.HasValue)
			{
				((HorizontalOrVerticalLayoutGroup)layoutGroup).childControlHeight = height.Value;
			}
			return layoutGroup;
		}

		public static T SetChildForceExpand<T>(this T layoutGroup, bool? width = null, bool? height = null) where T : HorizontalOrVerticalLayoutGroup
		{
			if (!width.HasValue && !height.HasValue)
			{
				throw new ArgumentException("Value for width or height must be provided.");
			}
			if (width.HasValue)
			{
				((HorizontalOrVerticalLayoutGroup)layoutGroup).childForceExpandWidth = width.Value;
			}
			if (height.HasValue)
			{
				((HorizontalOrVerticalLayoutGroup)layoutGroup).childForceExpandHeight = height.Value;
			}
			return layoutGroup;
		}

		public static T SetPadding<T>(this T layoutGroup, int? left = null, int? right = null, int? top = null, int? bottom = null) where T : HorizontalOrVerticalLayoutGroup
		{
			if (!left.HasValue && !right.HasValue && !top.HasValue && !bottom.HasValue)
			{
				throw new ArgumentException("Value for left, right, top or bottom must be provided.");
			}
			if (left.HasValue)
			{
				((LayoutGroup)(object)layoutGroup).padding.left = left.Value;
			}
			if (right.HasValue)
			{
				((LayoutGroup)(object)layoutGroup).padding.right = right.Value;
			}
			if (top.HasValue)
			{
				((LayoutGroup)(object)layoutGroup).padding.top = top.Value;
			}
			if (bottom.HasValue)
			{
				((LayoutGroup)(object)layoutGroup).padding.bottom = bottom.Value;
			}
			return layoutGroup;
		}

		public static T SetSpacing<T>(this T layoutGroup, float spacing) where T : HorizontalOrVerticalLayoutGroup
		{
			((HorizontalOrVerticalLayoutGroup)layoutGroup).spacing = spacing;
			return layoutGroup;
		}
	}
	public static class ImageExtensions
	{
		public static Image SetColor(this Image image, Color color)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			((Graphic)image).color = color;
			return image;
		}

		public static Image SetFillAmount(this Image image, float amount)
		{
			image.fillAmount = amount;
			return image;
		}

		public static Image SetFillCenter(this Image image, bool fillCenter)
		{
			image.fillCenter = fillCenter;
			return image;
		}

		public static Image SetFillMethod(this Image image, FillMethod fillMethod)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			image.fillMethod = fillMethod;
			return image;
		}

		public static Image SetFillOrigin(this Image image, OriginHorizontal origin)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Expected I4, but got Unknown
			image.fillOrigin = (int)origin;
			return image;
		}

		public static Image SetFillOrigin(this Image image, OriginVertical origin)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Expected I4, but got Unknown
			image.fillOrigin = (int)origin;
			return image;
		}

		public static Image SetMaskable(this Image image, bool maskable)
		{
			((MaskableGraphic)image).maskable = maskable;
			return image;
		}

		public static Image SetMaterial(this Image image, Material material)
		{
			((Graphic)image).material = material;
			return image;
		}

		public static Image SetPixelsPerUnitMultiplier(this Image image, float pixelsPerUnitMultiplier)
		{
			image.pixelsPerUnitMultiplier = pixelsPerUnitMultiplier;
			return image;
		}

		public static Image SetPreserveAspect(this Image image, bool preserveAspect)
		{
			image.preserveAspect = preserveAspect;
			return image;
		}

		public static Image SetRaycastTarget(this Image image, bool raycastTarget)
		{
			((Graphic)image).raycastTarget = raycastTarget;
			return image;
		}

		public static Image SetSprite(this Image image, Sprite sprite)
		{
			image.sprite = sprite;
			return image;
		}

		public static Image SetType(this Image image, Type type)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			image.type = type;
			return image;
		}
	}
	public static class LayoutElementExtensions
	{
		public static LayoutElement SetFlexible(this LayoutElement layoutElement, float? width = null, float? height = null)
		{
			if (!width.HasValue && !height.HasValue)
			{
				throw new ArgumentException("Value for width or height must be provided.");
			}
			if (width.HasValue)
			{
				layoutElement.flexibleWidth = width.Value;
			}
			if (height.HasValue)
			{
				layoutElement.flexibleHeight = height.Value;
			}
			return layoutElement;
		}

		public static LayoutElement SetIgnoreLayout(this LayoutElement layoutElement, bool ignoreLayout)
		{
			layoutElement.ignoreLayout = ignoreLayout;
			return layoutElement;
		}

		public static LayoutElement SetMinimum(this LayoutElement layoutElement, float? width = null, float? height = null)
		{
			if (!width.HasValue && !height.HasValue)
			{
				throw new ArgumentException("Value for width or height must be provided.");
			}
			if (width.HasValue)
			{
				layoutElement.minWidth = width.Value;
			}
			if (height.HasValue)
			{
				layoutElement.minHeight = height.Value;
			}
			return layoutElement;
		}

		public static LayoutElement SetPreferred(this LayoutElement layoutElement, float? width = null, float? height = null)
		{
			if (!width.HasValue && !height.HasValue)
			{
				throw new ArgumentException("Value for width or height must be provided.");
			}
			if (width.HasValue)
			{
				layoutElement.preferredWidth = width.Value;
			}
			if (height.HasValue)
			{
				layoutElement.preferredHeight = height.Value;
			}
			return layoutElement;
		}
	}
	public static class RectMask2DExtensions
	{
		public static RectMask2D SetSoftness(this RectMask2D rectMask2d, Vector2Int softness)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			rectMask2d.softness = softness;
			return rectMask2d;
		}
	}
	public static class RectTransformExtensions
	{
		public static RectTransform SetAnchorMin(this RectTransform rectTransform, Vector2 anchorMin)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			rectTransform.anchorMin = anchorMin;
			return rectTransform;
		}

		public static RectTransform SetAnchorMax(this RectTransform rectTransform, Vector2 anchorMax)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			rectTransform.anchorMax = anchorMax;
			return rectTransform;
		}

		public static RectTransform SetPivot(this RectTransform rectTransform, Vector2 pivot)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			rectTransform.pivot = pivot;
			return rectTransform;
		}

		public static RectTransform SetPosition(this RectTransform rectTransform, Vector2 position)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			rectTransform.anchoredPosition = position;
			return rectTransform;
		}

		public static RectTransform SetSizeDelta(this RectTransform rectTransform, Vector2 sizeDelta)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			rectTransform.sizeDelta = sizeDelta;
			return rectTransform;
		}
	}
	public static class ScrollbarExtensions
	{
		public static T SetDirection<T>(this T scrollbar, Direction direction) where T : Scrollbar
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			((Scrollbar)scrollbar).direction = direction;
			return scrollbar;
		}

		public static T SetHandleRect<T>(this T scrollbar, RectTransform handleRect) where T : Scrollbar
		{
			((Scrollbar)scrollbar).handleRect = handleRect;
			return scrollbar;
		}
	}
	public static class SelectableExtensions
	{
		public static T SetColors<T>(this T selectable, ColorBlock colors) where T : Selectable
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			((Selectable)selectable).colors = colors;
			return selectable;
		}

		public static T SetImage<T>(this T selectable, Image image) where T : Selectable
		{
			((Selectable)selectable).image = image;
			return selectable;
		}

		public static T SetInteractable<T>(this T selectable, bool interactable) where T : Selectable
		{
			((Selectable)selectable).interactable = interactable;
			return selectable;
		}

		public static T SetSpriteState<T>(this T selectable, SpriteState spriteState) where T : Selectable
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			((Selectable)selectable).spriteState = spriteState;
			return selectable;
		}

		public static T SetTargetGraphic<T>(this T selectable, Graphic graphic) where T : Selectable
		{
			((Selectable)selectable).targetGraphic = graphic;
			return selectable;
		}

		public static T SetTransition<T>(this T selectable, Transition transition) where T : Selectable
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			((Selectable)selectable).transition = transition;
			return selectable;
		}

		public static T SetNavigationMode<T>(this T selectable, Mode mode) where T : Selectable
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			Navigation navigation = ((Selectable)selectable).navigation;
			((Navigation)(ref navigation)).mode = mode;
			((Selectable)selectable).navigation = navigation;
			return selectable;
		}
	}
	public static class SliderExtensions
	{
		public static T SetDirection<T>(this T slider, Direction direction) where T : Slider
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			((Slider)slider).direction = direction;
			return slider;
		}

		public static T SetFillRect<T>(this T slider, RectTransform fillRect) where T : Slider
		{
			((Slider)slider).fillRect = fillRect;
			return slider;
		}

		public static T SetHandleRect<T>(this T slider, RectTransform handleRect) where T : Slider
		{
			((Slider)slider).handleRect = handleRect;
			return slider;
		}

		public static T SetMaxValue<T>(this T slider, float maxValue) where T : Slider
		{
			((Slider)slider).maxValue = maxValue;
			return slider;
		}

		public static T SetMinValue<T>(this T slider, float minValue) where T : Slider
		{
			((Slider)slider).minValue = minValue;
			return slider;
		}

		public static T SetWholeNumbers<T>(this T slider, bool wholeNumbers) where T : Slider
		{
			((Slider)slider).wholeNumbers = wholeNumbers;
			return slider;
		}
	}
	public static class ScrollRectExtensions
	{
		public static T SetContent<T>(this T scrollRect, RectTransform content) where T : ScrollRect
		{
			((ScrollRect)scrollRect).content = content;
			return scrollRect;
		}

		public static T SetHorizontal<T>(this T scrollRect, bool horizontal) where T : ScrollRect
		{
			((ScrollRect)scrollRect).horizontal = horizontal;
			return scrollRect;
		}

		public static T SetMovementType<T>(this T scrollRect, MovementType movementType) where T : ScrollRect
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			((ScrollRect)scrollRect).movementType = movementType;
			return scrollRect;
		}

		public static T SetScrollSensitivity<T>(this T scrollRect, float sensitivity) where T : ScrollRect
		{
			((ScrollRect)scrollRect).scrollSensitivity = sensitivity;
			return scrollRect;
		}

		public static T SetVertical<T>(this T scrollRect, bool vertical) where T : ScrollRect
		{
			((ScrollRect)scrollRect).vertical = vertical;
			return scrollRect;
		}

		public static T SetVerticalScrollbar<T>(this T scrollRect, Scrollbar verticalScrollbar) where T : ScrollRect
		{
			((ScrollRect)scrollRect).verticalScrollbar = verticalScrollbar;
			return scrollRect;
		}

		public static T SetVerticalScrollPosition<T>(this T scrollRect, float position) where T : ScrollRect
		{
			((ScrollRect)scrollRect).verticalNormalizedPosition = position;
			return scrollRect;
		}

		public static T SetVerticalScrollbarVisibility<T>(this T scrollRect, ScrollbarVisibility visibility) where T : ScrollRect
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			((ScrollRect)scrollRect).verticalScrollbarVisibility = visibility;
			return scrollRect;
		}

		public static T SetViewport<T>(this T scrollRect, RectTransform viewport) where T : ScrollRect
		{
			((ScrollRect)scrollRect).viewport = viewport;
			return scrollRect;
		}
	}
	public static class TextMeshProExtensions
	{
		public static T SetAlignment<T>(this T tmpText, TextAlignmentOptions alignment) where T : TMP_Text
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			((TMP_Text)tmpText).alignment = alignment;
			return tmpText;
		}

		public static T SetColor<T>(this T tmpText, Color color) where T : TMP_Text
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			((Graphic)(object)tmpText).color = color;
			return tmpText;
		}

		public static T SetEnableAutoSizing<T>(this T tmpText, bool enableAutoSizing) where T : TMP_Text
		{
			((TMP_Text)tmpText).enableAutoSizing = enableAutoSizing;
			return tmpText;
		}

		public static T SetFont<T>(this T tmpText, TMP_FontAsset font) where T : TMP_Text
		{
			((TMP_Text)tmpText).font = font;
			return tmpText;
		}

		public static T SetFontSize<T>(this T tmpText, float fontSize) where T : TMP_Text
		{
			((TMP_Text)tmpText).fontSize = fontSize;
			return tmpText;
		}

		public static T SetFontMaterial<T>(this T tmpText, Material fontMaterial) where T : TMP_Text
		{
			((TMP_Text)tmpText).fontMaterial = fontMaterial;
			return tmpText;
		}

		public static T SetLineSpacing<T>(this T tmpText, float lineSpacing) where T : TMP_Text
		{
			((TMP_Text)tmpText).lineSpacing = lineSpacing;
			return tmpText;
		}

		public static T SetMargin<T>(this T tmpText, Vector4 margin) where T : TMP_Text
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			((TMP_Text)tmpText).margin = margin;
			return tmpText;
		}

		public static T SetOverflowMode<T>(this T tmpText, TextOverflowModes overflowMode) where T : TMP_Text
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			((TMP_Text)tmpText).overflowMode = overflowMode;
			return tmpText;
		}

		public static T SetRichText<T>(this T tmpText, bool richText) where T : TMP_Text
		{
			((TMP_Text)tmpText).richText = richText;
			return tmpText;
		}

		public static T SetTextWrappingMode<T>(this T tmpText, TextWrappingModes textWrappingMode) where T : TMP_Text
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			((TMP_Text)tmpText).textWrappingMode = textWrappingMode;
			return tmpText;
		}
	}
	public static class Texture2DExtensions
	{
		public static Texture2D SetFilterMode(this Texture2D texture, FilterMode filterMode)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			((Texture)texture).filterMode = filterMode;
			return texture;
		}

		public static Texture2D SetWrapMode(this Texture2D texture, TextureWrapMode wrapMode)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			((Texture)texture).wrapMode = wrapMode;
			return texture;
		}
	}
	public static class ToggleExtensions
	{
		public static T SetGraphic<T>(this T toggle, Graphic graphic) where T : Toggle
		{
			((Toggle)toggle).graphic = graphic;
			return toggle;
		}

		public static T SetToggleTransition<T>(this T toggle, ToggleTransition toggleTransition) where T : Toggle
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			((Toggle)toggle).toggleTransition = toggleTransition;
			return toggle;
		}
	}
	public static class UIResources
	{
		public static readonly ResourceCache<Sprite> SpriteCache = new ResourceCache<Sprite>();

		public static readonly ResourceCache<Material> MaterialCache = new ResourceCache<Material>();

		public static Sprite GetSprite(string spriteName)
		{
			return SpriteCache.GetResource(spriteName);
		}

		public static Material GetMaterial(string materialName)
		{
			return MaterialCache.GetResource(materialName);
		}
	}
	public sealed class ResourceCache<T> where T : Object
	{
		private readonly Dictionary<string, T> _cache = new Dictionary<string, T>();

		public T GetResource(string resourceName)
		{
			if (!_cache.TryGetValue(resourceName, out var value))
			{
				value = Resources.FindObjectsOfTypeAll<T>().FirstByNameOrThrow(resourceName);
				_cache[resourceName] = value;
			}
			return value;
		}
	}
}