Decompiled source of SevenUI v1.10.1

plugins/SevenUI/SevenUI.dll

Decompiled 5 days ago
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Diagnostics;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using System.Text;
using System.Text.RegularExpressions;
using BepInEx;
using BepInEx.Bootstrap;
using BepInEx.Configuration;
using BepInEx.Logging;
using EntityStates;
using EntityStates.Bandit2.Weapon;
using HG;
using Microsoft.CodeAnalysis;
using RiskOfOptions;
using RiskOfOptions.Options;
using RoR2;
using RoR2.ContentManagement;
using RoR2.Items;
using RoR2.Skills;
using RoR2.UI;
using RoR2.UI.SkinControllers;
using TMPro;
using UnityEngine;
using UnityEngine.EventSystems;
using UnityEngine.Events;
using UnityEngine.Networking;
using UnityEngine.TextCore;
using UnityEngine.TextCore.LowLevel;
using UnityEngine.UI;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: InternalsVisibleTo("SevenUI.Tests")]
[assembly: IgnoresAccessChecksTo("RoR2")]
[assembly: IgnoresAccessChecksTo("Unity.TextMeshPro")]
[assembly: IgnoresAccessChecksTo("UnityEngine.TextCoreFontEngineModule")]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("SevenUI")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.10.1.0")]
[assembly: AssemblyInformationalVersion("1.10.1+c27382b292fd0d63ca7cb0c2c7e9338b3d89653b")]
[assembly: AssemblyProduct("SevenUI")]
[assembly: AssemblyTitle("SevenUI")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.10.1.0")]
[module: UnverifiableCode]
[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 SevenUI
{
	internal sealed class AllyCardsStyler : IStyler
	{
		private sealed class Kind
		{
			public AllyCardController Lead;

			public CharacterMaster Leader;

			public int Tier;

			public string Name;

			public readonly List<CharacterMaster> Members = new List<CharacterMaster>();

			public readonly List<AllyCardController> Cards = new List<AllyCardController>();

			public bool Indent;

			public bool Shared => Members.Count > 1;
		}

		private sealed class Section
		{
			public int Index;

			public Kind Player;

			public readonly List<Kind> Allies = new List<Kind>();

			public int Shown;

			public int HiddenAllies;

			public readonly List<AllyCardController> Overflow = new List<AllyCardController>();

			public AllyMoreRow Row;
		}

		private const int MaxLeaderDepth = 8;

		private const string TroughName = "BackgroundPanel";

		private const float ChatGap = 8.188332f;

		private const float SizeTolerance = 0.01f;

		private readonly HUD hud;

		private readonly Transform root;

		private readonly StyleRecorder recorder = new StyleRecorder();

		private readonly List<AllyCardController> cards = new List<AllyCardController>();

		private readonly List<Kind> kinds = new List<Kind>();

		private readonly Stack<Kind> spareKinds = new Stack<Kind>();

		private readonly List<Kind> unsorted = new List<Kind>();

		private readonly List<Section> pool = new List<Section>();

		private readonly List<Section> active = new List<Section>();

		private readonly List<(RectTransform Rect, float Y)> places = new List<(RectTransform, float)>();

		private readonly Dictionary<AllyCardController, AllyCompactCard> looks = new Dictionary<AllyCardController, AllyCompactCard>();

		private readonly Dictionary<AllyCardController, AllyKindParts> shared = new Dictionary<AllyCardController, AllyKindParts>();

		private readonly Dictionary<AllyCardController, (CharacterBody Body, int Upgrades, string Text)> tierNames = new Dictionary<AllyCardController, (CharacterBody, int, string)>();

		private readonly AllyNames names = new AllyNames();

		private readonly List<AllyCardController> goneCards = new List<AllyCardController>();

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

		private RectTransform container;

		private AllyCardManager cardManager;

		private RectTransform chat;

		private CanvasGroup hider;

		private float stretch;

		public bool Compact { get; private set; }

		public int HiddenCount { get; private set; }

		public bool Enabled => SevenUIPlugin.Settings.FlatPanels.Value;

		public AllyCardsStyler(HUD hud, Transform root)
		{
			this.hud = hud;
			this.root = root;
		}

		public void Apply()
		{
			//IL_008f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0099: Expected O, but got Unknown
			//IL_00a0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00aa: Expected O, but got Unknown
			//IL_00e0: Unknown result type (might be due to invalid IL or missing references)
			//IL_0179: Unknown result type (might be due to invalid IL or missing references)
			Transform val = root.Find("MainContainer/MainUIArea/SpringCanvas/LeftCluster");
			if (!Object.op_Implicit((Object)(object)val))
			{
				return;
			}
			((Component)val).GetComponentsInChildren<AllyCardController>(true, cards);
			cards.RemoveAll((AllyCardController card) => card is BaggedCardController);
			foreach (AllyCardController card in cards)
			{
				StyleCard(card);
			}
			Canvas.willRenderCanvases -= new WillRenderCanvases(Place);
			Canvas.willRenderCanvases += new WillRenderCanvases(Place);
			if (!Object.op_Implicit((Object)(object)container))
			{
				cardManager = ((Component)val).GetComponentInChildren<AllyCardManager>(true);
				container = ((!Object.op_Implicit((Object)(object)cardManager)) ? ((RectTransform)null) : ((RectTransform)((Component)cardManager).transform));
				stretch = 0f;
			}
			if (Object.op_Implicit((Object)(object)container) && !Object.op_Implicit((Object)(object)hider))
			{
				hider = ((Component)container).GetComponent<CanvasGroup>();
				if (!Object.op_Implicit((Object)(object)hider))
				{
					hider = ((Component)container).gameObject.AddComponent<CanvasGroup>();
				}
			}
			if (!Object.op_Implicit((Object)(object)chat))
			{
				ChatBox componentInChildren = ((Component)root).GetComponentInChildren<ChatBox>(true);
				chat = (RectTransform)((!Object.op_Implicit((Object)(object)componentInChildren)) ? null : (Object.op_Implicit((Object)(object)componentInChildren.standardChatboxRect) ? ((object)componentInChildren.standardChatboxRect) : ((object)(RectTransform)((Component)componentInChildren).transform)));
			}
		}

		public void Restore()
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Expected O, but got Unknown
			Canvas.willRenderCanvases -= new WillRenderCanvases(Place);
			places.Clear();
			foreach (AllyCardController key in tierNames.Keys)
			{
				CharacterBody val = ((Object.op_Implicit((Object)(object)key) && Object.op_Implicit((Object)(object)key.sourceMaster)) ? key.sourceMaster.GetBody() : null);
				if (Object.op_Implicit((Object)(object)val) && Object.op_Implicit((Object)(object)key.nameLabel))
				{
					((TMP_Text)key.nameLabel).text = Util.GetBestBodyName(((Component)val).gameObject);
				}
			}
			tierNames.Clear();
			foreach (KeyValuePair<AllyCardController, AllyKindParts> item in shared)
			{
				item.Value.Remove(item.Key);
			}
			shared.Clear();
			foreach (AllyCompactCard value in looks.Values)
			{
				value.Revert();
			}
			looks.Clear();
			foreach (Section item2 in pool)
			{
				item2.Row?.Destroy();
			}
			pool.Clear();
			active.Clear();
			kinds.Clear();
			Stretch(0f);
			if (Object.op_Implicit((Object)(object)hider))
			{
				hider.alpha = 1f;
				hider.blocksRaycasts = true;
			}
			cards.Clear();
			names.Clear();
			Compact = false;
			HiddenCount = 0;
			recorder.Restore();
		}

		public void Update()
		{
			bool flag = Object.op_Implicit((Object)(object)hud) && Object.op_Implicit((Object)(object)hud.scoreboardPanel) && hud.scoreboardPanel.activeSelf;
			if (Object.op_Implicit((Object)(object)hider) && hider.alpha != (flag ? 0f : 1f))
			{
				hider.alpha = (flag ? 0f : 1f);
				hider.blocksRaycasts = !flag;
			}
			cards.RemoveAll((AllyCardController card) => !Object.op_Implicit((Object)(object)card));
			ForgetGoneCards();
			if (!Object.op_Implicit((Object)(object)container) || cards.Count == 0)
			{
				foreach (Section item in pool)
				{
					item.Row?.Hide();
				}
				return;
			}
			SortIntoKinds();
			foreach (AllyCardController card in cards)
			{
				ShowTier(card);
			}
			float num = Room();
			float num2 = 0f;
			foreach (Kind kind2 in kinds)
			{
				num2 += LookOf(kind2.Lead).FullHeight;
			}
			bool value = SevenUIPlugin.Settings.CompactAllyCards.Value;
			bool compact = value && num2 > num + 0.01f;
			float num3 = 0f;
			foreach (Kind kind3 in kinds)
			{
				num3 += Height(kind3, compact);
			}
			FitSections(compact, num, value && num3 > num + 0.01f);
			float num4 = 0f;
			int num5 = 0;
			float num6 = 0f;
			places.Clear();
			foreach (Section item2 in active)
			{
				if (item2.Player != null)
				{
					ShowKind(item2.Player, compact, fits: true);
					num4 = Mathf.Max(num4, Height(item2.Player, compact));
					places.Add((item2.Player.Lead.rectTransform, 0f - num6));
					num6 += Height(item2.Player, compact);
				}
				item2.Overflow.Clear();
				int num7 = 0;
				bool flag2 = true;
				for (int num8 = 0; num8 < item2.Allies.Count; num8++)
				{
					Kind kind = item2.Allies[num8];
					bool flag3 = num8 < item2.Shown;
					ShowKind(kind, compact, flag3);
					if (flag3)
					{
						num4 = Mathf.Max(num4, Height(kind, compact));
						places.Add((kind.Lead.rectTransform, 0f - num6));
						num6 += Height(kind, compact);
					}
					else
					{
						num7 += Mathf.Max(1, kind.Members.Count);
						flag2 &= kind.Indent;
						item2.Overflow.Add(kind.Lead);
					}
				}
				item2.HiddenAllies = num7;
				num5 += num7;
				if (num7 > 0)
				{
					int paddingLeft = PaddingLeft(kinds[0].Lead);
					if (item2.Row == null || !item2.Row.Alive)
					{
						item2.Row = new AllyMoreRow(container, (TMP_Text)(object)cards[0].nameLabel, paddingLeft, item2.Index);
					}
					float indent = (flag2 ? GameIndent() : 0f);
					item2.Row.Show(num6, item2.Overflow, num7, paddingLeft, indent);
					num6 += 28.65916f;
				}
				else
				{
					item2.Row?.Hide();
				}
			}
			foreach (Section item3 in pool)
			{
				if (!active.Contains(item3))
				{
					item3.Row?.Hide();
				}
			}
			Compact = compact;
			HiddenCount = num5;
			Stretch((float)cards.Count * num4);
			Place();
		}

		private void FitSections(bool compact, float room, bool fold)
		{
			float num = 0f;
			int num2 = 0;
			int num3 = 0;
			Section section = null;
			foreach (Section item in active)
			{
				if (item.Player != null)
				{
					num += Height(item.Player, compact);
					num3 += ((item.Allies.Count > 0) ? 1 : 0);
				}
				else
				{
					section = item;
				}
				num2 += ((item.Allies.Count > 0) ? 1 : 0);
				item.Shown = ((!fold) ? item.Allies.Count : 0);
			}
			if (!fold || num + 28.65916f * (float)num2 > room + 0.01f)
			{
				return;
			}
			float num4 = 0f;
			if (section != null)
			{
				float limit = room - num - 28.65916f * (float)num3;
				num4 = Fill(section, compact, 0f, limit, 0);
			}
			float num5 = num + num4;
			int num6 = num3;
			foreach (Section item2 in active)
			{
				if (item2.Player != null)
				{
					num6 -= ((item2.Allies.Count > 0) ? 1 : 0);
					num5 += Fill(item2, compact, num5, room, num6);
				}
			}
		}

		private float Fill(Section section, bool compact, float used, float limit, int laterRows)
		{
			float num = used;
			float num2 = 28.65916f * (float)laterRows;
			while (section.Shown < section.Allies.Count)
			{
				float num3 = Height(section.Allies[section.Shown], compact);
				float num4 = ((section.Shown < section.Allies.Count - 1) ? 28.65916f : 0f);
				if (used + num3 + num4 + num2 > limit + 0.01f)
				{
					break;
				}
				used += num3;
				section.Shown++;
			}
			if (section.Shown < section.Allies.Count)
			{
				used += 28.65916f;
			}
			return used - num;
		}

		private static bool IsPlayer(Kind kind)
		{
			CharacterMaster sourceMaster = kind.Lead.sourceMaster;
			if (Object.op_Implicit((Object)(object)sourceMaster))
			{
				return Object.op_Implicit((Object)(object)sourceMaster.playerCharacterMasterController);
			}
			return false;
		}

		private float Height(Kind kind, bool compact)
		{
			if (!Compacts(kind, compact))
			{
				return LookOf(kind.Lead).FullHeight;
			}
			return 28.65916f;
		}

		private static bool Compacts(Kind kind, bool compact)
		{
			if (compact && !kind.Shared)
			{
				return !IsPlayer(kind);
			}
			return false;
		}

		private void Place()
		{
			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
			//IL_001e: Expected O, but got Unknown
			//IL_004a: 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_0050: Unknown result type (might be due to invalid IL or missing references)
			//IL_0065: 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)
			if (!Object.op_Implicit((Object)(object)root))
			{
				Canvas.willRenderCanvases -= new WillRenderCanvases(Place);
				return;
			}
			foreach (var (val, num) in places)
			{
				if (Object.op_Implicit((Object)(object)val))
				{
					Vector2 anchoredPosition = val.anchoredPosition;
					if (Mathf.Abs(anchoredPosition.y - num) > 0.01f)
					{
						val.anchoredPosition = new Vector2(anchoredPosition.x, num);
					}
				}
			}
		}

		private static int PaddingLeft(AllyCardController card)
		{
			HorizontalLayoutGroup val = (Object.op_Implicit((Object)(object)card) ? ((Component)card).GetComponent<HorizontalLayoutGroup>() : null);
			if (!Object.op_Implicit((Object)(object)val))
			{
				return 0;
			}
			return ((LayoutGroup)val).padding.left;
		}

		private float GameIndent()
		{
			if (!Object.op_Implicit((Object)(object)cardManager))
			{
				return 0f;
			}
			return cardManager.indentWidth;
		}

		private void SetIndent(AllyCardController card, bool indent)
		{
			if (card.shouldIndent != indent)
			{
				card.shouldIndent = indent;
				if (Object.op_Implicit((Object)(object)container))
				{
					LayoutRebuilder.MarkLayoutForRebuild(container);
				}
			}
		}

		private void ShowTier(AllyCardController card)
		{
			CharacterMaster sourceMaster = card.sourceMaster;
			if (!Object.op_Implicit((Object)(object)card.nameLabel) || !Object.op_Implicit((Object)(object)sourceMaster) || Object.op_Implicit((Object)(object)sourceMaster.playerCharacterMasterController))
			{
				return;
			}
			CharacterBody body = sourceMaster.GetBody();
			if (!DroneTier.HasTier(body))
			{
				return;
			}
			int tier;
			string text = NameOf(sourceMaster, out tier);
			if (text != null)
			{
				if (!tierNames.TryGetValue(card, out (CharacterBody, int, string) value) || (Object)(object)value.Item1 != (Object)(object)body || value.Item2 != tier)
				{
					value = (body, tier, DroneTier.Name(text, body.baseNameToken, tier));
					tierNames[card] = value;
				}
				if (((TMP_Text)card.nameLabel).text != value.Item3)
				{
					TierBadge.Attach((TMP_Text)(object)card.nameLabel);
					((TMP_Text)card.nameLabel).text = value.Item3;
				}
			}
		}

		private void ShowKind(Kind kind, bool compact, bool fits)
		{
			foreach (AllyCardController card in kind.Cards)
			{
				SetIndent(card, kind.Indent);
				AllyCompactCard allyCompactCard = LookOf(card);
				if ((Object)(object)card != (Object)(object)kind.Lead)
				{
					if (shared.TryGetValue(card, out var value))
					{
						value.Remove(card);
						shared.Remove(card);
					}
					allyCompactCard.Set(compact: false, hidden: true);
					continue;
				}
				AllyKindParts value2;
				bool flag = shared.TryGetValue(card, out value2);
				if (!kind.Shared && flag)
				{
					value2.Remove(card);
					shared.Remove(card);
				}
				allyCompactCard.Set(Compacts(kind, compact), !fits);
				if (!kind.Shared || !fits)
				{
					continue;
				}
				if (!flag)
				{
					value2 = AllyKindParts.Add(card);
					if (value2 == null)
					{
						continue;
					}
					shared.Add(card, value2);
				}
				value2.Update(card, kind.Members);
			}
		}

		private void SortIntoKinds()
		{
			foreach (Kind kind2 in kinds)
			{
				kind2.Lead = null;
				kind2.Leader = null;
				kind2.Indent = false;
				kind2.Tier = 0;
				kind2.Name = null;
				kind2.Members.Clear();
				kind2.Cards.Clear();
				spareKinds.Push(kind2);
			}
			kinds.Clear();
			bool value = SevenUIPlugin.Settings.GroupAllyCards.Value;
			foreach (AllyCardController card in cards)
			{
				CharacterMaster sourceMaster = card.sourceMaster;
				int tier = 0;
				string text = ((value && Object.op_Implicit((Object)(object)sourceMaster) && !Object.op_Implicit((Object)(object)sourceMaster.playerCharacterMasterController)) ? NameOf(sourceMaster, out tier) : null);
				CharacterMaster val = ((Object.op_Implicit((Object)(object)sourceMaster) && Object.op_Implicit((Object)(object)sourceMaster.minionOwnership)) ? sourceMaster.minionOwnership.ownerMaster : null);
				Kind kind = null;
				if (text != null)
				{
					foreach (Kind kind3 in kinds)
					{
						if (kind3.Name == text && kind3.Tier == tier && (Object)(object)kind3.Leader == (Object)(object)val)
						{
							kind = kind3;
							break;
						}
					}
				}
				if (kind == null)
				{
					kind = ((spareKinds.Count > 0) ? spareKinds.Pop() : new Kind());
					kind.Lead = card;
					kind.Leader = val;
					kind.Tier = tier;
					kind.Name = text;
					kinds.Add(kind);
				}
				kind.Cards.Add(card);
				if (IsAlive(sourceMaster))
				{
					kind.Members.Add(sourceMaster);
					if (!IsAlive(kind.Lead.sourceMaster))
					{
						kind.Lead = card;
					}
				}
			}
			foreach (Kind kind4 in kinds)
			{
				kind4.Indent = HasCard(kind4.Leader);
			}
			BuildSections();
		}

		private bool HasCard(CharacterMaster master)
		{
			if (!Object.op_Implicit((Object)(object)master))
			{
				return false;
			}
			foreach (AllyCardController card in cards)
			{
				if ((Object)(object)card.sourceMaster == (Object)(object)master)
				{
					return true;
				}
			}
			return false;
		}

		private void BuildSections()
		{
			unsorted.Clear();
			unsorted.AddRange(kinds);
			kinds.Clear();
			active.Clear();
			foreach (Section item in pool)
			{
				item.Player = null;
				item.Allies.Clear();
			}
			int num = 1;
			foreach (Kind item2 in unsorted)
			{
				if (IsPlayer(item2))
				{
					SectionAt(num++).Player = item2;
				}
			}
			SectionAt(0);
			foreach (Kind item3 in unsorted)
			{
				if (!IsPlayer(item3))
				{
					OwnerOf(item3, num).Allies.Add(item3);
				}
			}
			for (int i = 1; i <= num; i++)
			{
				Section section = pool[i % num];
				if (section.Player != null || section.Allies.Count != 0)
				{
					active.Add(section);
					if (section.Player != null)
					{
						kinds.Add(section.Player);
					}
					kinds.AddRange(section.Allies);
				}
			}
		}

		private Section OwnerOf(Kind kind, int playerSections)
		{
			CharacterMaster val = kind.Leader;
			int num = 0;
			while (Object.op_Implicit((Object)(object)val) && num < 8)
			{
				for (int i = 1; i < playerSections; i++)
				{
					if ((Object)(object)pool[i].Player.Lead.sourceMaster == (Object)(object)val)
					{
						return pool[i];
					}
				}
				val = (Object.op_Implicit((Object)(object)val.minionOwnership) ? val.minionOwnership.ownerMaster : null);
				num++;
			}
			return pool[0];
		}

		private Section SectionAt(int index)
		{
			while (pool.Count <= index)
			{
				pool.Add(new Section
				{
					Index = pool.Count
				});
			}
			return pool[index];
		}

		private static bool IsAlive(CharacterMaster master)
		{
			if (!Object.op_Implicit((Object)(object)master))
			{
				return false;
			}
			CharacterBody body = master.GetBody();
			if (Object.op_Implicit((Object)(object)body) && Object.op_Implicit((Object)(object)body.healthComponent))
			{
				return body.healthComponent.alive;
			}
			return false;
		}

		private string NameOf(CharacterMaster master, out int tier)
		{
			return names.NameOf(master, cards.Count, out tier);
		}

		private float Room()
		{
			//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_0048: Unknown result type (might be due to invalid IL or missing references)
			//IL_004d: Unknown result type (might be due to invalid IL or missing references)
			//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)
			Rect rect = container.rect;
			float num = ((Rect)(ref rect)).height - stretch;
			if (!Object.op_Implicit((Object)(object)chat))
			{
				return num;
			}
			chat.GetWorldCorners(corners);
			float y = ((Transform)container).InverseTransformPoint(corners[1]).y;
			rect = container.rect;
			return Mathf.Min(num, ((Rect)(ref rect)).yMax - y - 8.188332f);
		}

		private void Stretch(float needed)
		{
			//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_0053: Unknown result type (might be due to invalid IL or missing references)
			//IL_0065: 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)
			if (Object.op_Implicit((Object)(object)container))
			{
				Rect rect = container.rect;
				float num = ((Rect)(ref rect)).height - stretch;
				float num2 = Mathf.Max(0f, needed - num);
				if (!(Mathf.Abs(num2 - stretch) < 0.01f))
				{
					RectTransform obj = container;
					obj.offsetMin -= new Vector2(0f, num2 - stretch);
					stretch = num2;
				}
			}
		}

		private AllyCompactCard LookOf(AllyCardController card)
		{
			if (!looks.TryGetValue(card, out var value))
			{
				value = new AllyCompactCard(card);
				looks.Add(card, value);
			}
			return value;
		}

		private void ForgetGoneCards()
		{
			foreach (AllyCardController key in looks.Keys)
			{
				if (!Object.op_Implicit((Object)(object)key))
				{
					goneCards.Add(key);
				}
			}
			foreach (AllyCardController key2 in shared.Keys)
			{
				if (!Object.op_Implicit((Object)(object)key2))
				{
					goneCards.Add(key2);
				}
			}
			foreach (AllyCardController key3 in tierNames.Keys)
			{
				if (!Object.op_Implicit((Object)(object)key3))
				{
					goneCards.Add(key3);
				}
			}
			foreach (AllyCardController goneCard in goneCards)
			{
				looks.Remove(goneCard);
				shared.Remove(goneCard);
				tierNames.Remove(goneCard);
			}
			goneCards.Clear();
		}

		private void StyleCard(AllyCardController card)
		{
			//IL_002a: 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)
			Image component = ((Component)card).GetComponent<Image>();
			if (Object.op_Implicit((Object)(object)component))
			{
				recorder.Record(component);
				component.sprite = null;
				component.type = (Type)0;
				((Graphic)component).color = Palette.Panel;
			}
			if (Object.op_Implicit((Object)(object)card.healthBar))
			{
				FlatHealthStyles.Apply(card.healthBar, recorder);
				Transform val = ((Component)card.healthBar).transform.Find("BackgroundPanel");
				Image val2 = (Object.op_Implicit((Object)(object)val) ? ((Component)val).GetComponent<Image>() : null);
				if (Object.op_Implicit((Object)(object)val2))
				{
					recorder.Record(val2);
					val2.sprite = null;
					val2.type = (Type)0;
					((Graphic)val2).color = Palette.Trough;
				}
			}
		}

		public void Describe(StringBuilder output)
		{
			output.AppendLine($"  restyled ally card values: {recorder.Count}");
			StringBuilder stringBuilder = new StringBuilder();
			foreach (Section item in active)
			{
				if (item.HiddenAllies != 0)
				{
					CharacterBody val = ((item.Player != null && Object.op_Implicit((Object)(object)item.Player.Lead.sourceMaster)) ? item.Player.Lead.sourceMaster.GetBody() : null);
					stringBuilder.Append(string.Format(" [{0}: {1} allies in ", Object.op_Implicit((Object)(object)val) ? val.GetUserName() : "viewer's own", item.HiddenAllies) + $"{item.Allies.Count - item.Shown} of {item.Allies.Count} kinds folded]");
				}
			}
			output.AppendLine($"  ally cards: {cards.Count} in {kinds.Count} kinds, {shared.Count} shared, " + string.Format("{0}, allies under the more row: {1}, ", Compact ? "single allies compact" : "full size", HiddenCount) + string.Format("room above the chat: {0}, container stretched {1:0.#}", Object.op_Implicit((Object)(object)container) ? Room().ToString("0.#") : "none", stretch));
			output.AppendLine(string.Format("  ally sections: {0} (players, then the viewer's own allies), folded:{1}", active.Count, (stringBuilder.Length > 0) ? stringBuilder.ToString() : " none"));
		}
	}
	internal sealed class AllyCompactCard
	{
		private const float Canvas = 1.0235415f;

		public const float RowHeight = 28.65916f;

		private const float NameSize = 15.353122f;

		private const float NameLeft = 6.1412487f;

		private const float BarGap = 8.188332f;

		private const float BarRight = 8.188332f;

		private const float BarHeight = 5.1177073f;

		private const float NameShare = 0.58f;

		private const float BarsFlexibleWidth = 1f;

		public readonly AllyCardController Card;

		public readonly float FullHeight;

		private readonly LayoutElement portraitLayout;

		private readonly float portraitWidth;

		private readonly RectTransform[] badges;

		private readonly Vector2[] badgePositions;

		private readonly Vector3[] badgeScales;

		private readonly RectTransform bars;

		private readonly VerticalLayoutGroup barsLayout;

		private readonly float barsHeight;

		private readonly HorizontalLayoutGroup row;

		private readonly TextAnchor rowAlignment;

		private readonly bool rowExpandsWidth;

		private LayoutElement barsElement;

		private float barsFlexibleWidth;

		private readonly float paddingY;

		private readonly float nameMaxSize;

		private readonly float nameMinSize;

		private readonly TextAlignmentOptions nameAlignment;

		private readonly TextOverflowModes nameOverflow;

		public bool Compact { get; private set; }

		public bool Hidden { get; private set; }

		private bool CanCompact
		{
			get
			{
				if (Object.op_Implicit((Object)(object)portraitLayout) && Object.op_Implicit((Object)(object)bars) && Object.op_Implicit((Object)(object)barsLayout) && Object.op_Implicit((Object)(object)Card.nameLabel))
				{
					return Object.op_Implicit((Object)(object)Card.healthBar);
				}
				return false;
			}
		}

		public AllyCompactCard(AllyCardController card)
		{
			//IL_0055: Unknown result type (might be due to invalid IL or missing references)
			//IL_005a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0203: Unknown result type (might be due to invalid IL or missing references)
			//IL_016a: Unknown result type (might be due to invalid IL or missing references)
			//IL_016f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0183: Unknown result type (might be due to invalid IL or missing references)
			//IL_0188: 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_024d: 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_025e: Unknown result type (might be due to invalid IL or missing references)
			Card = card;
			FullHeight = (Object.op_Implicit((Object)(object)card.layoutElement) ? card.layoutElement.preferredHeight : 0f);
			row = ((Component)card).GetComponent<HorizontalLayoutGroup>();
			rowAlignment = (TextAnchor)(Object.op_Implicit((Object)(object)row) ? ((int)((LayoutGroup)row).childAlignment) : 0);
			rowExpandsWidth = Object.op_Implicit((Object)(object)row) && ((HorizontalOrVerticalLayoutGroup)row).childForceExpandWidth;
			paddingY = (Object.op_Implicit((Object)(object)row) ? ((float)((LayoutGroup)row).padding.vertical) : 0f);
			if (Object.op_Implicit((Object)(object)card.portraitIconImage))
			{
				portraitLayout = ((Component)card.portraitIconImage).GetComponent<LayoutElement>();
				portraitWidth = (Object.op_Implicit((Object)(object)portraitLayout) ? portraitLayout.preferredWidth : 0f);
				Transform transform = ((Component)card.portraitIconImage).transform;
				badges = (RectTransform[])(object)new RectTransform[transform.childCount];
				badgePositions = (Vector2[])(object)new Vector2[badges.Length];
				badgeScales = (Vector3[])(object)new Vector3[badges.Length];
				for (int i = 0; i < badges.Length; i++)
				{
					ref RectTransform reference = ref badges[i];
					Transform child = transform.GetChild(i);
					reference = (RectTransform)(object)((child is RectTransform) ? child : null);
					if (Object.op_Implicit((Object)(object)badges[i]))
					{
						badgePositions[i] = badges[i].anchoredPosition;
						badgeScales[i] = ((Transform)badges[i]).localScale;
					}
				}
			}
			bars = (RectTransform)(Object.op_Implicit((Object)(object)card.nameLabel) ? /*isinst with value type is only supported in some contexts*/: null);
			barsLayout = (Object.op_Implicit((Object)(object)bars) ? ((Component)bars).GetComponent<VerticalLayoutGroup>() : null);
			barsHeight = (Object.op_Implicit((Object)(object)bars) ? bars.sizeDelta.y : 0f);
			if (Object.op_Implicit((Object)(object)card.nameLabel))
			{
				nameMaxSize = ((TMP_Text)card.nameLabel).fontSizeMax;
				nameMinSize = ((TMP_Text)card.nameLabel).fontSizeMin;
				nameAlignment = ((TMP_Text)card.nameLabel).alignment;
				nameOverflow = ((TMP_Text)card.nameLabel).overflowMode;
			}
		}

		public void Set(bool compact, bool hidden)
		{
			if (!Object.op_Implicit((Object)(object)Card))
			{
				return;
			}
			if (compact != Compact && CanCompact)
			{
				Compact = compact;
				if (compact)
				{
					ApplyCompact();
				}
				else
				{
					RevertCompact();
				}
			}
			Hidden = hidden;
			float num = (hidden ? 0f : (Compact ? 28.65916f : FullHeight));
			if (Object.op_Implicit((Object)(object)Card.layoutElement) && Card.layoutElement.preferredHeight != num)
			{
				Card.layoutElement.preferredHeight = num;
			}
			if (((Component)Card).gameObject.activeSelf == hidden)
			{
				((Component)Card).gameObject.SetActive(!hidden);
			}
		}

		public void Revert()
		{
			Set(compact: false, hidden: false);
		}

		private void ApplyCompact()
		{
			//IL_0058: 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_0077: Unknown result type (might be due to invalid IL or missing references)
			//IL_007d: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bb: 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)
			//IL_013d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0180: Unknown result type (might be due to invalid IL or missing references)
			//IL_0195: Unknown result type (might be due to invalid IL or missing references)
			//IL_01aa: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b4: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ce: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d3: Unknown result type (might be due to invalid IL or missing references)
			//IL_01de: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e8: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f3: Unknown result type (might be due to invalid IL or missing references)
			//IL_01fd: Unknown result type (might be due to invalid IL or missing references)
			//IL_0208: Unknown result type (might be due to invalid IL or missing references)
			//IL_021c: Unknown result type (might be due to invalid IL or missing references)
			float num = 28.65916f - paddingY;
			portraitLayout.preferredWidth = num;
			float num2 = ((portraitWidth > 0f) ? (num / portraitWidth) : 1f);
			for (int i = 0; i < badges.Length; i++)
			{
				if (Object.op_Implicit((Object)(object)badges[i]))
				{
					badges[i].anchoredPosition = badgePositions[i] * num2;
					((Transform)badges[i]).localScale = badgeScales[i] * num2;
				}
			}
			((Behaviour)barsLayout).enabled = false;
			if (Object.op_Implicit((Object)(object)row))
			{
				((LayoutGroup)row).childAlignment = LeftOf(rowAlignment);
				((HorizontalOrVerticalLayoutGroup)row).childForceExpandWidth = false;
			}
			barsElement = ((Component)bars).GetComponent<LayoutElement>();
			if (!Object.op_Implicit((Object)(object)barsElement))
			{
				barsElement = ((Component)bars).gameObject.AddComponent<LayoutElement>();
			}
			barsFlexibleWidth = barsElement.flexibleWidth;
			barsElement.flexibleWidth = 1f;
			bars.sizeDelta = new Vector2(bars.sizeDelta.x, num);
			TextMeshProUGUI nameLabel = Card.nameLabel;
			((TMP_Text)nameLabel).fontSizeMax = 15.353122f;
			((TMP_Text)nameLabel).fontSizeMin = 15.353122f;
			((TMP_Text)nameLabel).alignment = (TextAlignmentOptions)4097;
			((TMP_Text)nameLabel).overflowMode = (TextOverflowModes)1;
			RectTransform rectTransform = ((TMP_Text)nameLabel).rectTransform;
			rectTransform.anchorMin = Vector2.zero;
			rectTransform.anchorMax = new Vector2(0.58f, 1f);
			rectTransform.offsetMin = new Vector2(6.1412487f, 0f);
			rectTransform.offsetMax = Vector2.zero;
			RectTransform val = (RectTransform)((Component)Card.healthBar).transform;
			val.anchorMin = new Vector2(0.58f, 0.5f);
			val.anchorMax = new Vector2(1f, 0.5f);
			val.offsetMin = new Vector2(8.188332f, -2.5588536f);
			val.offsetMax = new Vector2(-8.188332f, 2.5588536f);
			FlatHealthStyles.SetCompact(Card.healthBar, compact: true);
			LayoutRebuilder.MarkLayoutForRebuild(Card.rectTransform);
		}

		private void RevertCompact()
		{
			//IL_0071: 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_00b0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bb: Unknown result type (might be due to invalid IL or missing references)
			//IL_0033: 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_011b: Unknown result type (might be due to invalid IL or missing references)
			portraitLayout.preferredWidth = portraitWidth;
			for (int i = 0; i < badges.Length; i++)
			{
				if (Object.op_Implicit((Object)(object)badges[i]))
				{
					badges[i].anchoredPosition = badgePositions[i];
					((Transform)badges[i]).localScale = badgeScales[i];
				}
			}
			bars.sizeDelta = new Vector2(bars.sizeDelta.x, barsHeight);
			TextMeshProUGUI nameLabel = Card.nameLabel;
			((TMP_Text)nameLabel).fontSizeMax = nameMaxSize;
			((TMP_Text)nameLabel).fontSizeMin = nameMinSize;
			((TMP_Text)nameLabel).alignment = nameAlignment;
			((TMP_Text)nameLabel).overflowMode = nameOverflow;
			((Behaviour)barsLayout).enabled = true;
			if (Object.op_Implicit((Object)(object)barsElement))
			{
				barsElement.flexibleWidth = barsFlexibleWidth;
			}
			barsElement = null;
			FlatHealthStyles.SetCompact(Card.healthBar, compact: false);
			if (Object.op_Implicit((Object)(object)row))
			{
				((LayoutGroup)row).childAlignment = rowAlignment;
				((HorizontalOrVerticalLayoutGroup)row).childForceExpandWidth = rowExpandsWidth;
			}
			LayoutRebuilder.MarkLayoutForRebuild(Card.rectTransform);
		}

		private static TextAnchor LeftOf(TextAnchor anchor)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0028: Expected I4, but got Unknown
			//IL_0030: Unknown result type (might be due to invalid IL or missing references)
			switch (anchor - 1)
			{
			case 0:
			case 1:
				return (TextAnchor)0;
			case 3:
			case 4:
				return (TextAnchor)3;
			case 6:
			case 7:
				return (TextAnchor)6;
			default:
				return anchor;
			}
		}
	}
	internal sealed class AllyKindParts
	{
		public const string SegmentsName = "SevenUIAllySegments";

		public const string CountName = "SevenUIAllyCount";

		private const float Canvas = 1.0235415f;

		private const float SegmentGap = 2.047083f;

		private const float CountGap = 6.1412487f;

		private const float LowHealthShare = 0.25f;

		private readonly TMP_Text count;

		private readonly RectTransform segments;

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

		private readonly List<GameObject> slots = new List<GameObject>();

		private int shownCount = -1;

		private string shownName;

		private float[] shown = new float[0];

		private float[] spanLefts = new float[0];

		private float[] spanWidths = new float[0];

		private float placedLeft = float.NaN;

		private float placedRight = float.NaN;

		private int placedCount = -1;

		private AllyKindParts(TMP_Text count, RectTransform segments)
		{
			this.count = count;
			this.segments = segments;
		}

		public static AllyKindParts Add(AllyCardController card)
		{
			//IL_0044: 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_005d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0078: Unknown result type (might be due to invalid IL or missing references)
			//IL_007d: 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_00d7: Unknown result type (might be due to invalid IL or missing references)
			//IL_0152: Unknown result type (might be due to invalid IL or missing references)
			//IL_0157: Unknown result type (might be due to invalid IL or missing references)
			//IL_015c: Unknown result type (might be due to invalid IL or missing references)
			if (!Object.op_Implicit((Object)(object)card.nameLabel) || !Object.op_Implicit((Object)(object)card.healthBar))
			{
				return null;
			}
			RectTransform obj = UiFactory.NewObject("SevenUIAllyCount", ((TMP_Text)card.nameLabel).transform);
			Vector2 val = default(Vector2);
			((Vector2)(ref val))..ctor(0f, 0.5f);
			obj.anchorMax = val;
			obj.anchorMin = val;
			obj.pivot = new Vector2(0f, 0.5f);
			Rect rect = ((TMP_Text)card.nameLabel).rectTransform.rect;
			obj.sizeDelta = new Vector2(0f, ((Rect)(ref rect)).height);
			TextMeshProUGUI val2 = ((Component)obj).gameObject.AddComponent<TextMeshProUGUI>();
			((TMP_Text)val2).font = ((TMP_Text)card.nameLabel).font;
			((TMP_Text)val2).fontSharedMaterial = ((TMP_Text)card.nameLabel).fontSharedMaterial;
			((TMP_Text)val2).fontSize = ((TMP_Text)card.nameLabel).fontSize;
			((TMP_Text)val2).fontStyle = (FontStyles)1;
			((Graphic)val2).color = Palette.Accent;
			((TMP_Text)val2).alignment = (TextAlignmentOptions)4097;
			((TMP_Text)val2).enableWordWrapping = false;
			((TMP_Text)val2).overflowMode = (TextOverflowModes)0;
			((Graphic)val2).raycastTarget = false;
			((Component)obj).gameObject.AddComponent<CondensedText>();
			Transform transform = ((Component)card.healthBar).transform;
			RectTransform val3 = UiFactory.NewObject("SevenUIAllySegments", transform.parent);
			((Transform)val3).SetSiblingIndex(transform.GetSiblingIndex() + 1);
			LayoutElement component = ((Component)transform).GetComponent<LayoutElement>();
			LayoutElement obj2 = ((Component)val3).gameObject.AddComponent<LayoutElement>();
			float preferredHeight;
			if (!Object.op_Implicit((Object)(object)component))
			{
				rect = ((RectTransform)transform).rect;
				preferredHeight = ((Rect)(ref rect)).height;
			}
			else
			{
				preferredHeight = component.preferredHeight;
			}
			obj2.preferredHeight = preferredHeight;
			((Component)transform).gameObject.SetActive(false);
			return new AllyKindParts((TMP_Text)(object)val2, val3);
		}

		public void Update(AllyCardController card, List<CharacterMaster> members)
		{
			//IL_00b6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d8: Unknown result type (might be due to invalid IL or missing references)
			//IL_0186: 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_01a6: Unknown result type (might be due to invalid IL or missing references)
			Image val = (Object.op_Implicit((Object)(object)card.healthBar) ? card.healthBar.deadImage : null);
			if (Object.op_Implicit((Object)(object)val) && ((Behaviour)val).enabled)
			{
				((Behaviour)val).enabled = false;
			}
			int num = members.Count;
			string text = (Object.op_Implicit((Object)(object)card.nameLabel) ? ((TMP_Text)card.nameLabel).text : "");
			if (num != shownCount || text != shownName)
			{
				shownCount = num;
				shownName = text;
				count.text = "×" + num;
				float num2 = (Object.op_Implicit((Object)(object)card.nameLabel) ? ((TMP_Text)card.nameLabel).GetPreferredValues(text).x : 0f);
				count.rectTransform.anchoredPosition = new Vector2(num2 + 6.1412487f, 0f);
				SetSegmentCount(num);
			}
			PlaceSegments(num);
			for (int i = 0; i < num; i++)
			{
				CharacterBody val2 = (Object.op_Implicit((Object)(object)members[i]) ? members[i].GetBody() : null);
				float num3 = ((Object.op_Implicit((Object)(object)val2) && Object.op_Implicit((Object)(object)val2.healthComponent)) ? Mathf.Clamp01(val2.healthComponent.combinedHealthFraction) : 0f);
				if (!(Mathf.Abs(num3 - shown[i]) < 0.001f))
				{
					shown[i] = num3;
					((Graphic)fills[i]).rectTransform.anchorMax = new Vector2(num3, 1f);
					((Graphic)fills[i]).color = ((num3 < 0.25f) ? Palette.LowHealth : Palette.Health);
				}
			}
		}

		public void Remove(AllyCardController card)
		{
			if (Object.op_Implicit((Object)(object)count))
			{
				Object.Destroy((Object)(object)((Component)count).gameObject);
			}
			if (Object.op_Implicit((Object)(object)segments))
			{
				Object.Destroy((Object)(object)((Component)segments).gameObject);
			}
			if (Object.op_Implicit((Object)(object)card) && Object.op_Implicit((Object)(object)card.healthBar))
			{
				((Component)card.healthBar).gameObject.SetActive(true);
				HealthBar healthBar = card.healthBar;
				if (Object.op_Implicit((Object)(object)healthBar.deadImage) && !Object.op_Implicit((Object)(object)healthBar.altSource))
				{
					CharacterBody val = (Object.op_Implicit((Object)(object)card.sourceMaster) ? card.sourceMaster.GetBody() : null);
					((Behaviour)healthBar.deadImage).enabled = !Object.op_Implicit((Object)(object)val) || !Object.op_Implicit((Object)(object)val.healthComponent) || !val.healthComponent.alive;
				}
			}
		}

		private void PlaceSegments(int allies)
		{
			//IL_00c5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ca: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d8: 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)
			if (!Object.op_Implicit((Object)(object)segments))
			{
				return;
			}
			Camera eye = PixelSpans.Eye((Component)(object)segments);
			if (!PixelSpans.ScreenEdges(segments, eye, out var left, out var right))
			{
				return;
			}
			left = Mathf.Round(left);
			right = Mathf.Round(right);
			if (allies == placedCount && left == placedLeft && right == placedRight)
			{
				return;
			}
			if (spanLefts.Length < allies)
			{
				spanLefts = new float[allies];
				spanWidths = new float[allies];
			}
			if (PixelSpans.Split(segments, eye, 2.047083f, spanLefts, spanWidths, allies))
			{
				placedCount = allies;
				placedLeft = left;
				placedRight = right;
				for (int i = 0; i < allies; i++)
				{
					RectTransform val = (RectTransform)slots[i].transform;
					val.anchoredPosition = new Vector2(spanLefts[i], 0f);
					val.sizeDelta = new Vector2(spanWidths[i], 0f);
				}
			}
		}

		private void SetSegmentCount(int allies)
		{
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			//IL_0033: Unknown result type (might be due to invalid IL or missing references)
			//IL_003e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0053: 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_0074: 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_0085: 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_008c: 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)
			while (slots.Count < allies)
			{
				RectTransform val = UiFactory.NewObject("Segment", (Transform)(object)segments);
				Image obj = ((Component)val).gameObject.AddComponent<Image>();
				((Graphic)obj).color = Palette.Trough;
				((Graphic)obj).raycastTarget = false;
				val.anchorMin = Vector2.zero;
				val.anchorMax = Vector2.up;
				val.pivot = new Vector2(0f, 0.5f);
				RectTransform obj2 = UiFactory.NewObject("Fill", (Transform)(object)val);
				obj2.anchorMin = Vector2.zero;
				obj2.anchorMax = Vector2.one;
				Vector2 offsetMin = (obj2.offsetMax = Vector2.zero);
				obj2.offsetMin = offsetMin;
				Image val2 = ((Component)obj2).gameObject.AddComponent<Image>();
				((Graphic)val2).color = Palette.Health;
				((Graphic)val2).raycastTarget = false;
				slots.Add(((Component)val).gameObject);
				fills.Add(val2);
			}
			for (int i = 0; i < slots.Count; i++)
			{
				bool flag = i < allies;
				if (slots[i].activeSelf != flag)
				{
					slots[i].SetActive(flag);
				}
			}
			shown = new float[allies];
			for (int j = 0; j < allies; j++)
			{
				shown[j] = -1f;
			}
		}
	}
	internal sealed class AllyMoreRow
	{
		public const string Name = "SevenUIAllyMore";

		public const string IconName = "Kind";

		private const float Canvas = 1.0235415f;

		private const float IconSize = 22.517912f;

		private const float IconGap = 4.094166f;

		private const int PaddingRight = 8;

		private const float FontSize = 15.353122f;

		public const int MaxIcons = 5;

		private readonly RectTransform rect;

		private readonly HorizontalLayoutGroup layout;

		private readonly TextMeshProUGUI label;

		private readonly List<RawImage> icons = new List<RawImage>();

		private readonly List<Texture> kinds = new List<Texture>();

		private int shownCount = -1;

		public bool Alive => Object.op_Implicit((Object)(object)rect);

		public AllyMoreRow(RectTransform container, TMP_Text style, int paddingLeft, int index)
		{
			//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_007a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0094: 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_00e8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f2: Expected O, but got Unknown
			//IL_0236: Unknown result type (might be due to invalid IL or missing references)
			rect = UiFactory.NewObject("SevenUIAllyMore" + index, (Transform)(object)container);
			rect.anchorMin = new Vector2(0f, 1f);
			rect.anchorMax = Vector2.one;
			rect.pivot = new Vector2(0f, 1f);
			rect.sizeDelta = new Vector2(0f, 28.65916f);
			Image obj = ((Component)rect).gameObject.AddComponent<Image>();
			((Graphic)obj).color = Palette.Panel;
			((Graphic)obj).raycastTarget = false;
			layout = ((Component)rect).gameObject.AddComponent<HorizontalLayoutGroup>();
			((LayoutGroup)layout).padding = new RectOffset(paddingLeft, Mathf.RoundToInt(8.188332f), 0, 0);
			((HorizontalOrVerticalLayoutGroup)layout).spacing = 4.094166f;
			((LayoutGroup)layout).childAlignment = (TextAnchor)3;
			((HorizontalOrVerticalLayoutGroup)layout).childControlWidth = (((HorizontalOrVerticalLayoutGroup)layout).childControlHeight = true);
			((HorizontalOrVerticalLayoutGroup)layout).childForceExpandWidth = (((HorizontalOrVerticalLayoutGroup)layout).childForceExpandHeight = false);
			for (int i = 0; i < 5; i++)
			{
				RectTransform obj2 = UiFactory.NewObject("Kind", (Transform)(object)rect);
				RawImage val = ((Component)obj2).gameObject.AddComponent<RawImage>();
				((Graphic)val).raycastTarget = false;
				LayoutElement obj3 = ((Component)obj2).gameObject.AddComponent<LayoutElement>();
				float preferredWidth = (obj3.preferredHeight = 22.517912f);
				obj3.preferredWidth = preferredWidth;
				((Component)obj2).gameObject.SetActive(false);
				icons.Add(val);
			}
			((Component)UiFactory.NewObject("Space", (Transform)(object)rect)).gameObject.AddComponent<LayoutElement>().flexibleWidth = 1f;
			label = ((Component)UiFactory.NewObject("Count", (Transform)(object)rect)).gameObject.AddComponent<TextMeshProUGUI>();
			if (Object.op_Implicit((Object)(object)style))
			{
				((TMP_Text)label).font = style.font;
				((TMP_Text)label).fontSharedMaterial = style.fontSharedMaterial;
			}
			((TMP_Text)label).fontSize = 15.353122f;
			((TMP_Text)label).fontStyle = (FontStyles)1;
			((Graphic)label).color = Palette.HeaderText;
			((TMP_Text)label).alignment = (TextAlignmentOptions)4100;
			((TMP_Text)label).enableWordWrapping = false;
			((TMP_Text)label).overflowMode = (TextOverflowModes)0;
			((Graphic)label).raycastTarget = false;
		}

		public void Show(float top, List<AllyCardController> hidden, int allies, int paddingLeft, float indent)
		{
			//IL_0061: 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: Expected O, but got Unknown
			//IL_0097: Unknown result type (might be due to invalid IL or missing references)
			//IL_007b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0087: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ca: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d4: 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_00ab: Unknown result type (might be due to invalid IL or missing references)
			if (!((Component)rect).gameObject.activeSelf)
			{
				((Component)rect).gameObject.SetActive(true);
			}
			if (((LayoutGroup)layout).padding.left != paddingLeft)
			{
				((LayoutGroup)layout).padding = new RectOffset(paddingLeft, ((LayoutGroup)layout).padding.right, 0, 0);
			}
			if (rect.anchoredPosition.y != 0f - top)
			{
				rect.anchoredPosition = new Vector2(rect.anchoredPosition.x, 0f - top);
			}
			if (rect.offsetMin.x != indent || rect.offsetMax.x != 0f)
			{
				rect.offsetMin = new Vector2(indent, rect.offsetMin.y);
				rect.offsetMax = new Vector2(0f, rect.offsetMax.y);
			}
			if (allies != shownCount)
			{
				shownCount = allies;
				((TMP_Text)label).text = "+" + allies + " more";
			}
			kinds.Clear();
			for (int i = 0; i < hidden.Count; i++)
			{
				if (kinds.Count >= 5)
				{
					break;
				}
				CharacterMaster val = (Object.op_Implicit((Object)(object)hidden[i]) ? hidden[i].sourceMaster : null);
				CharacterBody val2 = (Object.op_Implicit((Object)(object)val) ? val.GetBody() : null);
				Texture val3 = (Object.op_Implicit((Object)(object)val2) ? val2.portraitIcon : null);
				if (Object.op_Implicit((Object)(object)val3) && !kinds.Contains(val3))
				{
					kinds.Add(val3);
				}
			}
			for (int j = 0; j < icons.Count; j++)
			{
				Texture val4 = ((j < kinds.Count) ? kinds[j] : null);
				if ((Object)(object)icons[j].texture != (Object)(object)val4)
				{
					icons[j].texture = val4;
				}
				bool flag = Object.op_Implicit((Object)(object)val4);
				if (((Component)icons[j]).gameObject.activeSelf != flag)
				{
					((Component)icons[j]).gameObject.SetActive(flag);
				}
			}
		}

		public void Hide()
		{
			if (Object.op_Implicit((Object)(object)rect) && ((Component)rect).gameObject.activeSelf)
			{
				((Component)rect).gameObject.SetActive(false);
			}
		}

		public void Destroy()
		{
			if (Object.op_Implicit((Object)(object)rect))
			{
				Object.Destroy((Object)(object)((Component)rect).gameObject);
			}
		}
	}
	internal sealed class AllyNames
	{
		private readonly Dictionary<CharacterMaster, (CharacterBody Body, int Tier, string Name)> names = new Dictionary<CharacterMaster, (CharacterBody, int, string)>();

		private readonly List<CharacterMaster> goneMasters = new List<CharacterMaster>();

		public string NameOf(CharacterMaster master, int expected, out int tier)
		{
			tier = 0;
			CharacterBody body = master.GetBody();
			names.TryGetValue(master, out (CharacterBody, int, string) value);
			if (!Object.op_Implicit((Object)(object)body))
			{
				if (!master.lostBodyToDeath || value.Item3 == null)
				{
					return null;
				}
				tier = value.Item2;
				return value.Item3;
			}
			tier = (Object.op_Implicit((Object)(object)body.inventory) ? body.inventory.GetItemCountEffective(Items.DroneUpgradeHidden) : 0);
			if (value.Item3 != null && (Object)(object)value.Item1 == (Object)(object)body && value.Item2 == tier)
			{
				return value.Item3;
			}
			string bestBodyName = Util.GetBestBodyName(((Component)body).gameObject);
			names[master] = (body, tier, bestBodyName);
			if (names.Count > expected * 2)
			{
				ForgetGoneMasters();
			}
			return bestBodyName;
		}

		public void Clear()
		{
			names.Clear();
		}

		private void ForgetGoneMasters()
		{
			foreach (CharacterMaster key in names.Keys)
			{
				if (!Object.op_Implicit((Object)(object)key))
				{
					goneMasters.Add(key);
				}
			}
			foreach (CharacterMaster goneMaster in goneMasters)
			{
				names.Remove(goneMaster);
			}
			goneMasters.Clear();
		}
	}
	internal sealed class ArtifactRow
	{
		public const string RowName = "SevenUIArtifacts";

		public const string IconsName = "Icons";

		public const string LabelName = "Label";

		private const string ArtifactsToken = "RULE_HEADER_ARTIFACTS";

		private const float Canvas = 0.64705884f;

		public const float Height = 14.235294f;

		private const float IconGap = 1.2941177f;

		private const float LabelGap = 6.4705887f;

		public readonly RectTransform Root;

		private readonly RectTransform icons;

		private readonly TMP_Text label;

		private readonly RectTransform container;

		private readonly GridLayoutGroup grid;

		private int shownCount = -1;

		private float shownWidth = -1f;

		private TMP_FontAsset shownFont;

		public bool Alive
		{
			get
			{
				if (Object.op_Implicit((Object)(object)Root) && Object.op_Implicit((Object)(object)container))
				{
					return Object.op_Implicit((Object)(object)grid);
				}
				return false;
			}
		}

		public int Count
		{
			get
			{
				if (!Alive || !((Component)container).gameObject.activeSelf)
				{
					return 0;
				}
				return ((Transform)container).childCount;
			}
		}

		public float IconSize
		{
			get
			{
				//IL_0019: Unknown result type (might be due to invalid IL or missing references)
				if (!Object.op_Implicit((Object)(object)grid))
				{
					return 0f;
				}
				return grid.cellSize.x;
			}
		}

		public ArtifactRow(RectTransform bar, ArtifactDisplayPanelController panel, TMP_Text fontFrom, float inset, float labelSize, StyleRecorder recorder)
		{
			//IL_0039: 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_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0084: 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_00e4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fe: Unknown result type (might be due to invalid IL or missing references)
			//IL_0118: Unknown result type (might be due to invalid IL or missing references)
			//IL_0128: Unknown result type (might be due to invalid IL or missing references)
			Root = UiFactory.NewObject("SevenUIArtifacts", (Transform)(object)bar);
			Root.anchorMin = new Vector2(0f, 0.5f);
			Root.anchorMax = new Vector2(1f, 0.5f);
			Root.pivot = new Vector2(0.5f, 0.5f);
			Root.offsetMin = new Vector2(inset, -7.117647f);
			Root.offsetMax = new Vector2(0f - inset, 7.117647f);
			((Component)Root).gameObject.AddComponent<Canvas>();
			((Component)Root).gameObject.AddComponent<GraphicRaycaster>();
			icons = UiFactory.NewObject("Icons", (Transform)(object)Root);
			icons.anchorMin = Vector2.zero;
			icons.anchorMax = new Vector2(0f, 1f);
			icons.pivot = new Vector2(0f, 0.5f);
			icons.anchoredPosition = Vector2.zero;
			TextMeshProUGUI val = ((Component)UiFactory.NewObject("Label", (Transform)(object)Root)).gameObject.AddComponent<TextMeshProUGUI>();
			if (Object.op_Implicit((Object)(object)fontFrom))
			{
				((TMP_Text)val).font = fontFrom.font;
				((TMP_Text)val).fontSharedMaterial = fontFrom.fontSharedMaterial;
			}
			HeaderStyle.Apply((TMP_Text)(object)val);
			((TMP_Text)val).fontSize = labelSize;
			((TMP_Text)val).alignment = (TextAlignmentOptions)4100;
			((TMP_Text)val).enableWordWrapping = false;
			((TMP_Text)val).overflowMode = (TextOverflowModes)0;
			((Graphic)val).raycastTarget = false;
			label = (TMP_Text)(object)val;
			((Component)Root).gameObject.SetActive(false);
			container = panel.iconContainer;
			grid = (Object.op_Implicit((Object)(object)container) ? ((Component)container).GetComponent<GridLayoutGroup>() : null);
			if (Object.op_Implicit((Object)(object)container) && Object.op_Implicit((Object)(object)grid))
			{
				HideGamePanel(panel.panelObject, recorder);
				MoveContainer(recorder);
			}
		}

		public void Place(float rowOffset)
		{
			//IL_000c: 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)
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			//IL_0046: Unknown result type (might be due to invalid IL or missing references)
			Root.offsetMin = new Vector2(Root.offsetMin.x, 0f - rowOffset - 7.117647f);
			Root.offsetMax = new Vector2(Root.offsetMax.x, 0f - rowOffset + 7.117647f);
		}

		public void Update()
		{
			//IL_0028: Unknown result type (might be due to invalid IL or missing references)
			//IL_002d: Unknown result type (might be due to invalid IL or missing references)
			if (Alive && ((Component)Root).gameObject.activeInHierarchy)
			{
				int count = Count;
				Rect rect = Root.rect;
				float width = ((Rect)(ref rect)).width;
				if (count != shownCount || !Mathf.Approximately(width, shownWidth) || !((Object)(object)label.font == (Object)(object)shownFont))
				{
					shownCount = count;
					shownWidth = width;
					shownFont = label.font;
					Layout(count, width);
				}
			}
		}

		private void Layout(int count, float width)
		{
			//IL_0030: 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_005c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0071: 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_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ed: Unknown result type (might be due to invalid IL or missing references)
			label.text = Language.GetString("RULE_HEADER_ARTIFACTS");
			float x = label.GetPreferredValues(label.text, float.PositiveInfinity, float.PositiveInfinity).x;
			RectTransform rectTransform = label.rectTransform;
			rectTransform.anchorMin = new Vector2(1f, 0f);
			rectTransform.anchorMax = Vector2.one;
			rectTransform.pivot = new Vector2(1f, 0.5f);
			rectTransform.anchoredPosition = Vector2.zero;
			rectTransform.sizeDelta = new Vector2(x, 0f);
			float num = Mathf.Max(0f, width - x - 6.4705887f);
			icons.sizeDelta = new Vector2(num, 0f);
			float num2 = ((count > 0) ? Mathf.Min(14.235294f, (num - 1.2941177f * (float)(count - 1)) / (float)count) : 14.235294f);
			grid.cellSize = new Vector2(num2, num2);
		}

		private static void HideGamePanel(GameObject gamePanel, StyleRecorder recorder)
		{
			if (!Object.op_Implicit((Object)(object)gamePanel))
			{
				return;
			}
			recorder.Disable((Behaviour)(object)gamePanel.GetComponent<Image>());
			LayoutElement element = gamePanel.GetComponent<LayoutElement>();
			if (Object.op_Implicit((Object)(object)element))
			{
				bool ignored = element.ignoreLayout;
				recorder.OnRestore(delegate
				{
					if (Object.op_Implicit((Object)(object)element))
					{
						element.ignoreLayout = ignored;
					}
				});
			}
			else
			{
				element = gamePanel.AddComponent<LayoutElement>();
				recorder.Add((Object)(object)element);
			}
			element.ignoreLayout = true;
		}

		private void MoveContainer(StyleRecorder recorder)
		{
			//IL_0036: 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_0058: 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)
			//IL_0069: 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_007a: Unknown result type (might be due to invalid IL or missing references)
			//IL_007f: 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_0090: 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_00dc: 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_0106: 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_0121: Unknown result type (might be due to invalid IL or missing references)
			//IL_0122: Unknown result type (might be due to invalid IL or missing references)
			//IL_0128: Unknown result type (might be due to invalid IL or missing references)
			//IL_017a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0194: Unknown result type (might be due to invalid IL or missing references)
			Transform parent = ((Transform)container).parent;
			int index = ((Transform)container).GetSiblingIndex();
			Constraint constraint = grid.constraint;
			int constraintCount = grid.constraintCount;
			Vector2 cellSize = grid.cellSize;
			Vector2 spacing = grid.spacing;
			TextAnchor alignment = ((LayoutGroup)grid).childAlignment;
			Corner corner = grid.startCorner;
			Axis axis = grid.startAxis;
			recorder.RecordRect(container);
			recorder.OnRestore(delegate
			{
				//IL_0021: Unknown result type (might be due to invalid IL or missing references)
				//IL_004d: 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_0079: Unknown result type (might be due to invalid IL or missing references)
				//IL_008f: Unknown result type (might be due to invalid IL or missing references)
				//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
				if (Object.op_Implicit((Object)(object)grid))
				{
					grid.constraint = constraint;
					grid.constraintCount = constraintCount;
					grid.cellSize = cellSize;
					grid.spacing = spacing;
					((LayoutGroup)grid).childAlignment = alignment;
					grid.startCorner = corner;
					grid.startAxis = axis;
				}
				if (Object.op_Implicit((Object)(object)container) && Object.op_Implicit((Object)(object)parent))
				{
					((Transform)container).SetParent(parent, false);
					((Transform)container).SetSiblingIndex(index);
				}
			});
			((Transform)container).SetParent((Transform)(object)icons, false);
			container.anchorMin = Vector2.zero;
			container.anchorMax = Vector2.one;
			container.pivot = new Vector2(0.5f, 0.5f);
			RectTransform obj = container;
			Vector2 offsetMin = (container.offsetMax = Vector2.zero);
			obj.offsetMin = offsetMin;
			grid.constraint = (Constraint)2;
			grid.constraintCount = 1;
			grid.startCorner = (Corner)0;
			grid.startAxis = (Axis)0;
			((LayoutGroup)grid).childAlignment = (TextAnchor)3;
			grid.spacing = new Vector2(1.2941177f, 0f);
			grid.cellSize = new Vector2(14.235294f, 14.235294f);
		}
	}
	internal sealed class BoardHoverRelay : MonoBehaviour, IPointerEnterHandler, IEventSystemHandler, IPointerExitHandler, ISelectHandler, IDeselectHandler
	{
		public ScoreboardItemsBoard Board;

		public TooltipProvider Provider;

		public void OnPointerEnter(PointerEventData eventData)
		{
			Enter();
		}

		public void OnPointerExit(PointerEventData eventData)
		{
			Leave();
		}

		public void OnSelect(BaseEventData eventData)
		{
			Enter();
		}

		public void OnDeselect(BaseEventData eventData)
		{
			Leave();
		}

		private void Enter()
		{
			if (Object.op_Implicit((Object)(object)Board))
			{
				Board.Hover(Provider);
			}
		}

		private void Leave()
		{
			if (Object.op_Implicit((Object)(object)Board))
			{
				Board.Unhover(Provider);
			}
		}
	}
	internal sealed class BossBarEffects
	{
		private struct Shares
		{
			public float HealthEnd;

			public float ShieldEnd;

			public float VoidEnd;

			public float FillEnd;

			public float Barrier;

			public float TrailEnd;

			public float HealStart;

			public float LunarRuin;

			public float CurseStart;

			public float Execute;

			public static readonly Shares None = new Shares
			{
				CurseStart = 1f
			};
		}

		public const string ShieldName = "SevenUIBossShield";

		public const string VoidShieldName = "SevenUIBossVoidShield";

		public const string BarrierName = "SevenUIBossBarrier";

		public const string BarrierCoverName = "SevenUIBossBarrierCover";

		public const string TrailName = "SevenUIBossTrail";

		public const string HealName = "SevenUIBossHeal";

		public const string LunarRuinName = "SevenUIBossLunarRuin";

		public const string CurseName = "SevenUIBossCurse";

		public const string ExecuteName = "SevenUIBossExecute";

		public const float TrailSmoothTime = 0.2f;

		public const float HealLead = 0.01f;

		private const float ExecuteMarkWidth = 2f;

		private const float ChangeTolerance = 0.0001f;

		private static readonly Vector2 Unset = new Vector2(-1f, -1f);

		private readonly HUDBossHealthBarController boss;

		private readonly HUD hud;

		private readonly Image shield;

		private readonly Image voidShield;

		private readonly Image barrier;

		private readonly Image barrierCover;

		private readonly Image trail;

		private readonly Image heal;

		private readonly Image lunarRuin;

		private readonly float lunarRuinSize;

		private readonly Image curse;

		private readonly Image execute;

		private Vector2 shownShield = Unset;

		private Vector2 shownVoidShield = Unset;

		private Vector2 shownCover = Unset;

		private Vector2 shownBarrier = Unset;

		private Vector2 shownTrail = Unset;

		private Vector2 shownHeal = Unset;

		private Vector2 shownLunarRuin = Unset;

		private Vector2 shownCurse = Unset;

		private float shownExecute = -1f;

		private BossGroup trailGroup;

		private float trailShare = -1f;

		private float trailVelocity;

		private GameObject viewerObject;

		private CharacterBody viewer;

		public bool Alive
		{
			get
			{
				if (Object.op_Implicit((Object)(object)boss) && Object.op_Implicit((Object)(object)shield) && Object.op_Implicit((Object)(object)voidShield) && Object.op_Implicit((Object)(object)barrier) && Object.op_Implicit((Object)(object)barrierCover) && Object.op_Implicit((Object)(object)trail) && Object.op_Implicit((Object)(object)heal) && Object.op_Implicit((Object)(object)curse))
				{
					return Object.op_Implicit((Object)(object)execute);
				}
				return false;
			}
		}

		private BossBarEffects(HUDBossHealthBarController boss, HUD hud, Image shield, Image voidShield, Image barrier, Image barrierCover, Image trail, Image heal, Image lunarRuin, float lunarRuinSize, Image curse, Image execute)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_0017: 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_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_002d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0032: Unknown result type (might be due to invalid IL or missing references)
			//IL_0038: 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_0043: Unknown result type (might be due to invalid IL or missing references)
			//IL_0048: 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_0053: Unknown result type (might be due to invalid IL or missing references)
			this.boss = boss;
			this.hud = hud;
			this.shield = shield;
			this.voidShield = voidShield;
			this.barrier = barrier;
			this.barrierCover = barrierCover;
			this.trail = trail;
			this.heal = heal;
			this.lunarRuin = lunarRuin;
			this.lunarRuinSize = lunarRuinSize;
			this.curse = curse;
			this.execute = execute;
		}

		public static BossBarEffects Style(HUDBossHealthBarController boss, StyleRecorder recorder)
		{
			//IL_0049: Unknown result type (might be due to invalid IL or missing references)
			//IL_0061: Unknown result type (might be due to invalid IL or missing references)
			//IL_0079: 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_00ab: 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_0100: Unknown result type (might be due to invalid IL or missing references)
			//IL_0106: 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_011c: 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_0115: 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)
			//IL_0178: 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_013e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0143: Unknown result type (might be due to invalid IL or missing references)
			//IL_014a: 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_0220: Unknown result type (might be due to invalid IL or missing references)
			RectTransform val = (RectTransform)(Object.op_Implicit((Object)(object)boss.fillRectImage) ? /*isinst with value type is only supported in some contexts*/: null);
			if (!Object.op_Implicit((Object)(object)val))
			{
				return null;
			}
			HUD componentInParent = ((Component)boss).GetComponentInParent<HUD>();
			recorder.Disable((Behaviour)(object)boss.delayRectImage);
			Image val2 = Segment("SevenUIBossBarrierCover", val, Palette.Trough, FlatSprite.White, (Type)0, recorder);
			Image val3 = Segment("SevenUIBossTrail", val, Palette.BossHealthLost, FlatSprite.White, (Type)0, recorder);
			Image val4 = Segment("SevenUIBossHeal", val, Palette.BossHealthHealing, FlatSprite.White, (Type)0, recorder);
			Image val5 = Segment("SevenUIBossShield", val, Palette.Shield, FlatSprite.White, (Type)0, recorder);
			Image val6 = Segment("SevenUIBossVoidShield", val, Palette.VoidShield, FlatSprite.White, (Type)0, recorder);
			Image val7 = Segment("SevenUIBossBarrier", val, Palette.Barrier, FlatSprite.TopStrip, (Type)1, recorder);
			BarStyle val8 = (BarStyle)((Object.op_Implicit((Object)(object)componentInParent) && Object.op_Implicit((Object)(object)componentInParent.healthBar) && Object.op_Implicit((Object)(object)componentInParent.healthBar._style)) ? componentInParent.healthBar._style.lunarRuinStyle : default(BarStyle));
			Image val9 = ((val8.enabled && Object.op_Implicit((Object)(object)val8.sprite)) ? Segment("SevenUIBossLunarRuin", val, val8.baseColor, val8.sprite, val8.imageType, recorder) : null);
			Image val10 = Segment("SevenUIBossCurse", val, Color.white, FlatSprite.Hatch, (Type)2, recorder);
			Image val11 = Segment("SevenUIBossExecute", val, Palette.ExecuteMark, FlatSprite.White, (Type)0, recorder);
			int siblingIndex = ((Component)boss.fillRectImage).transform.GetSiblingIndex();
			Image[] array = (Image[])(object)new Image[9] { val2, val3, val4, val5, val6, val7, val9, val10, val11 };
			foreach (Image val12 in array)
			{
				if (Object.op_Implicit((Object)(object)val12))
				{
					((Component)val12).transform.SetSiblingIndex(siblingIndex + 1);
					siblingIndex = ((Component)val12).transform.GetSiblingIndex();
				}
			}
			return new BossBarEffects(boss, componentInParent, val5, val6, val7, val2, val3, val4, val9, val8.sizeDelta, val10, val11);
		}

		public void Update()
		{
			//IL_0118: Unknown result type (might be due to invalid IL or missing references)
			//IL_0127: 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_018f: Unknown result type (might be due to invalid IL or missing references)
			if (!boss.container.activeInHierarchy)
			{
				return;
			}
			BossGroup currentBossGroup = boss.currentBossGroup;
			float num = (Object.op_Implicit((Object)(object)currentBossGroup) ? currentBossGroup.totalMaxObservedMaxHealth : 0f);
			if (!Object.op_Implicit((Object)(object)currentBossGroup) || !Object.op_Implicit((Object)(object)currentBossGroup.combatSquad) || num <= 0f)
			{
				trailGroup = null;
				Show(Shares.None);
				return;
			}
			CharacterBody val = Viewer();
			float num2 = 0f;
			float num3 = 0f;
			float num4 = 0f;
			float num5 = 0f;
			float num6 = 0f;
			float num7 = 0f;
			float num8 = 0f;
			float num9 = 0f;
			ReadOnlyCollection<CharacterMaster> readOnlyMembersList = currentBossGroup.combatSquad.readOnlyMembersList;
			CharacterBody val3 = default(CharacterBody);
			BossNamePriority val4 = default(BossNamePriority);
			for (int i = 0; i < readOnlyMembersList.Count; i++)
			{
				CharacterMaster val2 = readOnlyMembersList[i];
				if (!Object.op_Implicit((Object)(object)val2) || !val2.TryGetBody(ref val3))
				{
					continue;
				}
				HealthComponent healthComponent = val3.healthComponent;
				if (Object.op_Implicit((Object)(object)healthComponent) && (((Component)val2).TryGetComponent<BossNamePriority>(ref val4) ? val4.priority : 0f) == currentBossGroup.currentPriority)
				{
					HealthBarValues healthBarValues = healthComponent.GetHealthBarValues();
					num2 += healthComponent.health;
					if (healthBarValues.hasVoidShields)
					{
						num4 += healthComponent.shield;
					}
					else
					{
						num3 += healthComponent.shield;
					}
					num5 += healthComponent.barrier;
					if (healthBarValues.hasLunarRuin)
					{
						num6 += healthComponent.health;
					}
					num8 += healthComponent.fullCombinedHealth;
					num7 += healthComponent.fullHealth * (val3.cursePenalty - 1f);
					float num10 = healthBarValues.cullFraction * val3.cursePenalty;
					if (healthBarValues.isElite && Object.op_Implicit((Object)(object)val))
					{
						num10 = Mathf.Max(num10, val.executeEliteHealthFraction);
					}
					num9 += num10 * healthComponent.fullCombinedHealth;
				}
			}
			Shares wanted = default(Shares);
			wanted.FillEnd = Mathf.Clamp01(currentBossGroup.totalObservedHealth / num);
			wanted.HealthEnd = Mathf.Clamp01(num2 / num);
			wanted.ShieldEnd = Mathf.Clamp01(wanted.HealthEnd + num3 / num);
			wanted.VoidEnd = Mathf.Clamp01(wanted.ShieldEnd + num4 / num);
			wanted.Barrier = Mathf.Clamp01(num5 / num);
			wanted.LunarRuin = Mathf.Min(wanted.HealthEnd, num6 / num);
			wanted.CurseStart = 1f - Mathf.Clamp01(Mathf.Min(num7 / num, 1f - num8 / num));
			wanted.Execute = Mathf.Clamp01(num9 / num);
			if ((Object)(object)currentBossGroup != (Object)(object)trailGroup || trailShare < 0f)
			{
				trailGroup = currentBossGroup;
				trailShare = wanted.HealthEnd;
				trailVelocity = 0f;
			}
			trailShare = Mathf.SmoothDamp(trailShare, wanted.HealthEnd, ref trailVelocity, 0.2f, float.PositiveInfinity, Time.deltaTime);
			wanted.TrailEnd = Mathf.Max(trailShare, wanted.HealthEnd);
			wanted.HealStart = Mathf.Min(trailShare + 0.01f, wanted.HealthEnd);
			Show(wanted);
		}

		private CharacterBody Viewer()
		{
			GameObject val = (Object.op_Implicit((Object)(object)hud) ? hud.targetBodyObject : null);
			if ((Object)(object)val != (Object)(object)viewerObject)
			{
				viewerObject = val;
				viewer = (Object.op_Implicit((Object)(object)val) ? val.GetComponent<CharacterBody>() : null);
			}
			return viewer;
		}

		private void Show(Shares wanted)
		{
			//IL_016c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0182: Unknown result type (might be due to invalid IL or missing references)
			//IL_0197: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a2: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b6: Unknown result type (might be due to invalid IL or missing references)
			Place(shield, ref shownShield, wanted.HealthEnd, wanted.ShieldEnd);
			Place(voidShield, ref shownVoidShield, wanted.ShieldEnd, wanted.VoidEnd);
			Place(barrierCover, ref shownCover, wanted.VoidEnd, wanted.FillEnd);
			Place(barrier, ref shownBarrier, 0f, wanted.Barrier);
			Place(trail, ref shownTrail, wanted.HealthEnd, wanted.TrailEnd);
			Place(heal, ref shownHeal, wanted.HealStart, wanted.HealthEnd);
			if (Object.op_Implicit((Object)(object)lunarRuin))
			{
				Place(lunarRuin, ref shownLunarRuin, 0f, wanted.LunarRuin, lunarRuinSize);
			}
			Place(curse, ref shownCurse, wanted.CurseStart, 1f);
			if (Moved(shownExecute, wanted.Execute))
			{
				shownExecute = wanted.Execute;
				((Behaviour)execute).enabled = wanted.Execute > 0f;
				RectTransform rectTransform = ((Graphic)execute).rectTransform;
				rectTransform.anchorMin = new Vector2(wanted.Execute, 0f);
				rectTransform.anchorMax = new Vector2(wanted.Execute, 1f);
				rectTransform.pivot = new Vector2(0.5f, 0.5f);
				rectTransform.anchoredPosition = Vector2.zero;
				rectTransform.sizeDelta = new Vector2(2f, 0f);
			}
		}

		private static bool Moved(float shown, float wanted)
		{
			return Mathf.Abs(shown - wanted) > 0.0001f;
		}

		private static void Place(Image segment, ref Vector2 shown, float from, float to, float sizeDelta = 0f)
		{
			//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_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_0065: Unknown result type (might be due to invalid IL or missing references)
			//IL_0076: 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_00b1: 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)
			if (to - from <= 0.0001f)
			{
				((Behaviour)segment).enabled = false;
				shown = new Vector2(from, to);
			}
			else if (Moved(shown.x, from) || Moved(shown.y, to) || !((Behaviour)segment).enabled)
			{
				shown = new Vector2(from, to);
				((Behaviour)segment).enabled = true;
				RectTransform rectTransform = ((Graphic)segment).rectTransform;
				rectTransform.anchorMin = new Vector2(from, 0f);
				rectTransform.anchorMax = new Vector2(to, 1f);
				rectTransform.anchoredPosition = Vector2.zero;
				rectTransform.sizeDelta = (Vector2)((sizeDelta == 0f) ? Vector2.zero : new Vector2(sizeDelta * 0.5f + 1f, sizeDelta + 1f));
			}
		}

		private static Image Segment(string name, RectTransform bar, Color color, Sprite sprite, Type type, StyleRecorder recorder)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			Image val = UiFactory.NewImage(name, (Transform)(object)bar, color);
			val.sprite = sprite;
			val.type = type;
			((Behaviour)val).enabled = false;
			recorder.Add((Object)(object)((Component)val).gameObject);
			return val;
		}
	}
	internal sealed class BossTitleRow
	{
		public const string HealthName = "SevenUIBossHealth";

		private const float BarWidth = 800f;

		private const float BarHeight = 14f;

		private const float RowGap = 6f;

		private const float SubtitleGap = 12f;

		private const float SmallFontSize = 16f;

		private const string Separator = " / ";

		private readonly HUDBossHealthBarController boss;

		private readonly RectTransform container;

		private readonly VerticalLayoutGroup layout;

		private readonly RectTransform cell;

		private readonly int topPadding;

		private readonly TMP_Text name;

		private readonly TMP_Text subtitle;

		private readonly TMP_Text health;

		private string shownName;

		private string shownSubtitle;

		private Rect shownCell;

		private TMP_FontAsset shownNameFont;

		private TMP_FontAsset shownSmallFont;

		private int shownHealth = -1;

		private int shownMaxHealth = -1;

		public bool Alive
		{
			get
			{
				if (Object.op_Implicit((Object)(object)boss) && Object.op_Implicit((Object)(object)container) && Object.op_Implicit((Object)(object)layout) && Object.op_Implicit((Object)(object)cell) && Object.op_Implicit((Object)(object)name) && Object.op_Implicit((Object)(object)subtitle))
				{
					return Object.op_Implicit((Object)(object)health);
				}
				return false;
			}
		}

		public string ShownHealth => health.text;

		private BossTitleRow(HUDBossHealthBarController boss, RectTransform container, VerticalLayoutGroup layout, RectTransform cell, int topPadding, TMP_Text name, TMP_Text subtitle, TMP_Text health)
		{
			this.boss = boss;
			this.container = container;
			this.layout = layout;
			this.cell = cell;
			this.topPadding = topPadding;
			this.name = name;
			this.subtitle = subtitle;
			this.health = health;
		}

		public static BossTitleRow Style(HUDBossHealthBarController boss, StyleRecorder recorder)
		{
			//IL_0166: Unknown result type (might be due to invalid IL or missing references)
			//IL_0170: Expected O, but got Unknown
			//IL_01b2: Unknown result type (might be due to invalid IL or missing references)
			//IL_01be: Unknown result type (might be due to invalid IL or missing references)
			//IL_01fe: Unknown result type (might be due to invalid IL or missing references)
			//IL_0208: Expected O, but got Unknown
			//IL_02ab: Unknown result type (might be due to invalid IL or missing references)
			RectTransform val = (RectTransform)(Object.op_Implicit((Object)(object)boss.container) ? /*isinst with value type is only supported in some contexts*/: null);
			VerticalLayoutGroup layout = (Object.op_Implicit((Object)(object)val) ? ((Component)val).GetComponent<VerticalLayoutGroup>() : null);
			TMP_Text bossNameLabel = (TMP_Text)(object)boss.bossNameLabel;
			TMP_Text bossSubtitleLabel = (TMP_Text)(object)boss.bossSubtitleLabel;
			RectTransform val2 = (RectTransform)(Object.op_Implicit((Object)(object)boss.fillRectImage) ? /*isinst with value type is only supported in some contexts*/: null);
			RectTransform val3 = (RectTransform)(Object.op_Implicit((Object)(object)val2) ? /*isinst with value type is only supported in some contexts*/: null);
			LayoutElement val4 = (Object.op_Implicit((Object)(object)val3) ? ((Component)val3).GetComponent<LayoutElement>() : null);
			if (!Object.op_Implicit((Object)(object)layout) || !Object.op_Implicit((Object)(object)bossNameLabel) || !Object.op_Implicit((Object)(object)bossSubtitleLabel) || !Object.op_Implicit((Object)(object)val4) || (Object)(object)bossNameLabel.transform.parent != (Object)(object)val || (Object)(object)bossSubtitleLabel.transform.parent != (Object)(object)val || (Object)(object)((Transform)val3).parent != (Object)(object)val)
			{
				return null;
			}
			bool expandWidth = ((HorizontalOrVerticalLayoutGroup)layout).childForceExpandWidth;
			int top = ((LayoutGroup)layout).padding.top;
			recorder.Record((HorizontalOrVerticalLayoutGroup)(object)layout);
			recorder.OnRestore(delegate
			{
				if (Object.op_Implicit((Object)(object)layout))
				{
					((HorizontalOrVerticalLayoutGroup)layout).childForceExpandWidth = expandWidth;
				}
			});
			((HorizontalOrVerticalLayoutGroup)layout).childForceExpandWidth = false;
			((LayoutGroup)layout).padding = new RectOffset(0, 0, top, ((LayoutGroup)layout).padding.bottom);
			recorder.Record(val4);
			val4.preferredWidth = 800f;
			val4.flexibleWidth = 0f;
			val4.minHeight = 14f;
			val4.preferredHeight = 14f;
			recorder.RecordRect(val2);
			val2.offsetMin = Vector2.zero;
			val2.offsetMax = Vector2.zero;
			TMP_Text[] array = (TMP_Text[])(object)new TMP_Text[2] { bossNameLabel, bossSubtitleLabel };
			foreach (TMP_Text val5 in array)
			{
				recorder.Add((Object)(object)((Component)val5).gameObject.AddComponent<LayoutIgnorer>());
				recorder.RecordRect((RectTransform)val5.transform);
				recorder.Record(val5);
				val5.alignment = (TextAlignmentOptions)1025;
				UiFactory.KeepOnOneLine(val5);
			}
			bossSubtitleLabel.fontSize = 16f;
			recorder.Disable((Behaviour)(object)boss.healthLabel);
			GameObject gameObject = ((Component)UiFactory.NewObject("SevenUIBossHealth", (Transform)(object)val2)).gameObject;
			TextMeshProUGUI val6 = gameObject.AddComponent<TextMeshProUGUI>();
			if (Object.op_Implicit((Object)(object)boss.healthLabel))
			{
				((TMP_Text)val6).font = ((TMP_Text)boss.healthLabel).font;
				((TMP_Text)val6).fontSharedMaterial = ((TMP_Text)boss.healthLabel).fontSharedMaterial;
			}
			((TMP_Text)val6).fontSize = 16f;
			((TMP_Text)val6).fontStyle = (FontStyles)1;
			((Graphic)val6).color = Palette.Text;
			((TMP_Text)val6).alignment = (TextAlignmentOptions)1028;
			((TMP_Text)val6).enableWordWrapping = false;
			((TMP_Text)val6).overflowMode = (TextOverflowModes)0;
			((Graphic)val6).raycastTarget = false;
			recorder.Add((Object)(object)gameObject);
			return new BossTitleRow(boss, val, layout, val3, top, bossNameLabel, bossSubtitleLabel, (TMP_Text)(object)val6);
		}

		public void Update()
		{
			//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_008f: Unknown result type (might be due to invalid IL or missing references)
			//IL_009a: Unknown result type (might be due to invalid IL or missing references)
			//IL_009f: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a4: Unknown result type (might be due to invalid IL or missing references)
			//IL_0120: Unknown result type (might be due to invalid IL or missing references)
			//IL_014c: Unknown result type (might be due to invalid IL or missing references)
			//IL_014d: 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_00e2: Unknown result type (might be due to invalid IL or missing references)
			if (!boss.container.activeInHierarchy)
			{
				return;
			}
			BossGroup currentBossGroup = boss.currentBossGroup;
			if (Object.op_Implicit((Object)(object)currentBossGroup))
			{
				int num = Mathf.FloorToInt(currentBossGroup.totalObservedHealth);
				int num2 = Mathf.FloorToInt(currentBossGroup.totalMaxObservedMaxHealth);
				if (num != shownHealth || num2 != shownMaxHealth)
				{
					shownHealth = num;
					shownMaxHealth = num2;
					health.text = TextSerialization.ToStringNumeric(num) + " / " + TextSerialization.ToStringNumeric(num2);
				}
			}
			Rect rect = cell.rect;
			((Rect)(ref rect)).position = ((Rect)(ref rect)).position + Vector2.op_Implicit(((Transform)cell).localPosition);
			if ((!string.Equals(name.text, shownName, StringComparison.Ordinal) || !string.Equals(subtitle.text, shownSubtitle, StringComparison.Ordinal) || !(rect == shownCell) || !((Object)(object)name.font == (Object)(object)shownNameFont) || !((Object)(object)health.font == (Object)(object)shownSmallFont)) && Place(rect))
			{
				shownName = name.text;
				shownSubtitle = subtitle.text;
				shownCell = rect;
				shownNameFont = name.font;
				shownSmallFont = health.font;
			}
		}

		private bool Place(Rect bar)
		{
			//IL_008d: 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_0093: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ac: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b4: 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_00c5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00dc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f6: 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_0109: Unknown result type (might be due to invalid IL or missing references)
			//IL_0110: Unknown result type (might be due to invalid IL or missing references)
			//IL_0117: Unknown result type (might be due to invalid IL or missing references)
			//IL_0118: Unknown result type (might be due to invalid IL or missing references)
			//IL_0122: 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_005c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0066: Expected O, but got Unknown
			//IL_016d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0172: Unknown result type (might be due to invalid IL or missing references)
			//IL_0176: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b2: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c7: Unknown result type (might be due to invalid IL or missing references)
			//IL_01cc: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d7: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e1: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e2: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ec: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f7: Unknown result type (might be due to invalid IL or missing references)
			//IL_0201: Unknown result type (might be due to invalid IL or missing references)
			//IL_0208: Unknown result type (might be due to invalid IL or missing references)
			//IL_022a: Unknown result type (might be due to invalid IL or missing references)
			float num = Mathf.Max(name.preferredHeight, name.fontSize);
			int num2 = topPadding + Mathf.CeilToInt(num + 6f);
			if (((LayoutGroup)layout).padding.top != num2)
			{
				((LayoutGroup)layout).padding = new RectOffset(0, 0, num2, ((LayoutGroup)layout).padding.bottom);
				return false;
			}
			float num3 = Descent(name);
			float num4 = ((Rect)(ref bar)).yMax + 6f;
			RectTransform val = (RectTransform)name.transform;
			Vector2 val2 = default(Vector2);
			((Vector2)(ref val2))..ctor(0.5f, 0.5f);
			val.anchorMax = val2;
			val.anchorMin = val2;
			val.pivot = Vector2.zero;
			val.sizeDelta = new Vector2(800f, num);
			((Transform)val).localPosition = new Vector3(((Rect)(ref bar)).xMin, num4, 0f);
			RectTransform val3 = (RectTransform)subtitle.transform;
			((Vector2)(ref val2))..ctor(0.5f, 0.5f);
			val3.anchorMax = val2;
			val3.anchorMin = val2;
			val3.pivot = Vector2.zero;
			val3.sizeDelta = new Vector2(800f, num);
			name.ForceMeshUpdate(false, false);
			subtitle.ForceMeshUpdate(false, false);
			float num5;
			if (name.textInfo.characterCount <= 0)
			{
				num5 = 0f;
			}
			else
			{
				Bounds textBounds = name.textBounds;
				num5 = ((Bounds)(ref textBounds)).max.x;
			}
			float num6 = num5;
			((Transform)val3).localPosition = new Vector3(((Rect)(ref bar)).xMin + num6 + 12f - DrawnLeft(subtitle), num4 + num3 - Descent(subtitle), 0f);
			RectTransform val4 = (RectTransform)health.transform;
			val4.anchorMin = new Vector2(0f, 1f);
			val4.anchorMax = Vector2.one;
			val4.pivot = new Vector2(0.5f, 0f);
			val4.sizeDelta = new Vector2(0f, num);
			val4.anchoredPosition = new Vector2(0f, 6f + num3 - Descent(health));
			return true;
		}

		public static float DrawnLeft(TMP_Text text)
		{
			//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_001e: 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_0028: Unknown result type (might be due to invalid IL or missing references)
			//IL_002d: 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)
			//IL_0038: 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)
			TMP_TextInfo textInfo = text.textInfo;
			float num = float.MaxValue;
			int num2 = 0;
			while (textInfo != null && num2 < textInfo.characterCount)
			{
				TMP_CharacterInfo val = textInfo.characterInfo[num2];
				if (val.isVisible)
				{
					num = Mathf.Min(num, Mathf.Min(val.vertex_BL.position.x, val.vertex_TL.position.x));
				}
				num2++;
			}
			if (num != float.MaxValue)
			{
				return num;
			}
			return 0f;
		}

		private static float Descent(TMP_Text text)
		{
			//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_0034: 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_0048: Unknown result type (might be due to invalid IL or missing references)
			//IL_004d: Unknown result type (might be due to invalid IL or missing references)
			if (Object.op_Implicit((Object)(object)text.font))
			{
				FaceInfo faceInfo = text.font.faceInfo;
				if (!((float)((FaceInfo)(ref faceInfo)).pointSize <= 0f))
				{
					faceInfo = text.font.faceInfo;
					float num = 0f - ((FaceInfo)(ref faceInfo)).descentLine;
					faceInfo = text.font.faceInfo;
					return num / (float)((FaceInfo)(ref faceInfo)).pointSize * text.fontSize;
				}
			}
			return 0f;
		}
	}
	internal sealed class BuffRows
	{
		public const string SlotName = "SevenUIBuffSlot";

		public const string LabelsName = "SevenUIBuffLabels";

		private const string TimerStart = "<size=";

		private const string TimerEnd = "</size>";

		private const string PercentSuffix = "%";

		private const float Canvas = 1.0235415f;

		private const float SlotSize = 34.800407f;

		private const float SlotGap = 4.094166f;

		private const float IconSize = 32.753326f;

		private const float IconMarginX = 1.0235405f;

		private const float StripHeight = 2.047083f;

		private const float CountFontSize = 13.306039f;

		private const float CountInset = 2.047083f;

		private const float CountBaseline = 12.998976f;

		private const float TimerFontSize = 12.282497f;

		private const float TimerBaseline = 14.943706f;

		private const float TimerRoom = 17.400204f;

		private const float LineBox = 40f;

		private readonly BuffDisplay display;

		private readonly RectTransform rect;

		private readonly RectTransform bounds;

		private readonly StyleRecorder recorder;

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

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

		private readonly List<TMP_Text> counts = new List<TMP_Text>();

		private readonly List<TMP_Text> timers = new List<TMP_Text>();

		private readonly List<string> timerSources = new List<string>();

		private readonly List<(BuffDef buff, int count)> countSources = new List<(BuffDef, int)>();

		private readonly HashSet<BuffIcon> styled = new HashSet<BuffIcon>();

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

		private RectTransform labels;

		public bool Alive
		{
			get
			{
				if (Object.op_Implicit((Object)(object)display))
				{
					return Object.op_Implicit((Object)(object)rect);
				}
				return false;
			}
		}

		public BuffRows(BuffDisplay display, RectTransform bounds, StyleRecorder recorder)
		{
			//IL_0084: Unknown result type (might be due to invalid IL or missing references)
			//IL_008e: Expected O, but got Unknown
			this.display = display;
			rect = (RectTransform)((Component)display).transform;
			this.bounds = bounds;
			this.recorder = recorder;
			recorder.OnRestore(delegate
			{
				//IL_005a: Unknown result type (might be due to invalid IL or missing references)
				if (!Object.op_Implicit((Object)(object)display) || display.buffIconDisplayData == null)
				{
					return;
				}
				float num = 0f;
				foreach (BuffIconDisplayData buffIconDisplayDatum in display.buffIconDisplayData)
				{
					if (Object.op_Implicit((Object)(object)buffIconDisplayDatum.buffIconComponent))
					{
						buffIconDisplayDatum.buffIconComponent.rectTransform.anchoredPosition = new Vector2(num, 0f);
						num += display.iconWidth;
					}
				}
			});
		}

		public void Update()
		{
			//IL_00f2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fe: 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_010a: 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_0