Decompiled source of ContainerCustomizer v1.0.10

BepInEx/plugins/ContainerCustomizer/ContainerCustomizer.dll

Decompiled a month ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Reflection.Emit;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Serialization;
using System.Runtime.Serialization.Json;
using System.Runtime.Versioning;
using System.Text;
using BepInEx;
using BepInEx.Configuration;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: AssemblyCompany("ContainerCustomizer")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.10.0")]
[assembly: AssemblyInformationalVersion("1.0.10")]
[assembly: AssemblyProduct("ContainerCustomizer")]
[assembly: AssemblyTitle("ContainerCustomizer")]
[assembly: AssemblyVersion("1.0.10.0")]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Embedded]
	[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace ContainerCustomizer
{
	[HarmonyPatch]
	internal static class CameraScrollInputPatch
	{
		private static IEnumerable<MethodBase> TargetMethods()
		{
			MethodInfo[] methods = typeof(GameCamera).GetMethods(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
			foreach (MethodInfo methodInfo in methods)
			{
				if (methodInfo.Name == "UpdateCamera" && methodInfo.GetMethodBody() != null)
				{
					yield return methodInfo;
				}
			}
			Type type = AccessTools.TypeByName("FirstPersonMode.Util.Functions");
			if (type == null)
			{
				yield break;
			}
			int targets = 0;
			methods = type.GetMethods(BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic);
			foreach (MethodInfo methodInfo2 in methods)
			{
				if ((methodInfo2.Name == "HandleNotFirstPersonMode" || methodInfo2.Name == "HandleScrollOutDetection") && methodInfo2.GetMethodBody() != null)
				{
					targets++;
					yield return methodInfo2;
				}
			}
			if (targets < 2)
			{
				Plugin.Warn("FirstPersonMode camera input methods changed; menu wheel compatibility needs verification.");
			}
		}

		private static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstruction> instructions, MethodBase __originalMethod)
		{
			MethodInfo axis = typeof(Input).GetMethod("GetAxis", new Type[1] { typeof(string) });
			MethodInfo raw = typeof(Input).GetMethod("GetAxisRaw", new Type[1] { typeof(string) });
			BindingFlags bindingAttr = BindingFlags.Static | BindingFlags.NonPublic;
			MethodInfo filteredAxis = typeof(CameraScrollInputPatch).GetMethod("ReadAxis", bindingAttr);
			MethodInfo filteredRaw = typeof(CameraScrollInputPatch).GetMethod("ReadAxisRaw", bindingAttr);
			int replacements = 0;
			foreach (CodeInstruction instruction in instructions)
			{
				if (instruction.opcode == OpCodes.Call && instruction.operand is MethodInfo methodInfo)
				{
					if (methodInfo == axis)
					{
						instruction.operand = filteredAxis;
						replacements++;
					}
					else if (methodInfo == raw)
					{
						instruction.operand = filteredRaw;
						replacements++;
					}
				}
				yield return instruction;
			}
			if (replacements > 0)
			{
				Plugin.LogInfo("Menu wheel guard: " + __originalMethod.DeclaringType.FullName + "." + __originalMethod.Name + " (" + replacements + " direct input reads).");
			}
			else if (__originalMethod.DeclaringType != typeof(GameCamera))
			{
				Plugin.Warn("No direct camera input reads found in " + __originalMethod.Name + "; FirstPersonMode menu compatibility needs verification.");
			}
		}

		private static bool BlockAxis(string axisName)
		{
			if (axisName == "Mouse ScrollWheel" && (Object)(object)Controller.Active != (Object)null)
			{
				return Controller.Active.IsWindowOpen;
			}
			return false;
		}

		private static float ReadAxis(string axisName)
		{
			if (!BlockAxis(axisName))
			{
				return Input.GetAxis(axisName);
			}
			return 0f;
		}

		private static float ReadAxisRaw(string axisName)
		{
			if (!BlockAxis(axisName))
			{
				return Input.GetAxisRaw(axisName);
			}
			return 0f;
		}
	}
	internal sealed class ChestEndLabel : MonoBehaviour
	{
		private TextMesh _text;

		private MeshRenderer _renderer;

		private Transform _icon;

		private Color _color;

		private float _width;

		private float _height;

		private float IconSize = 0.11f;

		private const float Gap = 0.025f;

		internal void Initialize(TextMesh text, Transform icon, float width, float height, float iconSurfaceOffset, float iconScale = 1f)
		{
			//IL_00c2: 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_00ce: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fc: Unknown result type (might be due to invalid IL or missing references)
			//IL_0101: Unknown result type (might be due to invalid IL or missing references)
			//IL_0107: Unknown result type (might be due to invalid IL or missing references)
			//IL_010c: Unknown result type (might be due to invalid IL or missing references)
			//IL_011a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0084: Unknown result type (might be due to invalid IL or missing references)
			//IL_0090: Unknown result type (might be due to invalid IL or missing references)
			//IL_0095: Unknown result type (might be due to invalid IL or missing references)
			_text = text;
			_icon = icon;
			_width = width;
			_height = height;
			IconSize = 0.11f * iconScale;
			if ((Object)(object)_icon != (Object)null && iconScale != 1f)
			{
				float num = Mathf.Min(1f, Mathf.Min(width * 0.9f, height * (((Object)(object)text != (Object)null) ? 0.4f : 0.9f)) / IconSize);
				_icon.localScale = Vector3.Scale(_icon.localScale, new Vector3(num, num, 1f));
				IconSize *= num;
			}
			if ((Object)(object)_icon != (Object)null)
			{
				Transform icon2 = _icon;
				icon2.localPosition += Vector3.forward * iconSurfaceOffset;
			}
			if ((Object)(object)text == (Object)null)
			{
				((Behaviour)this).enabled = false;
				return;
			}
			_renderer = ((Component)text).GetComponent<MeshRenderer>();
			_color = text.color;
			Color color = _color;
			color.a = 0f;
			text.color = color;
			if ((Object)(object)_icon != (Object)null)
			{
				((Component)_icon).gameObject.SetActive(false);
			}
		}

		private void LateUpdate()
		{
			//IL_0055: Unknown result type (might be due to invalid IL or missing references)
			//IL_005a: Unknown result type (might be due to invalid IL or missing references)
			//IL_005d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0070: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bf: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d7: Unknown result type (might be due to invalid IL or missing references)
			//IL_0106: Unknown result type (might be due to invalid IL or missing references)
			//IL_0126: Unknown result type (might be due to invalid IL or missing references)
			//IL_0136: Unknown result type (might be due to invalid IL or missing references)
			//IL_013d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0142: Unknown result type (might be due to invalid IL or missing references)
			//IL_0143: Unknown result type (might be due to invalid IL or missing references)
			//IL_0148: Unknown result type (might be due to invalid IL or missing references)
			//IL_014d: Unknown result type (might be due to invalid IL or missing references)
			//IL_015e: 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_01af: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b9: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)_text == (Object)null)
			{
				((Behaviour)this).enabled = false;
				return;
			}
			if (string.IsNullOrWhiteSpace(_text.text))
			{
				if ((Object)(object)_icon != (Object)null)
				{
					((Component)_icon).gameObject.SetActive(true);
				}
				((Behaviour)this).enabled = false;
				return;
			}
			Bounds localBounds = ((Renderer)_renderer).localBounds;
			if (!(((Bounds)(ref localBounds)).size.x <= 0f) && !(((Bounds)(ref localBounds)).size.y <= 0f))
			{
				float num = (((Object)(object)_icon != (Object)null) ? (_height - 2f * (IconSize + 0.025f)) : _height);
				float num2 = Mathf.Min(1f, Mathf.Min(_width / ((Bounds)(ref localBounds)).size.x, Mathf.Max(0.02f, num) / ((Bounds)(ref localBounds)).size.y));
				Vector3 val = default(Vector3);
				((Vector3)(ref val))..ctor(num2, num2, 1f);
				((Component)_text).transform.localScale = val;
				((Component)_text).transform.localPosition = new Vector3(0f, 0f, 0.005f) - ((Component)_text).transform.localRotation * Vector3.Scale(((Bounds)(ref localBounds)).center, val);
				_text.color = _color;
				if ((Object)(object)_icon != (Object)null)
				{
					_icon.localPosition = new Vector3(0f, 0f - (((Bounds)(ref localBounds)).size.y * num2 * 0.5f + 0.025f + IconSize * 0.5f), _icon.localPosition.z);
					((Component)_icon).gameObject.SetActive(true);
				}
				((Behaviour)this).enabled = false;
			}
		}
	}
	internal static class ChestGeometry
	{
		internal struct Point
		{
			internal float X;

			internal float Y;

			internal float Z;

			internal Point(float x, float y, float z)
			{
				X = x;
				Y = y;
				Z = z;
			}
		}

		internal static float MaxDepth(float minX, float minY, float maxX, float maxY, Point a, Point b, Point c)
		{
			List<Point> list = new List<Point> { a, b, c };
			for (int i = 0; i < 4; i++)
			{
				if (list.Count <= 0)
				{
					break;
				}
				List<Point> list2 = new List<Point>();
				Point p = list[list.Count - 1];
				float num = Distance(p, i, minX, minY, maxX, maxY);
				foreach (Point item in list)
				{
					float num2 = Distance(item, i, minX, minY, maxX, maxY);
					if (num >= 0f != num2 >= 0f)
					{
						float num3 = num / (num - num2);
						list2.Add(new Point(p.X + (item.X - p.X) * num3, p.Y + (item.Y - p.Y) * num3, p.Z + (item.Z - p.Z) * num3));
					}
					if (num2 >= 0f)
					{
						list2.Add(item);
					}
					p = item;
					num = num2;
				}
				list = list2;
			}
			float num4 = float.NegativeInfinity;
			foreach (Point item2 in list)
			{
				num4 = Math.Max(num4, item2.Z);
			}
			return num4;
		}

		private static float Distance(Point p, int edge, float minX, float minY, float maxX, float maxY)
		{
			return edge switch
			{
				2 => p.Y - minY, 
				1 => maxX - p.X, 
				0 => p.X - minX, 
				_ => maxY - p.Y, 
			};
		}

		internal static void Stack(float textWidth, float textHeight, float iconWidth, float iconHeight, float width, float height, bool iconBelow, out float fit, out float textY, out float iconY)
		{
			float num = ((textHeight > 0f && iconHeight > 0f) ? (height * 0.06f) : 0f);
			fit = Math.Min(1f, Math.Min(width / Math.Max(0.001f, Math.Max(textWidth, iconWidth)), height / Math.Max(0.001f, textHeight + iconHeight + num)));
			textY = ((iconHeight > 0f) ? ((0f - (iconHeight + num)) * fit * 0.5f) : 0f);
			iconY = ((textHeight > 0f) ? ((textHeight + num) * fit * 0.5f) : 0f);
			if (iconBelow)
			{
				textY = 0f - textY;
				iconY = 0f - iconY;
			}
		}

		internal static bool Intersect(float x, float y, float ax, float ay, float az, float bx, float by, float bz, float cx, float cy, float cz, out float depth)
		{
			depth = 0f;
			float num = (bx - ax) * (cy - ay) - (by - ay) * (cx - ax);
			if (Math.Abs(num) < 1E-06f)
			{
				return false;
			}
			float num2 = ((x - ax) * (cy - ay) - (y - ay) * (cx - ax)) / num;
			float num3 = ((bx - ax) * (y - ay) - (by - ay) * (x - ax)) / num;
			if (num2 < -0.0001f || num3 < -0.0001f || num2 + num3 > 1.0001f)
			{
				return false;
			}
			depth = az + num2 * (bz - az) + num3 * (cz - az);
			return true;
		}
	}
	internal sealed class ChestLabel : MonoBehaviour
	{
		private TextMesh _text;

		private Transform _icon;

		private float _width;

		private float _height;

		private bool _iconBelow;

		internal void Initialize(TextMesh text, Transform icon, float width, float height, bool iconBelow)
		{
			_text = text;
			_icon = icon;
			_width = width;
			_height = height;
			_iconBelow = iconBelow;
		}

		private void LateUpdate()
		{
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_002a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0050: 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_0041: Unknown result type (might be due to invalid IL or missing references)
			//IL_0055: Unknown result type (might be due to invalid IL or missing references)
			//IL_0066: Unknown result type (might be due to invalid IL or missing references)
			//IL_008f: Unknown result type (might be due to invalid IL or missing references)
			//IL_009f: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a4: Unknown result type (might be due to invalid IL or missing references)
			//IL_0086: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d1: 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_00d6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00dd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e9: Unknown result type (might be due to invalid IL or missing references)
			//IL_0125: Unknown result type (might be due to invalid IL or missing references)
			//IL_0143: Unknown result type (might be due to invalid IL or missing references)
			Bounds bounds = (Bounds)(((Object)(object)_text != (Object)null) ? ((Renderer)((Component)_text).GetComponent<MeshRenderer>()).localBounds : default(Bounds));
			Bounds bounds2 = (Bounds)(((Object)(object)_icon != (Object)null) ? ((Renderer)((Component)_icon).GetComponent<MeshRenderer>()).localBounds : default(Bounds));
			if (!((Object)(object)_text != (Object)null) || !(((Bounds)(ref bounds)).size.y <= 0f))
			{
				Vector3 val = (((Object)(object)_text != (Object)null) ? Vector3.Scale(((Bounds)(ref bounds)).size, ((Component)_text).transform.localScale) : Vector3.zero);
				Vector3 val2 = (((Object)(object)_icon != (Object)null) ? Vector3.Scale(((Bounds)(ref bounds2)).size, _icon.localScale) : Vector3.zero);
				ChestGeometry.Stack(val.x, val.y, val2.x, val2.y, _width, _height, _iconBelow, out var fit, out var textY, out var iconY);
				if ((Object)(object)_text != (Object)null)
				{
					Place(((Component)_text).transform, bounds, fit, textY);
				}
				if ((Object)(object)_icon != (Object)null)
				{
					Place(_icon, bounds2, fit, iconY);
				}
				((Behaviour)this).enabled = false;
			}
		}

		private static void Place(Transform item, Bounds bounds, float fit, float y)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_000e: 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_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Unknown result type (might be due to invalid IL or missing references)
			//IL_003c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0041: Unknown result type (might be due to invalid IL or missing references)
			//IL_0046: Unknown result type (might be due to invalid IL or missing references)
			//IL_004b: Unknown result type (might be due to invalid IL or missing references)
			item.localScale = Vector3.Scale(item.localScale, new Vector3(fit, fit, 1f));
			item.localPosition = new Vector3(0f, y, 0f) - item.localRotation * Vector3.Scale(((Bounds)(ref bounds)).center, item.localScale);
		}
	}
	internal sealed class ChestSurface
	{
		private readonly List<Vector3[]> _triangles = new List<Vector3[]>();

		private readonly Transform _anchor;

		private readonly Collider[] _colliders;

		private readonly Bounds _bounds;

		private readonly List<Bounds> _unreadable = new List<Bounds>();

		internal ChestSurface(Transform anchor, Transform generatedRoot, Bounds bounds)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_0025: 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_00b8: 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_00c1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cb: Unknown result type (might be due to invalid IL or missing references)
			//IL_0184: Unknown result type (might be due to invalid IL or missing references)
			//IL_0189: Unknown result type (might be due to invalid IL or missing references)
			//IL_018e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0193: Unknown result type (might be due to invalid IL or missing references)
			//IL_015b: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c9: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ce: Unknown result type (might be due to invalid IL or missing references)
			//IL_01de: 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_01f3: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ef: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ff: Unknown result type (might be due to invalid IL or missing references)
			//IL_0104: Unknown result type (might be due to invalid IL or missing references)
			//IL_0108: Unknown result type (might be due to invalid IL or missing references)
			//IL_0116: Unknown result type (might be due to invalid IL or missing references)
			//IL_011b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0120: Unknown result type (might be due to invalid IL or missing references)
			//IL_0125: Unknown result type (might be due to invalid IL or missing references)
			//IL_012a: Unknown result type (might be due to invalid IL or missing references)
			_anchor = anchor;
			_bounds = bounds;
			_colliders = ((Component)anchor).GetComponentsInChildren<Collider>();
			MeshRenderer[] componentsInChildren = ((Component)anchor).GetComponentsInChildren<MeshRenderer>();
			Bounds item = default(Bounds);
			foreach (MeshRenderer val in componentsInChildren)
			{
				if (!((Renderer)val).enabled || !((Component)val).gameObject.activeInHierarchy || ((Component)val).transform.IsChildOf(generatedRoot))
				{
					continue;
				}
				MeshFilter component = ((Component)val).GetComponent<MeshFilter>();
				Mesh val2 = (((Object)(object)component != (Object)null) ? component.sharedMesh : null);
				if ((Object)(object)val2 == (Object)null)
				{
					continue;
				}
				if (!val2.isReadable)
				{
					Transform transform = ((Component)component).transform;
					Bounds bounds2 = val2.bounds;
					((Bounds)(ref item))..ctor(anchor.InverseTransformPoint(transform.TransformPoint(((Bounds)(ref bounds2)).center)), Vector3.zero);
					for (int j = -1; j <= 1; j += 2)
					{
						for (int k = -1; k <= 1; k += 2)
						{
							for (int l = -1; l <= 1; l += 2)
							{
								Transform transform2 = ((Component)component).transform;
								bounds2 = val2.bounds;
								Vector3 center = ((Bounds)(ref bounds2)).center;
								bounds2 = val2.bounds;
								((Bounds)(ref item)).Encapsulate(anchor.InverseTransformPoint(transform2.TransformPoint(center + Vector3.Scale(((Bounds)(ref bounds2)).extents, new Vector3((float)j, (float)k, (float)l)))));
							}
						}
					}
					_unreadable.Add(item);
				}
				else
				{
					Vector3[] vertices = val2.vertices;
					for (int m = 0; m < vertices.Length; m++)
					{
						vertices[m] = anchor.InverseTransformPoint(((Component)component).transform.TransformPoint(vertices[m]));
					}
					int[] triangles = val2.triangles;
					for (int n = 0; n + 2 < triangles.Length; n += 3)
					{
						_triangles.Add((Vector3[])(object)new Vector3[3]
						{
							vertices[triangles[n]],
							vertices[triangles[n + 1]],
							vertices[triangles[n + 2]]
						});
					}
				}
			}
		}

		internal float Depth(Vector3 point, int axis, bool positive, bool includeColliders = false)
		{
			//IL_010e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0113: Unknown result type (might be due to invalid IL or missing references)
			//IL_012b: Unknown result type (might be due to invalid IL or missing references)
			//IL_012c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0156: Unknown result type (might be due to invalid IL or missing references)
			//IL_015b: Unknown result type (might be due to invalid IL or missing references)
			//IL_015f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0164: Unknown result type (might be due to invalid IL or missing references)
			//IL_0135: 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_013e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0143: Unknown result type (might be due to invalid IL or missing references)
			//IL_0181: 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_018e: 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_0254: Unknown result type (might be due to invalid IL or missing references)
			//IL_0259: Unknown result type (might be due to invalid IL or missing references)
			//IL_025d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0262: Unknown result type (might be due to invalid IL or missing references)
			//IL_023a: Unknown result type (might be due to invalid IL or missing references)
			//IL_023f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0243: Unknown result type (might be due to invalid IL or missing references)
			//IL_0248: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d9: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f1: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f6: Unknown result type (might be due to invalid IL or missing references)
			//IL_01fb: Unknown result type (might be due to invalid IL or missing references)
			int num = (axis + 1) % 3;
			int num2 = (axis + 2) % 3;
			float num3 = (positive ? float.NegativeInfinity : float.PositiveInfinity);
			foreach (Vector3[] triangle in _triangles)
			{
				if (ChestGeometry.Intersect(((Vector3)(ref point))[num], ((Vector3)(ref point))[num2], ((Vector3)(ref triangle[0]))[num], ((Vector3)(ref triangle[0]))[num2], ((Vector3)(ref triangle[0]))[axis], ((Vector3)(ref triangle[1]))[num], ((Vector3)(ref triangle[1]))[num2], ((Vector3)(ref triangle[1]))[axis], ((Vector3)(ref triangle[2]))[num], ((Vector3)(ref triangle[2]))[num2], ((Vector3)(ref triangle[2]))[axis], out var depth))
				{
					num3 = (positive ? Mathf.Max(num3, depth) : Mathf.Min(num3, depth));
				}
			}
			if (!float.IsInfinity(num3) && !includeColliders)
			{
				return num3;
			}
			Vector3 zero = Vector3.zero;
			((Vector3)(ref zero))[axis] = (positive ? (-1f) : 1f);
			Vector3 val = point;
			Bounds bounds;
			Vector3 val2;
			float num4;
			if (!positive)
			{
				bounds = _bounds;
				val2 = ((Bounds)(ref bounds)).min;
				num4 = ((Vector3)(ref val2))[axis] - 1f;
			}
			else
			{
				bounds = _bounds;
				val2 = ((Bounds)(ref bounds)).max;
				num4 = ((Vector3)(ref val2))[axis] + 1f;
			}
			((Vector3)(ref val))[axis] = num4;
			Ray val3 = default(Ray);
			((Ray)(ref val3))..ctor(_anchor.TransformPoint(val), _anchor.TransformDirection(zero));
			Collider[] colliders = _colliders;
			RaycastHit val5 = default(RaycastHit);
			foreach (Collider val4 in colliders)
			{
				if (!((Object)(object)val4 == (Object)null) && val4.enabled && !val4.isTrigger && ((Component)val4).gameObject.activeInHierarchy && val4.Raycast(val3, ref val5, 100f))
				{
					val2 = _anchor.InverseTransformPoint(((RaycastHit)(ref val5)).point);
					float num5 = ((Vector3)(ref val2))[axis];
					num3 = (positive ? Mathf.Max(num3, num5) : Mathf.Min(num3, num5));
				}
			}
			if (float.IsInfinity(num3))
			{
				if (!positive)
				{
					bounds = _bounds;
					val2 = ((Bounds)(ref bounds)).min;
					return ((Vector3)(ref val2))[axis];
				}
				bounds = _bounds;
				val2 = ((Bounds)(ref bounds)).max;
				return ((Vector3)(ref val2))[axis];
			}
			return num3;
		}

		internal float LidSurfaceDepth(Bounds footprint, float sampledDepth)
		{
			//IL_004b: 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_00c9: Unknown result type (might be due to invalid IL or missing references)
			//IL_0108: Unknown result type (might be due to invalid IL or missing references)
			//IL_011a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0126: Unknown result type (might be due to invalid IL or missing references)
			//IL_0132: Unknown result type (might be due to invalid IL or missing references)
			//IL_013e: Unknown result type (might be due to invalid IL or missing references)
			//IL_01fd: Unknown result type (might be due to invalid IL or missing references)
			//IL_0202: 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_0212: Unknown result type (might be due to invalid IL or missing references)
			//IL_0220: Unknown result type (might be due to invalid IL or missing references)
			//IL_022c: Unknown result type (might be due to invalid IL or missing references)
			//IL_023a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0246: Unknown result type (might be due to invalid IL or missing references)
			//IL_0254: 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_026f: Unknown result type (might be due to invalid IL or missing references)
			float num = sampledDepth;
			foreach (Vector3[] triangle in _triangles)
			{
				if (!(Mathf.Max(triangle[0].x, Mathf.Max(triangle[1].x, triangle[2].x)) < ((Bounds)(ref footprint)).min.x) && !(Mathf.Min(triangle[0].x, Mathf.Min(triangle[1].x, triangle[2].x)) > ((Bounds)(ref footprint)).max.x) && !(Mathf.Max(triangle[0].z, Mathf.Max(triangle[1].z, triangle[2].z)) < ((Bounds)(ref footprint)).min.z) && !(Mathf.Min(triangle[0].z, Mathf.Min(triangle[1].z, triangle[2].z)) > ((Bounds)(ref footprint)).max.z))
				{
					num = Mathf.Max(num, ChestGeometry.MaxDepth(((Bounds)(ref footprint)).min.x, ((Bounds)(ref footprint)).min.z, ((Bounds)(ref footprint)).max.x, ((Bounds)(ref footprint)).max.z, new ChestGeometry.Point(triangle[0].x, triangle[0].z, triangle[0].y), new ChestGeometry.Point(triangle[1].x, triangle[1].z, triangle[1].y), new ChestGeometry.Point(triangle[2].x, triangle[2].z, triangle[2].y)));
				}
			}
			foreach (Bounds item in _unreadable)
			{
				Bounds current2 = item;
				if (((Bounds)(ref current2)).max.x >= ((Bounds)(ref footprint)).min.x && ((Bounds)(ref current2)).min.x <= ((Bounds)(ref footprint)).max.x && ((Bounds)(ref current2)).max.z >= ((Bounds)(ref footprint)).min.z && ((Bounds)(ref current2)).min.z <= ((Bounds)(ref footprint)).max.z)
				{
					num = Mathf.Max(num, ((Bounds)(ref current2)).max.y);
				}
			}
			return num;
		}
	}
	internal sealed class ChestSurfaceLabel : MonoBehaviour
	{
		private Transform _chest;

		private ChestSurface _surface;

		private Renderer[] _renderers;

		private int _axis;

		private int _settleFrames;

		private bool _positive;

		private bool _lid;

		private bool _ready;

		private bool _guardLidSurface;

		private Quaternion _lastRotation;

		internal void Initialize(Transform chest, ChestSurface surface, bool lid, bool guardLidSurface = false)
		{
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			//IL_002a: Unknown result type (might be due to invalid IL or missing references)
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Unknown result type (might be due to invalid IL or missing references)
			//IL_0048: Unknown result type (might be due to invalid IL or missing references)
			_chest = chest;
			_surface = surface;
			_lid = lid;
			_guardLidSurface = lid && guardLidSurface;
			Vector3 val = ((Component)this).transform.localRotation * Vector3.forward;
			_axis = ((Mathf.Abs(val.y) > 0.9f) ? 1 : ((!(Mathf.Abs(val.x) > 0.9f)) ? 2 : 0));
			_positive = ((Vector3)(ref val))[_axis] > 0f;
			_renderers = ((Component)this).GetComponentsInChildren<Renderer>(true);
			Renderer[] renderers = _renderers;
			for (int i = 0; i < renderers.Length; i++)
			{
				renderers[i].enabled = false;
			}
		}

		private void LateUpdate()
		{
			//IL_0026: Unknown result type (might be due to invalid IL or missing references)
			//IL_0031: Unknown result type (might be due to invalid IL or missing references)
			//IL_008a: Unknown result type (might be due to invalid IL or missing references)
			//IL_008f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0093: 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_0398: Unknown result type (might be due to invalid IL or missing references)
			//IL_039d: Unknown result type (might be due to invalid IL or missing references)
			//IL_027e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0283: Unknown result type (might be due to invalid IL or missing references)
			//IL_0287: 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_0111: Unknown result type (might be due to invalid IL or missing references)
			//IL_0116: Unknown result type (might be due to invalid IL or missing references)
			//IL_011b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0120: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ea: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ef: Unknown result type (might be due to invalid IL or missing references)
			//IL_02f4: Unknown result type (might be due to invalid IL or missing references)
			//IL_02f9: 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_031c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0321: Unknown result type (might be due to invalid IL or missing references)
			//IL_013e: Unknown result type (might be due to invalid IL or missing references)
			//IL_014a: 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_0170: 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_01a6: 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_01ad: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b2: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b6: 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_0358: Unknown result type (might be due to invalid IL or missing references)
			//IL_0363: Unknown result type (might be due to invalid IL or missing references)
			//IL_0365: Unknown result type (might be due to invalid IL or missing references)
			//IL_036a: Unknown result type (might be due to invalid IL or missing references)
			if (_settleFrames++ < 2 || (_ready && (!_lid || Quaternion.Angle(_lastRotation, ((Component)this).transform.localRotation) < 2f)))
			{
				return;
			}
			bool ready = true;
			float[] array = new float[_renderers.Length];
			float num = (_positive ? float.NegativeInfinity : float.PositiveInfinity);
			Bounds footprint = default(Bounds);
			Vector3 val2 = default(Vector3);
			for (int i = 0; i < _renderers.Length; i++)
			{
				Renderer val = _renderers[i];
				if ((Object)(object)val == (Object)null)
				{
					continue;
				}
				Bounds localBounds = val.localBounds;
				if (((Bounds)(ref localBounds)).size.x <= 0f || ((Bounds)(ref localBounds)).size.y <= 0f)
				{
					TextMesh component = ((Component)val).GetComponent<TextMesh>();
					if ((Object)(object)component == (Object)null || !string.IsNullOrWhiteSpace(component.text))
					{
						ready = false;
					}
					continue;
				}
				float num2 = (_positive ? float.NegativeInfinity : float.PositiveInfinity);
				bool guardLidSurface = _guardLidSurface;
				((Bounds)(ref footprint))..ctor(_chest.InverseTransformPoint(((Component)val).transform.TransformPoint(((Bounds)(ref localBounds)).center)), Vector3.zero);
				for (int j = 0; j <= 4; j++)
				{
					for (int k = 0; k <= 4; k++)
					{
						((Vector3)(ref val2))..ctor(Mathf.Lerp(((Bounds)(ref localBounds)).min.x, ((Bounds)(ref localBounds)).max.x, (float)j / 4f), Mathf.Lerp(((Bounds)(ref localBounds)).min.y, ((Bounds)(ref localBounds)).max.y, (float)k / 4f), ((Bounds)(ref localBounds)).center.z);
						Vector3 val3 = _chest.InverseTransformPoint(((Component)val).transform.TransformPoint(val2));
						((Bounds)(ref footprint)).Encapsulate(val3);
						float num3 = _surface.Depth(val3, _axis, _positive, guardLidSurface);
						num2 = (_positive ? Mathf.Max(num2, num3) : Mathf.Min(num2, num3));
					}
				}
				array[i] = (guardLidSurface ? _surface.LidSurfaceDepth(footprint, num2) : num2);
				if (((Object)val).name == "Background")
				{
					num = array[i];
				}
			}
			for (int l = 0; l < _renderers.Length; l++)
			{
				Renderer val4 = _renderers[l];
				if ((Object)(object)val4 == (Object)null)
				{
					continue;
				}
				Bounds localBounds2 = val4.localBounds;
				if (!(((Bounds)(ref localBounds2)).size.x <= 0f) && !(((Bounds)(ref localBounds2)).size.y <= 0f))
				{
					float num4 = array[l];
					if (!float.IsInfinity(num))
					{
						num4 = (_positive ? Mathf.Max(num4, num) : Mathf.Min(num4, num));
					}
					Vector3 val5 = _chest.InverseTransformPoint(((Component)val4).transform.TransformPoint(((Bounds)(ref localBounds2)).center));
					float num5 = ((((Object)val4).name == "Background") ? 0.003f : 0.007f);
					Vector3 zero = Vector3.zero;
					((Vector3)(ref zero))[_axis] = num4 + (_positive ? num5 : (0f - num5)) - ((Vector3)(ref val5))[_axis];
					Transform transform = ((Component)val4).transform;
					transform.position += _chest.TransformVector(zero);
					val4.enabled = true;
				}
			}
			_lastRotation = ((Component)this).transform.localRotation;
			_ready = ready;
		}
	}
	internal sealed class CurvedLabel : MonoBehaviour
	{
		private TextMesh[] _text;

		private MeshRenderer[] _renderers;

		private Bounds[] _bounds;

		private Color[] _colors;

		private float[] _angles;

		private Transform _icon;

		private Renderer _iconRenderer;

		private Camera _camera;

		private bool _ready;

		private float _span;

		private int _measurementAttempts;

		private float _fontScale = 1f;

		private float _iconScale = 1f;

		private float _radius = 0.452f;

		internal bool FollowsView
		{
			get
			{
				if (_ready)
				{
					return _span <= (float)Math.PI * 9f / 10f;
				}
				return true;
			}
		}

		internal void Initialize(TextMesh[] text, Transform icon, float fontScale, bool hasBackground, float iconScale = 1f)
		{
			//IL_00a1: 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_00b2: 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_00c7: Unknown result type (might be due to invalid IL or missing references)
			_fontScale = fontScale;
			_iconScale = iconScale;
			_radius = (hasBackground ? 0.467f : 0.452f);
			_text = text;
			_icon = icon;
			_iconRenderer = (((Object)(object)icon != (Object)null) ? ((Component)icon).GetComponent<Renderer>() : null);
			_renderers = (MeshRenderer[])(object)new MeshRenderer[text.Length];
			_bounds = (Bounds[])(object)new Bounds[text.Length];
			_colors = (Color[])(object)new Color[text.Length];
			_angles = new float[text.Length];
			for (int i = 0; i < text.Length; i++)
			{
				_renderers[i] = ((Component)text[i]).GetComponent<MeshRenderer>();
				_colors[i] = text[i].color;
				Color color = _colors[i];
				color.a = 0f;
				text[i].color = color;
			}
			if ((Object)(object)_iconRenderer != (Object)null)
			{
				_iconRenderer.enabled = false;
			}
		}

		internal void SetCamera(Camera camera)
		{
			_camera = camera;
		}

		private void LateUpdate()
		{
			//IL_005c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0063: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0082: 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_009a: Unknown result type (might be due to invalid IL or missing references)
			//IL_00aa: Unknown result type (might be due to invalid IL or missing references)
			//IL_00af: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f5: Unknown result type (might be due to invalid IL or missing references)
			//IL_0105: 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_011a: Unknown result type (might be due to invalid IL or missing references)
			//IL_011f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0124: Unknown result type (might be due to invalid IL or missing references)
			if (_text != null && (_ready || TryArrange()) && !((Object)(object)_camera == (Object)null))
			{
				Vector3 val = default(Vector3);
				for (int i = 0; i < _renderers.Length; i++)
				{
					((Vector3)(ref val))..ctor(Mathf.Sin(_angles[i]), 0f, Mathf.Cos(_angles[i]));
					Vector3 val2 = ((Component)this).transform.TransformPoint(val * _radius);
					((Renderer)_renderers[i]).enabled = ((Bounds)(ref _bounds[i])).size.x > 0f && Vector3.Dot(((Component)this).transform.TransformDirection(val), ((Component)_camera).transform.position - val2) > 0f;
				}
				if ((Object)(object)_iconRenderer != (Object)null)
				{
					_iconRenderer.enabled = Vector3.Dot(((Component)this).transform.forward, ((Component)_camera).transform.position - ((Component)this).transform.TransformPoint(Vector3.forward * 0.484f)) > 0f;
				}
			}
		}

		private bool TryArrange()
		{
			//IL_0043: Unknown result type (might be due to invalid IL or missing references)
			//IL_0048: Unknown result type (might be due to invalid IL or missing references)
			//IL_004c: 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_00b0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ba: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cd: Unknown result type (might be due to invalid IL or missing references)
			//IL_0158: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c9: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ce: Unknown result type (might be due to invalid IL or missing references)
			//IL_0314: Unknown result type (might be due to invalid IL or missing references)
			//IL_032b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0336: 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_033f: 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_0361: 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_036b: Unknown result type (might be due to invalid IL or missing references)
			//IL_03b0: Unknown result type (might be due to invalid IL or missing references)
			//IL_025e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0263: Unknown result type (might be due to invalid IL or missing references)
			_measurementAttempts++;
			float num = float.PositiveInfinity;
			float num2 = float.NegativeInfinity;
			for (int i = 0; i < _text.Length; i++)
			{
				if (string.IsNullOrWhiteSpace(_text[i].text))
				{
					continue;
				}
				Bounds localBounds = ((Renderer)_renderers[i]).localBounds;
				if (((Bounds)(ref localBounds)).size.x <= 0f || ((Bounds)(ref localBounds)).size.y <= 0f)
				{
					if (_measurementAttempts >= 3 && _text[i].text != "?")
					{
						_text[i].text = "?";
					}
					return false;
				}
				_bounds[i] = localBounds;
				num = Mathf.Min(num, ((Bounds)(ref localBounds)).min.y);
				num2 = Mathf.Max(num2, ((Bounds)(ref localBounds)).max.y);
			}
			float num3 = (float.IsInfinity(num) ? 0f : (num2 - num));
			float num4 = ((num3 > 0f) ? ((num + num2) * 0.5f) : 0f);
			float[] array = new float[_text.Length];
			for (int j = 0; j < array.Length; j++)
			{
				array[j] = (string.IsNullOrWhiteSpace(_text[j].text) ? LabelGeometry.WordSpace(num3, _fontScale) : ((Bounds)(ref _bounds[j])).size.x);
			}
			LabelGeometry.ArrangeArc(array, _radius, LabelGeometry.TrackingGap(num3, _fontScale), out var horizontalScale, out _span, _angles);
			float num5 = LabelGeometry.FitIconScale(num3, _iconScale);
			if ((Object)(object)_icon != (Object)null && num5 < _iconScale)
			{
				Mesh sharedMesh = ((Component)_icon).GetComponent<MeshFilter>().sharedMesh;
				Vector3[] vertices = sharedMesh.vertices;
				float num6 = num5 / _iconScale;
				for (int k = 0; k < vertices.Length; k++)
				{
					float num7 = Mathf.Atan2(vertices[k].x, vertices[k].z) * num6;
					vertices[k] = new Vector3(Mathf.Sin(num7) * 0.484f, 0.54f + (vertices[k].y - 0.54f) * num6, Mathf.Cos(num7) * 0.484f);
				}
				sharedMesh.vertices = vertices;
				sharedMesh.RecalculateBounds();
			}
			LabelGeometry.Stack(num3, (Object)(object)_icon != (Object)null, out var textCenter, out var iconCenter, num5);
			Vector3 val2 = default(Vector3);
			for (int l = 0; l < _text.Length; l++)
			{
				float num8 = _angles[l];
				Quaternion val = Quaternion.Euler(0f, num8 * 57.29578f + 180f, 0f);
				((Vector3)(ref val2))..ctor(Mathf.Sin(num8) * _radius, textCenter, Mathf.Cos(num8) * _radius);
				Transform transform = ((Component)_text[l]).transform;
				_text[l].color = _colors[l];
				transform.localScale = new Vector3(horizontalScale, 1f, 1f);
				transform.localRotation = val;
				transform.localPosition = val2 - val * new Vector3(((Bounds)(ref _bounds[l])).center.x * horizontalScale, num4, 0f);
			}
			if ((Object)(object)_icon != (Object)null)
			{
				_icon.localPosition = new Vector3(0f, iconCenter - 0.54f, 0f);
			}
			_ready = true;
			return true;
		}
	}
	internal static class EditorSizing
	{
		internal const float CompactHeight = 580f;

		internal static float DisplayHeight(float preferred, float screenHeight)
		{
			if (float.IsNaN(preferred) || float.IsInfinity(preferred))
			{
				preferred = 580f;
			}
			float val = Math.Max(100f, screenHeight - 56f);
			return Math.Max(Math.Min(580f, val), Math.Min(preferred, val));
		}

		internal static float DragHeight(float initial, float deltaY, float top, float screenHeight)
		{
			float val = Math.Max(100f, Math.Min(screenHeight - 56f, screenHeight - top - 8f));
			return Math.Max(Math.Min(580f, val), Math.Min(initial + deltaY, val));
		}

		internal static float GridHeight(float windowHeight)
		{
			return Math.Max(210f, windowHeight - 540f);
		}
	}
	internal static class GameLocalization
	{
		private const BindingFlags AnyStatic = BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic;

		private const BindingFlags AnyMethod = BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic;

		private static Type _type;

		private static Type ResolveType()
		{
			if (_type != null)
			{
				return _type;
			}
			Assembly[] assemblies = AppDomain.CurrentDomain.GetAssemblies();
			for (int i = 0; i < assemblies.Length; i++)
			{
				Type type = assemblies[i].GetType("Localization", throwOnError: false);
				if (!(type == null))
				{
					_type = type;
					break;
				}
			}
			return _type;
		}

		private static object Instance(Type type)
		{
			FieldInfo field = type.GetField("instance", BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic);
			if (field != null)
			{
				return field.GetValue(null);
			}
			PropertyInfo property = type.GetProperty("instance", BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic);
			if (!(property != null))
			{
				return null;
			}
			return property.GetValue(null, null);
		}

		internal static string SelectedLanguage()
		{
			try
			{
				Type type = ResolveType();
				if (type == null)
				{
					return "English";
				}
				MethodInfo method = type.GetMethod("GetSelectedLanguage", BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic, null, Type.EmptyTypes, null);
				object obj = ((method != null) ? method.Invoke(method.IsStatic ? null : Instance(type), null) : null);
				if (obj == null)
				{
					FieldInfo field = type.GetField("m_language", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
					if (field != null)
					{
						obj = field.GetValue(Instance(type));
					}
				}
				return (obj != null) ? obj.ToString() : "English";
			}
			catch
			{
				return "English";
			}
		}

		internal static string Localize(string key)
		{
			if (string.IsNullOrEmpty(key))
			{
				return "";
			}
			try
			{
				Type type = ResolveType();
				if (type == null)
				{
					return key;
				}
				MethodInfo method = type.GetMethod("Localize", BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic, null, new Type[1] { typeof(string) }, null);
				if (method == null)
				{
					return key;
				}
				return (method.Invoke(method.IsStatic ? null : Instance(type), new object[1] { key }) as string) ?? key;
			}
			catch
			{
				return key;
			}
		}
	}
	internal static class GameUiFocus
	{
		private static readonly Dictionary<string, Type> Types = new Dictionary<string, Type>();

		private static bool Active(string typeName, string methodName)
		{
			try
			{
				if (!Types.TryGetValue(typeName, out var value))
				{
					value = (Types[typeName] = (from a in AppDomain.CurrentDomain.GetAssemblies()
						select a.GetType(typeName, throwOnError: false)).FirstOrDefault((Type t) => t != null));
				}
				if (value == null)
				{
					return false;
				}
				MethodInfo method = value.GetMethod(methodName, BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic, null, Type.EmptyTypes, null);
				if (method == null)
				{
					return false;
				}
				object obj = null;
				if (!method.IsStatic)
				{
					obj = value.GetField("instance", BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic)?.GetValue(null) ?? value.GetProperty("instance", BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic)?.GetValue(null, null);
					if (obj != null)
					{
						Object val = (Object)((obj is Object) ? obj : null);
						if (val == null || !(val == (Object)null))
						{
							goto IL_0107;
						}
					}
					return false;
				}
				goto IL_0107;
				IL_0107:
				object obj2 = method.Invoke(obj, null);
				bool flag = default(bool);
				int num;
				if (obj2 is bool)
				{
					flag = (bool)obj2;
					num = 1;
				}
				else
				{
					num = 0;
				}
				return (byte)((uint)num & (flag ? 1u : 0u)) != 0;
			}
			catch
			{
				return false;
			}
		}

		internal static bool BlocksShortcuts()
		{
			return BlockingReason() != null;
		}

		internal static string BlockingReason()
		{
			if (Active("Chat", "HasFocus"))
			{
				return "chat";
			}
			if (Active("Console", "IsVisible"))
			{
				return "console";
			}
			if (Active("TextInput", "IsVisible"))
			{
				return "text input";
			}
			if (Active("Menu", "IsVisible"))
			{
				return "menu";
			}
			if (Active("InventoryGui", "IsVisible"))
			{
				return "inventory";
			}
			if (Cursor.visible && GUIUtility.keyboardControl != 0)
			{
				return "IMGUI text field";
			}
			return null;
		}
	}
	internal static class IconAtlas
	{
		internal static readonly string[] Pictograms = new string[16]
		{
			"◆", "✦", "✚", "⬟", "☼", "☾", "⚒", "⚔", "⚓", "♜",
			"❖", "✿", "♠", "♣", "♦", "♥"
		};

		private const int CellSize = 128;

		private const int Columns = 16;

		private static Texture2D _atlas;

		private static readonly Dictionary<int, Texture2D> Icons = new Dictionary<int, Texture2D>();

		private static bool _failed;

		internal static readonly string[] Emoji = new string[120]
		{
			"\ud83e\udeb5", "\ud83e\udea8", "⚒\ufe0f", "\ud83d\udde1\ufe0f", "\ud83c\udff9", "\ud83d\udee1\ufe0f", "\ud83c\udf56", "\ud83d\udc1f", "\ud83c\udf6f", "\ud83c\udf3e",
			"\ud83d\udc8e", "\ud83e\ude99", "\ud83d\udd25", "\ud83e\uddea", "\ud83e\uddf5", "\ud83d\udce6", "\ud83c\udf32", "\ud83c\udf43", "\ud83c\udf31", "\ud83e\uded0",
			"\ud83c\udf44", "\ud83e\udd55", "\ud83c\udf30", "\ud83e\udd58", "\ud83c\udf5e", "\ud83c\udf7a", "\ud83e\uddb4", "\ud83e\udeb6", "\ud83d\udc17", "\ud83d\udc3a",
			"\ud83d\udc1d", "\ud83e\udd5a", "\ud83e\uddf6", "\ud83e\uddf1", "\ud83e\ude91", "⛵", "\ud83d\udddd\ufe0f", "\ud83c\udfc6", "\ud83d\udcb0", "\ud83d\udc51",
			"✨", "\ud83d\udd2e", "❄\ufe0f", "\ud83d\udca7", "\ud83c\udf3f", "\ud83e\udded", "\ud83d\udd28", "⛏\ufe0f", "\ud83d\udd29", "\ud83d\udc3e",
			"\ud83d\udc79", "⚙\ufe0f", "\ud83c\udf86", "v:copper", "v:tin", "v:bronze", "v:iron", "v:silver", "v:blackmetal", "v:flametal",
			"v:ingots", "v:scrap", "v:coal", "v:coalbag", "v:obsidian", "v:flint", "v:marble", "v:furs", "v:deer", "v:troll",
			"v:wolf", "v:lox", "v:bear", "v:finewood", "v:corewood", "v:ancient", "v:yggwood", "v:resin", "v:tar", "v:leather",
			"v:flax", "v:linen", "v:chain", "v:surtling", "v:blackcore", "v:eitr", "v:sap", "v:tissue", "v:carrotseed", "v:turnipseed",
			"v:onionseed", "v:barley", "v:flaxseed", "v:seedpile", "v:seedbag", "v:grimoire", "v:rune", "v:staff", "v:soup", "v:skewer",
			"v:rawmeat", "v:forge", "v:weapons", "v:tools", "v:armor", "v:totems", "v:money", "v:arrwood", "v:arrflint", "v:arrbronze",
			"v:arriron", "v:arrsilver", "v:arrfire", "v:arrpoison", "v:arrfrost", "v:arrobsid", "v:arrneedle", "v:arrshell", "v:arrchar", "v:quiver"
		};

		internal static readonly string[] EmojiGroups = new string[120]
		{
			"materials", "materials", "craft", "equipment", "equipment", "equipment", "food", "food", "food", "nature",
			"materials", "materials", "craft", "food", "craft", "craft", "materials", "nature", "nature", "nature",
			"nature", "nature", "food", "food", "food", "food", "materials", "materials", "materials", "materials",
			"creatures", "food", "materials", "materials", "craft", "equipment", "craft", "creatures", "materials", "creatures",
			"mystic", "mystic", "mystic", "nature", "nature", "equipment", "equipment", "materials", "materials", "materials",
			"creatures", "craft", "craft", "materials", "materials", "materials", "materials", "materials", "materials", "materials",
			"materials", "materials", "materials", "materials", "materials", "materials", "materials", "materials", "materials", "materials",
			"materials", "materials", "materials", "materials", "materials", "materials", "materials", "craft", "craft", "craft",
			"craft", "craft", "craft", "mystic", "mystic", "mystic", "mystic", "mystic", "nature", "nature",
			"nature", "nature", "nature", "nature", "nature", "mystic", "mystic", "mystic", "food", "food",
			"food", "craft", "equipment", "equipment", "equipment", "mystic", "materials", "equipment", "equipment", "equipment",
			"equipment", "equipment", "equipment", "equipment", "equipment", "equipment", "equipment", "equipment", "equipment", "equipment"
		};

		internal static readonly string[] EmojiTypes = new string[120]
		{
			"wood_resource", "stone", "components", "weapons", "ammo", "armor", "meals", "fishing", "rawfood", "seeds",
			"precious", "ore_metal", "misc", "potions", "components", "misc", "wood_resource", "plants", "seeds", "plants",
			"plants", "seeds", "rawfood", "meals", "meals", "potions", "bones", "bones", "hides", "hides",
			"monster", "rawfood", "hides", "stone", "misc", "utility", "quest", "trophies", "precious", "trophies",
			"magic", "magic", "magic", "plants", "plants", "utility", "tools", "ore_metal", "ore_metal", "hides",
			"monster", "components", "misc", "ore_metal", "ore_metal", "ore_metal", "ore_metal", "ore_metal", "ore_metal", "ore_metal",
			"ore_metal", "ore_metal", "coal_stone", "coal_stone", "coal_stone", "coal_stone", "coal_stone", "hides", "hides", "hides",
			"hides", "hides", "hides", "wood_resource", "wood_resource", "wood_resource", "wood_resource", "components", "components", "components",
			"components", "components", "components", "magic_resources", "magic_resources", "magic_resources", "magic_resources", "magic_resources", "seeds", "seeds",
			"seeds", "seeds", "seeds", "seeds", "seeds", "magic", "magic", "magic", "meals", "meals",
			"rawfood", "components", "weapons", "tools", "armor", "totems", "precious", "arrows", "arrows", "arrows",
			"arrows", "arrows", "arrows", "arrows", "arrows", "arrows", "arrows", "arrows", "arrows", "arrows"
		};

		internal static readonly string[] EmojiNamesFr = new string[120]
		{
			"Bois", "Pierre", "Forge", "Épées", "Arcs", "Boucliers", "Viande cuite", "Poissons", "Miel", "Céréales",
			"Gemmes", "Pièces", "Feu", "Potions", "Fil", "Stockage", "Arbres", "Feuilles", "Semis", "Baies",
			"Champignons", "Légumes", "Noix", "Ragoûts", "Pain", "Hydromel", "Os", "Plumes", "Sangliers", "Loups",
			"Insectes", "Œufs", "Laine", "Matériaux de construction", "Mobilier", "Bateaux", "Clés", "Trophées", "Trésors", "Boss",
			"Magie", "Cristaux", "Givre", "Eau", "Plantes", "Exploration", "Outils", "Minerais", "Métaux", "Peaux et cuir",
			"Butin de monstres", "Composants", "Divers", "Cuivre", "Étain", "Bronze", "Fer", "Argent", "Sombracier", "Flametal",
			"Lingots assortis", "Ferraille", "Morceaux de charbon", "Sac de charbon", "Obsidienne", "Silex", "Marbre noir", "Fourrures assorties", "Peau de cerf", "Peau de troll",
			"Peau de loup", "Peau de lox", "Peau d’ours", "Bois précieux", "Bois robuste", "Écorce ancienne", "Bois d’Yggdrasil", "Résine", "Goudron", "Morceaux de cuir",
			"Lin", "Fil de lin", "Chaîne", "Cœur de Surtling", "Cœur noir", "Eitr raffiné", "Sève", "Tissu mou", "Graines de carotte", "Graines de navet",
			"Graines d’oignon", "Orge", "Graines de lin", "Tas de graines", "Sac de graines", "Grimoire", "Rune gravée", "Bâton magique", "Soupe", "Brochette",
			"Viande crue", "Forge et enclume", "Armes assorties", "Outils assortis", "Armures", "Totems métalliques", "Monnaie", "Flèche en bois", "Flèche en silex", "Flèche en bronze",
			"Flèche en fer", "Flèche en argent", "Flèche enflammée", "Flèche empoisonnée", "Flèche de givre", "Flèche en obsidienne", "Flèche en dard de moustique", "Flèche en carapace", "Flèche carbonisée", "Carquois assorti"
		};

		internal static readonly string[] EmojiNamesEn = new string[120]
		{
			"Wood", "Stone", "Forge", "Swords", "Bows", "Shields", "Cooked meat", "Fish", "Honey", "Grain",
			"Gems", "Coins", "Fire", "Potions", "Thread", "Storage", "Trees", "Leaves", "Seedlings", "Berries",
			"Mushrooms", "Vegetables", "Nuts", "Stews", "Bread", "Mead", "Bones", "Feathers", "Boars", "Wolves",
			"Insects", "Eggs", "Wool", "Building materials", "Furniture", "Boats", "Keys", "Trophies", "Treasure", "Bosses",
			"Magic", "Crystals", "Frost", "Water", "Plants", "Exploration", "Tools", "Ore", "Metals", "Hides and leather",
			"Monster loot", "Components", "Miscellaneous", "Copper", "Tin", "Bronze", "Iron", "Silver", "Black metal", "Flametal",
			"Mixed ingots", "Scrap iron", "Coal chunks", "Charcoal bag", "Obsidian", "Flint", "Black marble", "Mixed furs", "Deer hide", "Troll hide",
			"Wolf pelt", "Lox pelt", "Bear pelt", "Fine wood", "Core wood", "Ancient bark", "Yggdrasil wood", "Resin", "Tar", "Leather scraps",
			"Flax", "Linen thread", "Chain", "Surtling core", "Black core", "Refined Eitr", "Sap", "Soft tissue", "Carrot seeds", "Turnip seeds",
			"Onion seeds", "Barley", "Flax seeds", "Mixed seeds", "Seed sack", "Spellbook", "Runestone", "Magic staff", "Soup", "Skewer",
			"Raw meat", "Forge and anvil", "Assorted weapons", "Assorted tools", "Armor", "Metal totems", "Money", "Wood arrow", "Flinthead arrow", "Bronzehead arrow",
			"Ironhead arrow", "Silver arrow", "Fire arrow", "Poison arrow", "Frost arrow", "Obsidian arrow", "Needle arrow", "Carapace arrow", "Charred arrow", "Mixed quiver"
		};

		internal static readonly string[] EmojiAliases = new string[120]
		{
			"materials wood_resource", "materials stone", "craft components", "equipment weapons", "equipment ammo", "equipment armor", "food meals", "food fishing", "food rawfood", "nature seeds",
			"materials precious", "materials ore_metal", "craft misc flamme flame", "food potions", "craft components", "craft misc", "materials wood_resource", "nature plants", "nature seeds pousse semis sprout seedling", "nature plants",
			"nature plants", "nature seeds", "food rawfood", "food meals", "food meals", "food potions", "materials bones", "materials bones", "materials hides peau peaux pelage fourrure hide fur pelt", "materials hides peau peaux pelage fourrure hide fur pelt",
			"creatures monster", "food rawfood", "materials hides peau peaux pelage fourrure hide fur pelt", "materials stone", "craft misc", "equipment utility", "craft quest", "creatures trophies", "materials precious", "creatures trophies",
			"mystic magic", "mystic magic", "mystic magic", "nature plants", "nature plants", "equipment utility", "equipment tools", "materials ore_metal", "materials ore_metal", "materials hides peau peaux pelage fourrure hide fur pelt",
			"creatures monster", "craft components", "craft misc", "minerai minerais metal metaux ore ores ingot lingot forge ", "minerai minerais metal metaux ore ores ingot lingot forge ", "minerai minerais metal metaux ore ores ingot lingot forge ", "minerai minerais metal metaux ore ores ingot lingot forge ", "minerai minerais metal metaux ore ores ingot lingot forge ", "minerai minerais metal metaux ore ores ingot lingot forge ", "minerai minerais metal metaux ore ores ingot lingot forge ",
			"minerai minerais metal metaux ore ores ingot lingot forge ", "minerai minerais metal metaux ore ores ingot lingot forge ", "mineral mineraux pierre stone charbon charbonnage combustible coal charcoal fuel barbecue", "mineral mineraux pierre stone charbon sac charbonnage combustible coal charcoal fuel barbecue viking weber bag", "mineral mineraux pierre stone ", "mineral mineraux pierre stone ", "mineral mineraux pierre stone ", "peau peaux pelage fourrure cuir hide pelt fur leather assortiment assortiment mixed assorted", "peau peaux pelage fourrure cuir hide pelt fur leather ", "peau peaux pelage fourrure cuir hide pelt fur leather ",
			"peau peaux pelage fourrure cuir hide pelt fur leather ", "peau peaux pelage fourrure cuir hide pelt fur leather ", "peau peaux pelage fourrure cuir hide pelt fur leather ", "bois wood log timber buche bouleau birch chene oak finewood", "bois wood log timber buche pin pine corewood", "bois wood log timber buche ancient bark ecorce marais swamp", "bois wood log timber buche yggdrasil yggdrasilwood", "artisanat crafting composant components ", "artisanat crafting composant components ", "artisanat crafting composant components ",
			"artisanat crafting composant components fibre fibers textile fibres plante plant", "artisanat crafting composant components fibre fibers textile fibres bobine spool linen thread", "artisanat crafting composant components ", "magie magique mystique magic magical eitr resource ressource noyau core feu fire surtling surtlingcore", "magie magique mystique magic magical eitr resource ressource noyau core noir black blackcore", "magie magique mystique magic magical eitr resource ressource raffine refined eitr magie", "magie magique mystique magic magical eitr resource ressource seve arbre tree sap", "magie magique mystique magic magical eitr resource ressource tissu mou chair cerveau flesh brain soft tissue", "graines semences agriculture seed seeds farming jardin ", "graines semences agriculture seed seeds farming jardin ",
			"graines semences agriculture seed seeds farming jardin ", "graines semences agriculture seed seeds farming jardin ", "graines semences agriculture seed seeds farming jardin ", "graines semences agriculture seed seeds farming jardin tas vrac pile assorted mixed", "graines semences agriculture seed seeds farming jardin sac sachet bag sack pouch", "magie magique sort sorcier magic spell wizard sorcery livre book spellbook enchantement enchantment", "magie magique sort sorcier magic spell wizard sorcery pierre stone rune inscription runestone", "magie magique sort sorcier magic spell wizard sorcery baton baguette sceptre staff wand scepter", "cuisine repas plat food meal cooked cuisine ", "cuisine repas plat food meal cooked cuisine ",
			"viande crue cru raw uncooked meat ", "artisanat crafting composant components ", "armes weapons epee sword hache axe combat ", "outils tools pioche marteau hache pickaxe hammer axe ", "armure armor casque helmet cuirasse protection ", "totem statue moai paques matiere metal minerais ", "monnaie pieces or piastres bourse bijoux pierres precieuses tresor money coins gold purse pouch jewelry gems treasure valuables ", "fleche fleches arrow arrows munitions ammunition стрелы 箭 ", "fleche fleches arrow arrows munitions ammunition стрелы 箭 ", "fleche fleches arrow arrows munitions ammunition стрелы 箭 metal metaux metallic",
			"fleche fleches arrow arrows munitions ammunition стрелы 箭 metal metaux metallic", "fleche fleches arrow arrows munitions ammunition стрелы 箭 metal metaux metallic", "fleche fleches arrow arrows munitions ammunition стрелы 箭 feu incendiaire fire burning", "fleche fleches arrow arrows munitions ammunition стрелы 箭 poison toxique", "fleche fleches arrow arrows munitions ammunition стрелы 箭 glace gel frost ice", "fleche fleches arrow arrows munitions ammunition стрелы 箭 ", "fleche fleches arrow arrows munitions ammunition стрелы 箭 aiguille dard moustique morstic deathsquito mosquito needle", "fleche fleches arrow arrows munitions ammunition стрелы 箭 chitine chitin shell seeker", "fleche fleches arrow arrows munitions ammunition стрелы 箭 cendre ashlands charred", "fleche fleches arrow arrows munitions ammunition стрелы 箭 carquois assortiment toutes mixed quiver all колчан 箭袋"
		};

		private static int RowsPerMode => (Emoji.Length + 16 - 1) / 16;

		internal static Texture2D Get(string icon, IconMode mode)
		{
			//IL_0064: Unknown result type (might be due to invalid IL or missing references)
			//IL_006a: Expected O, but got Unknown
			int num = Array.IndexOf((mode == IconMode.Pictogram) ? Pictograms : Emoji, icon);
			if (num < 0 || !EnsureLoaded())
			{
				return null;
			}
			int num2 = mode switch
			{
				IconMode.EmojiOriginal => 1, 
				IconMode.Pictogram => 0, 
				_ => 2, 
			};
			int key = num2 * Emoji.Length + num;
			if (Icons.TryGetValue(key, out var value) && (Object)(object)value != (Object)null)
			{
				return value;
			}
			value = new Texture2D(128, 128, (TextureFormat)4, false);
			((Object)value).name = "ContainerCustomizer_Icon_" + key + ((mode != IconMode.Pictogram && num >= 53) ? "_Detail" : "");
			((Object)value).hideFlags = (HideFlags)61;
			((Texture)value).filterMode = (FilterMode)1;
			int num3 = num % 16 * 128;
			int num4 = (3 * RowsPerMode - 1 - num2 * RowsPerMode - num / 16) * 128;
			value.SetPixels(_atlas.GetPixels(num3, num4, 128, 128));
			value.Apply(false, false);
			Icons[key] = value;
			return value;
		}

		private static bool EnsureLoaded()
		{
			//IL_0082: Unknown result type (might be due to invalid IL or missing references)
			//IL_008c: Expected O, but got Unknown
			if ((Object)(object)_atlas != (Object)null)
			{
				return true;
			}
			if (_failed)
			{
				return false;
			}
			try
			{
				using (Stream stream = Assembly.GetExecutingAssembly().GetManifestResourceStream("ContainerCustomizer.icons.rgba"))
				{
					if (stream == null)
					{
						throw new FileNotFoundException("Embedded icons.rgba was not found");
					}
					using MemoryStream memoryStream = new MemoryStream();
					stream.CopyTo(memoryStream);
					byte[] array = memoryStream.ToArray();
					if (array.Length != 6144 * RowsPerMode * 128 * 4)
					{
						throw new InvalidDataException("Embedded icon atlas has an invalid size");
					}
					_atlas = new Texture2D(2048, 3 * RowsPerMode * 128, (TextureFormat)4, false);
					((Object)_atlas).hideFlags = (HideFlags)61;
					_atlas.LoadRawTextureData(array);
					_atlas.Apply(false, false);
				}
				((Object)_atlas).name = "ContainerCustomizer_Atlas";
				((Texture)_atlas).filterMode = (FilterMode)1;
				return true;
			}
			catch (Exception ex)
			{
				_failed = true;
				if ((Object)(object)_atlas != (Object)null)
				{
					Object.Destroy((Object)(object)_atlas);
				}
				_atlas = null;
				Plugin.Warn("Icon atlas unavailable: " + ex);
				return false;
			}
		}

		internal static void Dispose()
		{
			foreach (Texture2D value in Icons.Values)
			{
				if ((Object)(object)value != (Object)null)
				{
					Object.Destroy((Object)(object)value);
				}
			}
			Icons.Clear();
			if ((Object)(object)_atlas != (Object)null)
			{
				Object.Destroy((Object)(object)_atlas);
			}
			_atlas = null;
			_failed = false;
		}
	}
	internal static class IconSearch
	{
		private static string[] _documents;

		private static string _documentLanguage;

		private static string _lastQuery;

		private static string[] _terms = new string[0];

		internal static string Normalize(string value)
		{
			StringBuilder stringBuilder = new StringBuilder();
			string text = (value ?? "").Normalize(NormalizationForm.FormD);
			foreach (char c in text)
			{
				if (CharUnicodeInfo.GetUnicodeCategory(c) != UnicodeCategory.NonSpacingMark)
				{
					if (char.IsLetterOrDigit(c))
					{
						stringBuilder.Append(char.ToLowerInvariant(c));
					}
					else
					{
						stringBuilder.Append(' ');
					}
				}
			}
			return stringBuilder.ToString().Replace("œ", "oe").Replace("æ", "ae");
		}

		internal static bool Matches(int index, string query)
		{
			if (index < 0 || index >= IconAtlas.Emoji.Length)
			{
				return false;
			}
			string language = Translations.Language;
			if (_documents == null || _documentLanguage != language)
			{
				_documentLanguage = language;
				_documents = new string[IconAtlas.Emoji.Length];
				for (int i = 0; i < _documents.Length; i++)
				{
					_documents[i] = Normalize(IconAtlas.EmojiNamesFr[i] + " " + IconAtlas.EmojiNamesEn[i] + " " + IconAtlas.EmojiAliases[i] + " " + Translations.SearchNames(language, IconAtlas.Emoji[i]));
				}
			}
			if (_lastQuery != query)
			{
				_lastQuery = query;
				_terms = Normalize(query).Split(new char[1] { ' ' }, StringSplitOptions.RemoveEmptyEntries);
			}
			return _terms.All((string term) => _documents[index].IndexOf(term, StringComparison.Ordinal) >= 0);
		}

		internal static string[] ReadHistory(string stored)
		{
			return (from id in (stored ?? "").Split(new char[1] { ',' }, StringSplitOptions.RemoveEmptyEntries)
				where Array.IndexOf(IconAtlas.Emoji, id) >= 0
				select id).Distinct().Take(12).ToArray();
		}

		internal static string Remember(string stored, string selected)
		{
			if (Array.IndexOf(IconAtlas.Emoji, selected) < 0)
			{
				return string.Join(",", ReadHistory(stored));
			}
			return string.Join(",", new string[1] { selected }.Concat(from id in ReadHistory(stored)
				where id != selected
				select id).Take(12));
		}

		internal static IEnumerable<int> Select(string group, string type, string query, bool favoritesOnly, ISet<string> favorites, bool recentOnly, string recent)
		{
			IEnumerable<int> enumerable = (recentOnly ? (from id in ReadHistory(recent)
				select Array.IndexOf(IconAtlas.Emoji, id)) : Enumerable.Range(0, IconAtlas.Emoji.Length));
			foreach (int item in enumerable)
			{
				if ((!(group != "all") || !(IconAtlas.EmojiGroups[item] != group)) && (!(type != "all") || !(IconAtlas.EmojiTypes[item] != type)) && (!favoritesOnly || favorites.Contains(IconAtlas.Emoji[item])) && Matches(item, query))
				{
					yield return item;
				}
			}
		}
	}
	internal static class LabelGeometry
	{
		internal static float TrackingGap(float textHeight, float fontScale)
		{
			float num = Math.Max(0f, Math.Min(1f, (fontScale - 0.5f) / 2.5f));
			return Math.Max(0.004f, textHeight * (0.075f - 0.05f * num));
		}

		internal static float WordSpace(float textHeight, float fontScale)
		{
			float num = Math.Max(0f, Math.Min(1f, (fontScale - 0.5f) / 2.5f));
			return Math.Max(0.012f, textHeight * (0.32f - 0.1f * num));
		}

		internal static void ArrangeArc(float[] widths, float radius, float gap, out float horizontalScale, out float span, float[] angles)
		{
			float num = gap * (float)Math.Max(0, widths.Length - 1);
			float[] array = widths;
			foreach (float num2 in array)
			{
				num += num2;
			}
			float num3 = (float)(Math.PI * 2.0 * (double)radius) - 0.16f;
			horizontalScale = Math.Min(1f, num3 / Math.Max(0.001f, num));
			float num4 = gap * horizontalScale / radius;
			span = num4 * (float)Math.Max(0, widths.Length - 1);
			array = widths;
			foreach (float num5 in array)
			{
				span += 2f * (float)Math.Atan(num5 * horizontalScale / (2f * radius));
			}
			float num6 = span * 0.5f;
			for (int j = 0; j < widths.Length; j++)
			{
				float num7 = (float)Math.Atan(widths[j] * horizontalScale / (2f * radius));
				angles[j] = num6 - num7;
				num6 -= num7 * 2f + num4;
			}
		}

		internal static float FitIconScale(float textHeight, float requested)
		{
			if (textHeight <= 0f)
			{
				return requested;
			}
			float num = Math.Max(0.035f, textHeight * 0.12f);
			return Math.Min(requested, Math.Max(0.095f, 0.68f - textHeight - num) / 0.19f);
		}

		internal static void Stack(float textHeight, bool hasIcon, out float textCenter, out float iconCenter, float iconScale = 1f)
		{
			if (textHeight <= 0f)
			{
				textCenter = (iconCenter = 0.56f);
				return;
			}
			float num = 0.19f * iconScale;
			float num2 = Math.Max(0.035f, textHeight * 0.12f);
			float num3 = textHeight + (hasIcon ? (num2 + num) : 0f);
			float num4 = Math.Min(0.56f, 0.84f - num3 * 0.5f);
			textCenter = num4 - (hasIcon ? ((num2 + num) * 0.5f) : 0f);
			iconCenter = textCenter + textHeight * 0.5f + num2 + num * 0.5f;
		}
	}
	internal static class MenuFonts
	{
		private static Font _chinese;

		private static bool _attempted;

		private static bool _owned;

		internal static void Apply(GUISkin skin)
		{
			if (Translations.Language != "Chinese")
			{
				return;
			}
			if ((Object)(object)_chinese == (Object)null && _chinese != null)
			{
				_attempted = false;
			}
			if ((Object)(object)_chinese == (Object)null && !_attempted)
			{
				_attempted = true;
				_chinese = ((IEnumerable<Font>)Resources.FindObjectsOfTypeAll<Font>()).FirstOrDefault((Func<Font, bool>)((Font f) => (Object)(object)f != (Object)null && f.HasCharacter('中')));
				if ((Object)(object)_chinese == (Object)null)
				{
					string[] source = new string[10] { "Microsoft YaHei", "Microsoft YaHei UI", "Noto Sans CJK SC", "Noto Sans SC", "PingFang SC", "Heiti SC", "WenQuanYi Zen Hei", "SimHei", "SimSun", "Arial Unicode MS" };
					string[] installed = Font.GetOSInstalledFontNames();
					string[] array = source.Where((string p) => installed.Any((string n) => string.Equals(n, p, StringComparison.OrdinalIgnoreCase))).ToArray();
					if (array.Length != 0)
					{
						_chinese = Font.CreateDynamicFontFromOSFont(array, 16);
						if ((Object)(object)_chinese != (Object)null)
						{
							((Object)_chinese).name = "ContainerCustomizer_ChineseFont";
							((Object)_chinese).hideFlags = (HideFlags)61;
							_owned = true;
						}
					}
					if ((Object)(object)_chinese == (Object)null)
					{
						Plugin.Warn("No Chinese-capable UI font found. Install a CJK font such as Noto Sans CJK SC.");
					}
				}
			}
			if (!((Object)(object)_chinese == (Object)null))
			{
				skin.font = _chinese;
				GUIStyle[] array2 = (GUIStyle[])(object)new GUIStyle[7] { skin.window, skin.box, skin.button, skin.label, skin.toggle, skin.textField, skin.textArea };
				for (int num = 0; num < array2.Length; num++)
				{
					array2[num].font = _chinese;
				}
			}
		}

		internal static void Dispose()
		{
			if (_owned && (Object)(object)_chinese != (Object)null)
			{
				Object.Destroy((Object)(object)_chinese);
			}
			_chinese = null;
			_owned = false;
			_attempted = false;
		}
	}
	[HarmonyPatch]
	internal static class MenuMouseWheelPatch
	{
		private static IEnumerable<MethodBase> TargetMethods()
		{
			Type type = AccessTools.TypeByName("ZInput");
			bool found = false;
			if (type != null)
			{
				MethodInfo[] methods = type.GetMethods(BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic);
				foreach (MethodInfo methodInfo in methods)
				{
					if (!(methodInfo.Name != "GetMouseScrollWheel") && !(methodInfo.ReturnType != typeof(float)))
					{
						found = true;
						yield return methodInfo;
					}
				}
			}
			if (!found)
			{
				Plugin.Warn("Mouse wheel input method unavailable; menu camera zoom suppression could not be installed.");
			}
		}

		[HarmonyPostfix]
		[HarmonyPriority(0)]
		private static void Postfix(ref float __result)
		{
			if ((Object)(object)Controller.Active != (Object)null && Controller.Active.IsWindowOpen)
			{
				__result = 0f;
			}
		}
	}
	internal static class Strings
	{
		internal static string Get(string key)
		{
			return Translations.Get("ui." + key);
		}
	}
	internal static class Panels
	{
		private static Style _clipboard;

		private static readonly string[] PaletteNames = new string[12]
		{
			"white", "black", "red", "orange", "yellow", "green", "cyan", "blue", "purple", "pink",
			"brown", "gold"
		};

		private static readonly Color32[] Palette = (Color32[])(object)new Color32[12]
		{
			new Color32(byte.MaxValue, byte.MaxValue, byte.MaxValue, byte.MaxValue),
			new Color32((byte)35, (byte)31, (byte)29, byte.MaxValue),
			new Color32((byte)210, (byte)64, (byte)49, byte.MaxValue),
			new Color32((byte)227, (byte)130, (byte)53, byte.MaxValue),
			new Color32((byte)245, (byte)216, (byte)97, byte.MaxValue),
			new Color32((byte)92, (byte)173, (byte)89, byte.MaxValue),
			new Color32((byte)73, (byte)191, (byte)190, byte.MaxValue),
			new Color32((byte)76, (byte)127, (byte)210, byte.MaxValue),
			new Color32((byte)142, (byte)96, (byte)188, byte.MaxValue),
			new Color32((byte)226, (byte)139, (byte)166, byte.MaxValue),
			new Color32((byte)126, (byte)84, (byte)52, byte.MaxValue),
			new Color32((byte)227, (byte)183, (byte)88, byte.MaxValue)
		};

		internal static void Draw(Controller controller)
		{
			//IL_01ae: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b7: 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_034a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0353: 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_0362: Unknown result type (might be due to invalid IL or missing references)
			//IL_0334: 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_041a: Unknown result type (might be due to invalid IL or missing references)
			//IL_041f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0427: Unknown result type (might be due to invalid IL or missing references)
			//IL_042e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0435: Unknown result type (might be due to invalid IL or missing references)
			//IL_043c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0446: Expected O, but got Unknown
			//IL_0448: Expected O, but got Unknown
			//IL_0455: Unknown result type (might be due to invalid IL or missing references)
			//IL_045f: Expected O, but got Unknown
			//IL_045a: Unknown result type (might be due to invalid IL or missing references)
			//IL_045f: 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_0490: Unknown result type (might be due to invalid IL or missing references)
			//IL_04c3: Unknown result type (might be due to invalid IL or missing references)
			//IL_03a6: 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_03c1: Expected O, but got Unknown
			//IL_03bc: Unknown result type (might be due to invalid IL or missing references)
			//IL_03c1: Unknown result type (might be due to invalid IL or missing references)
			//IL_03cb: Unknown result type (might be due to invalid IL or missing references)
			//IL_03d1: Invalid comparison between Unknown and I4
			//IL_0379: Unknown result type (might be due to invalid IL or missing references)
			//IL_0106: Unknown result type (might be due to invalid IL or missing references)
			//IL_010d: 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_0133: Unknown result type (might be due to invalid IL or missing references)
			//IL_013f: Unknown result type (might be due to invalid IL or missing references)
			//IL_014e: Expected O, but got Unknown
			//IL_0149: 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_00f3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f5: Unknown result type (might be due to invalid IL or missing references)
			using (new VikingSkin.DrawingScope(GUI.skin))
			{
				MenuFonts.Apply(GUI.skin);
				if (controller.SearchOpen)
				{
					DrawOccludedMatches(controller);
				}
				if (controller.Editing != null && controller.Draft != null)
				{
					float num = Mathf.Min(660f, (float)Screen.width - 32f);
					float num2 = EditorSizing.DisplayHeight((((Rect)(ref controller.EditorRect)).width > 0f) ? ((Rect)(ref controller.EditorRect)).height : Plugin.EditorHeight.Value, Screen.height);
					Rect editorRect = default(Rect);
					((Rect)(ref editorRect))..ctor(((float)Screen.width - num) / 2f, ((float)Screen.height - num2) / 2f, num, num2);
					if (((Rect)(ref controller.EditorRect)).width <= 0f)
					{
						controller.EditorRect = editorRect;
					}
					controller.EditorRect = KeepOnScreen(controller.EditorRect, num, num2);
					HandleEditorResize(controller);
					controller.EditorRect = GUI.Window(833010, controller.EditorRect, (WindowFunction)delegate
					{
						DrawEditor(controller);
					}, "");
				}
				else if (controller.SearchOpen && controller.SearchNavigating)
				{
					float height = Mathf.Min(195f, (float)Screen.height - 32f);
					float width = Mathf.Min(370f, (float)Screen.width - 32f);
					GUI.Box(KeepOnScreen(controller.SearchRect, width, height), Strings.Get("search") + "\n" + Strings.Get("query") + ": " + controller.Query + "\n" + Strings.Get("nearby") + ": " + controller.Results.Count() + "\n" + string.Join("\n", from h in controller.Results.Take(4)
						select controller.MatchName(h.Container) + " (" + Vector3.Distance(((Component)Player.m_localPlayer).transform.position, ((Component)h.Container).transform.position).ToString("0") + " m)") + "\n" + string.Format(Strings.Get("return_search"), ShortcutInput.Describe(Plugin.SearchKey.Value)));
				}
				else if (controller.SearchOpen)
				{
					float num3 = Mathf.Min(460f, (float)Screen.width - 32f);
					float num4 = Mathf.Min(420f, (float)Screen.height - 56f);
					if (((Rect)(ref controller.SearchRect)).width <= 0f)
					{
						controller.SearchRect = new Rect((float)Screen.width * Mathf.Clamp01(Plugin.SearchWindowX.Value), (float)Screen.height * Mathf.Clamp01(Plugin.SearchWindowY.Value), num3, num4);
					}
					controller.SearchRect = KeepOnScreen(controller.SearchRect, num3, num4);
					if ((int)Event.current.type == 0 && !((Rect)(ref controller.SearchRect)).Contains(Event.current.mousePosition))
					{
						controller.BeginSearchNavigation();
						return;
					}
					controller.SearchRect = GUI.Window(833011, controller.SearchRect, (WindowFunction)delegate
					{
						DrawSearch(controller);
					}, "");
					if ((int)Event.current.type == 1)
					{
						controller.SaveSearchPosition();
					}
				}
				else if (!string.IsNullOrEmpty(controller.Status) && Time.unscaledTime < controller.StatusUntil)
				{
					GUIStyle val = new GUIStyle(GUI.skin.box)
					{
						fontSize = 17,
						wordWrap = false,
						alignment = (TextAnchor)4,
						padding = new RectOffset(13, 13, 7, 7)
					};
					Vector2 val2 = val.CalcSize(new GUIContent(controller.Status));
					float num5 = Mathf.Min((float)Screen.width - 24f, Mathf.Max(165f, val2.x + 10f));
					float num6 = Mathf.Max(38f, val2.y + 8f);
					GUI.Box(new Rect(((float)Screen.width - num5) * 0.5f, (float)Screen.height - 110f, num5, num6), controller.Status, val);
				}
			}
		}

		private static Rect EditorResizeHandle(Controller c)
		{
			//IL_0038: Unknown result type (might be due to invalid IL or missing references)
			return new Rect(((Rect)(ref c.EditorRect)).x + 10f, ((Rect)(ref c.EditorRect)).yMax - 28f, ((Rect)(ref c.EditorRect)).width - 20f, 20f);
		}

		private static void HandleEditorResize(Controller c)
		{
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_004c: Unknown result type (might be due to invalid IL or missing references)
			//IL_005e: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bd: Invalid comparison between Unknown and I4
			//IL_007f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0100: Unknown result type (might be due to invalid IL or missing references)
			//IL_0106: Invalid comparison between Unknown and I4
			//IL_00cc: Unknown result type (might be due to invalid IL or missing references)
			int controlID = GUIUtility.GetControlID(833012, (FocusType)2);
			Event current = Event.current;
			Rect val = EditorResizeHandle(c);
			if (c.EditorResizing && (!Application.isFocused || GUIUtility.hotControl != controlID))
			{
				if (GUIUtility.hotControl == controlID)
				{
					GUIUtility.hotControl = 0;
				}
				c.EditorResizing = false;
				c.SaveEditorHeight();
			}
			if ((int)current.type == 0 && current.button == 0 && ((Rect)(ref val)).Contains(current.mousePosition))
			{
				GUIUtility.hotControl = controlID;
				GUIUtility.keyboardControl = 0;
				c.EditorResizing = true;
				c.EditorResizeStartY = current.mousePosition.y;
				c.EditorResizeStartHeight = ((Rect)(ref c.EditorRect)).height;
				current.Use();
			}
			else if (c.EditorResizing && GUIUtility.hotControl == controlID)
			{
				if ((int)current.type == 3)
				{
					((Rect)(ref c.EditorRect)).height = EditorSizing.DragHeight(c.EditorResizeStartHeight, current.mousePosition.y - c.EditorResizeStartY, ((Rect)(ref c.EditorRect)).y, Screen.height);
					current.Use();
				}
				else if ((int)current.type == 1 && current.button == 0)
				{
					GUIUtility.hotControl = 0;
					c.EditorResizing = false;
					c.SaveEditorHeight();
					current.Use();
				}
			}
		}

		private static void DrawEditorResizeHandle(Controller c)
		{
			//IL_000a: Unknown result type (might be due to invalid IL or missing references)
			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_002d: Expected O, but got Unknown
			//IL_002e: Expected O, but got Unknown
			//IL_0061: 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_0090: Unknown result type (might be due to invalid IL or missing references)
			//IL_009a: Unknown result type (might be due to invalid IL or missing references)
			GUIStyle val = new GUIStyle(GUI.skin.label)
			{
				alignment = (TextAnchor)4,
				fontSize = 11,
				padding = new RectOffset(2, 2, 0, 0)
			};
			Rect val2 = default(Rect);
			((Rect)(ref val2))..ctor(10f, ((Rect)(ref c.EditorRect)).height - 28f, ((Rect)(ref c.EditorRect)).width - 20f, 20f);
			Fill(val2, new Color(0.25f, 0.13f, 0.055f));
			val.normal.textColor = new Color(1f, 0.87f, 0.57f);
			GUI.Label(val2, Strings.Get("resize_height"), val);
			DrawResizeArrow(((Rect)(ref val2)).x + 10f, ((Rect)(ref val2)).y + 1f);
			DrawResizeArrow(((Rect)(ref val2)).xMax - 10f, ((Rect)(ref val2)).y + 1f);
		}

		private static void DrawResizeArrow(float x, float y)
		{
			//IL_0012: 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_005b: Unknown result type (might be due to invalid IL or missing references)
			//IL_006f: Unknown result type (might be due to invalid IL or missing references)
			Fill(new Rect(x - 1f, y, 3f, 11f), new Color(1f, 0.8f, 0.3f));
			for (int i = 0; i < 5; i++)
			{
				Fill(new Rect(x - 5f + (float)i, y + 9f + (float)i, 11f - (float)i * 2f, 1f), new Color(1f, 0.8f, 0.3f));
			}
		}

		private static void Fill(Rect rect, Color color)
		{
			//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_000b: Unknown result type (might be due to invalid IL or missing references)
			Color color2 = GUI.color;
			GUI.color = color;
			GUI.DrawTexture(rect, (Texture)(object)Texture2D.whiteTexture);
			GUI.color = color2;
		}

		private static void DrawPreview(Style style)
		{
			//IL_002d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0032: Unknown result type (might be due to invalid IL or missing references)
			//IL_0038: Unknown result type (might be due to invalid IL or missing references)
			//IL_003e: Invalid comparison between Unknown and I4
			//IL_0055: Unknown result type (might be due to invalid IL or missing references)
			//IL_005a: Unknown result type (might be due to invalid IL or missing references)
			//IL_004d: Unknown result type (might be due to invalid IL or missing references)
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_0072: Unknown result type (might be due to invalid IL or missing references)
			//IL_007e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0085: 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_00c2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ce: Unknown result type (might be due to invalid IL or missing references)
			//IL_00da: 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_0139: Unknown result type (might be due to invalid IL or missing references)
			//IL_0159: 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_01ac: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b1: 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_01cf: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d6: Unknown result type (might be due to invalid IL or missing references)
			//IL_01dd: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e2: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ec: Expected O, but got Unknown
			//IL_01ee: Expected O, but got Unknown
			//IL_01f6: Unknown result type (might be due to invalid IL or missing references)
			//IL_01fb: Unknown result type (might be due to invalid IL or missing references)
			//IL_020b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0212: Expected O, but got Unknown
			//IL_028c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0278: Unknown result type (might be due to invalid IL or missing references)
			//IL_0330: 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_02e1: Unknown result type (might be due to invalid IL or missing references)
			//IL_02d5: Unknown result type (might be due to invalid IL or missing references)
			//IL_02da: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ef: Unknown result type (might be due to invalid IL or missing references)
			//IL_0306: Unknown result type (might be due to invalid IL or missing references)
			GUILayout.Label(Strings.Get("preview"), Array.Empty<GUILayoutOption>());
			Rect rect = GUILayoutUtility.GetRect(1f, 88f, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.ExpandWidth(true) });
			if ((int)Event.current.type == 7)
			{
				Color val = (Plugin.EnableWoodTint.Value ? Color32.op_Implicit(style.Wood) : Color.white);
				Fill(rect, new Color(0.43f * val.r, 0.29f * val.g, 0.17f * val.b));
				for (int i = 1; i < 4; i++)
				{
					Fill(new Rect(((Rect)(ref rect)).x, ((Rect)(ref rect)).y + (float)i * 22f, ((Rect)(ref rect)).width, 1f), new Color(0.24f * val.r, 0.15f * val.g, 0.09f * val.b));
				}
				Rect rect2 = default(Rect);
				((Rect)(ref rect2))..ctor(((Rect)(ref rect)).x + 9f, ((Rect)(ref rect)).y + 7f, ((Rect)(ref rect)).width - 18f, ((Rect)(ref rect)).height - 14f);
				if (style.Background != BackgroundMode.Transparent)
				{
					Fill(rect2, (Color)((style.Background == BackgroundMode.White) ? Color.white : new Color(0.06f, 0.045f, 0.035f)));
				}
				Texture2D val2 = IconAtlas.Get(style.Icon, style.IconMode);
				float num = (((Object)(object)val2 == (Object)null) ? 0f : (24f * Mathf.Clamp(style.IconScale, 0.5f, 3f)));
				GUIStyle val3 = new GUIStyle(GUI.skin.label)
				{
					fontSize = Mathf.RoundToInt(18f * style.TextScale),
					alignment = (TextAnchor)4,
					wordWrap = false,
					richText = false,
					padding = new RectOffset(0, 0, 0, 0)
				};
				val3.normal.textColor = Color32.op_Implicit(style.Text);
				GUIContent val4 = new GUIContent(style.Name);
				float num2 = ((num > 0f && !string.IsNullOrEmpty(style.Name)) ? 10f : 0f);
				float num3 = Mathf.Max(1f, ((Rect)(ref rect2)).width - num - num2 - 12f);
				while (val3.fontSize > 8 && val3.CalcSize(val4).x > num3)
				{
					int fontSize = val3.fontSize;
					val3.fontSize = fontSize - 1;
				}
				float num4 = Mathf.Min(num3, val3.CalcSize(val4).x);
				float num5 = ((Rect)(ref rect2)).x + (((Rect)(ref rect2)).width - num - num2 - num4) * 0.5f;
				if ((Object)(object)val2 != (Object)null)
				{
					Color color = GUI.color;
					GUI.color = ((style.IconMode == IconMode.EmojiOriginal) ? Color.white : Color32.op_Implicit(style.IconColor));
					GUI.DrawTexture(new Rect(num5, ((Rect)(ref rect2)).center.y - num * 0.5f, num, num), (Texture)(object)val2, (ScaleMode)2, true);
					GUI.color = color;
				}
				GUI.Label(new Rect(num5 + num + num2, ((Rect)(ref rect2)).y, num4, ((Rect)(ref rect2)).height), val4, val3);
			}
		}

		private static void DrawOccludedMatches(Controller controller)
		{
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			//IL_0018: Invalid comparison between Unknown and I4
			//IL_008b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0090: Unknown result type (might be due to invalid IL or missing references)
			//IL_0095: 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_009f: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cf: Unknown result type (might be due to invalid IL or missing references)
			//IL_0108: 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_010f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0111: Unknown result type (might be due to invalid IL or missing references)
			//IL_011f: Unknown result type (might be due to invalid IL or missing references)
			//IL_012d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0142: 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_0178: Unknown result type (might be due to invalid IL or missing references)
			//IL_0190: Unknown result type (might be due to invalid IL or missing references)
			if (!Plugin.ShowOccludedMarkers.Value || (int)Event.current.type != 7)
			{
				return;
			}
			Camera main = Camera.main;
			if ((Object)(object)main == (Object)null)
			{
				return;
			}
			Texture2D val = IconAtlas.Get("✨", IconMode.EmojiOriginal);
			if ((Object)(object)val == (Object)null)
			{
				return;
			}
			RaycastHit val4 = default(RaycastHit);
			foreach (ContainerHandle item in controller.Results.Take(32))
			{
				if ((Object)(object)item.Piece == (Object)null)
				{
					continue;
				}
				Vector3 val2 = ((Component)item.Piece).transform.TransformPoint(new Vector3(0f, 0.48f, 0f));
				Vector3 val3 = val2 - ((Component)main).transform.position;
				float magnitude = ((Vector3)(ref val3)).magnitude;
				if (!(magnitude < 0.1f) && Physics.Raycast(((Component)main).transform.position, val3 / magnitude, ref val4, magnitude - 0.05f, -5, (QueryTriggerInteraction)1) && !((RaycastHit)(ref val4)).transform.IsChildOf(((Component)item.Piece).transform))
				{
					Vector3 val5 = main.WorldToScreenPoint(val2);
					if (!(val5.z <= 0f) && !(val5.x < 10f) && !(val5.x > (float)Screen.width - 10f) && !(val5.y < 10f) && !(val5.y > (float)Screen.height - 10f))
					{
						GUI.DrawTexture(new Rect(val5.x - 12f, (float)Screen.height - val5.y - 12f, 24f, 24f), (Texture)(object)val, (ScaleMode)2, true);
					}
				}
			}
		}

		private static Rect KeepOnScreen(Rect rect, float width, float height)
		{
			//IL_0070: Unknown result type (might be due to invalid IL or missing references)
			((Rect)(ref rect)).width = width;
			((Rect)(ref rect)).height = height;
			((Rect)(ref rect)).x = Mathf.Clamp(((Rect)(ref rect)).x, 8f, Mathf.Max(8f, (float)Screen.width - width - 8f));
			((Rect)(ref rect)).y = Mathf.Clamp(((Rect)(ref rect)).y, 8f, Mathf.Max(8f, (float)Screen.height - height - 8f));
			return rect;
		}

		private static void DrawEditor(Controller c)
		{
			//IL_00ed: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fc: Unknown result type (might be due to invalid IL or missing references)
			//IL_0385: Unknown result type (might be due to invalid IL or missing references)
			Style draft = c.Draft;
			GUILayout.Space(8f);
			GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
			GUILayout.Label(Strings.Get("edit") + " · " + GameLocalization.Localize(c.Editing.Piece.m_name), Array.Empty<GUILayoutOption>());
			GUILayout.FlexibleSpace();
			if (GUILayout.Button("X  " + Strings.Get("close"), (GUILayoutOption[])(object)new GUILayoutOption[2]
			{
				GUILayout.Width(110f),
				GUILayout.Height(26f)
			}))
			{
				GUILayout.EndHorizontal();
				c.Close();
				return;
			}
			GUILayout.EndHorizontal();
			string text = c.Editing.Zdo.GetString("sac_owner_name", "");
			if (!string.IsNullOrEmpty(text))
			{
				GUILayout.Label(Strings.Get("owner") + " : " + text, Array.Empty<GUILayoutOption>());
			}
			GUILayout.Space(8f);
			c.EditorScroll = GUILayout.BeginScrollView(c.EditorScroll, Array.Empty<GUILayou