Decompiled source of LiveDamageMeter v1.0.0

LiveDamageMeter.dll

Decompiled 8 hours ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using BepInEx;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using SuperFantasyKingdom;
using TMPro;
using UnityEngine;
using UnityEngine.UI;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: AssemblyCompany("LiveDamageMeter")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+123efbaf18f05fa0e611156fa7133517574c692e")]
[assembly: AssemblyProduct("Live Damage Meter")]
[assembly: AssemblyTitle("LiveDamageMeter")]
[assembly: AssemblyVersion("1.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 LiveDamageMeter
{
	[BepInPlugin("ownly.livedamagemeter", "Live Damage Meter", "1.0.0")]
	public class Plugin : BaseUnityPlugin
	{
		private void Awake()
		{
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			new Harmony(((BaseUnityPlugin)this).Info.Metadata.GUID).PatchAll();
			((BaseUnityPlugin)this).Logger.LogInfo((object)"Live Damage Meter loaded");
		}
	}
	[HarmonyPatch(typeof(MusicManager), "Start")]
	internal static class Patch_Attach
	{
		private static void Postfix(MusicManager __instance)
		{
			((Component)__instance).gameObject.AddComponent<Meter>();
		}
	}
	[HarmonyPatch(typeof(RelicManager), "Awake")]
	internal static class Patch_Relics
	{
		private const int RelicRows = 9;

		private static void Postfix(RelicManager __instance)
		{
			try
			{
				GridLayoutGroup component = ((Component)__instance).GetComponent<GridLayoutGroup>();
				if (!((Object)(object)component == (Object)null))
				{
					component.constraint = (Constraint)2;
					component.constraintCount = 9;
				}
			}
			catch
			{
			}
		}
	}
	internal class Meter : MonoBehaviour
	{
		private class Group
		{
			public UnitBase unit;

			public float damage;

			public int count;

			public bool allDead;
		}

		private class Row
		{
			public RectTransform root;

			public RectTransform bar;

			public Image icon;

			public RectTransform disc;

			public RectTransform levelBox;

			public TextMeshProUGUI level;

			public TextMeshProUGUI unitName;

			public TextMeshProUGUI value;
		}

		private const int Rows = 7;

		private const float RowHeight = 20f;

		private const float PanelWidth = 200f;

		private const float EdgeMargin = 14f;

		private const float TopEdge = 0.3234f;

		private const float TextPad = 6f;

		private const float ValueWidth = 68f;

		private const float RefreshInterval = 0.1f;

		private const string OutlinedFont = "Passage7Outline";

		private const float Border = 2f;

		private const float Gap = 2f;

		private const float CornerCut = 2f;

		private const float EnterRange = 7.5f;

		private const float LeaveRange = 10f;

		private const float WidenX = 2.25f;

		private const float WidenY = 1.5f;

		private const float TextFill = 1.4f;

		private const float WideFactor = 1.6f;

		private const float DiscOpacity = 0.41f;

		private static readonly Vector2 DiscAnchor = new Vector2(0.78f, 0.79f);

		private static readonly Vector2 DiscSize = new Vector2(0.5f, 0.56f);

		private static readonly Vector2 TextNudge = new Vector2(0.015f, 0.02f);

		private static readonly Color FrameColor = new Color(0f, 0f, 0f, 1f);

		private static readonly Color RowColor = new Color(0f, 0f, 0f, 0.78f);

		private static readonly Color BarColor = new Color(0.7f, 0.24f, 0.14f, 0.95f);

		private static readonly Color NameColor = Color32.op_Implicit(new Color32(byte.MaxValue, byte.MaxValue, byte.MaxValue, byte.MaxValue));

		private static readonly Color ValueColor = Color32.op_Implicit(new Color32(byte.MaxValue, (byte)231, (byte)0, byte.MaxValue));

		private static readonly Color DeadTint = new Color(1f, 1f, 1f, 0.35f);

		private const float TextHeight = 24f;

		private const float InnerWidth = 196f;

		private const float BarLeft = 22f;

		private const float BarWidth = 174f;

		private const float RowPitch = 22f;

		private static Sprite s_Disc;

		private static TMP_FontAsset s_Font;

		private static Material s_Material;

		private FieldRef<MusicManager, Vector3> m_CombatLocation;

		private GameObject m_Panel;

		private RectTransform m_PanelRect;

		private Row[] m_Rows;

		private Group[] m_Groups;

		private GameObject[] m_Dividers;

		private float m_Timer;

		private bool m_OnField;

		private int m_Shown;

		private void Awake()
		{
			try
			{
				m_CombatLocation = AccessTools.FieldRefAccess<MusicManager, Vector3>("combatLocation");
			}
			catch
			{
				((Behaviour)this).enabled = false;
			}
		}

		private void Update()
		{
			//IL_003c: Unknown result type (might be due to invalid IL or missing references)
			//IL_004b: 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_0055: 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_0062: 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_0074: 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)
			try
			{
				if ((Object)(object)MusicManager.Instance == (Object)null || (Object)(object)CombatManager.Instance == (Object)null || (Object)(object)GameCamera.Instance == (Object)null)
				{
					return;
				}
				Vector3 val = m_CombatLocation.Invoke(MusicManager.Instance) - ((Component)GameCamera.Instance).transform.position;
				Vector3 val2 = new Vector3(val.x / 2.25f, val.y / 1.5f, val.z);
				float magnitude = ((Vector3)(ref val2)).magnitude;
				if (magnitude < 7.5f)
				{
					m_OnField = true;
				}
				else if (magnitude > 10f)
				{
					m_OnField = false;
				}
				if (!m_OnField || (!CombatManager.Instance.IsCombat() && !CombatManager.Instance.IsCombatOver()))
				{
					if ((Object)(object)m_Panel != (Object)null && m_Panel.activeSelf)
					{
						m_Panel.SetActive(false);
					}
					m_Timer = 0f;
					return;
				}
				if ((Object)(object)m_Panel == (Object)null)
				{
					Build();
				}
				if (!((Object)(object)m_Panel == (Object)null))
				{
					m_Timer -= Time.unscaledDeltaTime;
					if (m_Timer <= 0f)
					{
						m_Timer = 0.1f;
						Refresh();
					}
					if (m_Panel.activeSelf != m_Shown > 0)
					{
						m_Panel.SetActive(m_Shown > 0);
					}
				}
			}
			catch
			{
				if ((Object)(object)m_Panel != (Object)null)
				{
					m_Panel.SetActive(false);
				}
				((Behaviour)this).enabled = false;
			}
		}

		private void Build()
		{
			//IL_0071: Unknown result type (might be due to invalid IL or missing references)
			//IL_0077: Expected O, but got Unknown
			//IL_01be: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c8: Expected O, but got Unknown
			//IL_01d4: Unknown result type (might be due to invalid IL or missing references)
			//IL_01de: Expected O, but got Unknown
			//IL_020b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0225: Unknown result type (might be due to invalid IL or missing references)
			//IL_023f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0259: Unknown result type (might be due to invalid IL or missing references)
			//IL_0273: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ff: Unknown result type (might be due to invalid IL or missing references)
			//IL_0104: Unknown result type (might be due to invalid IL or missing references)
			//IL_010e: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c9: Unknown result type (might be due to invalid IL or missing references)
			//IL_02d3: Unknown result type (might be due to invalid IL or missing references)
			//IL_02dd: Expected O, but got Unknown
			//IL_0301: Unknown result type (might be due to invalid IL or missing references)
			//IL_031c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0337: Unknown result type (might be due to invalid IL or missing references)
			//IL_0352: Unknown result type (might be due to invalid IL or missing references)
			//IL_0377: Unknown result type (might be due to invalid IL or missing references)
			//IL_039f: Unknown result type (might be due to invalid IL or missing references)
			//IL_03af: Unknown result type (might be due to invalid IL or missing references)
			//IL_03bf: Unknown result type (might be due to invalid IL or missing references)
			//IL_03cf: Unknown result type (might be due to invalid IL or missing references)
			//IL_03de: Unknown result type (might be due to invalid IL or missing references)
			//IL_03f4: Unknown result type (might be due to invalid IL or missing references)
			//IL_041f: Unknown result type (might be due to invalid IL or missing references)
			//IL_043a: 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_0470: Unknown result type (might be due to invalid IL or missing references)
			//IL_0488: Unknown result type (might be due to invalid IL or missing references)
			//IL_04ad: Unknown result type (might be due to invalid IL or missing references)
			//IL_04cd: Unknown result type (might be due to invalid IL or missing references)
			//IL_04ed: Unknown result type (might be due to invalid IL or missing references)
			//IL_0503: Unknown result type (might be due to invalid IL or missing references)
			//IL_0523: Unknown result type (might be due to invalid IL or missing references)
			//IL_0552: Unknown result type (might be due to invalid IL or missing references)
			//IL_055c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0561: Unknown result type (might be due to invalid IL or missing references)
			//IL_0574: Unknown result type (might be due to invalid IL or missing references)
			//IL_0575: Unknown result type (might be due to invalid IL or missing references)
			//IL_057f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0580: Unknown result type (might be due to invalid IL or missing references)
			//IL_058a: Unknown result type (might be due to invalid IL or missing references)
			//IL_058b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0595: Unknown result type (might be due to invalid IL or missing references)
			//IL_0596: Unknown result type (might be due to invalid IL or missing references)
			//IL_05a0: Unknown result type (might be due to invalid IL or missing references)
			//IL_05c5: Unknown result type (might be due to invalid IL or missing references)
			//IL_05cf: Expected O, but got Unknown
			//IL_05e6: Unknown result type (might be due to invalid IL or missing references)
			//IL_05f7: Unknown result type (might be due to invalid IL or missing references)
			//IL_0627: Unknown result type (might be due to invalid IL or missing references)
			//IL_0669: Unknown result type (might be due to invalid IL or missing references)
			//IL_067a: Unknown result type (might be due to invalid IL or missing references)
			//IL_06ad: Unknown result type (might be due to invalid IL or missing references)
			//IL_072b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0769: Unknown result type (might be due to invalid IL or missing references)
			//IL_0789: Unknown result type (might be due to invalid IL or missing references)
			//IL_07a9: Unknown result type (might be due to invalid IL or missing references)
			//IL_07c9: Unknown result type (might be due to invalid IL or missing references)
			//IL_07e9: Unknown result type (might be due to invalid IL or missing references)
			//IL_081c: Unknown result type (might be due to invalid IL or missing references)
			//IL_08a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_08e5: Unknown result type (might be due to invalid IL or missing references)
			//IL_0905: Unknown result type (might be due to invalid IL or missing references)
			//IL_0925: Unknown result type (might be due to invalid IL or missing references)
			//IL_0945: Unknown result type (might be due to invalid IL or missing references)
			//IL_0965: Unknown result type (might be due to invalid IL or missing references)
			//IL_0998: Unknown result type (might be due to invalid IL or missing references)
			//IL_0a15: Unknown result type (might be due to invalid IL or missing references)
			//IL_0a2f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0a49: Unknown result type (might be due to invalid IL or missing references)
			//IL_0a63: Unknown result type (might be due to invalid IL or missing references)
			//IL_0a7c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0a91: Unknown result type (might be due to invalid IL or missing references)
			//IL_0aab: Unknown result type (might be due to invalid IL or missing references)
			//IL_0ac5: Unknown result type (might be due to invalid IL or missing references)
			//IL_0adf: Unknown result type (might be due to invalid IL or missing references)
			//IL_0af8: Unknown result type (might be due to invalid IL or missing references)
			//IL_0b0d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0b27: Unknown result type (might be due to invalid IL or missing references)
			//IL_0b41: Unknown result type (might be due to invalid IL or missing references)
			//IL_0b5b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0b74: Unknown result type (might be due to invalid IL or missing references)
			//IL_0b89: Unknown result type (might be due to invalid IL or missing references)
			//IL_0ba3: Unknown result type (might be due to invalid IL or missing references)
			//IL_0bbd: Unknown result type (might be due to invalid IL or missing references)
			//IL_0bd7: Unknown result type (might be due to invalid IL or missing references)
			//IL_0bf0: Unknown result type (might be due to invalid IL or missing references)
			//IL_0c05: Unknown result type (might be due to invalid IL or missing references)
			//IL_0c1f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0c39: Unknown result type (might be due to invalid IL or missing references)
			//IL_0c53: Unknown result type (might be due to invalid IL or missing references)
			//IL_0c6c: Unknown result type (might be due to invalid IL or missing references)
			//IL_009c: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ab: Unknown result type (might be due to invalid IL or missing references)
			//IL_0ca1: Unknown result type (might be due to invalid IL or missing references)
			//IL_0cce: Unknown result type (might be due to invalid IL or missing references)
			//IL_0ce9: Unknown result type (might be due to invalid IL or missing references)
			//IL_0d04: Unknown result type (might be due to invalid IL or missing references)
			//IL_0d41: Unknown result type (might be due to invalid IL or missing references)
			//IL_0d5f: 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)
			Canvas val = (from c in Object.FindObjectsOfType<Canvas>()
				where c.isRootCanvas && (int)c.renderMode == 0
				orderby ((Component)c).transform.childCount descending
				select c).FirstOrDefault();
			if ((Object)(object)val == (Object)null)
			{
				return;
			}
			if ((Object)(object)s_Disc == (Object)null)
			{
				Texture2D val2 = new Texture2D(16, 16);
				((Texture)val2).filterMode = (FilterMode)0;
				for (int num = 0; num < 16; num++)
				{
					for (int num2 = 0; num2 < 16; num2++)
					{
						val2.SetPixel(num2, num, new Color(1f, 1f, 1f, (Vector2.Distance(new Vector2((float)num2, (float)num), Vector2.one * 7.5f) <= 8f) ? 1f : 0f));
					}
				}
				val2.Apply();
				s_Disc = Sprite.Create(val2, new Rect(0f, 0f, 16f, 16f), Vector2.one * 0.5f);
			}
			if ((Object)(object)s_Font == (Object)null)
			{
				TMP_FontAsset[] source = Resources.FindObjectsOfTypeAll<TMP_FontAsset>();
				s_Font = ((IEnumerable<TMP_FontAsset>)source).FirstOrDefault((Func<TMP_FontAsset, bool>)((TMP_FontAsset font) => ((Object)font).name == "Passage7Outline")) ?? ((IEnumerable<TMP_FontAsset>)source).FirstOrDefault((Func<TMP_FontAsset, bool>)((TMP_FontAsset font) => ((Object)font).name.Contains("Outline"))) ?? ((TMP_Text)((Component)val).GetComponentInChildren<TextMeshProUGUI>(true)).font;
				s_Material = ((TMP_Asset)s_Font).material;
			}
			m_Panel = new GameObject("LiveDamageMeter", new Type[1] { typeof(RectTransform) });
			m_PanelRect = (RectTransform)m_Panel.transform;
			((Transform)m_PanelRect).SetParent(((Component)val).transform, false);
			((Transform)m_PanelRect).SetAsFirstSibling();
			m_PanelRect.anchorMin = new Vector2(0f, 0.3234f);
			m_PanelRect.anchorMax = new Vector2(0f, 0.3234f);
			m_PanelRect.pivot = new Vector2(0f, 1f);
			m_PanelRect.sizeDelta = new Vector2(200f, 156f);
			m_PanelRect.anchoredPosition = new Vector2(14f, 0f);
			m_Rows = new Row[7];
			for (int num3 = 0; num3 < 7; num3++)
			{
				Row row = new Row();
				m_Rows[num3] = row;
				row.root = (RectTransform)new GameObject("Row" + num3, new Type[1] { typeof(RectTransform) }).transform;
				((Transform)row.root).SetParent((Transform)(object)m_PanelRect, false);
				row.root.anchorMin = new Vector2(0f, 1f);
				row.root.anchorMax = new Vector2(0f, 1f);
				row.root.pivot = new Vector2(0f, 1f);
				row.root.sizeDelta = new Vector2(196f, 20f);
				row.root.anchoredPosition = new Vector2(2f, -2f - (float)num3 * 22f);
				((Component)row.root).gameObject.SetActive(false);
				Image obj = MakeImage((Transform)(object)row.root, "Backdrop", RowColor);
				((Graphic)obj).rectTransform.anchorMin = Vector2.zero;
				((Graphic)obj).rectTransform.anchorMax = Vector2.one;
				((Graphic)obj).rectTransform.offsetMin = Vector2.zero;
				((Graphic)obj).rectTransform.offsetMax = Vector2.zero;
				Image val3 = MakeImage((Transform)(object)row.root, "Bar", BarColor);
				row.bar = ((Graphic)val3).rectTransform;
				row.bar.anchorMin = new Vector2(0f, 0.5f);
				row.bar.anchorMax = new Vector2(0f, 0.5f);
				row.bar.pivot = new Vector2(0f, 0.5f);
				row.bar.anchoredPosition = new Vector2(22f, 0f);
				row.icon = MakeImage((Transform)(object)row.root, "Icon", Color.white);
				((Graphic)row.icon).rectTransform.anchorMin = new Vector2(0f, 0.5f);
				((Graphic)row.icon).rectTransform.anchorMax = new Vector2(0f, 0.5f);
				((Graphic)row.icon).rectTransform.pivot = new Vector2(0f, 0.5f);
				((Graphic)row.icon).rectTransform.anchoredPosition = Vector2.zero;
				((Graphic)row.icon).rectTransform.sizeDelta = new Vector2(20f, 20f);
				row.icon.preserveAspect = true;
				RectTransform val4 = (RectTransform)new GameObject("LevelClip", new Type[1] { typeof(RectTransform) }).transform;
				((Transform)val4).SetParent((Transform)(object)((Graphic)row.icon).rectTransform, false);
				val4.anchorMin = Vector2.zero;
				val4.anchorMax = Vector2.one;
				val4.offsetMin = Vector2.zero;
				val4.offsetMax = Vector2.zero;
				((Component)val4).gameObject.AddComponent<RectMask2D>();
				Image val5 = MakeImage((Transform)val4, "LevelDisc", new Color(0f, 0f, 0f, 0.41f));
				row.disc = ((Graphic)val5).rectTransform;
				row.disc.offsetMin = Vector2.zero;
				row.disc.offsetMax = Vector2.zero;
				val5.sprite = s_Disc;
				row.level = new GameObject("Level", new Type[1] { typeof(RectTransform) }).AddComponent<TextMeshProUGUI>();
				row.levelBox = ((TMP_Text)row.level).rectTransform;
				((Transform)row.levelBox).SetParent((Transform)(object)((Graphic)row.icon).rectTransform, false);
				row.levelBox.offsetMin = Vector2.zero;
				row.levelBox.offsetMax = Vector2.zero;
				((TMP_Text)row.level).font = s_Font;
				((TMP_Text)row.level).fontSharedMaterial = s_Material;
				((Graphic)row.level).color = ValueColor;
				((TMP_Text)row.level).alignment = (TextAlignmentOptions)514;
				((TMP_Text)row.level).enableWordWrapping = false;
				((Graphic)row.level).raycastTarget = false;
				((TMP_Text)row.level).enableAutoSizing = true;
				((TMP_Text)row.level).fontSizeMin = 1f;
				((TMP_Text)row.level).fontSizeMax = 400f;
				row.unitName = new GameObject("Name", new Type[1] { typeof(RectTransform) }).AddComponent<TextMeshProUGUI>();
				((Transform)((TMP_Text)row.unitName).rectTransform).SetParent((Transform)(object)row.root, false);
				((TMP_Text)row.unitName).rectTransform.anchorMin = new Vector2(0f, 0.5f);
				((TMP_Text)row.unitName).rectTransform.anchorMax = new Vector2(0f, 0.5f);
				((TMP_Text)row.unitName).rectTransform.pivot = new Vector2(0f, 0.5f);
				((TMP_Text)row.unitName).rectTransform.anchoredPosition = new Vector2(28f, 0f);
				((TMP_Text)row.unitName).rectTransform.sizeDelta = new Vector2(94f, 24f);
				((TMP_Text)row.unitName).font = s_Font;
				((TMP_Text)row.unitName).fontSharedMaterial = s_Material;
				((Graphic)row.unitName).color = NameColor;
				((TMP_Text)row.unitName).alignment = (TextAlignmentOptions)513;
				((TMP_Text)row.unitName).enableWordWrapping = false;
				((TMP_Text)row.unitName).overflowMode = (TextOverflowModes)1;
				((Graphic)row.unitName).raycastTarget = false;
				((TMP_Text)row.unitName).enableAutoSizing = true;
				((TMP_Text)row.unitName).fontSizeMin = 8f;
				((TMP_Text)row.unitName).fontSizeMax = 21f;
				row.value = new GameObject("Value", new Type[1] { typeof(RectTransform) }).AddComponent<TextMeshProUGUI>();
				((Transform)((TMP_Text)row.value).rectTransform).SetParent((Transform)(object)row.root, false);
				((TMP_Text)row.value).rectTransform.anchorMin = new Vector2(0f, 0.5f);
				((TMP_Text)row.value).rectTransform.anchorMax = new Vector2(0f, 0.5f);
				((TMP_Text)row.value).rectTransform.pivot = new Vector2(0f, 0.5f);
				((TMP_Text)row.value).rectTransform.anchoredPosition = new Vector2(122f, 0f);
				((TMP_Text)row.value).rectTransform.sizeDelta = new Vector2(68f, 24f);
				((TMP_Text)row.value).font = s_Font;
				((TMP_Text)row.value).fontSharedMaterial = s_Material;
				((Graphic)row.value).color = ValueColor;
				((TMP_Text)row.value).alignment = (TextAlignmentOptions)516;
				((TMP_Text)row.value).enableWordWrapping = false;
				((Graphic)row.value).raycastTarget = false;
				((TMP_Text)row.value).enableAutoSizing = true;
				((TMP_Text)row.value).fontSizeMin = 8f;
				((TMP_Text)row.value).fontSizeMax = 21f;
			}
			Image obj2 = MakeImage((Transform)(object)m_PanelRect, "FrameTop", FrameColor);
			((Graphic)obj2).rectTransform.anchorMin = new Vector2(0f, 1f);
			((Graphic)obj2).rectTransform.anchorMax = new Vector2(1f, 1f);
			((Graphic)obj2).rectTransform.offsetMin = new Vector2(2f, -2f);
			((Graphic)obj2).rectTransform.offsetMax = new Vector2(-2f, 0f);
			Image obj3 = MakeImage((Transform)(object)m_PanelRect, "FrameBottom", FrameColor);
			((Graphic)obj3).rectTransform.anchorMin = new Vector2(0f, 0f);
			((Graphic)obj3).rectTransform.anchorMax = new Vector2(1f, 0f);
			((Graphic)obj3).rectTransform.offsetMin = new Vector2(2f, 0f);
			((Graphic)obj3).rectTransform.offsetMax = new Vector2(-2f, 2f);
			Image obj4 = MakeImage((Transform)(object)m_PanelRect, "FrameLeft", FrameColor);
			((Graphic)obj4).rectTransform.anchorMin = new Vector2(0f, 0f);
			((Graphic)obj4).rectTransform.anchorMax = new Vector2(0f, 1f);
			((Graphic)obj4).rectTransform.offsetMin = new Vector2(0f, 2f);
			((Graphic)obj4).rectTransform.offsetMax = new Vector2(2f, -2f);
			Image obj5 = MakeImage((Transform)(object)m_PanelRect, "FrameRight", FrameColor);
			((Graphic)obj5).rectTransform.anchorMin = new Vector2(1f, 0f);
			((Graphic)obj5).rectTransform.anchorMax = new Vector2(1f, 1f);
			((Graphic)obj5).rectTransform.offsetMin = new Vector2(-2f, 2f);
			((Graphic)obj5).rectTransform.offsetMax = new Vector2(0f, -2f);
			Image obj6 = MakeImage((Transform)(object)m_PanelRect, "DividerColumn", FrameColor);
			((Graphic)obj6).rectTransform.anchorMin = new Vector2(0f, 0f);
			((Graphic)obj6).rectTransform.anchorMax = new Vector2(0f, 1f);
			((Graphic)obj6).rectTransform.offsetMin = new Vector2(22f, 2f);
			((Graphic)obj6).rectTransform.offsetMax = new Vector2(24f, -2f);
			m_Dividers = (GameObject[])(object)new GameObject[6];
			for (int num4 = 0; num4 < 6; num4++)
			{
				Image val6 = MakeImage((Transform)(object)m_PanelRect, "Divider" + num4, FrameColor);
				m_Dividers[num4] = ((Component)val6).gameObject;
				((Graphic)val6).rectTransform.anchorMin = new Vector2(0f, 1f);
				((Graphic)val6).rectTransform.anchorMax = new Vector2(1f, 1f);
				((Graphic)val6).rectTransform.pivot = new Vector2(0.5f, 1f);
				float num5 = 2f + (float)(num4 + 1) * 22f - 2f;
				((Graphic)val6).rectTransform.offsetMin = new Vector2(2f, 0f - num5 - 2f);
				((Graphic)val6).rectTransform.offsetMax = new Vector2(-2f, 0f - num5);
				((Component)val6).gameObject.SetActive(false);
			}
			m_Panel.SetActive(false);
		}

		private static Image MakeImage(Transform parent, string name, Color color)
		{
			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			Image obj = new GameObject(name, new Type[1] { typeof(RectTransform) }).AddComponent<Image>();
			((Transform)((Graphic)obj).rectTransform).SetParent(parent, false);
			((Graphic)obj).color = color;
			((Graphic)obj).raycastTarget = false;
			return obj;
		}

		private void Refresh()
		{
			//IL_0233: Unknown result type (might be due to invalid IL or missing references)
			//IL_0320: Unknown result type (might be due to invalid IL or missing references)
			//IL_0354: Unknown result type (might be due to invalid IL or missing references)
			//IL_034d: Unknown result type (might be due to invalid IL or missing references)
			//IL_03f1: Unknown result type (might be due to invalid IL or missing references)
			//IL_03fb: Unknown result type (might be due to invalid IL or missing references)
			//IL_0400: Unknown result type (might be due to invalid IL or missing references)
			//IL_0402: Unknown result type (might be due to invalid IL or missing references)
			//IL_040c: 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_041b: 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_044f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0451: Unknown result type (might be due to invalid IL or missing references)
			//IL_0462: Unknown result type (might be due to invalid IL or missing references)
			//IL_0467: 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_047a: Unknown result type (might be due to invalid IL or missing references)
			//IL_047f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0481: Unknown result type (might be due to invalid IL or missing references)
			//IL_0486: Unknown result type (might be due to invalid IL or missing references)
			//IL_048b: Unknown result type (might be due to invalid IL or missing references)
			//IL_049c: Unknown result type (might be due to invalid IL or missing references)
			//IL_04a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_04a3: Unknown result type (might be due to invalid IL or missing references)
			//IL_04a8: Unknown result type (might be due to invalid IL or missing references)
			//IL_04ad: Unknown result type (might be due to invalid IL or missing references)
			float[] damageMeter = StatisticsManager.Instance.GetDamageMeter();
			if (m_Groups == null || m_Groups.Length < damageMeter.Length)
			{
				m_Groups = new Group[damageMeter.Length];
				for (int i = 0; i < m_Groups.Length; i++)
				{
					m_Groups[i] = new Group();
				}
			}
			int num = 0;
			for (int j = 0; j < damageMeter.Length; j++)
			{
				if (damageMeter[j] <= 0f)
				{
					continue;
				}
				UnitBase unit = UnitManager.Instance.GetUnit(j);
				if ((Object)(object)unit == (Object)null)
				{
					continue;
				}
				int num2 = -1;
				for (int k = 0; k < num; k++)
				{
					UnitBase unit2 = m_Groups[k].unit;
					if (unit2.GetLevel() == unit.GetLevel() && ((Entity)unit2).IsEvolved() == ((Entity)unit).IsEvolved() && ((Entity)unit2).GetEntityIdentifier() == ((Entity)unit).GetEntityIdentifier())
					{
						num2 = k;
						break;
					}
				}
				if (num2 < 0)
				{
					num2 = num++;
					m_Groups[num2].unit = unit;
					m_Groups[num2].damage = 0f;
					m_Groups[num2].count = 0;
					m_Groups[num2].allDead = true;
				}
				m_Groups[num2].damage += damageMeter[j];
				m_Groups[num2].count++;
				if (!unit.IsDead())
				{
					m_Groups[num2].allDead = false;
				}
			}
			m_Shown = Mathf.Min(num, 7);
			for (int l = 0; l < m_Shown; l++)
			{
				int num3 = l;
				for (int m = l + 1; m < num; m++)
				{
					if (m_Groups[m].damage > m_Groups[num3].damage)
					{
						num3 = m;
					}
				}
				Group obj = m_Groups[l];
				m_Groups[l] = m_Groups[num3];
				m_Groups[num3] = obj;
			}
			if (m_Shown > 0)
			{
				m_PanelRect.sizeDelta = new Vector2(200f, 4f + (float)m_Shown * 22f - 2f);
			}
			for (int n = 0; n < m_Dividers.Length; n++)
			{
				bool flag = n < m_Shown - 1;
				if (m_Dividers[n].activeSelf != flag)
				{
					m_Dividers[n].SetActive(flag);
				}
			}
			float num4 = ((m_Shown > 0) ? m_Groups[0].damage : 1f);
			for (int num5 = 0; num5 < 7; num5++)
			{
				Row row = m_Rows[num5];
				if (num5 >= m_Shown)
				{
					((Component)row.root).gameObject.SetActive(false);
					continue;
				}
				Group obj2 = m_Groups[num5];
				float damage = obj2.damage;
				UnitBase unit3 = obj2.unit;
				((Component)row.root).gameObject.SetActive(true);
				row.bar.sizeDelta = new Vector2(174f * Mathf.Clamp01(damage / num4), 20f);
				row.icon.sprite = ((Entity)unit3).GetIcon();
				((Graphic)row.icon).color = (obj2.allDead ? DeadTint : Color.white);
				((TMP_Text)row.unitName).text = ((obj2.count > 1) ? (((Entity)unit3).GetName(true) + " x" + obj2.count) : ((Entity)unit3).GetName(true));
				((TMP_Text)row.value).text = ((damage >= 10000f) ? ((damage / 1000f).ToString("F1") + "k") : Mathf.RoundToInt(damage).ToString("N0"));
				int level = unit3.GetLevel();
				Vector2 val = DiscSize * 0.5f;
				Vector2 val2 = DiscSize * 1.4f * 0.5f;
				if (level > 9)
				{
					val.x *= 1.6f;
					val2.x *= 1.6f;
				}
				row.disc.anchorMin = DiscAnchor - val;
				row.disc.anchorMax = DiscAnchor + val;
				row.levelBox.anchorMin = DiscAnchor - val2 + TextNudge;
				row.levelBox.anchorMax = DiscAnchor + val2 + TextNudge;
				((TMP_Text)row.level).text = level.ToString();
			}
		}
	}
}