Decompiled source of Personify v1.3.0

Personify.dll

Decompiled a week ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Resources;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using System.Text;
using DooDesch.AvatarKit;
using DooDesch.UI;
using Il2CppInterop.Runtime.InteropTypes.Arrays;
using Il2CppScheduleOne.AvatarFramework;
using Il2CppScheduleOne.UI.MainMenu;
using Il2CppSystem.Collections.Generic;
using MelonLoader;
using MelonLoader.Utils;
using Microsoft.CodeAnalysis;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using Personify;
using Personify.Editor;
using Personify.Editor.Widgets;
using S1API.Entities.Appearances.AccessoryFields;
using S1API.Entities.Appearances.BodyLayerFields;
using S1API.Entities.Appearances.CustomizationFields;
using S1API.Entities.Appearances.FaceLayerFields;
using S1API.Rendering;
using S1API.UI;
using SideHustle;
using UnityEngine;
using UnityEngine.Events;
using UnityEngine.UI;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: MelonInfo(typeof(Core), "Personify", "1.3.0", "DooDesch", "https://github.com/DooDesch-Mods/ScheduleOne-Personify")]
[assembly: MelonGame("TVGS", "Schedule I")]
[assembly: MelonOptionalDependencies(new string[] { "SideHustle" })]
[assembly: TargetFramework(".NETCoreApp,Version=v6.0", FrameworkDisplayName = ".NET 6.0")]
[assembly: AssemblyCompany("DooDesch")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyCopyright("Copyright © DooDesch")]
[assembly: AssemblyDescription("In-game NPC editor for Schedule I, launched as a Side Hustle gamemode.")]
[assembly: AssemblyFileVersion("1.3.0.0")]
[assembly: AssemblyInformationalVersion("1.3.0+e52e6b8529cd6b4e00197e9560047faf8a24621f")]
[assembly: AssemblyProduct("Personify")]
[assembly: AssemblyTitle("Personify")]
[assembly: NeutralResourcesLanguage("en-US")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.3.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.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableAttribute : Attribute
	{
		public readonly byte[] NullableFlags;

		public NullableAttribute(byte P_0)
		{
			NullableFlags = new byte[1] { P_0 };
		}

		public NullableAttribute(byte[] P_0)
		{
			NullableFlags = P_0;
		}
	}
	[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 DooDesch
{
	internal static class ModVersion
	{
		internal const string Current = "1.3.0";
	}
}
namespace DooDesch.AvatarKit
{
	public static class AvatarDistortion
	{
		public static readonly string[] BoneKeys = new string[9] { "HeadBone", "HipBone", "LeftFootBone", "RightFootBone", "LeftShoulder", "RightShoulder", "MiddleSpine", "LowerSpine", "LowestSpine" };

		public const string FaceMeshKey = "FaceMesh";

		public const string BodyMeshKeyPrefix = "BodyMesh";

		private static Transform BoneByName(Avatar avatar, string key)
		{
			return (Transform)(key switch
			{
				"HeadBone" => avatar.HeadBone, 
				"HipBone" => avatar.HipBone, 
				"LeftFootBone" => avatar.LeftFootBone, 
				"RightFootBone" => avatar.RightFootBone, 
				"LeftShoulder" => avatar.LeftShoulder, 
				"RightShoulder" => avatar.RightShoulder, 
				"MiddleSpine" => avatar.MiddleSpine, 
				"LowerSpine" => avatar.LowerSpine, 
				"LowestSpine" => avatar.LowestSpine, 
				_ => null, 
			});
		}

		public static void Apply(Avatar avatar, IReadOnlyDictionary<string, (Vector3 scale, bool hide)> entries)
		{
			//IL_0083: Unknown result type (might be due to invalid IL or missing references)
			//IL_0075: Unknown result type (might be due to invalid IL or missing references)
			//IL_006e: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)avatar == (Object)null)
			{
				return;
			}
			AvatarEffects component = ((Component)avatar).GetComponent<AvatarEffects>();
			if ((Object)(object)component != (Object)null)
			{
				((Behaviour)component).enabled = entries == null || entries.Count == 0;
			}
			string[] boneKeys = BoneKeys;
			foreach (string key in boneKeys)
			{
				Transform val = BoneByName(avatar, key);
				if (!((Object)(object)val == (Object)null))
				{
					if (entries != null && entries.TryGetValue(key, out (Vector3, bool) value))
					{
						val.localScale = (value.Item2 ? Vector3.zero : value.Item1);
					}
					else
					{
						val.localScale = Vector3.one;
					}
				}
			}
			if ((Object)(object)avatar.FaceMesh != (Object)null)
			{
				(Vector3, bool) value2;
				bool flag = entries != null && entries.TryGetValue("FaceMesh", out value2) && value2.Item2;
				((Renderer)avatar.FaceMesh).enabled = !flag;
			}
			Il2CppReferenceArray<SkinnedMeshRenderer> bodyMeshes = avatar.BodyMeshes;
			if (bodyMeshes == null)
			{
				return;
			}
			for (int j = 0; j < ((Il2CppArrayBase<SkinnedMeshRenderer>)(object)bodyMeshes).Length; j++)
			{
				if (!((Object)(object)((Il2CppArrayBase<SkinnedMeshRenderer>)(object)bodyMeshes)[j] == (Object)null))
				{
					(Vector3, bool) value3;
					bool flag2 = entries != null && entries.TryGetValue("BodyMesh" + j, out value3) && value3.Item2;
					((Renderer)((Il2CppArrayBase<SkinnedMeshRenderer>)(object)bodyMeshes)[j]).enabled = !flag2;
				}
			}
		}
	}
	public static class AvatarLayerSlots
	{
		public const int BodySlots = 8;

		public const int VanillaClearedSlots = 6;

		public const int FaceSlots = 6;

		public const int FixedFaceEntries = 2;

		public const int FreeFaceEntries = 3;

		public const string EmptyFacePath = "Avatar/Layers/None";

		private const string MouthPrefix = "Avatar/Layers/Face/Face_";

		private const string FacialHairPrefix = "Avatar/Layers/Face/FacialHair";

		public static bool IsMouthLayer(string path)
		{
			return path?.StartsWith("Avatar/Layers/Face/Face_", StringComparison.OrdinalIgnoreCase) ?? false;
		}

		public static bool IsFacialHairLayer(string path)
		{
			return path?.StartsWith("Avatar/Layers/Face/FacialHair", StringComparison.OrdinalIgnoreCase) ?? false;
		}

		public static void OrderFaceLayers(List<LayerSetting> list)
		{
			//IL_00ec: 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_0129: Unknown result type (might be due to invalid IL or missing references)
			//IL_010a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0099: 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_0083: Unknown result type (might be due to invalid IL or missing references)
			//IL_0153: Unknown result type (might be due to invalid IL or missing references)
			if (list == null)
			{
				return;
			}
			List<(string, Color)> list2 = new List<(string, Color)>();
			List<(string, Color)> list3 = new List<(string, Color)>();
			List<(string, Color)> list4 = new List<(string, Color)>();
			for (int i = 0; i < list.Count; i++)
			{
				LayerSetting val = list[i];
				string layerPath = val.layerPath;
				if (!string.IsNullOrEmpty(layerPath) && !(layerPath == "Avatar/Layers/None"))
				{
					if (list2.Count == 0 && IsMouthLayer(layerPath))
					{
						list2.Add((layerPath, val.layerTint));
					}
					else if (list3.Count == 0 && IsFacialHairLayer(layerPath))
					{
						list3.Add((layerPath, val.layerTint));
					}
					else
					{
						list4.Add((layerPath, val.layerTint));
					}
				}
			}
			list.Clear();
			list.Add((list2.Count > 0) ? Setting(list2[0].Item1, list2[0].Item2) : Setting("Avatar/Layers/None", Color.white));
			list.Add((list3.Count > 0) ? Setting(list3[0].Item1, list3[0].Item2) : Setting("Avatar/Layers/None", Color.white));
			for (int j = 0; j < list4.Count; j++)
			{
				list.Add(Setting(list4[j].Item1, list4[j].Item2));
			}
		}

		public static List<LayerSetting> TrimFaceToBudget(List<LayerSetting> list, Func<string, int> rank)
		{
			List<LayerSetting> list2 = new List<LayerSetting>();
			if (list == null || rank == null || list.Count <= 5)
			{
				return list2;
			}
			for (int num = CountRenderable(list, 2) - 3; num > 0; num--)
			{
				int num2 = -1;
				int num3 = int.MaxValue;
				for (int i = 2; i < list.Count; i++)
				{
					if (Renders(list[i].layerPath))
					{
						int num4 = rank(list[i].layerPath);
						if (num4 < num3)
						{
							num3 = num4;
							num2 = i;
						}
					}
				}
				if (num2 < 0)
				{
					break;
				}
				list2.Add(list[num2]);
				list.RemoveAt(num2);
			}
			return list2;
		}

		private static LayerSetting Setting(string path, Color tint)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0014: Expected O, but got Unknown
			return new LayerSetting
			{
				layerPath = path,
				layerTint = tint
			};
		}

		public static void LoadAndClean(Avatar avatar, AvatarSettings settings)
		{
			if (!((Object)(object)avatar == (Object)null) && !((Object)(object)settings == (Object)null))
			{
				avatar.LoadAvatarSettings(settings);
				List<LayerSetting> bodyLayerSettings = settings.BodyLayerSettings;
				int used = ((bodyLayerSettings != null && bodyLayerSettings.Count > 6) ? CountRenderable(bodyLayerSettings) : 6);
				ClearStaleBodySlots(avatar, used);
			}
		}

		public static int CountRenderable(List<LayerSetting> list, int startIndex = 0)
		{
			if (list == null)
			{
				return 0;
			}
			int num = 0;
			for (int i = Math.Max(0, startIndex); i < list.Count; i++)
			{
				if (Renders(list[i].layerPath))
				{
					num++;
				}
			}
			return num;
		}

		public static void ClearStaleBodySlots(Avatar avatar, int used)
		{
			//IL_002a: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)avatar == (Object)null || used >= 8)
			{
				return;
			}
			if (used < 0)
			{
				used = 0;
			}
			try
			{
				Il2CppReferenceArray<SkinnedMeshRenderer> bodyMeshes = avatar.BodyMeshes;
				for (int i = used + 1; i <= 8; i++)
				{
					avatar.SetBodyLayer(i, string.Empty, Color.white);
					if (bodyMeshes == null)
					{
						continue;
					}
					for (int j = 0; j < ((Il2CppArrayBase<SkinnedMeshRenderer>)(object)bodyMeshes).Length; j++)
					{
						SkinnedMeshRenderer val = ((Il2CppArrayBase<SkinnedMeshRenderer>)(object)bodyMeshes)[j];
						if ((Object)(object)val != (Object)null && (Object)(object)((Renderer)val).material != (Object)null)
						{
							((Renderer)val).material.SetTexture("_Layer_" + i + "_Normal", (Texture)null);
						}
					}
				}
			}
			catch (Exception)
			{
			}
		}

		public static List<LayerSetting> TrimToBudget(List<LayerSetting> list, Func<string, int> rank, int max = 8)
		{
			List<LayerSetting> list2 = new List<LayerSetting>();
			if (list == null || rank == null || list.Count <= max)
			{
				return list2;
			}
			for (int num = CountRenderable(list) - max; num > 0; num--)
			{
				int num2 = -1;
				int num3 = int.MaxValue;
				for (int i = 0; i < list.Count; i++)
				{
					if (Renders(list[i].layerPath))
					{
						int num4 = rank(list[i].layerPath);
						if (num4 < num3)
						{
							num3 = num4;
							num2 = i;
						}
					}
				}
				if (num2 < 0)
				{
					break;
				}
				list2.Add(list[num2]);
				list.RemoveAt(num2);
			}
			return list2;
		}

		public static bool AddOnce(List<LayerSetting> list, string path, Color tint)
		{
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			//IL_003a: Expected O, but got Unknown
			//IL_0042: Unknown result type (might be due to invalid IL or missing references)
			if (list == null || string.IsNullOrEmpty(path))
			{
				return false;
			}
			for (int i = 0; i < list.Count; i++)
			{
				if (list[i].layerPath == path)
				{
					return false;
				}
			}
			LayerSetting val = new LayerSetting();
			val.layerPath = path;
			val.layerTint = tint;
			list.Add(val);
			return true;
		}

		private static bool Renders(string layerPath)
		{
			if (!string.IsNullOrEmpty(layerPath))
			{
				return Resources.Load(layerPath) != (Object)null;
			}
			return false;
		}
	}
}
namespace DooDesch.UI
{
	public static class Theme
	{
		public static readonly Color BgDeep = new Color(0.043f, 0.047f, 0.063f, 1f);

		public static readonly Color BgBase = new Color(0.063f, 0.071f, 0.094f, 1f);

		public static readonly Color BgPanel = new Color(0.086f, 0.098f, 0.133f, 1f);

		public static readonly Color BgElevated = new Color(0.114f, 0.129f, 0.173f, 1f);

		public static readonly Color SurfaceInput = new Color(0.051f, 0.059f, 0.082f, 1f);

		public static readonly Color Clear = new Color(0f, 0f, 0f, 0f);

		public static readonly Color Hairline = new Color(1f, 1f, 1f, 0.08f);

		public static readonly Color HairlineStrong = new Color(1f, 1f, 1f, 0.14f);

		public static readonly Color ScrimPanel = new Color(0.063f, 0.071f, 0.094f, 0.82f);

		public static readonly Color ScrimRow = new Color(0.114f, 0.129f, 0.173f, 0.72f);

		public static readonly Color TextPrimary = new Color(0.925f, 0.929f, 0.945f, 1f);

		public static readonly Color TextMuted = new Color(0.541f, 0.561f, 0.62f, 1f);

		public static readonly Color TextDisabled = new Color(0.337f, 0.357f, 0.408f, 1f);

		public static readonly Color Accent = new Color(0.369f, 0.416f, 0.824f, 1f);

		public static readonly Color AccentHover = new Color(0.431f, 0.475f, 0.859f, 1f);

		public static readonly Color AccentPressed = new Color(0.298f, 0.341f, 0.737f, 1f);

		public static readonly Color AccentSubtle = new Color(0.125f, 0.133f, 0.227f, 1f);

		public static readonly Color AccentBorder = new Color(0.486f, 0.525f, 0.91f, 1f);

		public static readonly Color Button = new Color(0.2f, 0.212f, 0.263f, 1f);

		public static readonly Color Danger = new Color(0.784f, 0.29f, 0.329f, 1f);

		public static readonly Color DangerText = new Color(0.945f, 0.439f, 0.478f, 1f);

		public static readonly Color DangerSubtle = new Color(0.165f, 0.082f, 0.094f, 1f);

		public static readonly Color Warning = new Color(0.788f, 0.569f, 0.18f, 1f);

		public static readonly Color WarningText = new Color(0.902f, 0.706f, 0.314f, 1f);

		public static readonly Color WarningSubtle = new Color(0.165f, 0.133f, 0.071f, 1f);

		public static readonly Color Success = new Color(0.184f, 0.659f, 0.467f, 1f);

		public static readonly Color SuccessText = new Color(0.373f, 0.816f, 0.604f, 1f);

		public static readonly Color SuccessSubtle = new Color(0.071f, 0.165f, 0.125f, 1f);

		public static readonly Color Info = new Color(0.239f, 0.498f, 0.753f, 1f);

		public static readonly Color InfoText = new Color(0.435f, 0.659f, 0.902f, 1f);

		public static readonly Color InfoSubtle = new Color(0.071f, 0.125f, 0.192f, 1f);

		public const int RadiusMd = 6;

		public const float Fade = 0.12f;

		public const int Caption = 11;

		public const int Body = 13;

		public const int Label = 14;

		public const int H3 = 16;

		public const int H2 = 20;

		public const int H1 = 28;

		private static Sprite _rounded;

		private static Sprite _frame;

		public static Color Lighten(Color c, float amount)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_000d: 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_0027: Unknown result type (might be due to invalid IL or missing references)
			//IL_002d: Unknown result type (might be due to invalid IL or missing references)
			return new Color(Mathf.Clamp01(c.r + amount), Mathf.Clamp01(c.g + amount), Mathf.Clamp01(c.b + amount), c.a);
		}

		public static Color Darken(Color c, float amount)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0003: Unknown result type (might be due to invalid IL or missing references)
			return Lighten(c, 0f - amount);
		}

		public static Color WithAlpha(Color c, float a)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			return new Color(c.r, c.g, c.b, a);
		}

		public static Sprite RoundedSprite()
		{
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			//IL_001f: Expected O, but got Unknown
			//IL_0193: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a2: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c2: Unknown result type (might be due to invalid IL or missing references)
			//IL_0074: Unknown result type (might be due to invalid IL or missing references)
			//IL_0083: 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_00be: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e7: 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_011f: 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_0152: Unknown result type (might be due to invalid IL or missing references)
			//IL_014f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0153: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)_rounded != (Object)null)
			{
				return _rounded;
			}
			Texture2D val = new Texture2D(32, 32, (TextureFormat)5, false);
			((Object)val).hideFlags = (HideFlags)32;
			Color32 val2 = default(Color32);
			((Color32)(ref val2))..ctor((byte)0, (byte)0, (byte)0, (byte)0);
			Color32 val3 = default(Color32);
			((Color32)(ref val3))..ctor(byte.MaxValue, byte.MaxValue, byte.MaxValue, byte.MaxValue);
			for (int i = 0; i < 32; i++)
			{
				for (int j = 0; j < 32; j++)
				{
					bool flag = ((float)j < 6f && (float)i < 6f && Vector2.Distance(new Vector2((float)j, (float)i), new Vector2(6f, 6f)) > 6f) || ((float)j > 25f && (float)i < 6f && Vector2.Distance(new Vector2((float)j, (float)i), new Vector2(25f, 6f)) > 6f) || ((float)j < 6f && (float)i > 25f && Vector2.Distance(new Vector2((float)j, (float)i), new Vector2(6f, 25f)) > 6f) || ((float)j > 25f && (float)i > 25f && Vector2.Distance(new Vector2((float)j, (float)i), new Vector2(25f, 25f)) > 6f);
					val.SetPixel(j, i, Color32.op_Implicit(flag ? val2 : val3));
				}
			}
			val.Apply();
			_rounded = Sprite.Create(val, new Rect(0f, 0f, 32f, 32f), new Vector2(0.5f, 0.5f), 100f, 0u, (SpriteMeshType)0, new Vector4(8f, 8f, 8f, 8f));
			return _rounded;
		}

		public static Sprite FrameSprite()
		{
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			//IL_001f: Expected O, but got Unknown
			//IL_00b8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e7: 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_007a: Unknown result type (might be due to invalid IL or missing references)
			//IL_007e: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)_frame != (Object)null)
			{
				return _frame;
			}
			Texture2D val = new Texture2D(32, 32, (TextureFormat)5, false);
			((Object)val).hideFlags = (HideFlags)32;
			Color32 val2 = default(Color32);
			((Color32)(ref val2))..ctor((byte)0, (byte)0, (byte)0, (byte)0);
			Color32 val3 = default(Color32);
			((Color32)(ref val3))..ctor(byte.MaxValue, byte.MaxValue, byte.MaxValue, byte.MaxValue);
			for (int i = 0; i < 32; i++)
			{
				for (int j = 0; j < 32; j++)
				{
					bool flag = j < 3 || j >= 29 || i < 3 || i >= 29;
					val.SetPixel(j, i, Color32.op_Implicit(flag ? val3 : val2));
				}
			}
			val.Apply();
			_frame = Sprite.Create(val, new Rect(0f, 0f, 32f, 32f), new Vector2(0.5f, 0.5f), 100f, 0u, (SpriteMeshType)0, new Vector4(4f, 4f, 4f, 4f));
			return _frame;
		}
	}
	public static class Interactions
	{
		public static void PolishButtons(Transform root, bool round = true)
		{
			//IL_004b: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)root == (Object)null)
			{
				return;
			}
			Il2CppArrayBase<Button> componentsInChildren = ((Component)root).GetComponentsInChildren<Button>(true);
			if (componentsInChildren == null)
			{
				return;
			}
			for (int i = 0; i < componentsInChildren.Length; i++)
			{
				Button val = componentsInChildren[i];
				if ((Object)(object)val == (Object)null)
				{
					continue;
				}
				Graphic targetGraphic = ((Selectable)val).targetGraphic;
				Image val2 = (Image)(((object)((targetGraphic is Image) ? targetGraphic : null)) ?? ((object)((Component)val).GetComponent<Image>()));
				if (!((Object)(object)val2 == (Object)null) && !(((Graphic)val2).color.a < 0.02f))
				{
					if (round)
					{
						val2.sprite = Theme.RoundedSprite();
						val2.type = (Type)1;
					}
					ApplyStates(val);
				}
			}
		}

		public static void ApplyStates(Button btn)
		{
			//IL_0021: 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_0027: 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_003b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0040: Unknown result type (might be due to invalid IL or missing references)
			//IL_0041: Unknown result type (might be due to invalid IL or missing references)
			//IL_0047: Unknown result type (might be due to invalid IL or missing references)
			//IL_004c: Unknown result type (might be due to invalid IL or missing references)
			//IL_004d: Unknown result type (might be due to invalid IL or missing references)
			//IL_004e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0058: Unknown result type (might be due to invalid IL or missing references)
			//IL_005d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0061: Unknown result type (might be due to invalid IL or missing references)
			//IL_0073: 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_0083: 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_0085: Unknown result type (might be due to invalid IL or missing references)
			//IL_0091: Unknown result type (might be due to invalid IL or missing references)
			//IL_009d: Unknown result type (might be due to invalid IL or missing references)
			//IL_009e: Unknown result type (might be due to invalid IL or missing references)
			//IL_009f: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ab: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ac: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ad: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b9: 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_00bc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00df: Unknown result type (might be due to invalid IL or missing references)
			Graphic targetGraphic = ((Selectable)btn).targetGraphic;
			Image val = (Image)(((object)((targetGraphic is Image) ? targetGraphic : null)) ?? ((object)((Component)btn).GetComponent<Image>()));
			if (!((Object)(object)val == (Object)null))
			{
				Color color = ((Graphic)val).color;
				if (!(color.a < 0.02f))
				{
					Color val2 = Theme.Lighten(color, 0.06f);
					Color target = Theme.Darken(color, 0.06f);
					Color target2 = Color.Lerp(color, Theme.BgPanel, 0.55f);
					target2.a = color.a * 0.6f;
					((Graphic)val).color = val2;
					ColorBlock colors = ((Selectable)btn).colors;
					((ColorBlock)(ref colors)).normalColor = Ratio(color, val2);
					((ColorBlock)(ref colors)).highlightedColor = Color.white;
					((ColorBlock)(ref colors)).pressedColor = Ratio(target, val2);
					((ColorBlock)(ref colors)).selectedColor = Ratio(color, val2);
					((ColorBlock)(ref colors)).disabledColor = Ratio(target2, val2);
					((ColorBlock)(ref colors)).colorMultiplier = 1f;
					((ColorBlock)(ref colors)).fadeDuration = 0.12f;
					((Selectable)btn).colors = colors;
					((Selectable)btn).transition = (Transition)1;
				}
			}
		}

		private static Color Ratio(Color target, Color baseC)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_000d: 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_0026: 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_0039: 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_0059: 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_0072: 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_0085: Unknown result type (might be due to invalid IL or missing references)
			//IL_0098: Unknown result type (might be due to invalid IL or missing references)
			return new Color((baseC.r <= 0.0001f) ? 0f : Mathf.Clamp01(target.r / baseC.r), (baseC.g <= 0.0001f) ? 0f : Mathf.Clamp01(target.g / baseC.g), (baseC.b <= 0.0001f) ? 0f : Mathf.Clamp01(target.b / baseC.b), (baseC.a <= 0.0001f) ? 0f : Mathf.Clamp01(target.a / baseC.a));
		}
	}
	public enum Severity
	{
		Info,
		Success,
		Warning,
		Danger
	}
	public static class Components
	{
		public static void SeverityColors(Severity s, out Color bar, out Color text, out Color bg)
		{
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			//IL_0027: Unknown result type (might be due to invalid IL or missing references)
			//IL_002d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0032: Unknown result type (might be due to invalid IL or missing references)
			//IL_0039: 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_0044: Unknown result type (might be due to invalid IL or missing references)
			//IL_0049: Unknown result type (might be due to invalid IL or missing references)
			//IL_004f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0054: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_0066: Unknown result type (might be due to invalid IL or missing references)
			//IL_006b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0071: 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_007d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0082: Unknown result type (might be due to invalid IL or missing references)
			//IL_0088: Unknown result type (might be due to invalid IL or missing references)
			//IL_008d: 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_0098: Unknown result type (might be due to invalid IL or missing references)
			switch (s)
			{
			case Severity.Success:
				bar = Theme.Success;
				text = Theme.SuccessText;
				bg = Theme.SuccessSubtle;
				break;
			case Severity.Warning:
				bar = Theme.Warning;
				text = Theme.WarningText;
				bg = Theme.WarningSubtle;
				break;
			case Severity.Danger:
				bar = Theme.Danger;
				text = Theme.DangerText;
				bg = Theme.DangerSubtle;
				break;
			default:
				bar = Theme.Info;
				text = Theme.InfoText;
				bg = Theme.InfoSubtle;
				break;
			}
		}

		public static GameObject Divider(Transform parent)
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			GameObject obj = UIFactory.Panel("Divider", parent, Theme.Hairline, (Vector2?)null, (Vector2?)null, false);
			Image component = obj.GetComponent<Image>();
			if ((Object)(object)component != (Object)null)
			{
				((Graphic)component).raycastTarget = false;
			}
			return obj;
		}

		public static float Banner(Transform parent, Severity sev, string text, float y, float height = 30f, float gap = 6f, float inset = 16f)
		{
			//IL_0012: 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_0082: 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_00a8: 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_00cb: 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_0125: Unknown result type (might be due to invalid IL or missing references)
			//IL_013a: Unknown result type (might be due to invalid IL or missing references)
			//IL_014f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0163: 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_01ae: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c3: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d8: 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)
			SeverityColors(sev, out var bar, out var text2, out var bg);
			GameObject val = UIFactory.Panel("banner", parent, bg, (Vector2?)null, (Vector2?)null, false);
			Image component = val.GetComponent<Image>();
			if ((Object)(object)component != (Object)null)
			{
				component.sprite = Theme.RoundedSprite();
				component.type = (Type)1;
				((Graphic)component).raycastTarget = false;
			}
			RectTransform component2 = val.GetComponent<RectTransform>();
			component2.anchorMin = new Vector2(0f, 1f);
			component2.anchorMax = new Vector2(1f, 1f);
			component2.pivot = new Vector2(0.5f, 1f);
			component2.offsetMin = new Vector2(inset, y - height);
			component2.offsetMax = new Vector2(0f - inset, y);
			GameObject obj = UIFactory.Panel("bar", val.transform, bar, (Vector2?)null, (Vector2?)null, false);
			Image component3 = obj.GetComponent<Image>();
			if ((Object)(object)component3 != (Object)null)
			{
				((Graphic)component3).raycastTarget = false;
			}
			RectTransform component4 = obj.GetComponent<RectTransform>();
			component4.anchorMin = new Vector2(0f, 0f);
			component4.anchorMax = new Vector2(0f, 1f);
			component4.pivot = new Vector2(0f, 0.5f);
			component4.offsetMin = new Vector2(0f, 4f);
			component4.offsetMax = new Vector2(3f, -4f);
			Text obj2 = UIFactory.Text("t", text, val.transform, 13, (TextAnchor)3, (FontStyle)0);
			((Graphic)obj2).color = text2;
			((Graphic)obj2).raycastTarget = false;
			obj2.horizontalOverflow = (HorizontalWrapMode)0;
			obj2.verticalOverflow = (VerticalWrapMode)0;
			RectTransform rectTransform = ((Graphic)obj2).rectTransform;
			rectTransform.anchorMin = new Vector2(0f, 0f);
			rectTransform.anchorMax = new Vector2(1f, 1f);
			rectTransform.offsetMin = new Vector2(12f, 0f);
			rectTransform.offsetMax = new Vector2(-8f, 0f);
			return y - (height + gap);
		}

		public static GameObject Segmented(Transform parent, string[] labels, int active, Action<int> onSelect, out Button[] buttons, bool vertical = false, float spacing = 6f, Texture2D[] icons = null)
		{
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			//IL_0018: Expected O, but got Unknown
			//IL_00f7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f0: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = new GameObject("segmented");
			val.transform.SetParent(parent, false);
			val.AddComponent<RectTransform>();
			if (vertical)
			{
				VerticalLayoutGroup obj = val.AddComponent<VerticalLayoutGroup>();
				((HorizontalOrVerticalLayoutGroup)obj).spacing = spacing;
				((HorizontalOrVerticalLayoutGroup)obj).childControlWidth = true;
				((HorizontalOrVerticalLayoutGroup)obj).childControlHeight = true;
				((HorizontalOrVerticalLayoutGroup)obj).childForceExpandWidth = true;
				((HorizontalOrVerticalLayoutGroup)obj).childForceExpandHeight = true;
			}
			else
			{
				HorizontalLayoutGroup obj2 = val.AddComponent<HorizontalLayoutGroup>();
				((HorizontalOrVerticalLayoutGroup)obj2).spacing = spacing;
				((HorizontalOrVerticalLayoutGroup)obj2).childControlWidth = true;
				((HorizontalOrVerticalLayoutGroup)obj2).childControlHeight = true;
				((HorizontalOrVerticalLayoutGroup)obj2).childForceExpandWidth = true;
				((HorizontalOrVerticalLayoutGroup)obj2).childForceExpandHeight = true;
			}
			Button[] btns = (Button[])(object)new Button[labels.Length];
			for (int i = 0; i < labels.Length; i++)
			{
				int idx = i;
				Texture2D val2 = ((icons != null && i < icons.Length) ? icons[i] : null);
				ValueTuple<GameObject, Button, Text> valueTuple = UIFactory.ButtonWithLabel("seg_" + i, ((Object)(object)val2 != (Object)null) ? "" : labels[i], val.transform, (i == active) ? Theme.Accent : Theme.Button, 0f, 0f);
				GameObject item = valueTuple.Item1;
				Button item2 = valueTuple.Item2;
				Text item3 = valueTuple.Item3;
				LayoutElement obj3 = item.AddComponent<LayoutElement>();
				obj3.flexibleWidth = 1f;
				obj3.flexibleHeight = 1f;
				obj3.minHeight = 28f;
				if ((Object)(object)item3 != (Object)null)
				{
					item3.fontSize = 14;
				}
				if ((Object)(object)val2 != (Object)null)
				{
					AddCenterIcon(item.transform, val2, 20f);
				}
				((UnityEvent)item2.onClick).AddListener(UnityAction.op_Implicit((Action)delegate
				{
					SetSegmentedActive(btns, idx);
					onSelect?.Invoke(idx);
				}));
				btns[i] = item2;
			}
			buttons = btns;
			return val;
		}

		public static void AddCenterIcon(Transform parent, Texture2D tex, float size)
		{
			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
			//IL_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)
			//IL_0047: 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_0069: 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)
			//IL_009c: 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 (!((Object)(object)tex == (Object)null))
			{
				GameObject val = new GameObject("icon");
				val.transform.SetParent(parent, false);
				RectTransform obj = val.AddComponent<RectTransform>();
				obj.anchorMin = new Vector2(0.5f, 0.5f);
				obj.anchorMax = new Vector2(0.5f, 0.5f);
				obj.pivot = new Vector2(0.5f, 0.5f);
				obj.sizeDelta = new Vector2(size, size);
				obj.anchoredPosition = Vector2.zero;
				Image obj2 = val.AddComponent<Image>();
				obj2.sprite = Sprite.Create(tex, new Rect(0f, 0f, (float)((Texture)tex).width, (float)((Texture)tex).height), new Vector2(0.5f, 0.5f), 100f);
				obj2.preserveAspect = true;
				((Graphic)obj2).raycastTarget = false;
			}
		}

		public static void ConfirmDialog(Transform canvasRoot, string title, string message, string confirmLabel, Action onConfirm)
		{
			//IL_0033: 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_00e8: Unknown result type (might be due to invalid IL or missing references)
			//IL_013b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0150: Unknown result type (might be due to invalid IL or missing references)
			//IL_0165: 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)
			//IL_018a: Unknown result type (might be due to invalid IL or missing references)
			//IL_019e: 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_01df: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f4: Unknown result type (might be due to invalid IL or missing references)
			//IL_0209: Unknown result type (might be due to invalid IL or missing references)
			//IL_021e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0232: Unknown result type (might be due to invalid IL or missing references)
			//IL_0252: Unknown result type (might be due to invalid IL or missing references)
			//IL_0273: Unknown result type (might be due to invalid IL or missing references)
			//IL_0288: Unknown result type (might be due to invalid IL or missing references)
			//IL_029d: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b2: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c6: Unknown result type (might be due to invalid IL or missing references)
			//IL_02e0: Unknown result type (might be due to invalid IL or missing references)
			//IL_0313: Unknown result type (might be due to invalid IL or missing references)
			//IL_0328: Unknown result type (might be due to invalid IL or missing references)
			//IL_033d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0352: Unknown result type (might be due to invalid IL or missing references)
			//IL_0366: Unknown result type (might be due to invalid IL or missing references)
			//IL_0397: Unknown result type (might be due to invalid IL or missing references)
			//IL_03ce: Unknown result type (might be due to invalid IL or missing references)
			//IL_03e3: Unknown result type (might be due to invalid IL or missing references)
			//IL_03f8: Unknown result type (might be due to invalid IL or missing references)
			//IL_040d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0421: Unknown result type (might be due to invalid IL or missing references)
			GameObject scrim;
			if (!((Object)(object)canvasRoot == (Object)null))
			{
				scrim = UIFactory.Panel("DD_ConfirmScrim", canvasRoot, new Color(0f, 0f, 0f, 0.6f), (Vector2?)null, (Vector2?)null, true);
				scrim.transform.SetAsLastSibling();
				GameObject val = UIFactory.Panel("catcher", scrim.transform, new Color(0f, 0f, 0f, 0.01f), (Vector2?)null, (Vector2?)null, true);
				Button obj = val.AddComponent<Button>();
				((Selectable)obj).targetGraphic = (Graphic)(object)val.GetComponent<Image>();
				((UnityEvent)obj.onClick).AddListener(UnityAction.op_Implicit((Action)delegate
				{
					Close();
				}));
				GameObject val2 = UIFactory.Panel("card", scrim.transform, Theme.BgElevated, (Vector2?)null, (Vector2?)null, false);
				Image component = val2.GetComponent<Image>();
				if ((Object)(object)component != (Object)null)
				{
					component.sprite = Theme.RoundedSprite();
					component.type = (Type)1;
				}
				RectTransform component2 = val2.GetComponent<RectTransform>();
				component2.anchorMin = new Vector2(0.5f, 0.5f);
				component2.anchorMax = new Vector2(0.5f, 0.5f);
				component2.pivot = new Vector2(0.5f, 0.5f);
				component2.sizeDelta = new Vector2(440f, 190f);
				Outline obj2 = val2.AddComponent<Outline>();
				((Shadow)obj2).effectColor = Theme.HairlineStrong;
				((Shadow)obj2).effectDistance = new Vector2(1f, -1f);
				Text obj3 = UIFactory.Text("title", title, val2.transform, 16, (TextAnchor)0, (FontStyle)1);
				((Graphic)obj3).color = Theme.TextPrimary;
				((Graphic)obj3).raycastTarget = false;
				RectTransform rectTransform = ((Graphic)obj3).rectTransform;
				rectTransform.anchorMin = new Vector2(0f, 1f);
				rectTransform.anchorMax = new Vector2(1f, 1f);
				rectTransform.pivot = new Vector2(0.5f, 1f);
				rectTransform.offsetMin = new Vector2(20f, -52f);
				rectTransform.offsetMax = new Vector2(-20f, -18f);
				Text obj4 = UIFactory.Text("msg", message, val2.transform, 13, (TextAnchor)0, (FontStyle)0);
				((Graphic)obj4).color = Theme.TextMuted;
				((Graphic)obj4).raycastTarget = false;
				RectTransform rectTransform2 = ((Graphic)obj4).rectTransform;
				rectTransform2.anchorMin = new Vector2(0f, 1f);
				rectTransform2.anchorMax = new Vector2(1f, 1f);
				rectTransform2.pivot = new Vector2(0.5f, 1f);
				rectTransform2.offsetMin = new Vector2(20f, -120f);
				rectTransform2.offsetMax = new Vector2(-20f, -58f);
				ValueTuple<GameObject, Button, Text> valueTuple = UIFactory.ButtonWithLabel("Cancel", "Cancel", val2.transform, Theme.Button, 140f, 40f);
				GameObject item = valueTuple.Item1;
				Button item2 = valueTuple.Item2;
				RectTransform component3 = item.GetComponent<RectTransform>();
				component3.anchorMin = new Vector2(0f, 0f);
				component3.anchorMax = new Vector2(0f, 0f);
				component3.pivot = new Vector2(0f, 0f);
				component3.anchoredPosition = new Vector2(20f, 18f);
				component3.sizeDelta = new Vector2(140f, 40f);
				((UnityEvent)item2.onClick).AddListener(UnityAction.op_Implicit((Action)delegate
				{
					Close();
				}));
				ValueTuple<GameObject, Button, Text> valueTuple2 = UIFactory.ButtonWithLabel("Confirm", confirmLabel, val2.transform, Theme.Danger, 180f, 40f);
				GameObject item3 = valueTuple2.Item1;
				Button item4 = valueTuple2.Item2;
				RectTransform component4 = item3.GetComponent<RectTransform>();
				component4.anchorMin = new Vector2(1f, 0f);
				component4.anchorMax = new Vector2(1f, 0f);
				component4.pivot = new Vector2(1f, 0f);
				component4.anchoredPosition = new Vector2(-20f, 18f);
				component4.sizeDelta = new Vector2(180f, 40f);
				((UnityEvent)item4.onClick).AddListener(UnityAction.op_Implicit((Action)delegate
				{
					Close();
					onConfirm?.Invoke();
				}));
				Interactions.PolishButtons(val2.transform);
			}
			void Close()
			{
				Object.Destroy((Object)(object)scrim);
			}
		}

		public static void AlertDialog(Transform canvasRoot, string title, string message, string buttonLabel = "OK", Action onDismiss = null)
		{
			//IL_0033: 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_00e8: Unknown result type (might be due to invalid IL or missing references)
			//IL_013b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0150: Unknown result type (might be due to invalid IL or missing references)
			//IL_0165: 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)
			//IL_018a: Unknown result type (might be due to invalid IL or missing references)
			//IL_019e: 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_01df: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f4: Unknown result type (might be due to invalid IL or missing references)
			//IL_0209: Unknown result type (might be due to invalid IL or missing references)
			//IL_021e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0232: Unknown result type (might be due to invalid IL or missing references)
			//IL_0252: Unknown result type (might be due to invalid IL or missing references)
			//IL_0273: Unknown result type (might be due to invalid IL or missing references)
			//IL_0288: Unknown result type (might be due to invalid IL or missing references)
			//IL_029d: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b2: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c6: Unknown result type (might be due to invalid IL or missing references)
			//IL_02dc: Unknown result type (might be due to invalid IL or missing references)
			//IL_030f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0324: Unknown result type (might be due to invalid IL or missing references)
			//IL_0339: Unknown result type (might be due to invalid IL or missing references)
			//IL_034e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0362: Unknown result type (might be due to invalid IL or missing references)
			GameObject scrim;
			if (!((Object)(object)canvasRoot == (Object)null))
			{
				scrim = UIFactory.Panel("DD_AlertScrim", canvasRoot, new Color(0f, 0f, 0f, 0.6f), (Vector2?)null, (Vector2?)null, true);
				scrim.transform.SetAsLastSibling();
				GameObject val = UIFactory.Panel("catcher", scrim.transform, new Color(0f, 0f, 0f, 0.01f), (Vector2?)null, (Vector2?)null, true);
				Button obj = val.AddComponent<Button>();
				((Selectable)obj).targetGraphic = (Graphic)(object)val.GetComponent<Image>();
				((UnityEvent)obj.onClick).AddListener(UnityAction.op_Implicit((Action)delegate
				{
					Close();
				}));
				GameObject val2 = UIFactory.Panel("card", scrim.transform, Theme.BgElevated, (Vector2?)null, (Vector2?)null, false);
				Image component = val2.GetComponent<Image>();
				if ((Object)(object)component != (Object)null)
				{
					component.sprite = Theme.RoundedSprite();
					component.type = (Type)1;
				}
				RectTransform component2 = val2.GetComponent<RectTransform>();
				component2.anchorMin = new Vector2(0.5f, 0.5f);
				component2.anchorMax = new Vector2(0.5f, 0.5f);
				component2.pivot = new Vector2(0.5f, 0.5f);
				component2.sizeDelta = new Vector2(460f, 210f);
				Outline obj2 = val2.AddComponent<Outline>();
				((Shadow)obj2).effectColor = Theme.HairlineStrong;
				((Shadow)obj2).effectDistance = new Vector2(1f, -1f);
				Text obj3 = UIFactory.Text("title", title, val2.transform, 16, (TextAnchor)0, (FontStyle)1);
				((Graphic)obj3).color = Theme.TextPrimary;
				((Graphic)obj3).raycastTarget = false;
				RectTransform rectTransform = ((Graphic)obj3).rectTransform;
				rectTransform.anchorMin = new Vector2(0f, 1f);
				rectTransform.anchorMax = new Vector2(1f, 1f);
				rectTransform.pivot = new Vector2(0.5f, 1f);
				rectTransform.offsetMin = new Vector2(20f, -52f);
				rectTransform.offsetMax = new Vector2(-20f, -18f);
				Text obj4 = UIFactory.Text("msg", message, val2.transform, 13, (TextAnchor)0, (FontStyle)0);
				((Graphic)obj4).color = Theme.TextMuted;
				((Graphic)obj4).raycastTarget = false;
				RectTransform rectTransform2 = ((Graphic)obj4).rectTransform;
				rectTransform2.anchorMin = new Vector2(0f, 1f);
				rectTransform2.anchorMax = new Vector2(1f, 1f);
				rectTransform2.pivot = new Vector2(0.5f, 1f);
				rectTransform2.offsetMin = new Vector2(20f, -150f);
				rectTransform2.offsetMax = new Vector2(-20f, -58f);
				ValueTuple<GameObject, Button, Text> valueTuple = UIFactory.ButtonWithLabel("Dismiss", buttonLabel, val2.transform, Theme.Button, 180f, 40f);
				GameObject item = valueTuple.Item1;
				Button item2 = valueTuple.Item2;
				RectTransform component3 = item.GetComponent<RectTransform>();
				component3.anchorMin = new Vector2(0.5f, 0f);
				component3.anchorMax = new Vector2(0.5f, 0f);
				component3.pivot = new Vector2(0.5f, 0f);
				component3.anchoredPosition = new Vector2(0f, 18f);
				component3.sizeDelta = new Vector2(180f, 40f);
				((UnityEvent)item2.onClick).AddListener(UnityAction.op_Implicit((Action)delegate
				{
					Close();
				}));
				Interactions.PolishButtons(val2.transform);
			}
			void Close()
			{
				Object.Destroy((Object)(object)scrim);
				onDismiss?.Invoke();
			}
		}

		public static void ChoiceDialog(Transform canvasRoot, string title, string message, IReadOnlyList<string> items, params (string Label, Color Color, Action OnClick)[] choices)
		{
			//IL_002b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0083: Unknown result type (might be due to invalid IL or missing references)
			//IL_014e: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a8: Unknown result type (might be due to invalid IL or missing references)
			//IL_01bd: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d2: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e3: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f5: Unknown result type (might be due to invalid IL or missing references)
			//IL_0209: 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)
			//IL_024b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0260: Unknown result type (might be due to invalid IL or missing references)
			//IL_0275: Unknown result type (might be due to invalid IL or missing references)
			//IL_028a: Unknown result type (might be due to invalid IL or missing references)
			//IL_029e: Unknown result type (might be due to invalid IL or missing references)
			//IL_02bf: Unknown result type (might be due to invalid IL or missing references)
			//IL_02e0: Unknown result type (might be due to invalid IL or missing references)
			//IL_02f5: Unknown result type (might be due to invalid IL or missing references)
			//IL_030a: Unknown result type (might be due to invalid IL or missing references)
			//IL_031f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0333: Unknown result type (might be due to invalid IL or missing references)
			//IL_0354: Unknown result type (might be due to invalid IL or missing references)
			//IL_062f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0666: Unknown result type (might be due to invalid IL or missing references)
			//IL_067b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0690: Unknown result type (might be due to invalid IL or missing references)
			//IL_06a9: Unknown result type (might be due to invalid IL or missing references)
			//IL_06bb: Unknown result type (might be due to invalid IL or missing references)
			//IL_03aa: Unknown result type (might be due to invalid IL or missing references)
			//IL_03bf: Unknown result type (might be due to invalid IL or missing references)
			//IL_03d4: Unknown result type (might be due to invalid IL or missing references)
			//IL_03ec: Unknown result type (might be due to invalid IL or missing references)
			//IL_0400: Unknown result type (might be due to invalid IL or missing references)
			//IL_0555: Unknown result type (might be due to invalid IL or missing references)
			//IL_0588: Unknown result type (might be due to invalid IL or missing references)
			//IL_059d: Unknown result type (might be due to invalid IL or missing references)
			//IL_05b2: Unknown result type (might be due to invalid IL or missing references)
			//IL_05cb: Unknown result type (might be due to invalid IL or missing references)
			//IL_05dd: Unknown result type (might be due to invalid IL or missing references)
			//IL_042c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0492: Unknown result type (might be due to invalid IL or missing references)
			//IL_04a9: Unknown result type (might be due to invalid IL or missing references)
			//IL_04b4: Unknown result type (might be due to invalid IL or missing references)
			//IL_04c9: Unknown result type (might be due to invalid IL or missing references)
			//IL_04dd: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)canvasRoot == (Object)null)
			{
				return;
			}
			GameObject scrim = UIFactory.Panel("DD_ChoiceScrim", canvasRoot, new Color(0f, 0f, 0f, 0.6f), (Vector2?)null, (Vector2?)null, true);
			scrim.transform.SetAsLastSibling();
			GameObject val = UIFactory.Panel("catcher", scrim.transform, new Color(0f, 0f, 0f, 0.01f), (Vector2?)null, (Vector2?)null, true);
			Button obj = val.AddComponent<Button>();
			((Selectable)obj).targetGraphic = (Graphic)(object)val.GetComponent<Image>();
			((UnityEvent)obj.onClick).AddListener(UnityAction.op_Implicit((Action)delegate
			{
				Close();
			}));
			int num = items?.Count ?? 0;
			float num2 = ((num > 0) ? ((float)Mathf.Min(num, 7) * 24f + 12f) : 0f);
			int num3 = ((choices != null) ? choices.Length : 0) + 1;
			float num4 = 108f + ((num2 > 0f) ? (num2 + 10f) : 0f);
			float num5 = num4 + (float)num3 * 46f + 12f;
			GameObject val2 = UIFactory.Panel("card", scrim.transform, Theme.BgElevated, (Vector2?)null, (Vector2?)null, false);
			Image component = val2.GetComponent<Image>();
			if ((Object)(object)component != (Object)null)
			{
				component.sprite = Theme.RoundedSprite();
				component.type = (Type)1;
			}
			RectTransform component2 = val2.GetComponent<RectTransform>();
			component2.anchorMin = new Vector2(0.5f, 0.5f);
			component2.anchorMax = new Vector2(0.5f, 0.5f);
			component2.pivot = new Vector2(0.5f, 0.5f);
			component2.sizeDelta = new Vector2(480f, num5);
			Outline obj2 = val2.AddComponent<Outline>();
			((Shadow)obj2).effectColor = Theme.HairlineStrong;
			((Shadow)obj2).effectDistance = new Vector2(1f, -1f);
			Text obj3 = UIFactory.Text("title", title, val2.transform, 16, (TextAnchor)0, (FontStyle)1);
			((Graphic)obj3).color = Theme.TextPrimary;
			((Graphic)obj3).raycastTarget = false;
			RectTransform rectTransform = ((Graphic)obj3).rectTransform;
			rectTransform.anchorMin = new Vector2(0f, 1f);
			rectTransform.anchorMax = new Vector2(1f, 1f);
			rectTransform.pivot = new Vector2(0.5f, 1f);
			rectTransform.offsetMin = new Vector2(20f, -52f);
			rectTransform.offsetMax = new Vector2(-20f, -18f);
			Text obj4 = UIFactory.Text("msg", message, val2.transform, 13, (TextAnchor)0, (FontStyle)0);
			((Graphic)obj4).color = Theme.TextMuted;
			((Graphic)obj4).raycastTarget = false;
			RectTransform rectTransform2 = ((Graphic)obj4).rectTransform;
			rectTransform2.anchorMin = new Vector2(0f, 1f);
			rectTransform2.anchorMax = new Vector2(1f, 1f);
			rectTransform2.pivot = new Vector2(0.5f, 1f);
			rectTransform2.offsetMin = new Vector2(20f, -100f);
			rectTransform2.offsetMax = new Vector2(-20f, -56f);
			if (num2 > 0f)
			{
				GameObject obj5 = UIFactory.Panel("items", val2.transform, Theme.SurfaceInput, (Vector2?)null, (Vector2?)null, false);
				Image component3 = obj5.GetComponent<Image>();
				if ((Object)(object)component3 != (Object)null)
				{
					component3.sprite = Theme.RoundedSprite();
					component3.type = (Type)1;
				}
				RectTransform component4 = obj5.GetComponent<RectTransform>();
				component4.anchorMin = new Vector2(0f, 1f);
				component4.anchorMax = new Vector2(1f, 1f);
				component4.pivot = new Vector2(0.5f, 1f);
				component4.offsetMin = new Vector2(20f, 0f - (108f + num2));
				component4.offsetMax = new Vector2(-20f, -108f);
				ScrollRect scroll;
				RectTransform val3 = ScrollList(obj5.transform, out scroll, 0f);
				for (int num6 = 0; num6 < num; num6++)
				{
					GameObject val4 = UIFactory.Panel("item", (Transform)(object)val3, Theme.Clear, (Vector2?)null, (Vector2?)null, false);
					LayoutElement obj6 = val4.AddComponent<LayoutElement>();
					obj6.minHeight = 24f;
					obj6.preferredHeight = 24f;
					obj6.flexibleWidth = 1f;
					Text obj7 = UIFactory.Text("text", items[num6], val4.transform, 13, (TextAnchor)3, (FontStyle)0);
					((Graphic)obj7).color = Theme.TextPrimary;
					((Graphic)obj7).raycastTarget = false;
					RectTransform rectTransform3 = ((Graphic)obj7).rectTransform;
					rectTransform3.anchorMin = Vector2.zero;
					rectTransform3.anchorMax = Vector2.one;
					rectTransform3.offsetMin = new Vector2(10f, 0f);
					rectTransform3.offsetMax = new Vector2(-10f, 0f);
				}
			}
			float num7 = num4;
			if (choices != null)
			{
				foreach ((string, Color, Action) tuple in choices)
				{
					(string Label, Color Color, Action OnClick) c = tuple;
					ValueTuple<GameObject, Button, Text> valueTuple = UIFactory.ButtonWithLabel(c.Label, c.Label, val2.transform, c.Color, 440f, 40f);
					GameObject item = valueTuple.Item1;
					Button item2 = valueTuple.Item2;
					RectTransform component5 = item.GetComponent<RectTransform>();
					component5.anchorMin = new Vector2(0f, 1f);
					component5.anchorMax = new Vector2(1f, 1f);
					component5.pivot = new Vector2(0.5f, 1f);
					component5.offsetMin = new Vector2(20f, 0f - (num7 + 40f));
					component5.offsetMax = new Vector2(-20f, 0f - num7);
					((UnityEvent)item2.onClick).AddListener(UnityAction.op_Implicit((Action)delegate
					{
						Close();
						c.OnClick?.Invoke();
					}));
					num7 += 46f;
				}
			}
			ValueTuple<GameObject, Button, Text> valueTuple2 = UIFactory.ButtonWithLabel("Cancel", "Cancel", val2.transform, Theme.Button, 440f, 40f);
			GameObject item3 = valueTuple2.Item1;
			Button item4 = valueTuple2.Item2;
			RectTransform component6 = item3.GetComponent<RectTransform>();
			component6.anchorMin = new Vector2(0f, 1f);
			component6.anchorMax = new Vector2(1f, 1f);
			component6.pivot = new Vector2(0.5f, 1f);
			component6.offsetMin = new Vector2(20f, 0f - (num7 + 40f));
			component6.offsetMax = new Vector2(-20f, 0f - num7);
			((UnityEvent)item4.onClick).AddListener(UnityAction.op_Implicit((Action)delegate
			{
				Close();
			}));
			Interactions.PolishButtons(val2.transform);
			void Close()
			{
				Object.Destroy((Object)(object)scrim);
			}
		}

		public static GameObject ProgressBar(Transform parent, out Image fill, float height = 8f)
		{
			//IL_0006: 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_0058: 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_00b8: 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_00d8: 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)
			GameObject val = UIFactory.Panel("DD_Progress", parent, Theme.AccentSubtle, (Vector2?)null, (Vector2?)null, false);
			Image component = val.GetComponent<Image>();
			if ((Object)(object)component != (Object)null)
			{
				component.sprite = Theme.RoundedSprite();
				component.type = (Type)1;
			}
			RectTransform component2 = val.GetComponent<RectTransform>();
			component2.sizeDelta = new Vector2(component2.sizeDelta.x, height);
			GameObject val2 = UIFactory.Panel("fill", val.transform, Theme.Accent, (Vector2?)null, (Vector2?)null, false);
			fill = val2.GetComponent<Image>();
			if ((Object)(object)fill != (Object)null)
			{
				fill.sprite = Theme.RoundedSprite();
				fill.type = (Type)1;
			}
			RectTransform component3 = val2.GetComponent<RectTransform>();
			component3.anchorMin = Vector2.zero;
			component3.anchorMax = new Vector2(0f, 1f);
			component3.offsetMin = Vector2.zero;
			component3.offsetMax = Vector2.zero;
			return val;
		}

		public static void SetProgressBar(Image fill, float fraction01)
		{
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			if (!((Object)(object)fill == (Object)null))
			{
				((Graphic)fill).rectTransform.anchorMax = new Vector2(Mathf.Clamp01(fraction01), 1f);
			}
		}

		public static GameObject CountdownDialog(Transform canvasRoot, string title, string message, string confirmLabel, string cancelLabel, Action onConfirm, Action onCancel, out Text countdownLabel, Action onDismiss = null)
		{
			//IL_0047: 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_00b7: Unknown result type (might be due to invalid IL or missing references)
			//IL_0165: 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_018f: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a3: 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_01c8: 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_020c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0222: Unknown result type (might be due to invalid IL or missing references)
			//IL_0238: Unknown result type (might be due to invalid IL or missing references)
			//IL_024e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0264: Unknown result type (might be due to invalid IL or missing references)
			//IL_0284: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ba: Unknown result type (might be due to invalid IL or missing references)
			//IL_02cf: Unknown result type (might be due to invalid IL or missing references)
			//IL_02e4: Unknown result type (might be due to invalid IL or missing references)
			//IL_02f8: Unknown result type (might be due to invalid IL or missing references)
			//IL_031f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0343: Unknown result type (might be due to invalid IL or missing references)
			//IL_0358: Unknown result type (might be due to invalid IL or missing references)
			//IL_036d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0382: Unknown result type (might be due to invalid IL or missing references)
			//IL_0396: Unknown result type (might be due to invalid IL or missing references)
			//IL_03b2: Unknown result type (might be due to invalid IL or missing references)
			//IL_03e5: Unknown result type (might be due to invalid IL or missing references)
			//IL_03fa: Unknown result type (might be due to invalid IL or missing references)
			//IL_040f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0424: Unknown result type (might be due to invalid IL or missing references)
			//IL_0438: Unknown result type (might be due to invalid IL or missing references)
			//IL_0469: Unknown result type (might be due to invalid IL or missing references)
			//IL_04a0: Unknown result type (might be due to invalid IL or missing references)
			//IL_04b5: Unknown result type (might be due to invalid IL or missing references)
			//IL_04ca: Unknown result type (might be due to invalid IL or missing references)
			//IL_04df: Unknown result type (might be due to invalid IL or missing references)
			//IL_04f3: Unknown result type (might be due to invalid IL or missing references)
			//IL_0535: Unknown result type (might be due to invalid IL or missing references)
			//IL_058d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0594: Unknown result type (might be due to invalid IL or missing references)
			//IL_05a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_05bb: Unknown result type (might be due to invalid IL or missing references)
			//IL_05cf: Unknown result type (might be due to invalid IL or missing references)
			//IL_0602: Unknown result type (might be due to invalid IL or missing references)
			countdownLabel = null;
			if ((Object)(object)canvasRoot == (Object)null)
			{
				return null;
			}
			GameObject val = UIFactory.Panel("DD_CountdownScrim", canvasRoot, new Color(0f, 0f, 0f, 0.6f), (Vector2?)null, (Vector2?)null, true);
			val.transform.SetAsLastSibling();
			Canvas obj = val.AddComponent<Canvas>();
			obj.overrideSorting = true;
			obj.sortingOrder = 30000;
			val.AddComponent<GraphicRaycaster>();
			if (onDismiss != null)
			{
				GameObject val2 = UIFactory.Panel("catcher", val.transform, new Color(0f, 0f, 0f, 0.01f), (Vector2?)null, (Vector2?)null, true);
				Button obj2 = val2.AddComponent<Button>();
				((Selectable)obj2).targetGraphic = (Graphic)(object)val2.GetComponent<Image>();
				((UnityEvent)obj2.onClick).AddListener(UnityAction.op_Implicit((Action)delegate
				{
					try
					{
						onDismiss();
					}
					catch
					{
					}
				}));
			}
			GameObject val3 = UIFactory.Panel("card", val.transform, Theme.BgElevated, (Vector2?)null, (Vector2?)null, false);
			Image component = val3.GetComponent<Image>();
			if ((Object)(object)component != (Object)null)
			{
				component.sprite = Theme.RoundedSprite();
				component.type = (Type)1;
			}
			RectTransform component2 = val3.GetComponent<RectTransform>();
			component2.anchorMin = new Vector2(0.5f, 0.5f);
			component2.anchorMax = new Vector2(0.5f, 0.5f);
			component2.pivot = new Vector2(0.5f, 0.5f);
			component2.sizeDelta = new Vector2(460f, 220f);
			Outline obj3 = val3.AddComponent<Outline>();
			((Shadow)obj3).effectColor = Theme.HairlineStrong;
			((Shadow)obj3).effectDistance = new Vector2(1f, -1f);
			Text obj4 = UIFactory.Text("title", title, val3.transform, 16, (TextAnchor)0, (FontStyle)1);
			((Graphic)obj4).color = Theme.TextPrimary;
			((Graphic)obj4).raycastTarget = false;
			RectTransform rectTransform = ((Graphic)obj4).rectTransform;
			rectTransform.anchorMin = new Vector2(0f, 1f);
			rectTransform.anchorMax = new Vector2(1f, 1f);
			rectTransform.pivot = new Vector2(0.5f, 1f);
			rectTransform.offsetMin = new Vector2(20f, -52f);
			rectTransform.offsetMax = new Vector2(-20f, -18f);
			Text obj5 = UIFactory.Text("msg", message, val3.transform, 13, (TextAnchor)0, (FontStyle)0);
			((Graphic)obj5).color = Theme.TextMuted;
			((Graphic)obj5).raycastTarget = false;
			RectTransform rectTransform2 = ((Graphic)obj5).rectTransform;
			rectTransform2.anchorMin = new Vector2(0f, 1f);
			rectTransform2.anchorMax = new Vector2(1f, 1f);
			rectTransform2.pivot = new Vector2(0.5f, 1f);
			rectTransform2.offsetMin = new Vector2(20f, -116f);
			rectTransform2.offsetMax = new Vector2(-20f, -56f);
			Text val4 = UIFactory.Text("countdown", "", val3.transform, 13, (TextAnchor)0, (FontStyle)1);
			((Graphic)val4).color = Theme.TextPrimary;
			((Graphic)val4).raycastTarget = false;
			RectTransform rectTransform3 = ((Graphic)val4).rectTransform;
			rectTransform3.anchorMin = new Vector2(0f, 1f);
			rectTransform3.anchorMax = new Vector2(1f, 1f);
			rectTransform3.pivot = new Vector2(0.5f, 1f);
			rectTransform3.offsetMin = new Vector2(20f, -148f);
			rectTransform3.offsetMax = new Vector2(-20f, -118f);
			countdownLabel = val4;
			ValueTuple<GameObject, Button, Text> valueTuple = UIFactory.ButtonWithLabel("Cancel", cancelLabel, val3.transform, Theme.Button, 140f, 40f);
			GameObject item = valueTuple.Item1;
			Button item2 = valueTuple.Item2;
			RectTransform component3 = item.GetComponent<RectTransform>();
			component3.anchorMin = new Vector2(0f, 0f);
			component3.anchorMax = new Vector2(0f, 0f);
			component3.pivot = new Vector2(0f, 0f);
			component3.anchoredPosition = new Vector2(20f, 18f);
			component3.sizeDelta = new Vector2(140f, 40f);
			((UnityEvent)item2.onClick).AddListener(UnityAction.op_Implicit((Action)delegate
			{
				try
				{
					onCancel?.Invoke();
				}
				catch
				{
				}
			}));
			ValueTuple<GameObject, Button, Text> valueTuple2 = UIFactory.ButtonWithLabel("Confirm", confirmLabel, val3.transform, Theme.Accent, 180f, 40f);
			GameObject item3 = valueTuple2.Item1;
			Button item4 = valueTuple2.Item2;
			RectTransform component4 = item3.GetComponent<RectTransform>();
			component4.anchorMin = new Vector2(1f, 0f);
			component4.anchorMax = new Vector2(1f, 0f);
			component4.pivot = new Vector2(1f, 0f);
			component4.anchoredPosition = new Vector2(-20f, 18f);
			component4.sizeDelta = new Vector2(180f, 40f);
			((UnityEvent)item4.onClick).AddListener(UnityAction.op_Implicit((Action)delegate
			{
				try
				{
					onConfirm?.Invoke();
				}
				catch
				{
				}
			}));
			if (onDismiss != null)
			{
				var (val5, val6, val7) = UIFactory.ButtonWithLabel("Dismiss", "X", val3.transform, Theme.Button, 30f, 30f);
				if ((Object)(object)val7 != (Object)null)
				{
					val7.fontSize = 18;
				}
				RectTransform component5 = val5.GetComponent<RectTransform>();
				Vector2 val8 = default(Vector2);
				((Vector2)(ref val8))..ctor(1f, 1f);
				component5.anchorMax = val8;
				component5.anchorMin = val8;
				component5.pivot = new Vector2(1f, 1f);
				component5.anchoredPosition = new Vector2(-10f, -10f);
				component5.sizeDelta = new Vector2(30f, 30f);
				((UnityEvent)val6.onClick).AddListener(UnityAction.op_Implicit((Action)delegate
				{
					try
					{
						onDismiss();
					}
					catch
					{
					}
				}));
				rectTransform.offsetMax = new Vector2(-44f, -18f);
			}
			Interactions.PolishButtons(val3.transform);
			return val;
		}

		public static void PromptDialog(Transform canvasRoot, string title, string message, string placeholder, string confirmLabel, Func<string, string> onConfirm)
		{
			//IL_0033: 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_00e8: Unknown result type (might be due to invalid IL or missing references)
			//IL_013b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0150: Unknown result type (might be due to invalid IL or missing references)
			//IL_0165: 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)
			//IL_018a: Unknown result type (might be due to invalid IL or missing references)
			//IL_019e: 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_01df: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f4: Unknown result type (might be due to invalid IL or missing references)
			//IL_0209: Unknown result type (might be due to invalid IL or missing references)
			//IL_021e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0232: Unknown result type (might be due to invalid IL or missing references)
			//IL_0252: Unknown result type (might be due to invalid IL or missing references)
			//IL_0281: Unknown result type (might be due to invalid IL or missing references)
			//IL_0296: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ab: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c0: Unknown result type (might be due to invalid IL or missing references)
			//IL_02d4: Unknown result type (might be due to invalid IL or missing references)
			//IL_030f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0324: Unknown result type (might be due to invalid IL or missing references)
			//IL_0339: Unknown result type (might be due to invalid IL or missing references)
			//IL_034e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0362: Unknown result type (might be due to invalid IL or missing references)
			//IL_0391: Unknown result type (might be due to invalid IL or missing references)
			//IL_03bd: Unknown result type (might be due to invalid IL or missing references)
			//IL_03d2: Unknown result type (might be due to invalid IL or missing references)
			//IL_03e7: Unknown result type (might be due to invalid IL or missing references)
			//IL_03fc: Unknown result type (might be due to invalid IL or missing references)
			//IL_0410: Unknown result type (might be due to invalid IL or missing references)
			//IL_042a: Unknown result type (might be due to invalid IL or missing references)
			//IL_045d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0472: Unknown result type (might be due to invalid IL or missing references)
			//IL_0487: Unknown result type (might be due to invalid IL or missing references)
			//IL_049c: Unknown result type (might be due to invalid IL or missing references)
			//IL_04b0: Unknown result type (might be due to invalid IL or missing references)
			//IL_04e2: Unknown result type (might be due to invalid IL or missing references)
			//IL_0519: Unknown result type (might be due to invalid IL or missing references)
			//IL_052e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0543: Unknown result type (might be due to invalid IL or missing references)
			//IL_0558: Unknown result type (might be due to invalid IL or missing references)
			//IL_056c: Unknown result type (might be due to invalid IL or missing references)
			GameObject scrim;
			InputField input;
			Text err;
			if (!((Object)(object)canvasRoot == (Object)null))
			{
				scrim = UIFactory.Panel("DD_PromptScrim", canvasRoot, new Color(0f, 0f, 0f, 0.6f), (Vector2?)null, (Vector2?)null, true);
				scrim.transform.SetAsLastSibling();
				GameObject val = UIFactory.Panel("catcher", scrim.transform, new Color(0f, 0f, 0f, 0.01f), (Vector2?)null, (Vector2?)null, true);
				Button obj = val.AddComponent<Button>();
				((Selectable)obj).targetGraphic = (Graphic)(object)val.GetComponent<Image>();
				((UnityEvent)obj.onClick).AddListener(UnityAction.op_Implicit((Action)delegate
				{
					Close();
				}));
				GameObject val2 = UIFactory.Panel("card", scrim.transform, Theme.BgElevated, (Vector2?)null, (Vector2?)null, false);
				Image component = val2.GetComponent<Image>();
				if ((Object)(object)component != (Object)null)
				{
					component.sprite = Theme.RoundedSprite();
					component.type = (Type)1;
				}
				RectTransform component2 = val2.GetComponent<RectTransform>();
				component2.anchorMin = new Vector2(0.5f, 0.5f);
				component2.anchorMax = new Vector2(0.5f, 0.5f);
				component2.pivot = new Vector2(0.5f, 0.5f);
				component2.sizeDelta = new Vector2(460f, 250f);
				Outline obj2 = val2.AddComponent<Outline>();
				((Shadow)obj2).effectColor = Theme.HairlineStrong;
				((Shadow)obj2).effectDistance = new Vector2(1f, -1f);
				Text obj3 = UIFactory.Text("title", title, val2.transform, 16, (TextAnchor)0, (FontStyle)1);
				((Graphic)obj3).color = Theme.TextPrimary;
				((Graphic)obj3).raycastTarget = false;
				RectTransform rectTransform = ((Graphic)obj3).rectTransform;
				rectTransform.anchorMin = new Vector2(0f, 1f);
				rectTransform.anchorMax = new Vector2(1f, 1f);
				rectTransform.pivot = new Vector2(0.5f, 1f);
				rectTransform.offsetMin = new Vector2(20f, -52f);
				rectTransform.offsetMax = new Vector2(-20f, -18f);
				Text obj4 = UIFactory.Text("msg", message, val2.transform, 13, (TextAnchor)0, (FontStyle)0);
				((Graphic)obj4).color = Theme.TextMuted;
				((Graphic)obj4).raycastTarget = false;
				obj4.horizontalOverflow = (HorizontalWrapMode)0;
				obj4.verticalOverflow = (VerticalWrapMode)0;
				RectTransform rectTransform2 = ((Graphic)obj4).rectTransform;
				rectTransform2.anchorMin = new Vector2(0f, 1f);
				rectTransform2.anchorMax = new Vector2(1f, 1f);
				rectTransform2.pivot = new Vector2(0.5f, 1f);
				rectTransform2.offsetMin = new Vector2(20f, -98f);
				rectTransform2.offsetMax = new Vector2(-20f, -58f);
				input = TextInput(val2.transform, "", null, placeholder, 64);
				RectTransform component3 = ((Component)input).GetComponent<RectTransform>();
				component3.anchorMin = new Vector2(0f, 1f);
				component3.anchorMax = new Vector2(1f, 1f);
				component3.pivot = new Vector2(0.5f, 1f);
				component3.offsetMin = new Vector2(20f, -150f);
				component3.offsetMax = new Vector2(-20f, -110f);
				err = UIFactory.Text("err", "", val2.transform, 11, (TextAnchor)0, (FontStyle)0);
				((Graphic)err).color = Theme.DangerText;
				((Graphic)err).raycastTarget = false;
				RectTransform rectTransform3 = ((Graphic)err).rectTransform;
				rectTransform3.anchorMin = new Vector2(0f, 1f);
				rectTransform3.anchorMax = new Vector2(1f, 1f);
				rectTransform3.pivot = new Vector2(0.5f, 1f);
				rectTransform3.offsetMin = new Vector2(20f, -178f);
				rectTransform3.offsetMax = new Vector2(-20f, -152f);
				ValueTuple<GameObject, Button, Text> valueTuple = UIFactory.ButtonWithLabel("Cancel", "Cancel", val2.transform, Theme.Button, 140f, 40f);
				GameObject item = valueTuple.Item1;
				Button item2 = valueTuple.Item2;
				RectTransform component4 = item.GetComponent<RectTransform>();
				component4.anchorMin = new Vector2(0f, 0f);
				component4.anchorMax = new Vector2(0f, 0f);
				component4.pivot = new Vector2(0f, 0f);
				component4.anchoredPosition = new Vector2(20f, 18f);
				component4.sizeDelta = new Vector2(140f, 40f);
				((UnityEvent)item2.onClick).AddListener(UnityAction.op_Implicit((Action)delegate
				{
					Close();
				}));
				ValueTuple<GameObject, Button, Text> valueTuple2 = UIFactory.ButtonWithLabel("Confirm", confirmLabel, val2.transform, Theme.Accent, 180f, 40f);
				GameObject item3 = valueTuple2.Item1;
				Button item4 = valueTuple2.Item2;
				RectTransform component5 = item3.GetComponent<RectTransform>();
				component5.anchorMin = new Vector2(1f, 0f);
				component5.anchorMax = new Vector2(1f, 0f);
				component5.pivot = new Vector2(1f, 0f);
				component5.anchoredPosition = new Vector2(-20f, 18f);
				component5.sizeDelta = new Vector2(180f, 40f);
				((UnityEvent)item4.onClick).AddListener(UnityAction.op_Implicit((Action)delegate
				{
					Submit();
				}));
				Interactions.PolishButtons(val2.transform);
			}
			void Close()
			{
				Object.Destroy((Object)(object)scrim);
			}
			void Submit()
			{
				string text = ((onConfirm != null) ? onConfirm(input.text) : null);
				if (string.IsNullOrEmpty(text))
				{
					Close();
				}
				else
				{
					err.text = text;
				}
			}
		}

		public static void SetSegmentedActive(Button[] buttons, int active)
		{
			//IL_0042: 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)
			if (buttons == null)
			{
				return;
			}
			for (int i = 0; i < buttons.Length; i++)
			{
				if (!((Object)(object)buttons[i] == (Object)null))
				{
					Graphic targetGraphic = ((Selectable)buttons[i]).targetGraphic;
					Image val = (Image)(((object)((targetGraphic is Image) ? targetGraphic : null)) ?? ((object)((Component)buttons[i]).GetComponent<Image>()));
					if (!((Object)(object)val == (Object)null))
					{
						((Graphic)val).color = ((i == active) ? Theme.Accent : Theme.Button);
						Interactions.ApplyStates(buttons[i]);
					}
				}
			}
		}

		public static Slider Slider(Transform parent, float min, float max, float value, Action<float> onChange, float step = 0f)
		{
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_002f: Expected O, but got Unknown
			//IL_0054: Unknown result type (might be due to invalid IL or missing references)
			//IL_0059: Unknown result type (might be due to invalid IL or missing references)
			//IL_006b: 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_0091: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c0: 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_00e6: Expected O, but got Unknown
			//IL_0109: Unknown result type (might be due to invalid IL or missing references)
			//IL_011e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0133: 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_014c: 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_0163: Unknown result type (might be due to invalid IL or missing references)
			//IL_0175: Unknown result type (might be due to invalid IL or missing references)
			//IL_018a: 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_01a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c5: Unknown result type (might be due to invalid IL or missing references)
			//IL_01cc: Expected O, but got Unknown
			//IL_01f1: Unknown result type (might be due to invalid IL or missing references)
			//IL_0206: Unknown result type (might be due to invalid IL or missing references)
			//IL_021b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0225: Unknown result type (might be due to invalid IL or missing references)
			//IL_0234: Unknown result type (might be due to invalid IL or missing references)
			//IL_0239: Unknown result type (might be due to invalid IL or missing references)
			//IL_024c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0260: Unknown result type (might be due to invalid IL or missing references)
			//IL_0273: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = new GameObject("slider");
			val.transform.SetParent(parent, false);
			val.AddComponent<RectTransform>();
			Slider slider = val.AddComponent<Slider>();
			GameObject val2 = new GameObject("Background");
			val2.transform.SetParent(val.transform, false);
			RectTransform obj = val2.AddComponent<RectTransform>();
			obj.anchorMin = new Vector2(0f, 0.5f);
			obj.anchorMax = new Vector2(1f, 0.5f);
			obj.sizeDelta = new Vector2(0f, 6f);
			obj.anchoredPosition = Vector2.zero;
			Image obj2 = val2.AddComponent<Image>();
			((Graphic)obj2).color = Theme.AccentSubtle;
			obj2.sprite = Theme.RoundedSprite();
			obj2.type = (Type)1;
			GameObject val3 = new GameObject("Fill Area");
			val3.transform.SetParent(val.transform, false);
			RectTransform obj3 = val3.AddComponent<RectTransform>();
			obj3.anchorMin = new Vector2(0f, 0.5f);
			obj3.anchorMax = new Vector2(1f, 0.5f);
			obj3.sizeDelta = new Vector2(-16f, 6f);
			obj3.anchoredPosition = Vector2.zero;
			GameObject val4 = new GameObject("Fill");
			val4.transform.SetParent(val3.transform, false);
			RectTransform val5 = val4.AddComponent<RectTransform>();
			val5.anchorMin = new Vector2(0f, 0f);
			val5.anchorMax = new Vector2(1f, 1f);
			val5.sizeDelta = Vector2.zero;
			Image obj4 = val4.AddComponent<Image>();
			((Graphic)obj4).color = Theme.Accent;
			obj4.sprite = Theme.RoundedSprite();
			obj4.type = (Type)1;
			GameObject val6 = new GameObject("Handle Slide Area");
			val6.transform.SetParent(val.transform, false);
			RectTransform obj5 = val6.AddComponent<RectTransform>();
			obj5.anchorMin = new Vector2(0f, 0f);
			obj5.anchorMax = new Vector2(1f, 1f);
			obj5.sizeDelta = new Vector2(-16f, 0f);
			obj5.anchoredPosition = Vector2.zero;
			GameObject val7 = new GameObject("Handle");
			val7.transform.SetParent(val6.transform, false);
			RectTransform val8 = val7.AddComponent<RectTransform>();
			val8.sizeDelta = new Vector2(16f, 16f);
			Image val9 = val7.AddComponent<Image>();
			((Graphic)val9).color = Theme.AccentBorder;
			val9.sprite = Theme.RoundedSprite();
			val9.type = (Type)1;
			slider.fillRect = val5;
			slider.handleRect = val8;
			((Selectable)slider).targetGraphic = (Graphic)(object)val9;
			slider.direction = (Direction)0;
			slider.minValue = min;
			slider.maxValue = max;
			slider.wholeNumbers = false;
			Func<float, float> snap = (float v) => (!(step > 0f)) ? v : Mathf.Clamp(Mathf.Round((v - min) / step) * step + min, min, max);
			slider.value = snap(value);
			bool reentry = false;
			((UnityEvent<float>)(object)slider.onValueChanged).AddListener(UnityAction<float>.op_Implicit((Action<float>)delegate(float v)
			{
				if (!reentry)
				{
					float num = snap(v);
					if (step > 0f && !Mathf.Approximately(num, v))
					{
						reentry = true;
						slider.value = num;
						reentry = false;
					}
					onChange?.Invoke(num);
				}
			}));
			return slider;
		}

		public static Toggle Toggle(Transform parent, bool value, Action<bool> onChange)
		{
			//IL_002a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0030: Expected O, but got Unknown
			//IL_004d: 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_008a: Expected O, but got Unknown
			//IL_00c5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fb: Unknown result type (might be due to invalid IL or missing references)
			//IL_011e: Unknown result type (might be due to invalid IL or missing references)
			float onX = 11f;
			float offX = 0f - onX;
			GameObject val = new GameObject("toggle");
			val.transform.SetParent(parent, false);
			val.AddComponent<RectTransform>().sizeDelta = new Vector2(46f, 24f);
			Image track = val.AddComponent<Image>();
			track.sprite = Theme.RoundedSprite();
			track.type = (Type)1;
			GameObject val2 = new GameObject("knob");
			val2.transform.SetParent(val.transform, false);
			RectTransform krt = val2.AddComponent<RectTransform>();
			RectTransform obj = krt;
			RectTransform obj2 = krt;
			Vector2 val3 = default(Vector2);
			((Vector2)(ref val3))..ctor(0.5f, 0.5f);
			obj2.anchorMax = val3;
			obj.anchorMin = val3;
			krt.pivot = new Vector2(0.5f, 0.5f);
			krt.sizeDelta = new Vector2(18f, 18f);
			Image obj3 = val2.AddComponent<Image>();
			obj3.sprite = Theme.RoundedSprite();
			obj3.type = (Type)1;
			((Graphic)obj3).color = Theme.TextPrimary;
			((Graphic)obj3).raycastTarget = false;
			Toggle obj4 = val.AddComponent<Toggle>();
			((Selectable)obj4).transition = (Transition)0;
			((Selectable)obj4).targetGraphic = (Graphic)(object)track;
			obj4.graphic = null;
			obj4.isOn = value;
			Render(value);
			((UnityEvent<bool>)(object)obj4.onValueChanged).AddListener(UnityAction<bool>.op_Implicit((Action<bool>)delegate(bool on)
			{
				Render(on);
				onChange?.Invoke(on);
			}));
			return obj4;
			void Render(bool on)
			{
				//IL_0010: Unknown result type (might be due to invalid IL or missing references)
				//IL_0009: Unknown result type (might be due to invalid IL or missing references)
				//IL_0036: Unknown result type (might be due to invalid IL or missing references)
				((Graphic)track).color = (on ? Theme.Accent : Theme.SurfaceInput);
				krt.anchoredPosition = new Vector2(on ? onX : offX, 0f);
			}
		}

		public static InputField TextInput(Transform parent, string value, Action<string> onChange, string placeholder = null, int characterLimit = 0, bool numeric = false)
		{
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			//IL_0018: Expected O, but got Unknown
			//IL_0033: Unknown result type (might be due to invalid IL or missing references)
			//IL_0061: Unknown result type (might be due to invalid IL or missing references)
			//IL_0066: 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_007f: Unknown result type (might be due to invalid IL or missing references)
			//IL_008a: Unknown result type (might be due to invalid IL or missing references)
			//IL_009f: 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_00dc: 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_0129: Unknown result type (might be due to invalid IL or missing references)
			//IL_0130: Unknown result type (might be due to invalid IL or missing references)
			//IL_013b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0150: Unknown result type (might be due to invalid IL or missing references)
			//IL_0164: Unknown result type (might be due to invalid IL or missing references)
			//IL_0191: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = new GameObject("input");
			val.transform.SetParent(parent, false);
			val.AddComponent<RectTransform>();
			Image obj = val.AddComponent<Image>();
			((Graphic)obj).color = Theme.SurfaceInput;
			obj.sprite = Theme.RoundedSprite();
			obj.type = (Type)1;
			val.AddComponent<RectMask2D>();
			InputField val2 = val.AddComponent<InputField>();
			GameObject val3 = new GameObject("Text");
			val3.transform.SetParent(val.transform, false);
			RectTransform obj2 = val3.AddComponent<RectTransform>();
			obj2.anchorMin = Vector2.zero;
			obj2.anchorMax = Vector2.one;
			obj2.offsetMin = new Vector2(8f, 2f);
			obj2.offsetMax = new Vector2(-6f, -2f);
			Text val4 = val3.AddComponent<Text>();
			val4.font = Resources.GetBuiltinResource<Font>("Arial.ttf");
			val4.fontSize = 14;
			((Graphic)val4).color = Theme.TextPrimary;
			val4.alignment = (TextAnchor)3;
			val4.supportRichText = false;
			val4.horizontalOverflow = (HorizontalWrapMode)1;
			val2.textComponent = val4;
			if (!string.IsNullOrEmpty(placeholder))
			{
				GameObject val5 = new GameObject("Placeholder");
				val5.transform.SetParent(val.transform, false);
				RectTransform obj3 = val5.AddComponent<RectTransform>();
				obj3.anchorMin = Vector2.zero;
				obj3.anchorMax = Vector2.one;
				obj3.offsetMin = new Vector2(8f, 2f);
				obj3.offsetMax = new Vector2(-6f, -2f);
				Text val6 = val5.AddComponent<Text>();
				val6.font = Resources.GetBuiltinResource<Font>("Arial.ttf");
				val6.fontSize = 14;
				((Graphic)val6).color = Theme.TextMuted;
				val6.alignment = (TextAnchor)3;
				val6.supportRichText = false;
				val6.text = placeholder;
				val2.placeholder = (Graphic)(object)val6;
			}
			val2.lineType = (LineType)0;
			if (numeric)
			{
				val2.contentType = (ContentType)2;
			}
			if (characterLimit > 0)
			{
				val2.characterLimit = characterLimit;
			}
			val2.text = value ?? "";
			if (onChange != null)
			{
				try
				{
					((UnityEvent<string>)(object)val2.onEndEdit).AddListener(UnityAction<string>.op_Implicit((Action<string>)delegate(string s)
					{
						onChange(s);
					}));
				}
				catch
				{
				}
			}
			return val2;
		}

		public static GameObject FormRow(Transform parent, string label, string hint, out Transform controlSlot, bool stacked = false, float height = 50f)
		{
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_000b: Expected O, but got Unknown
			//IL_0156: Unknown result type (might be due to invalid IL or missing references)
			//IL_015d: Expected O, but got Unknown
			//IL_009a: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a0: Expected O, but got Unknown
			GameObject val = new GameObject("formRow");
			val.transform.SetParent(parent, false);
			val.AddComponent<RectTransform>();
			float num = (stacked ? (height + 42f) : height);
			LayoutElement val2 = val.AddComponent<LayoutElement>();
			val2.minHeight = num;
			val2.flexibleWidth = 1f;
			if (stacked)
			{
				val2.preferredHeight = num;
			}
			if (stacked)
			{
				VerticalLayoutGroup obj = val.AddComponent<VerticalLayoutGroup>();
				((HorizontalOrVerticalLayoutGroup)obj).spacing = 4f;
				((HorizontalOrVerticalLayoutGroup)obj).childControlWidth = true;
				((HorizontalOrVerticalLayoutGroup)obj).childControlHeight = true;
				((HorizontalOrVerticalLayoutGroup)obj).childForceExpandWidth = true;
				((HorizontalOrVerticalLayoutGroup)obj).childForceExpandHeight = false;
				LabelBlock(val.transform, label, hint);
				GameObject val3 = new GameObject("control");
				val3.transform.SetParent(val.transform, false);
				val3.AddComponent<RectTransform>();
				LayoutElement obj2 = val3.AddComponent<LayoutElement>();
				obj2.minHeight = 34f;
				obj2.preferredHeight = 34f;
				obj2.flexibleWidth = 1f;
				controlSlot = val3.transform;
			}
			else
			{
				HorizontalLayoutGroup obj3 = val.AddComponent<HorizontalLayoutGroup>();
				((HorizontalOrVerticalLayoutGroup)obj3).spacing = 12f;
				((HorizontalOrVerticalLayoutGroup)obj3).childControlWidth = true;
				((HorizontalOrVerticalLayoutGroup)obj3).childControlHeight = true;
				((HorizontalOrVerticalLayoutGroup)obj3).childForceExpandHeight = true;
				((HorizontalOrVerticalLayoutGroup)obj3).childForceExpandWidth = false;
				((LayoutGroup)obj3).childAlignment = (TextAnchor)3;
				LayoutElement component = LabelBlock(val.transform, label, hint).GetComponent<LayoutElement>();
				component.minWidth = 0f;
				component.preferredWidth = 0f;
				component.flexibleWidth = 0.4f;
				GameObject val4 = new GameObject("control");
				val4.transform.SetParent(val.transform, false);
				val4.AddComponent<RectTransform>();
				LayoutElement obj4 = val4.AddComponent<LayoutElement>();
				obj4.minWidth = 0f;
				obj4.preferredWidth = 0f;
				obj4.flexibleWidth = 0.6f;
				controlSlot = val4.transform;
			}
			return val;
		}

		public static void SectionHeader(Transform parent, string title)
		{
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_000b: Expected O, but got Unknown
			//IL_007d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0087: Expected O, but got Unknown
			//IL_00ab: 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_00e5: 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_00fe: 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)
			GameObject val = new GameObject("section");
			val.transform.SetParent(parent, false);
			val.AddComponent<RectTransform>();
			LayoutElement obj = val.AddComponent<LayoutElement>();
			obj.minHeight = 30f;
			obj.preferredHeight = 30f;
			obj.flexibleWidth = 1f;
			VerticalLayoutGroup obj2 = val.AddComponent<VerticalLayoutGroup>();
			((HorizontalOrVerticalLayoutGroup)obj2).spacing = 3f;
			((HorizontalOrVerticalLayoutGroup)obj2).childControlWidth = true;
			((HorizontalOrVerticalLayoutGroup)obj2).childControlHeight = true;
			((HorizontalOrVerticalLayoutGroup)obj2).childForceExpandWidth = true;
			((HorizontalOrVerticalLayoutGroup)obj2).childForceExpandHeight = false;
			((LayoutGroup)obj2).childAlignment = (TextAnchor)6;
			((LayoutGroup)obj2).padding = new RectOffset(0, 0, 8, 0);
			Text obj3 = UIFactory.Text("title", (title ?? "").ToUpperInvariant(), val.transform, 11, (TextAnchor)6, (FontStyle)1);
			((Graphic)obj3).color = Theme.Accent;
			((Graphic)obj3).raycastTarget = false;
			LayoutElement obj4 = ((Component)obj3).gameObject.AddComponent<LayoutElement>();
			obj4.minHeight = 16f;
			obj4.preferredHeight = 16f;
			GameObject val2 = new GameObject("divider");
			val2.transform.SetParent(val.transform, false);
			val2.AddComponent<RectTransform>();
			LayoutElement obj5 = val2.AddComponent<LayoutElement>();
			obj5.minHeight = 1f;
			obj5.preferredHeight = 1f;
			obj5.flexibleWidth = 1f;
			Image obj6 = val2.AddComponent<Image>();
			((Graphic)obj6).color = Theme.AccentSubtle;
			((Graphic)obj6).raycastTarget = false;
		}

		private static GameObject LabelBlock(Transform parent, string label, string hint)
		{
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_000b: Expected O, but got Unknown
			//IL_0078: 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)
			GameObject val = new GameObject("label");
			val.transform.SetParent(parent, false);
			val.AddComponent<RectTransform>();
			val.AddComponent<LayoutElement>();
			VerticalLayoutGroup obj = val.AddComponent<VerticalLayoutGroup>();
			((HorizontalOrVerticalLayoutGroup)obj).spacing = 1f;
			((HorizontalOrVerticalLayoutGroup)obj).childControlWidth = true;
			((HorizontalOrVerticalLayoutGroup)obj).childControlHeight = true;
			((HorizontalOrVerticalLayoutGroup)obj).childForceExpandWidth = true;
			((HorizontalOrVerticalLayoutGroup)obj).childForceExpandHeight = false;
			((LayoutGroup)obj).childAlignment = (TextAnchor)3;
			Text obj2 = UIFactory.Text("l", label ?? "", val.transform, 14, (TextAnchor)3, (FontStyle)0);
			((Graphic)obj2).color = Theme.TextPrimary;
			((Graphic)obj2).raycastTarget = false;
			obj2.horizontalOverflow = (HorizontalWrapMode)0;
			obj2.verticalOverflow = (VerticalWrapMode)0;
			LayoutElement obj3 = ((Component)obj2).gameObject.AddComponent<LayoutElement>();
			obj3.minHeight = 18f;
			obj3.flexibleHeight = 0f;
			if (!string.IsNullOrEmpty(hint))
			{
				Text obj4 = UIFactory.Text("h", hint, val.transform, 11, (TextAnchor)0, (FontStyle)0);
				((Graphic)obj4).color = Theme.TextMuted;
				((Graphic)obj4).raycastTarget = false;
				obj4.horizontalOverflow = (HorizontalWrapMode)0;
				obj4.verticalOverflow = (VerticalWrapMode)0;
				LayoutElement obj5 = ((Component)obj4).gameObject.AddComponent<LayoutElement>();
				obj5.minHeight = 14f;
				obj5.flexibleHeight = 1f;
			}
			return val;
		}

		public static void FillSlot(GameObject go, float vInset = 0f)
		{
			//IL_0028: Unknown result type (might be due to invalid IL or missing references)
			//IL_003d: Unknown result type (might be due to invalid IL or missing references)
			//IL_004e: 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)
			RectTransform val = (((Object)(object)go != (Object)null) ? go.GetComponent<RectTransform>() : null);
			if (!((Object)(object)val