Decompiled source of JeusticeStats v1.0.0

JeusticeStats.dll

Decompiled 3 days ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Text;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using Photon.Pun;
using TMPro;
using UnboundLib.Extensions;
using UnboundLib.Utils;
using UnityEngine;
using UnityEngine.UI;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyVersion("0.0.0.0")]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[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 JeusticeStats
{
	internal static class DamageLog
	{
		private const float Every = 2f;

		private static readonly Dictionary<int, float> NextLog = new Dictionary<int, float>();

		private static bool InSandbox
		{
			get
			{
				if ((Object)(object)GM_Test.instance != (Object)null)
				{
					return ((Component)GM_Test.instance).gameObject.activeInHierarchy;
				}
				return false;
			}
		}

		public static void Note(Player victim, Player attacker, GameObject weapon, float lost)
		{
			if (lost < 0.5f || !InSandbox)
			{
				return;
			}
			float unscaledTime = Time.unscaledTime;
			if (!NextLog.TryGetValue(victim.playerID, out var value) || !(unscaledTime < value))
			{
				NextLog[victim.playerID] = unscaledTime + 2f;
				IEnumerable<string> enumerable = (from m in new StackTrace(3, fNeedFileInfo: false).GetFrames()?.Select((StackFrame f) => f.GetMethod())
					where m != null && m.DeclaringType != null
					select m.DeclaringType.Name + "." + m.Name into n
					where !n.StartsWith("DamagePatch") && !n.Contains("DMD<") && !n.StartsWith("Mono") && !n.StartsWith("MethodBase") && !n.StartsWith("PhotonNetwork") && !n.StartsWith("SetupCoroutine") && !n.StartsWith("HealthHandler.TakeDamage")
					select n).Take(10);
				JeusticeStats.Log.LogInfo((object)($"Damage: player {victim.playerID} lost {lost:F1} HP" + " from " + (((Object)(object)attacker != (Object)null) ? ("player " + attacker.playerID) : "nobody") + (((Object)(object)weapon != (Object)null) ? (" (" + ((Object)weapon).name + ")") : "") + " via " + string.Join(" < ", enumerable ?? Enumerable.Empty<string>())));
			}
		}
	}
	internal static class Icons
	{
		private static readonly Dictionary<string, Sprite> Loaded = new Dictionary<string, Sprite>();

		public static Sprite Get(string name)
		{
			//IL_0081: 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_008e: Expected O, but got Unknown
			//IL_00ba: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c9: Unknown result type (might be due to invalid IL or missing references)
			if (string.IsNullOrEmpty(name))
			{
				return null;
			}
			if (Loaded.TryGetValue(name, out var value))
			{
				return value;
			}
			Sprite val;
			using (Stream stream = typeof(Icons).Assembly.GetManifestResourceStream("JeusticeStats.Icons." + name + ".png"))
			{
				if (stream == null)
				{
					JeusticeStats.Log.LogWarning((object)("Missing icon " + name));
					val = (Loaded[name] = null);
					val = val;
				}
				else
				{
					MemoryStream memoryStream = new MemoryStream();
					stream.CopyTo(memoryStream);
					Texture2D val3 = new Texture2D(2, 2, (TextureFormat)4, false)
					{
						filterMode = (FilterMode)1
					};
					ImageConversion.LoadImage(val3, memoryStream.ToArray());
					Sprite val4 = (Loaded[name] = Sprite.Create(val3, new Rect(0f, 0f, (float)((Texture)val3).width, (float)((Texture)val3).height), new Vector2(0.5f, 0.5f), 100f));
					val = val4;
				}
			}
			return val;
		}
	}
	public enum Corner
	{
		BottomLeft,
		BottomRight,
		TopRight
	}
	public enum Language
	{
		EN,
		FR
	}
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInPlugin("com.jeustice.rounds.stats", "Jeustice Stats", "1.0.0")]
	[BepInProcess("Rounds.exe")]
	public class JeusticeStats : BaseUnityPlugin
	{
		public const string ModId = "com.jeustice.rounds.stats";

		public const string ModName = "Jeustice Stats";

		public const string Version = "1.0.0";

		internal static ConfigEntry<KeyCode> SheetKey;

		internal static ConfigEntry<bool> ShowCorner;

		internal static ConfigEntry<Corner> CornerPosition;

		internal static ConfigEntry<float> CornerScale;

		internal static ConfigEntry<Language> Lang;

		internal static ConfigEntry<bool> ShowHealthNumbers;

		internal static ConfigEntry<bool> ShowDamageNumbers;

		internal static ManualLogSource Log { get; private set; }

		private void Awake()
		{
			//IL_00f5: 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_010f: Expected O, but got Unknown
			Log = ((BaseUnityPlugin)this).Logger;
			SheetKey = ((BaseUnityPlugin)this).Config.Bind<KeyCode>("General", "SheetKey", (KeyCode)9, "Hold this key to see every player's stats.");
			ShowCorner = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "ShowCorner", true, "Show your main stats in a corner during the game.");
			CornerPosition = ((BaseUnityPlugin)this).Config.Bind<Corner>("General", "Corner", Corner.BottomLeft, "Where the small stats panel goes.");
			CornerScale = ((BaseUnityPlugin)this).Config.Bind<float>("General", "CornerScale", 1f, "Size of the small stats panel (1 = normal).");
			Lang = ((BaseUnityPlugin)this).Config.Bind<Language>("General", "Language", Language.EN, "EN or FR.");
			ShowHealthNumbers = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "ShowHealthNumbers", true, "Show each player's HP above their health bar.");
			ShowDamageNumbers = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "ShowDamageNumbers", true, "Show red damage numbers on hits you deal or take.");
			new Harmony("com.jeustice.rounds.stats").PatchAll();
			GameObject val = new GameObject("JeusticeStats HUD");
			Object.DontDestroyOnLoad((Object)val);
			val.AddComponent<StatsHud>();
		}
	}
	public class Overhead : MonoBehaviour
	{
		private class Popup
		{
			public TextMeshProUGUI Text;

			public Vector3 Anchor;

			public float Born;

			public float LastHit;

			public float Amount;

			public float Side;

			public int Victim;
		}

		public TMP_FontAsset Font;

		private const float PopupLife = 1f;

		private const float FadeFrom = 0.5f;

		private const float MergeWindow = 0.2f;

		private const float LaunchUp = 260f;

		private const float Gravity = 620f;

		private const float SideMin = 60f;

		private const float SideMax = 120f;

		private static readonly Color DamageRed = new Color(0.72f, 0.15f, 0.16f);

		private static readonly Color32 DamageOutline = new Color32((byte)35, (byte)6, (byte)6, byte.MaxValue);

		private static readonly Color HpTop = new Color(0.85f, 1f, 0.8f);

		private static readonly Color HpBottom = new Color(0.2f, 0.9f, 0.3f);

		private static readonly Color32 HpOutline = new Color32((byte)6, (byte)45, (byte)12, byte.MaxValue);

		private static Overhead _instance;

		private readonly Dictionary<int, TextMeshProUGUI> _hpLabels = new Dictionary<int, TextMeshProUGUI>();

		private readonly Dictionary<int, float> _nextSide = new Dictionary<int, float>();

		private readonly List<Popup> _popups = new List<Popup>();

		private readonly Stack<TextMeshProUGUI> _pool = new Stack<TextMeshProUGUI>();

		private static readonly Vector3[] Corners = (Vector3[])(object)new Vector3[4];

		private RectTransform _rect;

		private static Camera Cam
		{
			get
			{
				if (!((Object)(object)MainCam.instance != (Object)null))
				{
					return Camera.main;
				}
				return MainCam.instance.cam;
			}
		}

		private void Awake()
		{
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0017: Expected O, but got Unknown
			_instance = this;
			_rect = (RectTransform)((Component)this).transform;
		}

		private static Vector3 Head(Player p)
		{
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0064: Unknown result type (might be due to invalid IL or missing references)
			//IL_006e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0079: Unknown result type (might be due to invalid IL or missing references)
			//IL_0083: 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_0039: 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_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)
			HealthBar componentInChildren = ((Component)p).GetComponentInChildren<HealthBar>();
			if ((Object)(object)componentInChildren != (Object)null && (Object)(object)componentInChildren.hp != (Object)null)
			{
				((Graphic)componentInChildren.hp).rectTransform.GetWorldCorners(Corners);
				return (Corners[1] + Corners[2]) * 0.5f;
			}
			return ((Component)p).transform.position + Vector3.up * 1.5f * ((Component)p).transform.localScale.y;
		}

		internal static void Hit(Player victim, float amount)
		{
			if (!((Object)(object)_instance == (Object)null) && JeusticeStats.ShowDamageNumbers.Value && !((Object)(object)victim == (Object)null) && !(amount < 0.5f))
			{
				Player val = StatsHud.LocalPlayer();
				if (!((Object)(object)val == (Object)null) && ((Object)(object)victim == (Object)(object)val || victim.teamID != val.teamID))
				{
					_instance.Add(victim, amount);
				}
			}
		}

		private void Add(Player victim, float amount)
		{
			//IL_00fc: Unknown result type (might be due to invalid IL or missing references)
			//IL_0101: Unknown result type (might be due to invalid IL or missing references)
			float unscaledTime = Time.unscaledTime;
			foreach (Popup popup2 in _popups)
			{
				if (popup2.Victim == victim.playerID && unscaledTime - popup2.LastHit < 0.2f)
				{
					popup2.Amount += amount;
					popup2.LastHit = unscaledTime;
					Show(popup2, victim);
					return;
				}
			}
			_nextSide.TryGetValue(victim.playerID, out var value);
			value = ((value >= 0f) ? (-1f) : 1f);
			_nextSide[victim.playerID] = value;
			TextMeshProUGUI val = ((_pool.Count > 0) ? _pool.Pop() : MakeText(30f));
			StyleDamage(val);
			((Component)val).gameObject.SetActive(true);
			Popup popup = new Popup
			{
				Text = val,
				Anchor = Head(victim),
				Born = unscaledTime,
				LastHit = unscaledTime,
				Amount = amount,
				Side = value * Random.Range(60f, 120f),
				Victim = victim.playerID
			};
			_popups.Add(popup);
			Show(popup, victim);
		}

		private static void Show(Popup popup, Player victim)
		{
			((TMP_Text)popup.Text).text = Mathf.RoundToInt(popup.Amount).ToString();
			float num = Mathf.Clamp01(popup.Amount / Mathf.Max(1f, victim.data.maxHealth));
			((TMP_Text)popup.Text).fontSize = Mathf.Lerp(26f, 44f, num);
		}

		private void LateUpdate()
		{
			Camera cam = Cam;
			bool inGame = (Object)(object)cam != (Object)null && (Object)(object)StatsHud.LocalPlayer() != (Object)null;
			try
			{
				UpdateHealthLabels(cam, inGame);
			}
			catch (Exception ex)
			{
				JeusticeStats.Log.LogWarning((object)("HP numbers: " + ex.Message));
			}
			UpdatePopups(cam, inGame);
		}

		private void UpdateHealthLabels(Camera cam, bool inGame)
		{
			//IL_0119: Unknown result type (might be due to invalid IL or missing references)
			//IL_011e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0139: Unknown result type (might be due to invalid IL or missing references)
			//IL_013e: Unknown result type (might be due to invalid IL or missing references)
			HashSet<int> hashSet = new HashSet<int>();
			if (inGame && JeusticeStats.ShowHealthNumbers.Value)
			{
				foreach (Player player in PlayerManager.instance.players)
				{
					if ((Object)(object)player == (Object)null || (Object)(object)player.data == (Object)null || player.data.dead || !((Component)player).gameObject.activeInHierarchy)
					{
						continue;
					}
					HealthBar componentInChildren = ((Component)player).GetComponentInChildren<HealthBar>();
					if (!((Object)(object)componentInChildren == (Object)null) && ((Component)componentInChildren).gameObject.activeInHierarchy)
					{
						if (!_hpLabels.TryGetValue(player.playerID, out var value) || (Object)(object)value == (Object)null)
						{
							value = (_hpLabels[player.playerID] = MakeText(19f));
							StyleHealth(value);
						}
						((Component)value).gameObject.SetActive(true);
						((TMP_Text)value).text = Mathf.CeilToInt(Mathf.Max(0f, player.data.health)).ToString();
						Place(value, cam.WorldToScreenPoint(Head(player)) + new Vector3(0f, (float)Screen.height * 0.014f, 0f));
						hashSet.Add(player.playerID);
					}
				}
			}
			foreach (KeyValuePair<int, TextMeshProUGUI> hpLabel in _hpLabels)
			{
				if ((Object)(object)hpLabel.Value != (Object)null && !hashSet.Contains(hpLabel.Key))
				{
					((Component)hpLabel.Value).gameObject.SetActive(false);
				}
			}
		}

		private void UpdatePopups(Camera cam, bool inGame)
		{
			//IL_00a4: 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_00af: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ba: Unknown result type (might be due to invalid IL or missing references)
			//IL_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)
			//IL_00c6: 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_013b: Unknown result type (might be due to invalid IL or missing references)
			//IL_015f: Unknown result type (might be due to invalid IL or missing references)
			float unscaledTime = Time.unscaledTime;
			float num = (float)Screen.height / 1080f;
			for (int num2 = _popups.Count - 1; num2 >= 0; num2--)
			{
				Popup popup = _popups[num2];
				float num3 = unscaledTime - popup.Born;
				if (!inGame || num3 > 1f)
				{
					((Component)popup.Text).gameObject.SetActive(false);
					_pool.Push(popup.Text);
					_popups.RemoveAt(num2);
				}
				else
				{
					Vector3 val = new Vector3(popup.Side * num3, 30f + 260f * num3 - 310f * num3 * num3, 0f) * num;
					Place(popup.Text, cam.WorldToScreenPoint(popup.Anchor) + val);
					float num4 = ((num3 < 0.5f) ? 1f : (1f - (num3 - 0.5f) / 0.5f));
					((Graphic)popup.Text).color = new Color(DamageRed.r, DamageRed.g, DamageRed.b, num4);
					float num5 = unscaledTime - popup.LastHit;
					((TMP_Text)popup.Text).transform.localScale = Vector3.one * (1f + 0.3f * Mathf.Clamp01(1f - num5 / 0.12f));
				}
			}
		}

		private void Place(TextMeshProUGUI text, Vector3 screen)
		{
			//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)
			//IL_001c: 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)
			Vector2 val = default(Vector2);
			if (RectTransformUtility.ScreenPointToLocalPointInRectangle(_rect, Vector2.op_Implicit(screen), (Camera)null, ref val))
			{
				((Transform)((TMP_Text)text).rectTransform).localPosition = Vector2.op_Implicit(val);
			}
		}

		private TextMeshProUGUI MakeText(float size)
		{
			//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_0086: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = new GameObject("Number", new Type[1] { typeof(RectTransform) });
			val.transform.SetParent(((Component)this).transform, false);
			TextMeshProUGUI val2 = val.AddComponent<TextMeshProUGUI>();
			if ((Object)(object)Font != (Object)null)
			{
				((TMP_Text)val2).font = Font;
			}
			((TMP_Text)val2).fontSize = size;
			((TMP_Text)val2).fontStyle = (FontStyles)1;
			((TMP_Text)val2).alignment = (TextAlignmentOptions)514;
			((TMP_Text)val2).enableWordWrapping = false;
			((Graphic)val2).raycastTarget = false;
			((TMP_Text)val2).rectTransform.sizeDelta = new Vector2(200f, 50f);
			return val2;
		}

		private static void StyleHealth(TextMeshProUGUI text)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_0022: Unknown result type (might be due to invalid IL or missing references)
			//IL_0027: Unknown result type (might be due to invalid IL or missing references)
			//IL_003d: Unknown result type (might be due to invalid IL or missing references)
			((Graphic)text).color = Color.white;
			((TMP_Text)text).enableVertexGradient = true;
			((TMP_Text)text).colorGradient = new VertexGradient(HpTop, HpTop, HpBottom, HpBottom);
			((TMP_Text)text).outlineWidth = 0.25f;
			((TMP_Text)text).outlineColor = HpOutline;
		}

		private static void StyleDamage(TextMeshProUGUI text)
		{
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			((TMP_Text)text).enableVertexGradient = false;
			((Graphic)text).color = DamageRed;
			((TMP_Text)text).outlineWidth = 0.2f;
			((TMP_Text)text).outlineColor = DamageOutline;
		}
	}
	[HarmonyPatch(typeof(HealthHandler), "DoDamage")]
	internal static class DamagePatch
	{
		private static void Prefix(HealthHandler __instance, out float __state)
		{
			CharacterData component = ((Component)__instance).GetComponent<CharacterData>();
			__state = (((Object)(object)component != (Object)null) ? component.health : 0f);
		}

		private static void Postfix(HealthHandler __instance, Vector2 damage, Player damagingPlayer, GameObject damagingWeapon, float __state)
		{
			try
			{
				CharacterData component = ((Component)__instance).GetComponent<CharacterData>();
				if ((Object)(object)component != (Object)null && (Object)(object)component.player != (Object)null && __state > 0f)
				{
					float num = __state - Mathf.Max(0f, component.health);
					float amount = ((component.health <= 0f && num > 0f) ? Mathf.Max(num, ((Vector2)(ref damage)).magnitude) : num);
					Overhead.Hit(component.player, amount);
					DamageLog.Note(component.player, damagingPlayer, damagingWeapon, num);
				}
			}
			catch (Exception ex)
			{
				JeusticeStats.Log.LogWarning((object)("Damage number: " + ex.Message));
			}
		}
	}
	internal class Stat
	{
		public string En;

		public string Fr;

		public Color Color;

		public Func<Player, float> Read;

		public float Base;

		public string Format;

		public string Unit = "";

		public int Better = 1;

		public bool InCorner;

		public string Icon;

		public string Label
		{
			get
			{
				if (JeusticeStats.Lang.Value != Language.FR)
				{
					return En;
				}
				return Fr;
			}
		}

		public string Value(Player player)
		{
			float num = Read(player);
			string text = num.ToString(Format) + Unit;
			float num2 = (num - Base) * (float)Better;
			if (Better == 0 || Mathf.Abs(num - Base) < 0.005f)
			{
				return text;
			}
			return ((num2 > 0f) ? "<color=#7CF08A>" : "<color=#FF7A7A>") + text + "</color>";
		}
	}
	internal static class Stats
	{
		private static readonly Color Health = new Color(1f, 0.42f, 0.45f);

		private static readonly Color Attack = new Color(1f, 0.66f, 0.3f);

		private static readonly Color Bullet = new Color(1f, 0.88f, 0.4f);

		private static readonly Color Defense = new Color(0.45f, 0.8f, 1f);

		private static readonly Color Move = new Color(0.65f, 0.95f, 0.65f);

		public const float BaseBulletDamage = 55f;

		public const float BaseReload = 2f;

		public const float BaseDps = 56.89655f;

		public static readonly List<Stat> All = new List<Stat>
		{
			new Stat
			{
				En = "Max HP",
				Fr = "PV max",
				Color = Health,
				Read = (Player p) => p.data.maxHealth,
				Base = 100f,
				Format = "0",
				InCorner = true,
				Icon = "hp"
			},
			new Stat
			{
				En = "Regen",
				Fr = "Régén.",
				Color = Health,
				Read = (Player p) => p.data.healthHandler.regeneration,
				Base = 0f,
				Format = "0.#",
				Unit = "/s",
				Icon = "regen"
			},
			new Stat
			{
				En = "Lifesteal",
				Fr = "Vol de vie",
				Color = Health,
				Read = (Player p) => p.data.stats.lifeSteal * 100f,
				Base = 0f,
				Format = "0",
				Unit = "%",
				Icon = "lifesteal"
			},
			new Stat
			{
				En = "Revives",
				Fr = "Résurrections",
				Color = Health,
				Read = (Player p) => p.data.stats.respawns,
				Base = 0f,
				Format = "0",
				Icon = "revives"
			},
			new Stat
			{
				En = "Damage",
				Fr = "Dégâts",
				Color = Attack,
				Read = Damage,
				Base = 55f,
				Format = "0",
				InCorner = true,
				Icon = "damage"
			},
			new Stat
			{
				En = "DPS",
				Fr = "DPS",
				Color = Attack,
				Read = Dps,
				Base = 56.89655f,
				Format = "0",
				InCorner = true,
				Icon = "dps"
			},
			new Stat
			{
				En = "Fire rate",
				Fr = "Cadence",
				Color = Attack,
				Read = FireRate,
				Base = 3.3333333f,
				Format = "0.0",
				Unit = "/s",
				InCorner = true,
				Icon = "firerate"
			},
			new Stat
			{
				En = "Ammo",
				Fr = "Munitions",
				Color = Attack,
				Read = (Player p) => MaxAmmo(p),
				Base = 3f,
				Format = "0",
				InCorner = true,
				Icon = "ammo"
			},
			new Stat
			{
				En = "Reload",
				Fr = "Recharge",
				Color = Attack,
				Read = Reload,
				Base = 2f,
				Format = "0.0#",
				Unit = "s",
				Better = -1,
				InCorner = true,
				Icon = "reload"
			},
			new Stat
			{
				En = "Bullets/shot",
				Fr = "Balles/tir",
				Color = Bullet,
				Read = (Player p) => Mathf.Max(1, Gun(p).numberOfProjectiles),
				Base = 1f,
				Format = "0",
				Icon = "bullets"
			},
			new Stat
			{
				En = "Bursts",
				Fr = "Rafales",
				Color = Bullet,
				Read = (Player p) => Mathf.Max(1, Gun(p).bursts),
				Base = 1f,
				Format = "0",
				Icon = "bursts"
			},
			new Stat
			{
				En = "Bounces",
				Fr = "Rebonds",
				Color = Bullet,
				Read = (Player p) => Gun(p).reflects,
				Base = 0f,
				Format = "0",
				Icon = "bounces"
			},
			new Stat
			{
				En = "Bullet speed",
				Fr = "Vit. balles",
				Color = Bullet,
				Read = (Player p) => Gun(p).projectileSpeed * 100f,
				Base = 100f,
				Format = "0",
				Unit = "%",
				Icon = "bulletspeed"
			},
			new Stat
			{
				En = "Knockback",
				Fr = "Recul",
				Color = Bullet,
				Read = (Player p) => Gun(p).knockback * 100f,
				Base = 100f,
				Format = "0",
				Unit = "%",
				Icon = "knockback"
			},
			new Stat
			{
				En = "Block CD",
				Fr = "Recharge blocage",
				Color = Defense,
				Read = (Player p) => p.data.block.Cooldown(),
				Base = 4f,
				Format = "0.0#",
				Unit = "s",
				Better = -1,
				InCorner = true,
				Icon = "block"
			},
			new Stat
			{
				En = "Blocks",
				Fr = "Blocages",
				Color = Defense,
				Read = (Player p) => 1 + p.data.block.additionalBlocks,
				Base = 1f,
				Format = "0",
				Icon = "blocks"
			},
			new Stat
			{
				En = "Damage over",
				Fr = "Dégâts étalés",
				Color = Defense,
				Read = (Player p) => p.data.stats.secondsToTakeDamageOver,
				Base = 0f,
				Format = "0.#",
				Unit = "s",
				Icon = "dot"
			},
			new Stat
			{
				En = "Move speed",
				Fr = "Vitesse",
				Color = Move,
				Read = (Player p) => p.data.stats.movementSpeed * 100f,
				Base = 100f,
				Format = "0",
				Unit = "%",
				InCorner = true,
				Icon = "speed"
			},
			new Stat
			{
				En = "Jumps",
				Fr = "Sauts",
				Color = Move,
				Read = (Player p) => p.data.jumps,
				Base = 1f,
				Format = "0",
				Icon = "jumps"
			},
			new Stat
			{
				En = "Size",
				Fr = "Taille",
				Color = Move,
				Read = (Player p) => p.data.stats.sizeMultiplier * 100f,
				Base = 100f,
				Format = "0",
				Unit = "%",
				Better = 0,
				Icon = "size"
			}
		};

		private static MethodInfo _revolverMaxAmmo;

		private static bool _revolverLooked;

		private static Gun Gun(Player p)
		{
			return p.data.weaponHandler.gun;
		}

		private static GunAmmo Ammo(Player p)
		{
			return ((Component)Gun(p)).GetComponentInChildren<GunAmmo>();
		}

		private static float Damage(Player p)
		{
			return 55f * Gun(p).damage * Gun(p).bulletDamageMultiplier;
		}

		private static float Cooldown(Player p)
		{
			return Gun(p).attackSpeed / Mathf.Max(0.01f, Gun(p).attackSpeedMultiplier);
		}

		private static float FireRate(Player p)
		{
			return 1f / Mathf.Max(0.01f, Cooldown(p));
		}

		private static float Reload(Player p)
		{
			GunAmmo val = Ammo(p);
			if (!((Object)(object)val == (Object)null))
			{
				return (val.reloadTime + val.reloadTimeAdd) * val.reloadTimeMultiplier;
			}
			return 2f;
		}

		private static float Dps(Player p)
		{
			Gun val = Gun(p);
			float num = Damage(p) * (float)Mathf.Max(1, val.numberOfProjectiles) * (float)Mathf.Max(1, val.bursts);
			int num2 = Mathf.Max(1, MaxAmmo(p));
			float num3 = Mathf.Max(0.05f, (float)num2 * Cooldown(p) + Reload(p));
			return Mathf.Max(0f, (float)num2 * num / num3);
		}

		private static int MaxAmmo(Player p)
		{
			GunAmmo val = Ammo(p);
			if ((Object)(object)val == (Object)null)
			{
				return 3;
			}
			if (!_revolverLooked)
			{
				_revolverLooked = true;
				_revolverMaxAmmo = Type.GetType("JeusticeChaos.Cards.Revolver, JeusticeChaos")?.GetMethod("MaxAmmo", BindingFlags.Static | BindingFlags.Public);
			}
			if (_revolverMaxAmmo != null)
			{
				try
				{
					return (int)_revolverMaxAmmo.Invoke(null, new object[1] { val });
				}
				catch (Exception)
				{
					_revolverMaxAmmo = null;
				}
			}
			return val.maxAmmo;
		}
	}
	public class StatsHud : MonoBehaviour
	{
		private const float Refresh = 0.2f;

		private const float RefWidth = 1920f;

		private const float RefHeight = 1080f;

		private static readonly Color PanelColor = new Color(0.04f, 0.05f, 0.1f, 0.82f);

		private Canvas _canvas;

		private RectTransform _corner;

		private RectTransform _sheet;

		private CanvasGroup _cornerGroup;

		private Image _cornerStripe;

		private TextMeshProUGUI _sheetText;

		private readonly List<KeyValuePair<Stat, TextMeshProUGUI>> _cells = new List<KeyValuePair<Stat, TextMeshProUGUI>>();

		private const float CornerLeft = 20f;

		private const float CornerPad = 8f;

		private const float CellWidth = 104f;

		private const float CellHeight = 30f;

		private const float IconSize = 24f;

		private float _nextRefresh;

		private bool _built;

		private const float LabelWidth = 280f;

		private const float ColumnWidth = 150f;

		private const float SheetIconRoom = 36f;

		private const float SheetIconSize = 26f;

		private readonly List<Image> _sheetIcons = new List<Image>();

		private void Update()
		{
			//IL_0028: 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)
			Player val = LocalPlayer();
			bool flag = (Object)(object)val != (Object)null;
			if (!_built)
			{
				if (!flag)
				{
					return;
				}
				Build();
			}
			bool flag2 = flag && Input.GetKey(JeusticeStats.SheetKey.Value);
			bool flag3 = flag && JeusticeStats.ShowCorner.Value && !flag2;
			((Component)_sheet).gameObject.SetActive(flag2);
			((Component)_corner).gameObject.SetActive(flag3);
			if (!flag)
			{
				return;
			}
			if (Time.unscaledTime >= _nextRefresh || (flag2 && Input.GetKeyDown(JeusticeStats.SheetKey.Value)))
			{
				_nextRefresh = Time.unscaledTime + 0.2f;
				if (flag3)
				{
					FillCorner(val);
				}
				if (flag2)
				{
					FillSheet(val);
				}
			}
			if (flag3)
			{
				float num = (EnemyBehind(_corner, val) ? 0f : 1f);
				_cornerGroup.alpha = Mathf.MoveTowards(_cornerGroup.alpha, num, Time.unscaledDeltaTime * 6f);
			}
		}

		internal static Player LocalPlayer()
		{
			if ((Object)(object)PlayerManager.instance == (Object)null || PlayerManager.instance.players == null)
			{
				return null;
			}
			return (from p in PlayerManager.instance.players
				where (Object)(object)p != (Object)null && (Object)(object)p.data != (Object)null && (Object)(object)p.data.view != (Object)null && (p.data.view.IsMine || PhotonNetwork.OfflineMode)
				orderby p.playerID
				select p).FirstOrDefault();
		}

		private static Color PlayerColor(Player p)
		{
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Unknown result type (might be due to invalid IL or missing references)
			try
			{
				return ExtraPlayerSkins.GetPlayerSkinColors(PlayerExtensions.colorID(p)).color;
			}
			catch
			{
				return Color.white;
			}
		}

		internal static string Name(Player p)
		{
			string text = ((!PhotonNetwork.OfflineMode && (Object)(object)p.data.view != (Object)null && p.data.view.Owner != null) ? p.data.view.Owner.NickName : null);
			if (string.IsNullOrEmpty(text))
			{
				text = ((JeusticeStats.Lang.Value == Language.FR) ? "Joueur " : "Player ") + (p.playerID + 1);
			}
			if (text.Length <= 11)
			{
				return text;
			}
			return text.Substring(0, 10) + "..";
		}

		private static string Hex(Color c)
		{
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			return "#" + ColorUtility.ToHtmlStringRGB(c);
		}

		private void FillCorner(Player local)
		{
			//IL_0050: Unknown result type (might be due to invalid IL or missing references)
			//IL_007a: 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_00c8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00eb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ec: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f3: Unknown result type (might be due to invalid IL or missing references)
			//IL_0100: 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_00a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_0119: Unknown result type (might be due to invalid IL or missing references)
			//IL_0132: Unknown result type (might be due to invalid IL or missing references)
			foreach (KeyValuePair<Stat, TextMeshProUGUI> cell in _cells)
			{
				((TMP_Text)cell.Value).text = cell.Key.Value(local);
			}
			((Graphic)_cornerStripe).color = PlayerColor(local);
			float num = Mathf.Clamp(JeusticeStats.CornerScale.Value, 0.5f, 2f);
			((Transform)_corner).localScale = Vector3.one * num;
			Vector2 val = (Vector2)(JeusticeStats.CornerPosition.Value switch
			{
				Corner.BottomRight => new Vector2(1f, 0f), 
				Corner.BottomLeft => new Vector2(0f, 0f), 
				_ => new Vector2(1f, 1f), 
			});
			RectTransform corner = _corner;
			RectTransform corner2 = _corner;
			Vector2 val2 = (_corner.pivot = val);
			Vector2 anchorMin = (corner2.anchorMax = val2);
			corner.anchorMin = anchorMin;
			_corner.anchoredPosition = new Vector2((val.x == 0f) ? 16f : (-16f), (val.y == 0f) ? 16f : (-16f));
		}

		private static bool EnemyBehind(RectTransform panel, Player local)
		{
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_011f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0124: Unknown result type (might be due to invalid IL or missing references)
			//IL_0129: Unknown result type (might be due to invalid IL or missing references)
			//IL_012b: Unknown result type (might be due to invalid IL or missing references)
			//IL_013b: Unknown result type (might be due to invalid IL or missing references)
			Camera val = (((Object)(object)MainCam.instance != (Object)null) ? MainCam.instance.cam : Camera.main);
			if ((Object)(object)val == (Object)null)
			{
				return false;
			}
			Vector3[] array = (Vector3[])(object)new Vector3[4];
			panel.GetWorldCorners(array);
			Rect val2 = Rect.MinMaxRect(array[0].x, array[0].y, array[2].x, array[2].y);
			float num = (float)Screen.height * 0.05f;
			((Rect)(ref val2)).xMin = ((Rect)(ref val2)).xMin - num;
			((Rect)(ref val2)).yMin = ((Rect)(ref val2)).yMin - num;
			((Rect)(ref val2)).xMax = ((Rect)(ref val2)).xMax + num;
			((Rect)(ref val2)).yMax = ((Rect)(ref val2)).yMax + num;
			foreach (Player player in PlayerManager.instance.players)
			{
				if (!((Object)(object)player == (Object)null) && !((Object)(object)player.data == (Object)null) && !player.data.dead && ((Component)player).gameObject.activeInHierarchy && player.teamID != local.teamID)
				{
					Vector3 val3 = val.WorldToScreenPoint(((Component)player).transform.position);
					if (val3.z > 0f && ((Rect)(ref val2)).Contains(val3))
					{
						return true;
					}
				}
			}
			return false;
		}

		private void FillSheet(Player local)
		{
			//IL_00d5: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c2: 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_019d: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a4: Unknown result type (might be due to invalid IL or missing references)
			//IL_0302: Unknown result type (might be due to invalid IL or missing references)
			//IL_031d: Unknown result type (might be due to invalid IL or missing references)
			//IL_033d: Unknown result type (might be due to invalid IL or missing references)
			List<Player> list = (from p in PlayerManager.instance.players
				where (Object)(object)p != (Object)null && (Object)(object)p.data != (Object)null
				orderby p.teamID, p.playerID
				select p).ToList();
			StringBuilder stringBuilder = new StringBuilder();
			stringBuilder.Append("<size=120%><b>Stats</b></size>");
			for (int num = 0; num < list.Count; num++)
			{
				Player val = list[num];
				stringBuilder.Append("<pos=").Append(280f + (float)num * 150f).Append(">")
					.Append("<color=")
					.Append(Hex(PlayerColor(val)))
					.Append("><b>")
					.Append(((Object)(object)val == (Object)(object)local) ? "<u>" : "")
					.Append(Name(val))
					.Append(((Object)(object)val == (Object)(object)local) ? "</u>" : "")
					.Append("</b></color>");
			}
			stringBuilder.Append("\n<size=40%> </size>");
			Color? val2 = null;
			int num2 = 1;
			List<int> list2 = new List<int>();
			foreach (Stat item in Stats.All)
			{
				stringBuilder.Append('\n');
				num2++;
				if (val2.HasValue && val2.Value != item.Color)
				{
					stringBuilder.Append("<size=40%> </size>\n");
					num2++;
				}
				val2 = item.Color;
				list2.Add(num2);
				stringBuilder.Append("<pos=").Append(36f).Append("><color=")
					.Append(Hex(item.Color))
					.Append('>')
					.Append(item.Label)
					.Append("</color>");
				for (int num3 = 0; num3 < list.Count; num3++)
				{
					stringBuilder.Append("<pos=").Append(280f + (float)num3 * 150f).Append('>')
						.Append(item.Value(list[num3]));
				}
			}
			stringBuilder.Append("\n<size=40%> </size>\n<size=75%><color=#8A90A8>").Append((JeusticeStats.Lang.Value == Language.FR) ? "<color=#7CF08A>vert</color> = mieux que la base, <color=#FF7A7A>rouge</color> = moins bien" : "<color=#7CF08A>green</color> = better than base, <color=#FF7A7A>red</color> = worse").Append("</color></size>");
			string text = stringBuilder.ToString();
			((TMP_Text)_sheetText).text = text;
			float num4 = 280f + (float)Mathf.Max(1, list.Count) * 150f;
			float y = ((TMP_Text)_sheetText).GetPreferredValues(text, num4, 0f).y;
			((TMP_Text)_sheetText).rectTransform.sizeDelta = new Vector2(num4, y);
			_sheet.sizeDelta = new Vector2(num4 + 56f, y + 48f);
			PlaceSheetIcons(list2, num4);
		}

		private void PlaceSheetIcons(List<int> statLines, float width)
		{
			//IL_0047: Unknown result type (might be due to invalid IL or missing references)
			//IL_004c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0093: Unknown result type (might be due to invalid IL or missing references)
			//IL_00be: Unknown result type (might be due to invalid IL or missing references)
			//IL_0103: Unknown result type (might be due to invalid IL or missing references)
			//IL_0108: 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_012c: Unknown result type (might be due to invalid IL or missing references)
			//IL_013f: Unknown result type (might be due to invalid IL or missing references)
			((TMP_Text)_sheetText).ForceMeshUpdate();
			TMP_TextInfo textInfo = ((TMP_Text)_sheetText).textInfo;
			for (int i = 0; i < Stats.All.Count; i++)
			{
				if (_sheetIcons.Count <= i)
				{
					GameObject val = new GameObject("Icon", new Type[1] { typeof(RectTransform) });
					val.transform.SetParent(((TMP_Text)_sheetText).transform, false);
					Image val2 = val.AddComponent<Image>();
					val2.sprite = Icons.Get(Stats.All[i].Icon);
					((Graphic)val2).color = Stats.All[i].Color;
					val2.preserveAspect = true;
					((Graphic)val2).raycastTarget = false;
					((Graphic)val2).rectTransform.sizeDelta = new Vector2(26f, 26f);
					_sheetIcons.Add(val2);
				}
				Image val3 = _sheetIcons[i];
				int num = statLines[i];
				if (num >= textInfo.lineCount)
				{
					((Behaviour)val3).enabled = false;
					continue;
				}
				TMP_LineInfo val4 = textInfo.lineInfo[num];
				((Behaviour)val3).enabled = true;
				((Transform)((Graphic)val3).rectTransform).localPosition = new Vector3((0f - width) * 0.5f + 13f, (val4.ascender + val4.descender) * 0.5f, 0f);
			}
		}

		private void Build()
		{
			//IL_0076: Unknown result type (might be due to invalid IL or missing references)
			//IL_007c: Expected O, but got Unknown
			//IL_00cb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fc: Unknown result type (might be due to invalid IL or missing references)
			//IL_010e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0114: Unknown result type (might be due to invalid IL or missing references)
			//IL_0119: Unknown result type (might be due to invalid IL or missing references)
			//IL_011a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0124: 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_012f: 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_0243: Unknown result type (might be due to invalid IL or missing references)
			//IL_0248: Unknown result type (might be due to invalid IL or missing references)
			//IL_025a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0260: Unknown result type (might be due to invalid IL or missing references)
			//IL_0265: Unknown result type (might be due to invalid IL or missing references)
			//IL_0266: Unknown result type (might be due to invalid IL or missing references)
			//IL_0278: Unknown result type (might be due to invalid IL or missing references)
			//IL_027f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0286: Unknown result type (might be due to invalid IL or missing references)
			//IL_0291: Unknown result type (might be due to invalid IL or missing references)
			//IL_029b: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b4: Unknown result type (might be due to invalid IL or missing references)
			//IL_02e4: Unknown result type (might be due to invalid IL or missing references)
			//IL_0341: Unknown result type (might be due to invalid IL or missing references)
			//IL_0348: Unknown result type (might be due to invalid IL or missing references)
			//IL_035a: Unknown result type (might be due to invalid IL or missing references)
			//IL_036f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0389: Unknown result type (might be due to invalid IL or missing references)
			//IL_03d8: Unknown result type (might be due to invalid IL or missing references)
			//IL_03df: Expected O, but got Unknown
			//IL_0406: Unknown result type (might be due to invalid IL or missing references)
			//IL_040b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0416: Unknown result type (might be due to invalid IL or missing references)
			//IL_0420: Unknown result type (might be due to invalid IL or missing references)
			//IL_042b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0435: Unknown result type (might be due to invalid IL or missing references)
			//IL_0440: Unknown result type (might be due to invalid IL or missing references)
			//IL_044a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0455: Unknown result type (might be due to invalid IL or missing references)
			//IL_0469: Unknown result type (might be due to invalid IL or missing references)
			//IL_04c5: Unknown result type (might be due to invalid IL or missing references)
			//IL_04cc: Unknown result type (might be due to invalid IL or missing references)
			//IL_04ce: Unknown result type (might be due to invalid IL or missing references)
			//IL_04cf: Unknown result type (might be due to invalid IL or missing references)
			//IL_04d6: Unknown result type (might be due to invalid IL or missing references)
			//IL_0517: Unknown result type (might be due to invalid IL or missing references)
			//IL_051e: Unknown result type (might be due to invalid IL or missing references)
			//IL_052f: Unknown result type (might be due to invalid IL or missing references)
			_built = true;
			TMP_FontAsset font = (from t in Object.FindObjectsOfType<TextMeshProUGUI>()
				select ((TMP_Text)t).font).FirstOrDefault((Func<TMP_FontAsset, bool>)((TMP_FontAsset f) => (Object)(object)f != (Object)null)) ?? TMP_Settings.defaultFontAsset;
			GameObject val = new GameObject("Canvas", new Type[1] { typeof(RectTransform) });
			val.transform.SetParent(((Component)this).transform, false);
			_canvas = val.AddComponent<Canvas>();
			_canvas.renderMode = (RenderMode)0;
			_canvas.sortingOrder = 50;
			CanvasScaler obj = val.AddComponent<CanvasScaler>();
			obj.uiScaleMode = (ScaleMode)1;
			obj.referenceResolution = new Vector2(1920f, 1080f);
			obj.matchWidthOrHeight = 0.5f;
			GameObject val2 = new GameObject("Overhead", new Type[1] { typeof(RectTransform) });
			val2.transform.SetParent(val.transform, false);
			RectTransform val3 = (RectTransform)val2.transform;
			val3.anchorMin = Vector2.zero;
			val3.anchorMax = Vector2.one;
			val3.sizeDelta = Vector2.zero;
			val2.AddComponent<Overhead>().Font = font;
			List<Stat> list = Stats.All.Where((Stat st) => st.InCorner).ToList();
			int num = (list.Count + 1) / 2;
			_corner = Panel("Corner", val.transform);
			_corner.sizeDelta = new Vector2(234f, (float)num * 30f + 16f);
			_cornerGroup = ((Component)_corner).gameObject.AddComponent<CanvasGroup>();
			_cornerGroup.blocksRaycasts = false;
			_cornerGroup.interactable = false;
			Vector2 val6 = default(Vector2);
			for (int num2 = 0; num2 < list.Count; num2++)
			{
				float num3 = 20f + (float)(num2 % 2) * 104f;
				float num4 = -8f - (float)(num2 / 2) * 30f - 15f;
				GameObject val4 = new GameObject("Icon " + list[num2].Icon, new Type[1] { typeof(RectTransform) });
				val4.transform.SetParent((Transform)(object)_corner, false);
				RectTransform val5 = (RectTransform)val4.transform;
				((Vector2)(ref val6))..ctor(0f, 1f);
				val5.anchorMax = val6;
				val5.anchorMin = val6;
				val5.pivot = new Vector2(0f, 0.5f);
				val5.sizeDelta = new Vector2(24f, 24f);
				val5.anchoredPosition = new Vector2(num3, num4);
				Image obj2 = val4.AddComponent<Image>();
				obj2.sprite = Icons.Get(list[num2].Icon);
				((Graphic)obj2).color = list[num2].Color;
				obj2.preserveAspect = true;
				((Graphic)obj2).raycastTarget = false;
				TextMeshProUGUI val7 = Text("Value", (Transform)(object)_corner, font, 20f);
				((TMP_Text)val7).alignment = (TextAlignmentOptions)4097;
				((TMP_Text)val7).enableWordWrapping = false;
				RectTransform rectTransform = ((TMP_Text)val7).rectTransform;
				((Vector2)(ref val6))..ctor(0f, 1f);
				rectTransform.anchorMax = val6;
				rectTransform.anchorMin = val6;
				rectTransform.pivot = new Vector2(0f, 0.5f);
				rectTransform.sizeDelta = new Vector2(74f, 30f);
				rectTransform.anchoredPosition = new Vector2(num3 + 24f + 6f, num4);
				_cells.Add(new KeyValuePair<Stat, TextMeshProUGUI>(list[num2], val7));
			}
			GameObject val8 = new GameObject("Stripe", new Type[1] { typeof(RectTransform) });
			val8.transform.SetParent((Transform)(object)_corner, false);
			val8.AddComponent<LayoutElement>().ignoreLayout = true;
			RectTransform val9 = (RectTransform)val8.transform;
			val9.anchorMin = new Vector2(0f, 0f);
			val9.anchorMax = new Vector2(0f, 1f);
			val9.pivot = new Vector2(0f, 0.5f);
			val9.sizeDelta = new Vector2(5f, -16f);
			val9.anchoredPosition = new Vector2(8f, 0f);
			_cornerStripe = val8.AddComponent<Image>();
			((Graphic)_cornerStripe).raycastTarget = false;
			_sheet = Panel("Sheet", val.transform);
			RectTransform sheet = _sheet;
			RectTransform sheet2 = _sheet;
			RectTransform sheet3 = _sheet;
			Vector2 val10 = default(Vector2);
			((Vector2)(ref val10))..ctor(0.5f, 0.5f);
			sheet3.pivot = val10;
			val6 = (sheet.anchorMin = (sheet2.anchorMax = val10));
			_sheetText = Text("Text", (Transform)(object)_sheet, font, 24f);
			RectTransform rectTransform2 = ((TMP_Text)_sheetText).rectTransform;
			((Vector2)(ref val6))..ctor(0.5f, 0.5f);
			rectTransform2.anchorMax = val6;
			rectTransform2.anchorMin = val6;
			rectTransform2.pivot = new Vector2(0.5f, 0.5f);
			((TMP_Text)_sheetText).enableWordWrapping = false;
			((Component)_corner).gameObject.SetActive(false);
			((Component)_sheet).gameObject.SetActive(false);
		}

		private static RectTransform Panel(string name, Transform parent)
		{
			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
			//IL_0019: 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_003f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0054: Unknown result type (might be due to invalid IL or missing references)
			//IL_005a: Expected O, but got Unknown
			GameObject val = new GameObject(name, new Type[1] { typeof(RectTransform) });
			val.transform.SetParent(parent, false);
			Image obj = val.AddComponent<Image>();
			obj.sprite = Rounded.Sprite;
			obj.type = (Type)1;
			((Graphic)obj).color = PanelColor;
			((Graphic)obj).raycastTarget = false;
			return (RectTransform)val.transform;
		}

		private static TextMeshProUGUI Text(string name, Transform parent, TMP_FontAsset font, float size)
		{
			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
			//IL_0019: 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)
			GameObject val = new GameObject(name, new Type[1] { typeof(RectTransform) });
			val.transform.SetParent(parent, false);
			TextMeshProUGUI val2 = val.AddComponent<TextMeshProUGUI>();
			if ((Object)(object)font != (Object)null)
			{
				((TMP_Text)val2).font = font;
			}
			((TMP_Text)val2).fontSize = size;
			((Graphic)val2).color = Color.white;
			((TMP_Text)val2).alignment = (TextAlignmentOptions)257;
			((Graphic)val2).raycastTarget = false;
			((TMP_Text)val2).richText = true;
			((TMP_Text)val2).lineSpacing = 4f;
			return val2;
		}
	}
	internal static class Rounded
	{
		private static Sprite _sprite;

		public static Sprite Sprite
		{
			get
			{
				if (!((Object)(object)_sprite != (Object)null))
				{
					return _sprite = Make();
				}
				return _sprite;
			}
		}

		private static Sprite Make()
		{
			//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_0012: Unknown result type (might be due to invalid IL or missing references)
			//IL_001a: Expected O, but got Unknown
			//IL_0102: 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_0131: Unknown result type (might be due to invalid IL or missing references)
			//IL_0075: 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_00be: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c3: Unknown result type (might be due to invalid IL or missing references)
			Texture2D val = new Texture2D(64, 64, (TextureFormat)4, false)
			{
				filterMode = (FilterMode)1,
				wrapMode = (TextureWrapMode)1
			};
			Color32[] array = (Color32[])(object)new Color32[4096];
			for (int i = 0; i < 64; i++)
			{
				for (int j = 0; j < 64; j++)
				{
					float num = Mathf.Clamp((float)j + 0.5f, 16f, 48f);
					float num2 = Mathf.Clamp((float)i + 0.5f, 16f, 48f);
					float num3 = Vector2.Distance(new Vector2((float)j + 0.5f, (float)i + 0.5f), new Vector2(num, num2)) - 16f;
					byte b = (byte)(Mathf.Clamp01(0.5f - num3) * 255f);
					array[i * 64 + j] = new Color32(byte.MaxValue, byte.MaxValue, byte.MaxValue, b);
				}
			}
			val.SetPixels32(array);
			val.Apply();
			return Sprite.Create(val, new Rect(0f, 0f, 64f, 64f), new Vector2(0.5f, 0.5f), 100f, 0u, (SpriteMeshType)0, new Vector4(16f, 16f, 16f, 16f));
		}
	}
}