Decompiled source of SevenUI v1.5.0

plugins/SevenUI/SevenUI.dll

Decompiled 3 hours 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 Microsoft.CodeAnalysis;
using RiskOfOptions;
using RiskOfOptions.Options;
using RoR2;
using RoR2.ContentManagement;
using RoR2.UI;
using RoR2.UI.SkinControllers;
using TMPro;
using UnityEngine;
using UnityEngine.EventSystems;
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.5.0.0")]
[assembly: AssemblyInformationalVersion("1.5.0+0dbc866a95489afe988ebda4a05ce4e8a3ba79e9")]
[assembly: AssemblyProduct("SevenUI")]
[assembly: AssemblyTitle("SevenUI")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.5.0.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<CharacterMaster, (CharacterBody Body, int Tier, string Name)> names = new Dictionary<CharacterMaster, (CharacterBody, int, string)>();

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

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

		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 (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();
			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 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)
		{
			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 > cards.Count * 2)
			{
				ForgetGoneMasters();
			}
			return bestBodyName;
		}

		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 goneCard in goneCards)
			{
				looks.Remove(goneCard);
				shared.Remove(goneCard);
			}
			goneCards.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();
		}

		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 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;
			HorizontalLayoutGroup obj3 = ((Component)val3).gameObject.AddComponent<HorizontalLayoutGroup>();
			((HorizontalOrVerticalLayoutGroup)obj3).spacing = 2.047083f;
			bool childControlWidth = (((HorizontalOrVerticalLayoutGroup)obj3).childControlHeight = true);
			((HorizontalOrVerticalLayoutGroup)obj3).childControlWidth = childControlWidth;
			childControlWidth = (((HorizontalOrVerticalLayoutGroup)obj3).childForceExpandHeight = true);
			((HorizontalOrVerticalLayoutGroup)obj3).childForceExpandWidth = childControlWidth;
			((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_017f: 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)
			//IL_019f: 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);
			}
			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 SetSegmentCount(int allies)
		{
			//IL_0022: 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_005e: Unknown result type (might be due to invalid IL or missing references)
			//IL_006a: Unknown result type (might be due to invalid IL or missing references)
			//IL_006f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0070: Unknown result type (might be due to invalid IL or missing references)
			//IL_0076: Unknown result type (might be due to invalid IL or missing references)
			//IL_0088: Unknown result type (might be due to invalid IL or missing references)
			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;
				((Component)val).gameObject.AddComponent<LayoutElement>().flexibleWidth = 1f;
				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 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 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 = 25.588535f;

		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_00fb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ff: Unknown result type (might be due to invalid IL or missing references)
			//IL_0104: Unknown result type (might be due to invalid IL or missing references)
			//IL_010b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0112: 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_011b: 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_0125: Unknown result type (might be due to invalid IL or missing references)
			//IL_012a: Unknown result type (might be due to invalid IL or missing references)
			//IL_012e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0133: Unknown result type (might be due to invalid IL or missing references)
			//IL_0148: Unknown result type (might be due to invalid IL or missing references)
			//IL_0151: 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)
			List<BuffIconDisplayData> buffIconDisplayData = display.buffIconDisplayData;
			if (buffIconDisplayData == null)
			{
				return;
			}
			float num = 38.894573f;
			int num2 = Mathf.Max(1, Mathf.FloorToInt((RowWidth() + 4.094166f) / num));
			float num3 = 4.605936f;
			bool flag = false;
			foreach (BuffIconDisplayData item3 in buffIconDisplayData)
			{
				BuffIcon buffIconComponent = item3.buffIconComponent;
				if (Shows(buffIconComponent) && Timer(buffIconComponent) != null)
				{
					flag = true;
					break;
				}
			}
			float num4 = num + (flag ? 17.400204f : 0f);
			int num5 = 0;
			Vector2 val = default(Vector2);
			foreach (BuffIconDisplayData item4 in buffIconDisplayData)
			{
				BuffIcon buffIconComponent2 = item4.buffIconComponent;
				if (Shows(buffIconComponent2))
				{
					if (styled.Add(buffIconComponent2))
					{
						StyleIcon(buffIconComponent2);
					}
					((Vector2)(ref val))..ctor((float)(num5 % num2) * num, (float)(num5 / num2) * num4);
					RectTransform rectTransform = buffIconComponent2.rectTransform;
					Vector2 val2 = val + new Vector2(num3, num3);
					Vector2 pivot = rectTransform.pivot;
					Rect val3 = rectTransform.rect;
					Vector2 val4 = val2 + Vector2.Scale(pivot, ((Rect)(ref val3)).size);
					if (rectTransform.anchoredPosition != val4)
					{
						rectTransform.anchoredPosition = val4;
					}
					PlaceSlot(num5, val, StripColor(item4.buffDef));
					(BuffDef buff, int count) tuple = countSources[num5];
					BuffDef item = tuple.buff;
					int item2 = tuple.count;
					BuffDef buffDef = buffIconComponent2.buffDef;
					int buffCount = buffIconComponent2.buffCount;
					if ((Object)(object)item != (Object)(object)buffDef || item2 != buffCount)
					{
						countSources[num5] = (buffIconComponent2.buffDef, buffIconComponent2.buffCount);
						SetText(counts[num5], Count(buffIconComponent2));
					}
					string text = Timer(buffIconComponent2);
					if (!string.Equals(text, timerSources[num5], StringComparison.Ordinal))
					{
						timerSources[num5] = text;
						SetText(timers[num5], (text != null) ? TimerText(text) : "");
					}
					num5++;
				}
			}
			for (int i = num5; i < slots.Count; i++)
			{
				if (Object.op_Implicit((Object)(object)slots[i]) && ((Component)slots[i]).gameObject.activeSelf)
				{
					((Component)slots[i]).gameObject.SetActive(false);
					((Component)counts[i]).gameObject.SetActive(false);
					((Component)timers[i]).gameObject.SetActive(false);
				}
			}
			if (Object.op_Implicit((Object)(object)labels) && ((Transform)labels).GetSiblingIndex() != ((Transform)rect).childCount - 1)
			{
				((Transform)labels).SetAsLastSibling();
			}
		}

		private bool Shows(BuffIcon icon)
		{
			if (Object.op_Implicit((Object)(object)icon) && ((Component)icon).gameObject.activeSelf)
			{
				return (Object)(object)((Component)icon).transform.parent == (Object)(object)rect;
			}
			return false;
		}

		private float RowWidth()
		{
			//IL_003f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0044: Unknown result type (might be due to invalid IL or missing references)
			//IL_005b: 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_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)
			if (!Object.op_Implicit((Object)(object)bounds))
			{
				Rect val = rect.rect;
				return ((Rect)(ref val)).width;
			}
			bounds.GetWorldCorners(corners);
			return ((Transform)rect).InverseTransformPoint(corners[2]).x - ((Transform)rect).InverseTransformPoint(corners[0]).x;
		}

		private static Color StripColor(BuffDef buff)
		{
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_002a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			if (!Object.op_Implicit((Object)(object)buff))
			{
				return Palette.Buff;
			}
			if (buff.isDebuff)
			{
				return Palette.Debuff;
			}
			if (!buff.isCooldown)
			{
				return Palette.Buff;
			}
			return Palette.BuffCooldown;
		}

		private static string Count(BuffIcon icon)
		{
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0032: Invalid comparison between Unknown and I4
			BuffDef buffDef = icon.buffDef;
			if (!Object.op_Implicit((Object)(object)buffDef) || !buffDef.canStack)
			{
				return "";
			}
			int num = icon.buffCount + buffDef.displayOffset;
			if ((int)buffDef.stackingDisplayMethod == 1)
			{
				return num + "%";
			}
			if (num <= 1)
			{
				return "";
			}
			return num.ToString();
		}

		private static string Timer(BuffIcon icon)
		{
			TMP_Text stackCount = (TMP_Text)(object)icon.stackCount;
			if (!Object.op_Implicit((Object)(object)stackCount) || !((Behaviour)stackCount).enabled || stackCount.m_IsTextBackingStringDirty)
			{
				return null;
			}
			string text = stackCount.m_text;
			if (text == null || !text.StartsWith("<size=", StringComparison.Ordinal))
			{
				return null;
			}
			return text;
		}

		private static string TimerText(string written)
		{
			int num = written.IndexOf('>') + 1;
			int num2 = written.IndexOf("</size>", StringComparison.Ordinal);
			if (num <= 0 || num2 <= num)
			{
				return "";
			}
			return written.Substring(num, num2 - num);
		}

		private static void SetText(TMP_Text label, string text)
		{
			if (!string.Equals(label.text, text, StringComparison.Ordinal))
			{
				label.text = text;
			}
		}

		private void StyleIcon(BuffIcon icon)
		{
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0021: Unknown result type (might be due to invalid IL or missing references)
			//IL_0032: Unknown result type (might be due to invalid IL or missing references)
			RectTransform rectTransform = icon.rectTransform;
			recorder.RecordRect(rectTransform);
			Vector2 anchorMin = (rectTransform.anchorMax = Vector2.zero);
			rectTransform.anchorMin = anchorMin;
			rectTransform.sizeDelta = new Vector2(25.588535f, 25.588535f);
			if (Object.op_Implicit((Object)(object)icon.stackCount))
			{
				recorder.Record((TMP_Text)(object)icon.stackCount);
				((TMP_Text)icon.stackCount).alpha = 0f;
			}
		}

		private void PlaceSlot(int index, Vector2 origin, Color stripColor)
		{
			//IL_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0097: 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_00a3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bf: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00dd: 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_00ed: 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_00b6: Unknown result type (might be due to invalid IL or missing references)
			//IL_0103: Unknown result type (might be due to invalid IL or missing references)
			//IL_0108: Unknown result type (might be due to invalid IL or missing references)
			//IL_011c: Unknown result type (might be due to invalid IL or missing references)
			while (slots.Count <= index)
			{
				AddSlot();
			}
			Image val = slots[index];
			if (Object.op_Implicit((Object)(object)val))
			{
				if (!((Component)val).gameObject.activeSelf)
				{
					((Component)val).gameObject.SetActive(true);
					((Component)counts[index]).gameObject.SetActive(true);
					((Component)timers[index]).gameObject.SetActive(true);
				}
				RectTransform rectTransform = ((Graphic)val).rectTransform;
				RectTransform rectTransform2 = counts[index].rectTransform;
				Vector2 val2 = origin + new Vector2(32.753326f, 21.801432f);
				if (rectTransform.anchoredPosition != origin || rectTransform2.anchoredPosition != val2)
				{
					rectTransform.anchoredPosition = origin;
					rectTransform2.anchoredPosition = val2;
					timers[index].rectTransform.anchoredPosition = origin + new Vector2(17.400204f, -14.943706f);
				}
				if (((Graphic)strips[index]).color != stripColor)
				{
					((Graphic)strips[index]).color = stripColor;
				}
			}
		}

		private void AddSlot()
		{
			//IL_0027: Unknown result type (might be due to invalid IL or missing references)
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_002d: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Unknown result type (might be due to invalid IL or missing references)
			//IL_002f: 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_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_003c: 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_003f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0046: Unknown result type (might be due to invalid IL or missing references)
			//IL_0057: 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_0095: 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_009b: 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_00b0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ba: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cf: Unknown result type (might be due to invalid IL or missing references)
			//IL_019d: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c6: 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_020c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0136: Unknown result type (might be due to invalid IL or missing references)
			//IL_0140: Expected O, but got Unknown
			//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_0158: 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_0161: Unknown result type (might be due to invalid IL or missing references)
			//IL_0162: Unknown result type (might be due to invalid IL or missing references)
			//IL_0169: Unknown result type (might be due to invalid IL or missing references)
			//IL_0176: Unknown result type (might be due to invalid IL or missing references)
			GameObject gameObject = ((Component)UiFactory.NewObject("SevenUIBuffSlot", (Transform)(object)rect)).gameObject;
			gameObject.transform.SetAsFirstSibling();
			RectTransform val = (RectTransform)gameObject.transform;
			Vector2 val2 = (val.pivot = Vector2.zero);
			Vector2 anchorMin = (val.anchorMax = val2);
			val.anchorMin = anchorMin;
			val.sizeDelta = new Vector2(34.800407f, 34.800407f);
			Image val4 = gameObject.AddComponent<Image>();
			((Graphic)val4).color = Palette.ItemSlot;
			((Graphic)val4).raycastTarget = false;
			GameObject gameObject2 = ((Component)UiFactory.NewObject("Strip", gameObject.transform)).gameObject;
			RectTransform val5 = (RectTransform)gameObject2.transform;
			val5.anchorMin = Vector2.zero;
			val5.anchorMax = new Vector2(1f, 0f);
			val5.offsetMin = Vector2.zero;
			val5.offsetMax = new Vector2(0f, 2.047083f);
			Image val6 = gameObject2.AddComponent<Image>();
			((Graphic)val6).raycastTarget = false;
			slots.Add(val4);
			strips.Add(val6);
			recorder.Add((Object)(object)gameObject);
			if (!Object.op_Implicit((Object)(object)labels))
			{
				GameObject gameObject3 = ((Component)UiFactory.NewObject("SevenUIBuffLabels", (Transform)(object)rect)).gameObject;
				labels = (RectTransform)gameObject3.transform;
				RectTransform obj = labels;
				RectTransform obj2 = labels;
				val2 = (labels.pivot = Vector2.zero);
				anchorMin = (obj2.anchorMax = val2);
				obj.anchorMin = anchorMin;
				labels.sizeDelta = Vector2.zero;
				recorder.Add((Object)(object)gameObject3);
			}
			TMP_Text val8 = AddLabel("Count", new Vector2(1f, 0.5f), (TextAlignmentOptions)2052, 13.306039f);
			((Component)val8).gameObject.AddComponent<CondensedText>();
			val8.fontStyle = (FontStyles)1;
			((Graphic)val8).color = Palette.Text;
			counts.Add(val8);
			TMP_Text val9 = AddLabel("Timer", new Vector2(0.5f, 0.5f), (TextAlignmentOptions)2050, 12.282497f);
			val9.fontStyle = (FontStyles)1;
			((Graphic)val9).color = Palette.BuffTimer;
			timers.Add(val9);
			timerSources.Add(null);
			countSources.Add((null, -1));
		}

		private TMP_Text AddLabel(string name, Vector2 pivot, TextAlignmentOptions alignment, float size)
		{
			//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_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_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0030: Unknown result type (might be due to invalid IL or missing references)
			//IL_0031: Unknown result type (might be due to invalid IL or missing references)
			//IL_0041: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b7: Unknown result type (might be due to invalid IL or missing references)
			GameObject gameObject = ((Component)UiFactory.NewObject(name, (Transform)(object)labels)).gameObject;
			RectTransform val = (RectTransform)gameObject.transform;
			Vector2 anchorMin = (val.anchorMax = Vector2.zero);
			val.anchorMin = anchorMin;
			val.pivot = pivot;
			val.sizeDelta = new Vector2(69.600815f, 40f);
			TextMeshProUGUI val2 = gameObject.AddComponent<TextMeshProUGUI>();
			BuffIcon val3 = (Object.op_Implicit((Object)(object)display.buffIconPrefab) ? display.buffIconPrefab.GetComponent<BuffIcon>() : null);
			if (Object.op_Implicit((Object)(object)val3) && Object.op_Implicit((Object)(object)val3.stackCount))
			{
				((TMP_Text)val2).font = ((TMP_Text)val3.stackCount).font;
				((TMP_Text)val2).fontSharedMaterial = ((TMP_Text)val3.stackCount).fontSharedMaterial;
			}
			((TMP_Text)val2).fontSize = size;
			((TMP_Text)val2).alignment = alignment;
			((TMP_Text)val2).enableWordWrapping = false;
			((TMP_Text)val2).overflowMode = (TextOverflowModes)0;
			((Graphic)val2).raycastTarget = false;
			return (TMP_Text)(object)val2;
		}
	}
	internal static class CanvasBlend
	{
		public static Color Over(Color tint, Color backdrop)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0006: Invalid comparison between Unknown and I4
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_0026: Unknown result type (might be due to invalid IL or missing references)
			//IL_002c: 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_0042: 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_0044: Unknown result type (might be due to invalid IL or missing references)
			//IL_004a: Unknown result type (might be due to invalid IL or missing references)
			//IL_004f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0052: 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_0077: Unknown result type (might be due to invalid IL or missing references)
			//IL_008e: 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_009a: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a2: Unknown result type (might be due to invalid IL or missing references)
			//IL_0073: Unknown result type (might be due to invalid IL or missing references)
			if ((int)QualitySettings.activeColorSpace != 1 || tint.a <= 0f || tint.a >= 1f)
			{
				return tint;
			}
			Color val = default(Color);
			((Color)(ref val))..ctor(tint.r, tint.g, tint.b, 1f);
			Color val2 = Color.Lerp(backdrop, val, tint.a);
			float num = Luminance(((Color)(ref backdrop)).linear);
			float num2 = Luminance(((Color)(ref val)).linear);
			if (Mathf.Approximately(num2, num))
			{
				return tint;
			}
			float num3 = Mathf.Clamp01((Luminance(((Color)(ref val2)).linear) - num) / (num2 - num));
			return new Color(tint.r, tint.g, tint.b, num3);
		}

		private static float Luminance(Color color)
		{
			//IL_0005: 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_001e: Unknown result type (might be due to invalid IL or missing references)
			return 0.2126f * color.r + 0.7152f * color.g + 0.0722f * color.b;
		}
	}
	internal sealed class ChargeRow : MonoBehaviour
	{
		private const string PercentSuffix = "%";

		public HoldoutZoneController Zone;

		public TMP_Text GameLabel;

		public TMP_Text Label;

		public TMP_Text Percent;

		public RectTransform Fill;

		private string shownSource;

		private int shownPercent = -1;

		private static readonly Regex BracketedPercent = new Regex("\\s*[((]\\s*\\d{1,3}\\s*[%%]\\s*[))]");

		public int ShownPercent => shownPercent;

		private void LateUpdate()
		{
			//IL_006f: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ce: Unknown result type (might be due to invalid IL or missing refere