plugins/Auga.dll

Decompiled 3 days ago
using System;
using System.Collections;
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.Versioning;
using System.Security;
using System.Security.Permissions;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading;
using Auga.Common;
using Auga.Compat;
using Auga.Utilities;
using AugaUnity;
using BepInEx;
using BepInEx.Bootstrap;
using BepInEx.Configuration;
using BepInEx.Logging;
using GUIFramework;
using HarmonyLib;
using JetBrains.Annotations;
using JoshH.Extensions;
using Jotunn.Managers;
using Jotunn.Utils;
using Newtonsoft.Json;
using TMPro;
using UnityEngine;
using UnityEngine.EventSystems;
using UnityEngine.Events;
using UnityEngine.Experimental.Rendering;
using UnityEngine.PostProcessing;
using UnityEngine.UI;
using UnityStandardAssets.ImageEffects;
using Valheim.SettingsGui;
using Valheim.UI;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: AssemblyTitle("Auga")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Auga")]
[assembly: AssemblyCopyright("Copyright © Randy Knapp 2021")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("bcc7dd31-d943-4684-800e-176a97dddb8f")]
[assembly: AssemblyFileVersion("1.4.1.0")]
[assembly: IgnoresAccessChecksTo("assembly_valheim")]
[assembly: IgnoresAccessChecksTo("assembly_guiutils")]
[assembly: IgnoresAccessChecksTo("assembly_utils")]
[assembly: IgnoresAccessChecksTo("gui_framework")]
[assembly: IgnoresAccessChecksTo("assembly_postprocessing")]
[assembly: IgnoresAccessChecksTo("assembly_sunshafts")]
[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.4.1.0")]
[module: UnverifiableCode]
[module: UnverifiableCode]
namespace System.Runtime.CompilerServices
{
	[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
	internal sealed class IgnoresAccessChecksToAttribute : Attribute
	{
		public string AssemblyName { get; }

		public IgnoresAccessChecksToAttribute(string assemblyName)
		{
			AssemblyName = assemblyName;
		}
	}
}
namespace JoshH.Extensions
{
	public static class Vector2Extension
	{
		public static Vector2 Rotate(this Vector2 v, float degrees)
		{
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0021: Unknown result type (might be due to invalid IL or missing references)
			//IL_0044: Unknown result type (might be due to invalid IL or missing references)
			float num = Mathf.Sin(degrees * ((float)Math.PI / 180f));
			float num2 = Mathf.Cos(degrees * ((float)Math.PI / 180f));
			float x = v.x;
			float y = v.y;
			v.x = num2 * x - num * y;
			v.y = num * x + num2 * y;
			return v;
		}
	}
}
namespace JoshH.UI
{
	[AddComponentMenu("UI/Effects/UI Gradient")]
	[RequireComponent(typeof(RectTransform))]
	public class UIGradient : BaseMeshEffect
	{
		public enum UIGradientBlendMode
		{
			Override,
			Multiply
		}

		public enum UIGradientType
		{
			Linear,
			Corner,
			ComplexLinear
		}

		[Tooltip("How the gradient color will be blended with the graphics color.")]
		[SerializeField]
		private UIGradientBlendMode blendMode;

		[SerializeField]
		[Range(0f, 1f)]
		private float intensity = 1f;

		[SerializeField]
		private UIGradientType gradientType;

		[SerializeField]
		private Color linearColor1 = Color.yellow;

		[SerializeField]
		private Color linearColor2 = Color.red;

		[SerializeField]
		private Color cornerColorUpperLeft = Color.red;

		[SerializeField]
		private Color cornerColorUpperRight = Color.yellow;

		[SerializeField]
		private Color cornerColorLowerRight = Color.green;

		[SerializeField]
		private Color cornerColorLowerLeft = Color.blue;

		[SerializeField]
		private Gradient linearGradient;

		[SerializeField]
		[Range(0f, 360f)]
		private float angle;

		private RectTransform _rectTransform;

		protected RectTransform rectTransform
		{
			get
			{
				if ((Object)(object)_rectTransform == (Object)null)
				{
					ref RectTransform reference = ref _rectTransform;
					Transform transform = ((Component)this).transform;
					reference = (RectTransform)(object)((transform is RectTransform) ? transform : null);
				}
				return _rectTransform;
			}
		}

		public UIGradientBlendMode BlendMode
		{
			get
			{
				return blendMode;
			}
			set
			{
				blendMode = value;
				ForceUpdateGraphic();
			}
		}

		public float Intensity
		{
			get
			{
				return intensity;
			}
			set
			{
				intensity = Mathf.Clamp01(value);
				ForceUpdateGraphic();
			}
		}

		public UIGradientType GradientType
		{
			get
			{
				return gradientType;
			}
			set
			{
				gradientType = value;
				ForceUpdateGraphic();
			}
		}

		public Color LinearColor1
		{
			get
			{
				//IL_0001: Unknown result type (might be due to invalid IL or missing references)
				return linearColor1;
			}
			set
			{
				//IL_0001: Unknown result type (might be due to invalid IL or missing references)
				//IL_0002: Unknown result type (might be due to invalid IL or missing references)
				linearColor1 = value;
				ForceUpdateGraphic();
			}
		}

		public Color LinearColor2
		{
			get
			{
				//IL_0001: Unknown result type (might be due to invalid IL or missing references)
				return linearColor2;
			}
			set
			{
				//IL_0001: Unknown result type (might be due to invalid IL or missing references)
				//IL_0002: Unknown result type (might be due to invalid IL or missing references)
				linearColor2 = value;
				ForceUpdateGraphic();
			}
		}

		public Color CornerColorUpperLeft
		{
			get
			{
				//IL_0001: Unknown result type (might be due to invalid IL or missing references)
				return cornerColorUpperLeft;
			}
			set
			{
				//IL_0001: Unknown result type (might be due to invalid IL or missing references)
				//IL_0002: Unknown result type (might be due to invalid IL or missing references)
				cornerColorUpperLeft = value;
				ForceUpdateGraphic();
			}
		}

		public Color CornerColorUpperRight
		{
			get
			{
				//IL_0001: Unknown result type (might be due to invalid IL or missing references)
				return cornerColorUpperRight;
			}
			set
			{
				//IL_0001: Unknown result type (might be due to invalid IL or missing references)
				//IL_0002: Unknown result type (might be due to invalid IL or missing references)
				cornerColorUpperRight = value;
				ForceUpdateGraphic();
			}
		}

		public Color CornerColorLowerRight
		{
			get
			{
				//IL_0001: Unknown result type (might be due to invalid IL or missing references)
				return cornerColorLowerRight;
			}
			set
			{
				//IL_0001: Unknown result type (might be due to invalid IL or missing references)
				//IL_0002: Unknown result type (might be due to invalid IL or missing references)
				cornerColorLowerRight = value;
				ForceUpdateGraphic();
			}
		}

		public Color CornerColorLowerLeft
		{
			get
			{
				//IL_0001: Unknown result type (might be due to invalid IL or missing references)
				return cornerColorLowerLeft;
			}
			set
			{
				//IL_0001: Unknown result type (might be due to invalid IL or missing references)
				//IL_0002: Unknown result type (might be due to invalid IL or missing references)
				cornerColorLowerLeft = value;
				ForceUpdateGraphic();
			}
		}

		public float Angle
		{
			get
			{
				return angle;
			}
			set
			{
				if (value < 0f)
				{
					angle = value % 360f + 360f;
				}
				else
				{
					angle = value % 360f;
				}
				ForceUpdateGraphic();
			}
		}

		public Gradient LinearGradient
		{
			get
			{
				return linearGradient;
			}
			set
			{
				linearGradient = value;
				ForceUpdateGraphic();
			}
		}

		public override void ModifyMesh(VertexHelper vh)
		{
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0039: Unknown result type (might be due to invalid IL or missing references)
			//IL_003e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0042: 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_0052: Unknown result type (might be due to invalid IL or missing references)
			//IL_0056: Unknown result type (might be due to invalid IL or missing references)
			//IL_005b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0060: Unknown result type (might be due to invalid IL or missing references)
			//IL_0061: Unknown result type (might be due to invalid IL or missing references)
			//IL_0062: Unknown result type (might be due to invalid IL or missing references)
			//IL_0067: 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_0077: Unknown result type (might be due to invalid IL or missing references)
			//IL_007b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0080: 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_0096: Unknown result type (might be due to invalid IL or missing references)
			//IL_009d: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a7: 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_00b0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c7: 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_00d3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00de: Unknown result type (might be due to invalid IL or missing references)
			//IL_00df: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e4: 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_00f9: 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_0105: 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_010b: 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_0133: Unknown result type (might be due to invalid IL or missing references)
			//IL_0134: 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_013e: Unknown result type (might be due to invalid IL or missing references)
			//IL_014c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0151: Unknown result type (might be due to invalid IL or missing references)
			//IL_0156: Unknown result type (might be due to invalid IL or missing references)
			//IL_015c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0123: Unknown result type (might be due to invalid IL or missing references)
			//IL_0129: Unknown result type (might be due to invalid IL or missing references)
			//IL_012e: Unknown result type (might be due to invalid IL or missing references)
			if (!((Behaviour)this).enabled)
			{
				return;
			}
			UIVertex val = default(UIVertex);
			if (gradientType == UIGradientType.ComplexLinear)
			{
				CutMesh(vh);
			}
			for (int i = 0; i < vh.currentVertCount; i++)
			{
				vh.PopulateUIVertex(ref val, i);
				Rect rect = rectTransform.rect;
				Vector2 max = ((Rect)(ref rect)).max;
				rect = rectTransform.rect;
				Vector2 val2 = max - ((Rect)(ref rect)).min;
				Vector2 val3 = Vector2.op_Implicit(val.position);
				rect = rectTransform.rect;
				Vector2 normalizedPosition = Vector2.Scale(val3 - ((Rect)(ref rect)).min, new Vector2(1f / val2.x, 1f / val2.y));
				normalizedPosition = RotateNormalizedPosition(normalizedPosition, angle);
				Color c = Color.black;
				if (gradientType == UIGradientType.Linear)
				{
					c = GetColorInGradient(linearColor1, linearColor1, linearColor2, linearColor2, normalizedPosition);
				}
				else if (gradientType == UIGradientType.Corner)
				{
					c = GetColorInGradient(cornerColorUpperLeft, cornerColorUpperRight, cornerColorLowerRight, cornerColorLowerLeft, normalizedPosition);
				}
				else if (gradientType == UIGradientType.ComplexLinear)
				{
					c = linearGradient.Evaluate(normalizedPosition.y);
				}
				val.color = Color32.op_Implicit(BlendColor(Color32.op_Implicit(val.color), c, blendMode, intensity));
				vh.SetUIVertex(val, i);
			}
		}

		protected void CutMesh(VertexHelper vh)
		{
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			//IL_009c: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ca: Unknown result type (might be due to invalid IL or missing references)
			List<UIVertex> list = new List<UIVertex>();
			vh.GetUIVertexStream(list);
			vh.Clear();
			List<UIVertex> list2 = new List<UIVertex>();
			Vector2 cutDirection = GetCutDirection();
			foreach (float item in linearGradient.alphaKeys.Select((GradientAlphaKey x) => x.time).Union(linearGradient.colorKeys.Select((GradientColorKey x) => x.time)))
			{
				list2.Clear();
				Vector2 cutOrigin = GetCutOrigin(item);
				if (!((double)item < 0.001) && !((double)item > 0.999))
				{
					for (int num = 0; num < list.Count; num += 3)
					{
						CutTriangle(list, num, list2, cutDirection, cutOrigin);
					}
					list.Clear();
					list.AddRange(list2);
				}
			}
			vh.AddUIVertexTriangleStream(list);
		}

		private UIVertex UIVertexLerp(UIVertex v1, UIVertex v2, float f)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_000a: Unknown result type (might be due to invalid IL or missing references)
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Unknown result type (might be due to invalid IL or missing references)
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			//IL_003a: Unknown result type (might be due to invalid IL or missing references)
			//IL_003f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0044: Unknown result type (might be due to invalid IL or missing references)
			//IL_004b: Unknown result type (might be due to invalid IL or missing references)
			//IL_004c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0051: Unknown result type (might be due to invalid IL or missing references)
			//IL_0056: Unknown result type (might be due to invalid IL or missing references)
			//IL_0057: Unknown result type (might be due to invalid IL or missing references)
			//IL_005c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0062: Unknown result type (might be due to invalid IL or missing references)
			//IL_0067: Unknown result type (might be due to invalid IL or missing references)
			//IL_006c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0073: Unknown result type (might be due to invalid IL or missing references)
			//IL_0074: Unknown result type (might be due to invalid IL or missing references)
			//IL_0079: Unknown result type (might be due to invalid IL or missing references)
			//IL_007e: Unknown result type (might be due to invalid IL or missing references)
			//IL_007f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0084: 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_0094: Unknown result type (might be due to invalid IL or missing references)
			//IL_009b: Unknown result type (might be due to invalid IL or missing references)
			//IL_009c: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ac: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_00bc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c9: 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_00cf: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00da: Unknown result type (might be due to invalid IL or missing references)
			//IL_00df: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e4: 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)
			return new UIVertex
			{
				position = Vector3.Lerp(v1.position, v2.position, f),
				color = Color32.op_Implicit(Color.Lerp(Color32.op_Implicit(v1.color), Color32.op_Implicit(v2.color), f)),
				uv0 = Vector4.op_Implicit(Vector2.Lerp(Vector4.op_Implicit(v1.uv0), Vector4.op_Implicit(v2.uv0), f)),
				uv1 = Vector4.op_Implicit(Vector2.Lerp(Vector4.op_Implicit(v1.uv1), Vector4.op_Implicit(v2.uv1), f)),
				uv2 = Vector4.op_Implicit(Vector2.Lerp(Vector4.op_Implicit(v1.uv2), Vector4.op_Implicit(v2.uv2), f)),
				uv3 = Vector4.op_Implicit(Vector2.Lerp(Vector4.op_Implicit(v1.uv3), Vector4.op_Implicit(v2.uv3), f))
			};
		}

		private Vector2 GetCutDirection()
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
			//IL_0020: 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_0028: Unknown result type (might be due to invalid IL or missing references)
			//IL_0033: Unknown result type (might be due to invalid IL or missing references)
			//IL_003f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0044: Unknown result type (might be due to invalid IL or missing references)
			//IL_0047: Unknown result type (might be due to invalid IL or missing references)
			//IL_0057: Unknown result type (might be due to invalid IL or missing references)
			//IL_005d: Unknown result type (might be due to invalid IL or missing references)
			Vector2 val = Vector2.up.Rotate(0f - angle);
			float x = val.x;
			Rect rect = rectTransform.rect;
			float num = x / ((Rect)(ref rect)).size.x;
			float y = val.y;
			rect = rectTransform.rect;
			((Vector2)(ref val))..ctor(num, y / ((Rect)(ref rect)).size.y);
			return val.Rotate(90f);
		}

		private void CutTriangle(List<UIVertex> tris, int idx, List<UIVertex> list, Vector2 cutDirection, Vector2 point)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_0028: 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_002e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0033: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_003e: Unknown result type (might be due to invalid IL or missing references)
			//IL_003f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0044: Unknown result type (might be due to invalid IL or missing references)
			//IL_0049: Unknown result type (might be due to invalid IL or missing references)
			//IL_004a: Unknown result type (might be due to invalid IL or missing references)
			//IL_004f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0054: Unknown result type (might be due to invalid IL or missing references)
			//IL_0056: Unknown result type (might be due to invalid IL or missing references)
			//IL_0060: Unknown result type (might be due to invalid IL or missing references)
			//IL_0061: Unknown result type (might be due to invalid IL or missing references)
			//IL_0066: Unknown result type (might be due to invalid IL or missing references)
			//IL_006b: Unknown result type (might be due to invalid IL or missing references)
			//IL_006c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0071: Unknown result type (might be due to invalid IL or missing references)
			//IL_0076: Unknown result type (might be due to invalid IL or missing references)
			//IL_0078: 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_0171: Unknown result type (might be due to invalid IL or missing references)
			//IL_0173: 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_017b: Unknown result type (might be due to invalid IL or missing references)
			//IL_017c: Unknown result type (might be due to invalid IL or missing references)
			//IL_017f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0184: Unknown result type (might be due to invalid IL or missing references)
			//IL_018d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0194: Unknown result type (might be due to invalid IL or missing references)
			//IL_019c: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a3: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ab: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ba: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c2: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c9: 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_0100: Unknown result type (might be due to invalid IL or missing references)
			//IL_0103: Unknown result type (might be due to invalid IL or missing references)
			//IL_0108: Unknown result type (might be due to invalid IL or missing references)
			//IL_010b: 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_010f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0114: Unknown result type (might be due to invalid IL or missing references)
			//IL_011d: 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)
			//IL_012c: 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_013b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0143: Unknown result type (might be due to invalid IL or missing references)
			//IL_014a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0152: 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_0098: 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_009c: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ac: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b5: 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_00c4: 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_00d3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00db: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ea: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f1: Unknown result type (might be due to invalid IL or missing references)
			UIVertex val = tris[idx];
			UIVertex val2 = tris[idx + 1];
			UIVertex val3 = tris[idx + 2];
			float f = OnLine(Vector2.op_Implicit(val2.position), Vector2.op_Implicit(val3.position), point, cutDirection);
			float f2 = OnLine(Vector2.op_Implicit(val.position), Vector2.op_Implicit(val2.position), point, cutDirection);
			float f3 = OnLine(Vector2.op_Implicit(val3.position), Vector2.op_Implicit(val.position), point, cutDirection);
			if (IsOnLine(f2))
			{
				if (IsOnLine(f))
				{
					UIVertex item = UIVertexLerp(val, val2, f2);
					UIVertex item2 = UIVertexLerp(val2, val3, f);
					list.AddRange(new List<UIVertex> { val, item, val3, item, item2, val3, item, val2, item2 });
				}
				else
				{
					UIVertex item3 = UIVertexLerp(val, val2, f2);
					UIVertex item4 = UIVertexLerp(val3, val, f3);
					list.AddRange(new List<UIVertex> { val3, item4, val2, item4, item3, val2, item4, val, item3 });
				}
			}
			else if (IsOnLine(f))
			{
				UIVertex item5 = UIVertexLerp(val2, val3, f);
				UIVertex item6 = UIVertexLerp(val3, val, f3);
				list.AddRange(new List<UIVertex> { val2, item5, val, item5, item6, val, item5, val3, item6 });
			}
			else
			{
				list.AddRange(tris.GetRange(idx, 3));
			}
		}

		private bool IsOnLine(float f)
		{
			if (f <= 1f)
			{
				return f > 0f;
			}
			return false;
		}

		private float OnLine(Vector2 p1, Vector2 p2, Vector2 o, Vector2 dir)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			//IL_003a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0040: Unknown result type (might be due to invalid IL or missing references)
			//IL_0047: Unknown result type (might be due to invalid IL or missing references)
			//IL_004f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0055: Unknown result type (might be due to invalid IL or missing references)
			//IL_005c: Unknown result type (might be due to invalid IL or missing references)
			float num = (p2.x - p1.x) * dir.y - (p2.y - p1.y) * dir.x;
			if (num == 0f)
			{
				return -1f;
			}
			return ((o.x - p1.x) * dir.y - (o.y - p1.y) * dir.x) / num;
		}

		private float ProjectedDistance(Vector2 p1, Vector2 p2, Vector2 normal)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Unknown result type (might be due to invalid IL or missing references)
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			//IL_0027: Unknown result type (might be due to invalid IL or missing references)
			return Vector2.Distance(Vector2.op_Implicit(Vector3.Project(Vector2.op_Implicit(p1), Vector2.op_Implicit(normal))), Vector2.op_Implicit(Vector3.Project(Vector2.op_Implicit(p2), Vector2.op_Implicit(normal))));
		}

		private Vector2 GetCutOrigin(float f)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
			//IL_0020: 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_0028: Unknown result type (might be due to invalid IL or missing references)
			//IL_0033: Unknown result type (might be due to invalid IL or missing references)
			//IL_003f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0044: Unknown result type (might be due to invalid IL or missing references)
			//IL_0047: 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_0104: Unknown result type (might be due to invalid IL or missing references)
			//IL_0109: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_0118: Unknown result type (might be due to invalid IL or missing references)
			//IL_0122: Unknown result type (might be due to invalid IL or missing references)
			//IL_0127: 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_012d: 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_0137: 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_0146: Unknown result type (might be due to invalid IL or missing references)
			//IL_014b: 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_0155: Unknown result type (might be due to invalid IL or missing references)
			//IL_015a: 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_0169: Unknown result type (might be due to invalid IL or missing references)
			//IL_016e: Unknown result type (might be due to invalid IL or missing references)
			//IL_016f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0174: Unknown result type (might be due to invalid IL or missing references)
			//IL_0179: Unknown result type (might be due to invalid IL or missing references)
			//IL_0073: Unknown result type (might be due to invalid IL or missing references)
			//IL_0078: Unknown result type (might be due to invalid IL or missing references)
			//IL_007b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0080: Unknown result type (might be due to invalid IL or missing references)
			//IL_0085: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_0099: Unknown result type (might be due to invalid IL or missing references)
			//IL_009e: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a3: 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_00ae: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b5: 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_00bd: 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_00c7: 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_00db: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00eb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f0: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b8: 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)
			//IL_01be: Unknown result type (might be due to invalid IL or missing references)
			//IL_01bf: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c5: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d0: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d5: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d8: Unknown result type (might be due to invalid IL or missing references)
			//IL_01dd: Unknown result type (might be due to invalid IL or missing references)
			//IL_018d: 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_0194: Unknown result type (might be due to invalid IL or missing references)
			//IL_019a: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_01aa: 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)
			Vector2 val = Vector2.up.Rotate(0f - angle);
			float x = val.x;
			Rect rect = rectTransform.rect;
			float num = x / ((Rect)(ref rect)).size.x;
			float y = val.y;
			rect = rectTransform.rect;
			((Vector2)(ref val))..ctor(num, y / ((Rect)(ref rect)).size.y);
			Vector3 val2;
			Vector3 val3;
			if (angle % 180f < 90f)
			{
				rect = rectTransform.rect;
				val2 = Vector3.Project(Vector2.op_Implicit(Vector2.Scale(((Rect)(ref rect)).size, Vector2.down + Vector2.left) * 0.5f), Vector2.op_Implicit(val));
				rect = rectTransform.rect;
				val3 = Vector3.Project(Vector2.op_Implicit(Vector2.Scale(((Rect)(ref rect)).size, Vector2.up + Vector2.right) * 0.5f), Vector2.op_Implicit(val));
			}
			else
			{
				rect = rectTransform.rect;
				val2 = Vector3.Project(Vector2.op_Implicit(Vector2.Scale(((Rect)(ref rect)).size, Vector2.up + Vector2.left) * 0.5f), Vector2.op_Implicit(val));
				rect = rectTransform.rect;
				val3 = Vector3.Project(Vector2.op_Implicit(Vector2.Scale(((Rect)(ref rect)).size, Vector2.down + Vector2.right) * 0.5f), Vector2.op_Implicit(val));
			}
			if (angle % 360f >= 180f)
			{
				Vector2 val4 = Vector2.Lerp(Vector2.op_Implicit(val3), Vector2.op_Implicit(val2), f);
				rect = rectTransform.rect;
				return val4 + ((Rect)(ref rect)).center;
			}
			Vector2 val5 = Vector2.Lerp(Vector2.op_Implicit(val2), Vector2.op_Implicit(val3), f);
			rect = rectTransform.rect;
			return val5 + ((Rect)(ref rect)).center;
		}

		private Color BlendColor(Color c1, Color c2, UIGradientBlendMode mode, float intensity)
		{
			//IL_0003: Unknown result type (might be due to invalid IL or missing references)
			//IL_0004: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_003a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: 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_0014: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			switch (mode)
			{
			case UIGradientBlendMode.Override:
				return Color.Lerp(c1, c2, intensity);
			case UIGradientBlendMode.Multiply:
				return Color.Lerp(c1, c1 * c2, intensity);
			default:
				Debug.LogErrorFormat("Mode is not supported: {0}", new object[1] { mode });
				return c1;
			}
		}

		private Vector2 RotateNormalizedPosition(Vector2 normalizedPosition, float angle)
		{
			//IL_0033: 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_003e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0043: Unknown result type (might be due to invalid IL or missing references)
			//IL_0049: Unknown result type (might be due to invalid IL or missing references)
			//IL_004f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0054: Unknown result type (might be due to invalid IL or missing references)
			//IL_005e: 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)
			float num = (float)Math.PI / 180f * ((angle < 0f) ? (angle % 90f + 90f) : (angle % 90f));
			float num2 = Mathf.Sin(num) + Mathf.Cos(num);
			return (normalizedPosition - Vector2.one * 0.5f).Rotate(angle) / num2 + Vector2.one * 0.5f;
		}

		public void ForceUpdateGraphic()
		{
			if ((Object)(object)((BaseMeshEffect)this).graphic != (Object)null)
			{
				((BaseMeshEffect)this).graphic.SetVerticesDirty();
			}
		}

		private Color GetColorInGradient(Color ul, Color ur, Color lr, Color ll, Vector2 normalizedPosition)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0003: Unknown result type (might be due to invalid IL or missing references)
			//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_0010: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			return Color.Lerp(Color.Lerp(ll, lr, normalizedPosition.x), Color.Lerp(ul, ur, normalizedPosition.x), normalizedPosition.y);
		}
	}
}
namespace UnityEngine.UI
{
	[ExecuteInEditMode]
	[AddComponentMenu("UI/Effects/Letter Spacing", 15)]
	public class LetterSpacing : BaseMeshEffect
	{
		private const string SupportedTagRegexPattersn = "<b>|</b>|<i>|</i>|<size=.*?>|</size>|<color=.*?>|</color>|<material=.*?>|</material>";

		public bool UseRichText;

		public float Spacing;

		private float _lastSpacing;

		protected LetterSpacing()
		{
		}

		public void Update()
		{
			if (Application.isEditor && Spacing != _lastSpacing)
			{
				_lastSpacing = Spacing;
				if ((Object)(object)((BaseMeshEffect)this).graphic != (Object)null)
				{
					((BaseMeshEffect)this).graphic.SetVerticesDirty();
				}
			}
		}

		public override void ModifyMesh(VertexHelper vh)
		{
			if (((UIBehaviour)this).IsActive())
			{
				List<UIVertex> list = new List<UIVertex>();
				vh.GetUIVertexStream(list);
				ModifyVertices(list);
				vh.Clear();
				vh.AddUIVertexTriangleStream(list);
			}
		}

		public void ModifyVertices(List<UIVertex> verts)
		{
			//IL_0047: 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_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_00c9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f4: Expected I4, but got Unknown
			//IL_01fa: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ff: Unknown result type (might be due to invalid IL or missing references)
			//IL_0204: Unknown result type (might be due to invalid IL or missing references)
			//IL_0209: Unknown result type (might be due to invalid IL or missing references)
			//IL_020e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0213: Unknown result type (might be due to invalid IL or missing references)
			//IL_0218: Unknown result type (might be due to invalid IL or missing references)
			//IL_021d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0222: Unknown result type (might be due to invalid IL or missing references)
			//IL_0227: 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_0231: Unknown result type (might be due to invalid IL or missing references)
			//IL_0233: Unknown result type (might be due to invalid IL or missing references)
			//IL_0241: 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_0250: Unknown result type (might be due to invalid IL or missing references)
			//IL_0255: Unknown result type (might be due to invalid IL or missing references)
			//IL_0257: Unknown result type (might be due to invalid IL or missing references)
			//IL_025c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0269: Unknown result type (might be due to invalid IL or missing references)
			//IL_026e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0270: Unknown result type (might be due to invalid IL or missing references)
			//IL_0275: Unknown result type (might be due to invalid IL or missing references)
			//IL_0282: 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_0289: Unknown result type (might be due to invalid IL or missing references)
			//IL_028e: Unknown result type (might be due to invalid IL or missing references)
			//IL_029b: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a0: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a2: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b4: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b9: Unknown result type (might be due to invalid IL or missing references)
			//IL_02bb: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c0: Unknown result type (might be due to invalid IL or missing references)
			//IL_02cd: Unknown result type (might be due to invalid IL or missing references)
			//IL_02d2: Unknown result type (might be due to invalid IL or missing references)
			//IL_02d4: Unknown result type (might be due to invalid IL or missing references)
			//IL_02d9: 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_02eb: Unknown result type (might be due to invalid IL or missing references)
			//IL_02f5: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ff: Unknown result type (might be due to invalid IL or missing references)
			//IL_0309: Unknown result type (might be due to invalid IL or missing references)
			//IL_0313: Unknown result type (might be due to invalid IL or missing references)
			if (!((UIBehaviour)this).IsActive())
			{
				return;
			}
			Text component = ((Component)this).GetComponent<Text>();
			if ((Object)(object)component == (Object)null)
			{
				Debug.LogWarning((object)"LetterSpacing: Missing Text component");
				return;
			}
			string text = component.text;
			IList<UILineInfo> lines = component.cachedTextGenerator.lines;
			for (int num = lines.Count - 1; num > 0; num--)
			{
				text = text.Insert(lines[num].startCharIdx, "\n");
				text = text.Remove(lines[num].startCharIdx - 1, 1);
			}
			string[] array = text.Split('\n');
			float num2 = Spacing * (float)component.fontSize / 100f;
			float num3 = 0f;
			int num4 = 0;
			bool flag = UseRichText && component.supportRichText;
			IEnumerator enumerator = null;
			Match match = null;
			TextAnchor alignment = component.alignment;
			switch ((int)alignment)
			{
			case 0:
			case 3:
			case 6:
				num3 = 0f;
				break;
			case 1:
			case 4:
			case 7:
				num3 = 0.5f;
				break;
			case 2:
			case 5:
			case 8:
				num3 = 1f;
				break;
			}
			foreach (string text2 in array)
			{
				int lineLengthWithoutTags = text2.Length;
				if (flag)
				{
					enumerator = GetRegexMatchedTagCollection(text2, out lineLengthWithoutTags);
					match = null;
					if (enumerator.MoveNext())
					{
						match = (Match)enumerator.Current;
					}
				}
				float num5 = (float)(lineLengthWithoutTags - 1) * num2 * num3;
				int num6 = 0;
				int num7 = 0;
				while (num6 < text2.Length)
				{
					if (flag && match != null && match.Index == num6)
					{
						num6 += match.Length - 1;
						num7--;
						num4 += match.Length;
						match = null;
						if (enumerator.MoveNext())
						{
							match = (Match)enumerator.Current;
						}
					}
					else
					{
						int index = num4 * 6;
						int index2 = num4 * 6 + 1;
						int index3 = num4 * 6 + 2;
						int index4 = num4 * 6 + 3;
						int index5 = num4 * 6 + 4;
						int num8 = num4 * 6 + 5;
						if (num8 > verts.Count - 1)
						{
							return;
						}
						UIVertex value = verts[index];
						UIVertex value2 = verts[index2];
						UIVertex value3 = verts[index3];
						UIVertex value4 = verts[index4];
						UIVertex value5 = verts[index5];
						UIVertex value6 = verts[num8];
						Vector3 val = Vector3.right * (num2 * (float)num7 - num5);
						ref Vector3 position = ref value.position;
						position += val;
						ref Vector3 position2 = ref value2.position;
						position2 += val;
						ref Vector3 position3 = ref value3.position;
						position3 += val;
						ref Vector3 position4 = ref value4.position;
						position4 += val;
						ref Vector3 position5 = ref value5.position;
						position5 += val;
						ref Vector3 position6 = ref value6.position;
						position6 += val;
						verts[index] = value;
						verts[index2] = value2;
						verts[index3] = value3;
						verts[index4] = value4;
						verts[index5] = value5;
						verts[num8] = value6;
						num4++;
					}
					num6++;
					num7++;
				}
				num4++;
			}
		}

		private static IEnumerator GetRegexMatchedTagCollection(string line, out int lineLengthWithoutTags)
		{
			MatchCollection matchCollection = Regex.Matches(line, "<b>|</b>|<i>|</i>|<size=.*?>|</size>|<color=.*?>|</color>|<material=.*?>|</material>");
			lineLengthWithoutTags = 0;
			int num = 0;
			if (matchCollection.Count > 0)
			{
				foreach (Match item in matchCollection)
				{
					num += item.Length;
				}
			}
			lineLengthWithoutTags = line.Length - num;
			return matchCollection.GetEnumerator();
		}
	}
}
namespace AugaUnity
{
	[RequireComponent(typeof(Image))]
	public class AddItemIconMaterial : MonoBehaviour
	{
		public static Material IconMaterial;

		public void Start()
		{
			((Graphic)((Component)this).GetComponent<Image>()).material = IconMaterial;
		}
	}
	[RequireComponent(typeof(TextMeshProUGUI))]
	public class AlwaysUpper : MonoBehaviour
	{
	}
	[RequireComponent(typeof(TextMeshProUGUI))]
	public class TitleCase : MonoBehaviour
	{
	}
	public class AugaAchievementElement : MonoBehaviour
	{
		public TMP_Text NameText;

		public Color ConcealedColor = new Color(0.64f, 0.59f, 0.54f);

		private Color _normalColor;

		private bool _captured;

		public void SetConcealed(bool concealed)
		{
			//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_0041: Unknown result type (might be due to invalid IL or missing references)
			//IL_0039: Unknown result type (might be due to invalid IL or missing references)
			if (!((Object)(object)NameText == (Object)null))
			{
				if (!_captured)
				{
					_normalColor = ((Graphic)NameText).color;
					_captured = true;
				}
				((Graphic)NameText).color = (concealed ? ConcealedColor : _normalColor);
			}
		}
	}
	public class AugaAchievementsPanel : MonoBehaviour
	{
		public RectTransform Grid;

		public GameObject ElementPrefab;

		public Scrollbar Scrollbar;

		public TMP_Text CompletionRate;

		public TMP_Text CheatedText;

		public AchievementsGui Gui;

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

		public bool DetailsOpen
		{
			get
			{
				if ((Object)(object)Gui != (Object)null && (Object)(object)Gui.m_achievementDetails != (Object)null)
				{
					return Gui.m_achievementDetails.activeSelf;
				}
				return false;
			}
		}

		public void OnEnable()
		{
			Refresh();
		}

		public void Update()
		{
			if ((Object)(object)Gui != (Object)null)
			{
				Gui.m_width = Columns();
			}
		}

		public bool CloseDetailsIfOpen()
		{
			if (!DetailsOpen)
			{
				return false;
			}
			Gui.OnCloseAchievementDetails();
			return true;
		}

		public void Refresh()
		{
			//IL_0321: Unknown result type (might be due to invalid IL or missing references)
			//IL_032b: Expected O, but got Unknown
			foreach (GameObject element in _elements)
			{
				if ((Object)(object)element != (Object)null)
				{
					Object.Destroy((Object)(object)element);
				}
			}
			_elements.Clear();
			if ((Object)(object)Gui != (Object)null)
			{
				Gui.m_achievementsList.Clear();
			}
			Player localPlayer = Player.m_localPlayer;
			if ((Object)(object)localPlayer == (Object)null || (Object)(object)Achievements.m_instance == (Object)null || (Object)(object)Grid == (Object)null || (Object)(object)ElementPrefab == (Object)null)
			{
				if ((Object)(object)Gui != (Object)null)
				{
					((Behaviour)Gui).enabled = false;
				}
				return;
			}
			List<List<Achievement>> list = new List<List<Achievement>>();
			for (int i = 0; i <= 9; i++)
			{
				list.Add(new List<Achievement>());
			}
			int num = 0;
			foreach (AchievementList achievementList in Achievements.m_instance.m_achievementLists)
			{
				if ((Object)(object)achievementList == (Object)null)
				{
					continue;
				}
				foreach (Achievement achievement2 in achievementList.m_achievements)
				{
					if (!((Object)(object)achievement2 == (Object)null))
					{
						string text = (((Object)(object)achievement2.m_iconLocked != (Object)null) ? ((Object)achievement2.m_iconLocked).name : string.Empty);
						if (text.Length >= 2 && int.TryParse(text.Substring(0, 2), out var result) && result >= 0 && result < list.Count)
						{
							list[result].Add(achievement2);
						}
						else
						{
							list[list.Count - 1].Add(achievement2);
						}
						if (achievement2.m_unlocked)
						{
							num++;
						}
					}
				}
			}
			List<Achievement> list2 = new List<Achievement>();
			for (int j = 1; j <= 9; j++)
			{
				list2.AddRange(list[j]);
			}
			if ((Object)(object)CompletionRate != (Object)null)
			{
				CompletionRate.text = $"{num}/{list2.Count}";
			}
			foreach (Achievement item in list2)
			{
				GameObject val = Object.Instantiate<GameObject>(ElementPrefab, (Transform)(object)Grid);
				val.SetActive(true);
				_elements.Add(val);
				if ((Object)(object)Gui != (Object)null)
				{
					Gui.m_achievementsList.Add(val);
				}
				Achievement achievement = item;
				bool flag = (!achievement.m_isSecret || achievement.m_unlocked) && achievement.m_clickable;
				Button component = val.GetComponent<Button>();
				if ((Object)(object)component != (Object)null)
				{
					if (flag && (Object)(object)Gui != (Object)null)
					{
						((UnityEvent)component.onClick).AddListener((UnityAction)delegate
						{
							Gui.OnOpenAchievementDetails(achievement, true);
						});
					}
					else
					{
						((Selectable)component).transition = (Transition)0;
						((Selectable)component).interactable = false;
					}
				}
				bool flag2 = achievement.m_unlocked || !achievement.m_isSecret;
				Sprite sprite = ((flag2 && achievement.m_unlocked) ? achievement.m_icon : achievement.m_iconLocked);
				string text2 = Localization.instance.Localize(flag2 ? achievement.m_name : "$inventory_achievement_secret");
				string text3 = Localization.instance.Localize(flag2 ? achievement.m_description : "$inventory_achievement_secret_description");
				Transform obj = val.transform.Find("icon");
				Image val2 = ((obj != null) ? ((Component)obj).GetComponent<Image>() : null);
				if ((Object)(object)val2 != (Object)null)
				{
					val2.sprite = sprite;
				}
				Transform obj2 = val.transform.Find("name");
				TMP_Text val3 = ((obj2 != null) ? ((Component)obj2).GetComponent<TMP_Text>() : null);
				if ((Object)(object)val3 != (Object)null)
				{
					val3.text = text2;
				}
				Transform obj3 = val.transform.Find("description");
				TMP_Text val4 = ((obj3 != null) ? ((Component)obj3).GetComponent<TMP_Text>() : null);
				if ((Object)(object)val4 != (Object)null)
				{
					val4.text = text3;
				}
				UITooltip component2 = val.GetComponent<UITooltip>();
				if ((Object)(object)component2 != (Object)null)
				{
					component2.m_topic = text2;
					component2.m_text = text3;
				}
				AugaAchievementElement component3 = val.GetComponent<AugaAchievementElement>();
				if ((Object)(object)component3 != (Object)null)
				{
					component3.SetConcealed(!flag2);
				}
			}
			if ((Object)(object)Scrollbar != (Object)null)
			{
				Scrollbar.value = 1f;
			}
			UpdateCheatedText(localPlayer);
			if ((Object)(object)Gui != (Object)null)
			{
				Gui.m_width = Columns();
				((Behaviour)Gui).enabled = _elements.Count > 0;
			}
		}

		private void UpdateCheatedText(Player player)
		{
			if (!((Object)(object)CheatedText == (Object)null))
			{
				bool flag = (((Object)(object)Game.instance != (Object)null) ? Game.instance.GetPlayerProfile() : null)?.m_usedCheats ?? false;
				bool flag2 = ((Humanoid)player).GetInventory().AnyCheatedItem();
				string text = ((PlayerProfile.s_bypassCheatChecks && (Achievements.IsWorldCheated() || flag || flag2)) ? "$achievements_permanently_cheated_bypass" : (Achievements.IsWorldCheated() ? "$achievements_permanently_cheated_world" : (flag ? "$achievements_permanently_cheated_character" : ((!flag2) ? string.Empty : "$achievements_temporarily_cheated"))));
				CheatedText.text = (string.IsNullOrEmpty(text) ? string.Empty : Localization.instance.Localize(text));
			}
		}

		private int Columns()
		{
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_002f: Invalid comparison between Unknown and I4
			//IL_0044: Unknown result type (might be due to invalid IL or missing references)
			//IL_0049: Unknown result type (might be due to invalid IL or missing references)
			//IL_0080: Unknown result type (might be due to invalid IL or missing references)
			//IL_008b: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b1: 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_0075: Unknown result type (might be due to invalid IL or missing references)
			GridLayoutGroup val = (((Object)(object)Grid != (Object)null) ? ((Component)Grid).GetComponent<GridLayoutGroup>() : null);
			if ((Object)(object)val == (Object)null)
			{
				return 1;
			}
			if ((int)val.constraint == 1)
			{
				return Mathf.Max(1, val.constraintCount);
			}
			Rect rect = Grid.rect;
			float width = ((Rect)(ref rect)).width;
			if (width <= 0f)
			{
				Transform parent = ((Transform)Grid).parent;
				RectTransform val2 = (RectTransform)(object)((parent is RectTransform) ? parent : null);
				if (val2 != null)
				{
					rect = val2.rect;
					width = ((Rect)(ref rect)).width;
				}
			}
			float num = val.cellSize.x + val.spacing.x;
			if (num <= 0f)
			{
				return 1;
			}
			return Mathf.Max(1, Mathf.FloorToInt((width - (float)((LayoutGroup)val).padding.horizontal + val.spacing.x) / num));
		}
	}
	public class AugaBarberController : MonoBehaviour
	{
		public Button HairRightButton;

		public Button HairLeftButton;

		public Button BeardRightButton;

		public Button BeardLeftButton;

		private bool _playerFound;

		private static AugaBarberController _instance;

		private PlayerCustomizaton _playerCustomizaton;

		public static AugaBarberController Instance => _instance;

		private void Awake()
		{
			_instance = this;
			_playerCustomizaton = ((Component)this).GetComponent<PlayerCustomizaton>();
		}

		private void Start()
		{
			_playerCustomizaton.m_beards = ObjectDB.instance.GetAllItems((ItemType)10, "Beard");
			_playerCustomizaton.m_hairs = ObjectDB.instance.GetAllItems((ItemType)10, "Hair");
			_playerCustomizaton.m_beards.RemoveAll((ItemDrop x) => ((Object)x).name.Contains("_"));
			_playerCustomizaton.m_hairs.RemoveAll((ItemDrop x) => ((Object)x).name.Contains("_"));
			_playerCustomizaton.m_beards.Sort((ItemDrop x, ItemDrop y) => Localization.instance.Localize(x.m_itemData.m_shared.m_name).CompareTo(Localization.instance.Localize(y.m_itemData.m_shared.m_name)));
			_playerCustomizaton.m_hairs.Sort((ItemDrop x, ItemDrop y) => Localization.instance.Localize(x.m_itemData.m_shared.m_name).CompareTo(Localization.instance.Localize(y.m_itemData.m_shared.m_name)));
		}

		private void Update()
		{
			if (!_playerFound)
			{
				if ((Object)(object)Player.m_localPlayer == (Object)null)
				{
					return;
				}
				_playerFound = true;
			}
			int hairIndex = _playerCustomizaton.GetHairIndex();
			int beardIndex = _playerCustomizaton.GetBeardIndex();
			if (hairIndex == 0)
			{
				((Component)HairLeftButton).gameObject.SetActive(false);
			}
			else if (hairIndex >= _playerCustomizaton.m_hairs.Count - 1)
			{
				((Component)HairRightButton).gameObject.SetActive(false);
			}
			else
			{
				((Component)HairLeftButton).gameObject.SetActive(true);
				((Component)HairRightButton).gameObject.SetActive(true);
			}
			if (beardIndex == 0)
			{
				((Component)BeardLeftButton).gameObject.SetActive(false);
				return;
			}
			if (beardIndex >= _playerCustomizaton.m_beards.Count - 1)
			{
				((Component)BeardRightButton).gameObject.SetActive(false);
				return;
			}
			((Component)BeardLeftButton).gameObject.SetActive(true);
			((Component)BeardRightButton).gameObject.SetActive(true);
		}

		public void ResetLocalPlayer()
		{
			_playerFound = false;
		}
	}
	public class AugaBindingDisplay : MonoBehaviour
	{
		public string AutomaticKeyName;

		public TMP_Text KeybindText;

		public GameObject KeybindBox;

		public TMP_Text LongKeybindText;

		public GameObject LongKeybindBox;

		public GameObject Mouse1;

		public GameObject Mouse2;

		public GameObject Mouse3;

		public GameObject MouseX;

		public TMP_Text MouseXText;

		private string _shownKeyName;

		private bool _shownMissing;

		private string _shownPath;

		private string _shownOverride;

		private GamepadGlyphs _shownGlyph;

		private GamepadType _shownGamepad;

		private int _shownLanguage;

		private static int _languageVersion;

		private static bool _watchingLanguage;

		public void Awake()
		{
			if (!_watchingLanguage)
			{
				_watchingLanguage = true;
				Localization.OnLanguageChange = (Action)Delegate.Combine(Localization.OnLanguageChange, (Action)delegate
				{
					_languageVersion++;
				});
			}
		}

		public void Update()
		{
			if (!string.IsNullOrEmpty(AutomaticKeyName) && !IsShowing(AutomaticKeyName))
			{
				SetBinding(AutomaticKeyName);
			}
		}

		private bool IsShowing(string keyName)
		{
			//IL_005a: 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_0067: 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)
			if (keyName != _shownKeyName)
			{
				return false;
			}
			if (!ZInput.instance.m_buttons.TryGetValue(keyName, out var value))
			{
				return _shownMissing;
			}
			if (!_shownMissing && value.GetActionPath(true) == _shownPath && value.DisplayNameOverride == _shownOverride && ZInput.CurrentGlyph == _shownGlyph && ZInput.ConnectedGamepadType == _shownGamepad)
			{
				return _languageVersion == _shownLanguage;
			}
			return false;
		}

		public void SetBinding(string keyName)
		{
			//IL_0356: Unknown result type (might be due to invalid IL or missing references)
			//IL_035b: 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)
			if (!ZInput.instance.m_buttons.TryGetValue(keyName, out var value))
			{
				Debug.LogError((object)("[AugaBindingDisplay.SetBinding] Couldn't find key: " + keyName));
				_shownKeyName = keyName;
				_shownMissing = true;
				return;
			}
			string actionPath = value.GetActionPath(true);
			string text = actionPath ?? string.Empty;
			string text2 = string.Empty;
			string text3 = text;
			int num = text.IndexOf('/');
			if (num >= 0)
			{
				text2 = text.Substring(0, num);
				text3 = text.Substring(num + 1);
			}
			string text4 = Localization.instance.GetBoundKeyString(keyName, true);
			if (string.IsNullOrEmpty(text4))
			{
				text4 = "-";
			}
			int showMouse = -1;
			if (text2 == "<Mouse>")
			{
				switch (text3)
				{
				case "leftButton":
					showMouse = 0;
					break;
				case "rightButton":
					showMouse = 1;
					break;
				case "middleButton":
					showMouse = 2;
					break;
				case "backButton":
					showMouse = 3;
					break;
				case "forwardButton":
					showMouse = 4;
					break;
				}
			}
			if (!(text4 == "Equals"))
			{
				if (text4 == "BackQuote")
				{
					text4 = "`";
				}
			}
			else
			{
				text4 = "=";
			}
			if (text4.StartsWith("Keypad"))
			{
				text4 = text4.Replace("Keypad", "Num");
			}
			else if (text4.StartsWith("Alpha"))
			{
				text4 = text4.Replace("Alpha", "");
			}
			switch (text3)
			{
			case "numpadDivide":
				text4 = "Num /";
				break;
			case "numpadMinus":
				text4 = "Num -";
				break;
			case "numpadMultiply":
				text4 = "Num *";
				break;
			case "numpadEquals":
				text4 = "Num =";
				break;
			case "numpadPeriod":
				text4 = "Num .";
				break;
			case "numpadPlus":
				text4 = "Num +";
				break;
			case "leftArrow":
				text4 = "←";
				break;
			case "rightArrow":
				text4 = "→";
				break;
			case "upArrow":
				text4 = "↑";
				break;
			case "downArrow":
				text4 = "↓";
				break;
			}
			SetText(text4, showMouse);
			_shownKeyName = keyName;
			_shownMissing = false;
			_shownPath = actionPath;
			_shownOverride = value.DisplayNameOverride;
			_shownGlyph = ZInput.CurrentGlyph;
			_shownGamepad = ZInput.ConnectedGamepadType;
			_shownLanguage = _languageVersion;
		}

		public void SetText(string localizedKeyString, int showMouse = -1)
		{
			_shownKeyName = null;
			bool flag = localizedKeyString.Length == 1;
			(flag ? KeybindText : LongKeybindText).text = localizedKeyString;
			KeybindBox.SetActive(showMouse < 0 && flag);
			LongKeybindBox.SetActive(showMouse < 0 && !flag);
			Mouse1.SetActive(showMouse == 0);
			Mouse2.SetActive(showMouse == 1);
			Mouse3.SetActive(showMouse == 2);
			MouseX.SetActive(showMouse > 2);
			MouseXText.text = (showMouse + 1).ToString();
		}
	}
	public class AugaCharacterSelectPhotoBooth : MonoBehaviour
	{
		public RenderTexture RenderTexture;

		public PostProcessingProfile Profile;

		private const int SettleFrames = 15;

		private Camera _camera;

		private readonly Vector3 _offset = new Vector3(0f, -0.05f, 0f);

		private GameObject _standIn;

		private readonly List<Renderer> _renderers = new List<Renderer>();

		[UsedImplicitly]
		public void Awake()
		{
			//IL_0033: Unknown result type (might be due to invalid IL or missing references)
			//IL_003d: Expected O, but got Unknown
			//IL_003d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0047: Expected O, but got Unknown
			_camera = CharacterPortraitsController.GetCamera(RenderTexture, Profile);
			((Object)_camera).name = "AugaCamera PhotoBooth";
			Camera.onPreCull = (CameraCallback)Delegate.Combine((Delegate?)(object)Camera.onPreCull, (Delegate?)new CameraCallback(HideStandIn));
		}

		[UsedImplicitly]
		public void Start()
		{
			((MonoBehaviour)this).StartCoroutine(PhotoBoothCoroutine());
		}

		[UsedImplicitly]
		public void OnDestroy()
		{
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0016: Expected O, but got Unknown
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_0020: Expected O, but got Unknown
			Camera.onPreCull = (CameraCallback)Delegate.Remove((Delegate?)(object)Camera.onPreCull, (Delegate?)new CameraCallback(HideStandIn));
			if ((Object)(object)_standIn != (Object)null)
			{
				Object.Destroy((Object)(object)_standIn);
			}
		}

		public IEnumerator PhotoBoothCoroutine()
		{
			bool flag = false;
			int index = 0;
			while ((Object)(object)FejdStartup.instance != (Object)null && index < (FejdStartup.instance.m_profiles?.Count ?? 0))
			{
				if (NeedsPhoto(FejdStartup.instance.m_profiles[index]))
				{
					yield return TakePhoto(index);
					flag = true;
				}
				index++;
			}
			if (flag)
			{
				RefreshPortraits();
			}
		}

		public static void RefreshPortraits()
		{
			GameObject val = (((Object)(object)FejdStartup.instance != (Object)null) ? FejdStartup.instance.m_selectCharacterPanel : null);
			AugaCharacterSelect augaCharacterSelect = (((Object)(object)val != (Object)null) ? val.GetComponentInChildren<AugaCharacterSelect>(true) : null);
			if ((Object)(object)augaCharacterSelect != (Object)null && ((Behaviour)augaCharacterSelect).isActiveAndEnabled)
			{
				augaCharacterSelect.UpdatePortraits();
			}
		}

		public static bool NeedsPhoto(PlayerProfile profile)
		{
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			string outputFilePathForProfile = GetOutputFilePathForProfile(profile);
			if (!File.Exists(outputFilePathForProfile))
			{
				return true;
			}
			try
			{
				return FileHelpers.GetLastWriteTime(profile.GetPath(), profile.m_fileSource) > File.GetLastWriteTime(outputFilePathForProfile);
			}
			catch (Exception ex)
			{
				Debug.LogWarning((object)("[Auga] Could not compare the save of " + profile.m_filename + " with its portrait: " + ex.Message));
				return false;
			}
		}

		public IEnumerator TakePhoto(int profileIndex)
		{
			while ((Object)(object)_standIn != (Object)null)
			{
				yield return null;
			}
			List<PlayerProfile> list = (((Object)(object)FejdStartup.instance != (Object)null) ? FejdStartup.instance.m_profiles : null);
			if (list == null || profileIndex < 0 || profileIndex >= list.Count)
			{
				yield break;
			}
			PlayerProfile profile = list[profileIndex];
			_standIn = CreateStandIn(profile);
			for (int i = 0; i < 15; i++)
			{
				yield return null;
			}
			yield return (object)new WaitForEndOfFrame();
			try
			{
				Transform val = (((Object)(object)_standIn != (Object)null) ? Utils.FindChild(_standIn.transform, "Head", (IterativeSearchType)0) : null);
				if ((Object)(object)val != (Object)null)
				{
					SaveProfilePic(profile, Photograph(val));
				}
			}
			catch (Exception ex)
			{
				Debug.LogWarning((object)("[Auga] The portrait of " + profile.m_filename + " could not be taken: " + ex.Message));
			}
			finally
			{
				if ((Object)(object)_standIn != (Object)null)
				{
					Object.Destroy((Object)(object)_standIn);
				}
				_standIn = null;
			}
		}

		private static GameObject CreateStandIn(PlayerProfile profile)
		{
			//IL_0018: 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)
			FejdStartup instance = FejdStartup.instance;
			ZNetView.m_forceDisableInit = true;
			GameObject val;
			try
			{
				val = Object.Instantiate<GameObject>(instance.m_playerPrefab, instance.m_characterPreviewPoint.position, instance.m_characterPreviewPoint.rotation);
			}
			finally
			{
				ZNetView.m_forceDisableInit = false;
			}
			((Object)val).name = "AugaPortraitStandIn";
			Object.Destroy((Object)(object)val.GetComponent<Rigidbody>());
			Animator[] componentsInChildren = val.GetComponentsInChildren<Animator>();
			foreach (Animator obj in componentsInChildren)
			{
				obj.updateMode = (AnimatorUpdateMode)0;
				obj.cullingMode = (AnimatorCullingMode)0;
			}
			try
			{
				profile.LoadPlayerData(val.GetComponent<Player>());
			}
			catch (Exception ex)
			{
				Debug.LogWarning((object)("[Auga] Loading " + profile.m_filename + " for its portrait failed: " + ex.Message));
			}
			return val;
		}

		private void HideStandIn(Camera camera)
		{
			if ((Object)(object)_standIn != (Object)null && (Object)(object)camera != (Object)(object)_camera)
			{
				SetStandInRendering(visible: false);
			}
		}

		private void SetStandInRendering(bool visible)
		{
			_standIn.GetComponentsInChildren<Renderer>(true, _renderers);
			foreach (Renderer renderer in _renderers)
			{
				renderer.forceRenderingOff = !visible;
				SkinnedMeshRenderer val = (SkinnedMeshRenderer)(object)((renderer is SkinnedMeshRenderer) ? renderer : null);
				if (val != null)
				{
					val.updateWhenOffscreen = true;
				}
			}
		}

		private byte[] Photograph(Transform lookTarget)
		{
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ef: 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: Expected O, but got Unknown
			//IL_013a: Unknown result type (might be due to invalid IL or missing references)
			((Component)_camera).transform.LookAt(lookTarget.position + _offset);
			List<Renderer> list = new List<Renderer>();
			GameObject val = (((Object)(object)FejdStartup.instance != (Object)null) ? FejdStartup.instance.m_playerInstance : null);
			if ((Object)(object)val != (Object)null)
			{
				Renderer[] componentsInChildren = val.GetComponentsInChildren<Renderer>(true);
				foreach (Renderer val2 in componentsInChildren)
				{
					if (!val2.forceRenderingOff)
					{
						val2.forceRenderingOff = true;
						list.Add(val2);
					}
				}
			}
			SetStandInRendering(visible: true);
			try
			{
				_camera.Render();
			}
			finally
			{
				SetStandInRendering(visible: false);
				foreach (Renderer item in list)
				{
					item.forceRenderingOff = false;
				}
			}
			Texture2D val3 = new Texture2D(((Texture)RenderTexture).width, ((Texture)RenderTexture).height, RenderTexture.graphicsFormat, ((Texture)RenderTexture).mipmapCount, (TextureCreationFlags)0);
			RenderTexture active = RenderTexture.active;
			try
			{
				RenderTexture.active = RenderTexture;
				val3.ReadPixels(new Rect(0f, 0f, (float)((Texture)RenderTexture).width, (float)((Texture)RenderTexture).height), 0, 0);
				val3.Apply();
				return ImageConversion.EncodeToPNG(val3);
			}
			finally
			{
				RenderTexture.active = active;
				Object.Destroy((Object)(object)val3);
			}
		}

		private void SaveProfilePic(PlayerProfile profile, byte[] bytes)
		{
			string outputFilePathForProfile = GetOutputFilePathForProfile(profile);
			Directory.CreateDirectory(Path.GetDirectoryName(outputFilePathForProfile));
			File.WriteAllBytes(outputFilePathForProfile, bytes);
		}

		public static string GetOutputFilePathForProfile(PlayerProfile profile)
		{
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			string text = profile.m_filename + ".png";
			return Utils.GetSaveDataPath((FileSource)2) + (FileSourceHelper.IsLocal(profile.m_fileSource) ? "/characters_local/" : "/characters/") + text;
		}
	}
	public class AugaCharacterSelect : MonoBehaviour
	{
		public CharacterSelectPortrait CharacterPortraitPrefab;

		public Scrollbar ScrollBar;

		public RectTransform CharacterList;

		public RenderTexture RenderTexture;

		public GameObject SourceInfoPanel;

		public TMP_Text SourceInfoContent;

		private readonly List<CharacterSelectPortrait> _portraits = new List<CharacterSelectPortrait>();

		private bool _onFirstUpdate;

		[UsedImplicitly]
		public void OnEnable()
		{
			_onFirstUpdate = false;
			UpdatePortraits();
		}

		public void UpdateCharacterList()
		{
			UpdatePortraits();
			UpdateSourceInfo();
		}

		public void UpdatePortraits()
		{
			foreach (CharacterSelectPortrait portrait in _portraits)
			{
				Object.Destroy((Object)(object)((Component)portrait).gameObject);
			}
			_portraits.Clear();
			for (int i = 0; i < FejdStartup.instance.m_profiles.Count; i++)
			{
				PlayerProfile profile = FejdStartup.instance.m_profiles[i];
				CharacterSelectPortrait characterSelectPortrait = Object.Instantiate<CharacterSelectPortrait>(CharacterPortraitPrefab, (Transform)(object)CharacterList, false);
				characterSelectPortrait.Setup(profile, i, RenderTexture);
				_portraits.Add(characterSelectPortrait);
			}
		}

		public void UpdateSourceInfo()
		{
			//IL_0065: Unknown result type (might be due to invalid IL or missing references)
			//IL_006b: Invalid comparison between Unknown and I4
			if ((Object)(object)SourceInfoContent == (Object)null)
			{
				return;
			}
			SourceInfoContent.text = "";
			if (FejdStartup.instance.m_profileIndex >= 0 && FejdStartup.instance.m_profileIndex < FejdStartup.instance.m_profiles.Count)
			{
				PlayerProfile val = FejdStartup.instance.m_profiles[FejdStartup.instance.m_profileIndex];
				if (val != null && (int)val.m_fileSource == 8)
				{
					SourceInfoContent.text = Localization.instance.Localize("$menu_legacynotice \n\n");
				}
			}
			if (!FileHelpers.CloudStorageSupportedAndEnabled)
			{
				TMP_Text sourceInfoContent = SourceInfoContent;
				sourceInfoContent.text += Localization.instance.Localize("$menu_cloudsavesdisabled");
			}
		}

		public void LateUpdate()
		{
			if ((Object)(object)SourceInfoPanel != (Object)null && (Object)(object)SourceInfoContent != (Object)null)
			{
				bool flag = !string.IsNullOrWhiteSpace(SourceInfoContent.text);
				if (SourceInfoPanel.activeSelf != flag)
				{
					SourceInfoPanel.SetActive(flag);
				}
			}
			if (!_onFirstUpdate)
			{
				_onFirstUpdate = true;
				int profileIndex = FejdStartup.instance.m_profileIndex;
				if (profileIndex >= 0 && profileIndex < _portraits.Count && _portraits.Count > 1)
				{
					ScrollBar.value = 1f - (float)profileIndex / ((float)_portraits.Count - 1f);
				}
			}
		}
	}
	public class CharacterSelectPortrait : MonoBehaviour
	{
		public RawImage Image;

		public TMP_Text CharacterName;

		public Button Button;

		public GameObject Selected;

		public TMP_Text StatsText;

		public Image LocalSave;

		public Image LegacySave;

		public Image CloudSave;

		public Color NameColorSelected;

		public Color StatsTextColorSelected;

		private Texture2D _texture;

		private PlayerProfile _profile;

		private int _index;

		private Color _originalNameColor;

		private Color _originalStatsTextColor;

		public void Awake()
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			_originalNameColor = ((Graphic)CharacterName).color;
			_originalStatsTextColor = ((Graphic)StatsText).color;
			Update();
		}

		public void Setup(PlayerProfile profile, int index, RenderTexture renderTexture)
		{
			//IL_0031: Unknown result type (might be due to invalid IL or missing references)
			//IL_003b: Expected O, but got Unknown
			//IL_009c: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b2: Expected O, but got Unknown
			//IL_00e2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e8: Invalid comparison between Unknown and I4
			//IL_0101: Unknown result type (might be due to invalid IL or missing references)
			//IL_0107: Invalid comparison between Unknown and I4
			//IL_0120: Unknown result type (might be due to invalid IL or missing references)
			//IL_0126: Invalid comparison between Unknown and I4
			//IL_0129: Unknown result type (might be due to invalid IL or missing references)
			//IL_012f: Invalid comparison between Unknown and I4
			_profile = profile;
			_index = index;
			CharacterName.text = profile.m_playerName;
			((UnityEvent)Button.onClick).AddListener((UnityAction)delegate
			{
				FejdStartup.instance.SetSelectedProfile(_profile.m_filename);
			});
			StatsText.text = $"{profile.GetStat((PlayerStatType)0, (DifficultyRequirement)0)}\n{profile.GetStat((PlayerStatType)2, (DifficultyRequirement)0)}\n{profile.GetStat((PlayerStatType)13, (DifficultyRequirement)0)}";
			string outputFilePathForProfile = AugaCharacterSelectPhotoBooth.GetOutputFilePathForProfile(profile);
			if (File.Exists(outputFilePathForProfile))
			{
				byte[] array = File.ReadAllBytes(outputFilePathForProfile);
				_texture = new Texture2D(((Texture)renderTexture).width, ((Texture)renderTexture).height, renderTexture.graphicsFormat, ((Texture)renderTexture).mipmapCount, (TextureCreationFlags)0);
				ImageConversion.LoadImage(_texture, array);
				Image.texture = (Texture)(object)_texture;
			}
			Image localSave = LocalSave;
			if (localSave != null)
			{
				((Component)localSave).gameObject.SetActive((int)profile.m_fileSource == 2);
			}
			Image legacySave = LegacySave;
			if (legacySave != null)
			{
				((Component)legacySave).gameObject.SetActive((int)profile.m_fileSource == 8);
			}
			Image cloudSave = CloudSave;
			if (cloudSave != null)
			{
				((Component)cloudSave).gameObject.SetActive((int)profile.m_fileSource == 4 || (int)profile.m_fileSource == 1);
			}
			Update();
		}

		public void Update()
		{
			//IL_0031: 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_004d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0045: Unknown result type (might be due to invalid IL or missing references)
			bool flag = _index == FejdStartup.instance.m_profileIndex;
			Selected.SetActive(flag);
			((Graphic)CharacterName).color = (flag ? NameColorSelected : _originalNameColor);
			((Graphic)StatsText).color = (flag ? StatsTextColorSelected : _originalStatsTextColor);
		}

		[UsedImplicitly]
		public void OnDestroy()
		{
			Object.Destroy((Object)(object)_texture);
		}
	}
	public class CompendiumItem : MonoBehaviour
	{
		public ItemTooltip ItemTooltip;

		public Image Icon;

		public TMP_Text Amount;

		public virtual void SetItem(ItemData item, string amount = null)
		{
			ItemTooltip.Item = item;
			Icon.sprite = item.GetIcon();
			((Behaviour)Amount).enabled = !string.IsNullOrEmpty(amount);
			Amount.text = amount;
		}
	}
	public class BestiaryStatBlock : MonoBehaviour
	{
		public TMP_Text LevelLabel;

		public GameObject LevelStar;

		public TMP_Text Health;

		public TMP_Text Weakness;

		public TMP_Text Resistance;

		public TMP_Text Immune;

		public unsafe virtual void SetStats(Humanoid humanoid, int level)
		{
			LevelLabel.text = ((level == 1) ? "$baselevel" : (level - 1).ToString());
			LevelStar.SetActive(level >= 2);
			Health.text = GetMaxHealth(humanoid, level).ToString("0");
			List<DamageType> damageTypes = GetDamageTypes(humanoid, (DamageModifier)2);
			List<DamageType> damageTypes2 = GetDamageTypes(humanoid, (DamageModifier)6);
			DamageType[] source = damageTypes.Concat(damageTypes2).ToArray();
			List<DamageType> damageTypes3 = GetDamageTypes(humanoid, (DamageModifier)1);
			List<DamageType> damageTypes4 = GetDamageTypes(humanoid, (DamageModifier)5);
			DamageType[] source2 = damageTypes3.Concat(damageTypes4).ToArray();
			List<DamageType> damageTypes5 = GetDamageTypes(humanoid, (DamageModifier)3);
			Weakness.text = ((!source.Any()) ? "-" : string.Join("\n", source.Select((DamageType x) => "$inventory_" + ((object)(*(DamageType*)(&x))/*cast due to .constrained prefix*/).ToString().ToLowerInvariant())));
			Resistance.text = ((!source2.Any()) ? "-" : string.Join("\n", source2.Select((DamageType x) => "$inventory_" + ((object)(*(DamageType*)(&x))/*cast due to .constrained prefix*/).ToString().ToLowerInvariant())));
			Immune.text = ((!damageTypes5.Any()) ? "-" : string.Join("\n", damageTypes5.Select((DamageType x) => "$inventory_" + ((object)(*(DamageType*)(&x))/*cast due to .constrained prefix*/).ToString().ToLowerInvariant())));
		}

		public static float GetMaxHealth(Humanoid humanoid, int level)
		{
			return ((Character)humanoid).m_health * (float)level;
		}

		public static List<DamageType> GetDamageTypes(Humanoid humanoid, DamageModifier modifier)
		{
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_0028: Unknown result type (might be due to invalid IL or missing references)
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0030: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_0039: Unknown result type (might be due to invalid IL or missing references)
			List<DamageType> list = new List<DamageType>();
			foreach (DamageType value in Enum.GetValues(typeof(DamageType)))
			{
				if (((DamageModifiers)(ref ((Character)humanoid).m_damageModifiers)).GetModifier(value) == modifier)
				{
					list.Add(value);
				}
			}
			return list;
		}
	}
	public class AugaCompendiumController : MonoBehaviour
	{
		public TabHandler TabController;

		public TextsDialog Compendium;

		public TextsDialog LoreCompendium;

		public GameObject BestiaryContent;

		public RectTransform BestiaryList;

		public GameObject BestiaryListElementPrefab;

		public TMP_Text BestiaryName;

		public TMP_Text BestiaryDescription;

		public CompendiumItem CompendiumItemPrefab;

		public RectTransform DropsContainer;

		public List<BestiaryStatBlock> StatBlocks;

		public AugaAchievementsPanel Achievements;

		protected readonly List<KeyValuePair<string, GameObject>> _bestiaryItems = new List<KeyValuePair<string, GameObject>>();

		protected int _selectedBestiaryIndex = -1;

		protected Dictionary<string, Humanoid> _trophyToMonsterCache;

		protected virtual void SetupTrophyToMonsterCache()
		{
			//IL_00e5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ec: Invalid comparison between Unknown and I4
			if ((Object)(object)ZNetScene.instance == (Object)null || ZNetScene.instance.m_namedPrefabs == null || _trophyToMonsterCache != null || !ZNetScene.instance.m_namedPrefabs.Values.Any())
			{
				return;
			}
			_trophyToMonsterCache = new Dictionary<string, Humanoid>();
			foreach (GameObject value in ZNetScene.instance.m_namedPrefabs.Values)
			{
				Humanoid component = value.GetComponent<Humanoid>();
				CharacterDrop component2 = value.GetComponent<CharacterDrop>();
				if ((Object)(object)component2 == (Object)null || (Object)(object)component == (Object)null || component2.m_drops == null || !component2.m_drops.Any())
				{
					continue;
				}
				foreach (Drop drop in component2.m_drops)
				{
					if (drop != null)
					{
						ItemDrop component3 = drop.m_prefab.GetComponent<ItemDrop>();
						if ((Object)(object)component3 != (Object)null && (int)component3.m_itemData.m_shared.m_itemType == 13 && !_trophyToMonsterCache.ContainsKey(((Object)drop.m_prefab).name))
						{
							_trophyToMonsterCache.Add(((Object)drop.m_prefab).name, component);
							break;
						}
					}
				}
			}
		}

		public virtual void ShowCompendium()
		{
			((Component)this).gameObject.SetActive(true);
			TabController.SetActiveTab(0, false, true);
			Compendium.Setup(Player.m_localPlayer);
			LoreCompendium.Setup(Player.m_localPlayer);
			SetupBestiary();
			Menu.instance.m_settingsInstance = ((Component)this).gameObject;
		}

		public virtual void HideCompendium()
		{
			Menu.instance.m_settingsInstance = null;
			((Component)this).gameObject.SetActive(false);
		}

		public virtual void Update()
		{
			if ((Input.GetKeyDown((KeyCode)27) || ZInput.GetButtonDown("JoyMenu")) && (!((Object)(object)Achievements != (Object)null) || !Achievements.CloseDetailsIfOpen()))
			{
				HideCompendium();
			}
		}

		public virtual void SetupBestiary()
		{
			//IL_00db: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e0: Unknown result type (might be due to invalid IL or missing references)
			//IL_021d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0227: Expected O, but got Unknown
			SetupTrophyToMonsterCache();
			if (_trophyToMonsterCache == null)
			{
				return;
			}
			Player localPlayer = Player.m_localPlayer;
			if ((Object)(object)localPlayer == (Object)null)
			{
				BestiaryContent.SetActive(false);
				return;
			}
			BestiaryContent.SetActive(_bestiaryItems.Count > 0);
			foreach (KeyValuePair<string, GameObject> bestiaryItem in _bestiaryItems)
			{
				Object.Destroy((Object)(object)bestiaryItem.Value);
			}
			_bestiaryItems.Clear();
			List<string> trophies = localPlayer.GetTrophies();
			List<Tuple<int, string, GameObject>> list = new List<Tuple<int, string, GameObject>>();
			for (int i = 0; i < trophies.Count; i++)
			{
				string text = trophies[i];
				GameObject itemPrefab = ObjectDB.instance.GetItemPrefab(text);
				if (!((Object)(object)itemPrefab == (Object)null))
				{
					ItemDrop component = itemPrefab.GetComponent<ItemDrop>();
					Vector2Int trophyPos = component.m_itemData.m_shared.m_trophyPos;
					int item = ((Vector2Int)(ref trophyPos)).y * 10 + ((Vector2Int)(ref trophyPos)).x;
					_trophyToMonsterCache.TryGetValue(text, out var value);
					if ((Object)(object)value != (Object)null)
					{
						GameObject val = Object.Instantiate<GameObject>(BestiaryListElementPrefab, (Transform)(object)BestiaryList);
						val.SetActive(true);
						Transform transform = val.transform;
						string text2 = Localization.instance.Localize(((Character)value).m_name);
						((Component)transform.Find("name")).GetComponent<TMP_Text>().text = text2;
						((Component)transform.Find("icon")).GetComponent<Image>().sprite = component.m_itemData.GetIcon();
						list.Add(new Tuple<int, string, GameObject>(item, text, val));
					}
				}
			}
			List<Tuple<int, string, GameObject>> list2 = list.OrderBy((Tuple<int, string, GameObject> x) => x.Item1).ToList();
			for (int num = 0; num < list2.Count; num++)
			{
				Tuple<int, string, GameObject> tuple = list2[num];
				GameObject item2 = tuple.Item3;
				item2.transform.SetSiblingIndex(num);
				int i2 = num;
				((UnityEvent)item2.GetComponent<Button>().onClick).AddListener((UnityAction)delegate
				{
					OnBestiaryItemClicked(i2);
				});
				_bestiaryItems.Add(new KeyValuePair<string, GameObject>(tuple.Item2, item2));
			}
			OnBestiaryItemClicked(0);
		}

		private void OnBestiaryItemClicked(int index)
		{
			//IL_014e: Unknown result type (might be due to invalid IL or missing references)
			_selectedBestiaryIndex = index;
			for (int i = 0; i < _bestiaryItems.Count; i++)
			{
				((Component)_bestiaryItems[i].Value.transform.Find("selected")).gameObject.SetActive(i == _selectedBestiaryIndex);
			}
			if (_selectedBestiaryIndex < 0 || _selectedBestiaryIndex >= _bestiaryItems.Count || (Object)(object)Player.m_localPlayer == (Object)null)
			{
				return;
			}
			_selectedBestiaryIndex = Mathf.Clamp(_selectedBestiaryIndex, 0, _bestiaryItems.Count - 1);
			string key = _bestiaryItems[_selectedBestiaryIndex].Key;
			_trophyToMonsterCache.TryGetValue(key, out var value);
			if ((Object)(object)value == (Object)null)
			{
				return;
			}
			GameObject itemPrefab = ObjectDB.instance.GetItemPrefab(key);
			if ((Object)(object)itemPrefab == (Object)null)
			{
				return;
			}
			ItemDrop component = itemPrefab.GetComponent<ItemDrop>();
			BestiaryContent.SetActive(true);
			BestiaryName.text = ((Character)value).m_name;
			BestiaryDescription.text = component.m_itemData.m_shared.m_name + "_lore";
			foreach (Transform item in (Transform)DropsContainer)
			{
				Object.Destroy((Object)(object)((Component)item).gameObject);
			}
			foreach (Drop drop in ((Component)value).GetComponent<CharacterDrop>().m_drops)
			{
				Object.Instantiate<CompendiumItem>(CompendiumItemPrefab, (Transform)(object)DropsContainer).SetItem(amount: ((drop.m_amountMin == drop.m_amountMax) ? $"{drop.m_amountMin}" : $"{drop.m_amountMin}-{drop.m_amountMax}") + $" ({Mathf.CeilToInt(drop.m_chance * 100f)}%)", item: drop.m_prefab.GetComponent<ItemDrop>().m_itemData);
			}
			for (int j = 0; j < StatBlocks.Count; j++)
			{
				StatBlocks[j].SetStats(value, j + 1);
			}
			Localization.instance.Localize(BestiaryContent.transform);
		}
	}
	public class AugaTextsDialogFilter : MonoBehaviour
	{
		public string Filter;
	}
	public class AugaCraftingControls : MonoBehaviour
	{
		[Header("Crafting Controls")]
		public Button craftButton;

		[Header("MultiCraft Objects")]
		public GameObject multicraft;

		public Button plusButton;

		public Button minusButton;

		public TMP_Text craftAmountText;

		public GameObject craftAmountBg;

		public GameObject aaa;

		public GuiInputField inputAmount;

		public TMP_Text inputText;

		private static AugaCraftingControls _instance;

		public static AugaCraftingControls Instance => _instance;

		private void Awake()
		{
			_instance = this;
		}
	}
	public class AugaCraftingPanel : MonoBehaviour
	{
		public TMP_Text WorkbenchName;

		public Image WorkbenchIcon;

		public TMP_Text WorkbenchLevel;

		public RectTransform WorkbenchLevelRoot;

		public Button RepairButton;

		public Image RepairGlow;

		public Button DefaultRepairButton;

		public Image DefaultRepairGlow;

		public AugaTabController TabController;

		public CraftingRequirementsPanel CraftingRequirementsPanel;

		public CraftingRequirementsPanel UpgradeRequirementsPanel;

		public CraftingRequirementsPanel MaxQualityUpgradeRequirementsPanel;

		public CraftingRequirementsPanel GenericCraftingRequirementsPanel;

		public RectTransform RecipeList;

		public Scrollbar RecipeListScrollbar;

		public ScrollRectEnsureVisible RecipeListEnsureVisible;

		public GameObject RecipeItemPrefab;

		public ComplexTooltip ItemInfo;

		public GameObject RequirementsContainer;

		public Button CraftButton;

		public Button CraftCancelButton;

		public Button VariantButton;

		public GameObject VariantButtonContainer;

		public GameObject NonVariantButtonContainer;

		public VariantDialog VariantDialog;

		public Button CustomVariantButton;

		public GameObject CustomVariantDialog;

		public TMP_Text CustomVariantText;

		public Transform CraftProgressPanel;

		public Image CraftProgressBar;

		public GameObject ResultsPanelPrefab;

		[Header("MultiCraft Objects")]
		public GameObject Multicraft;

		public Button PlusButton;

		public Button MinusButton;

		public TMP_Text CraftAmountText;

		public GameObject CraftAmountBG;

		public GameObject AAA;

		public GuiInputField InputAmount;

		public TMP_Text InputText;

		[Header("Dummy Objects")]
		public Image DummyIcon;

		public TMP_Text DummyName;

		public TMP_Text DummyDescription;

		public Transform DummyRepairPanelSelection;

		public Button DummyCraftTabButton;

		public Button DummyUpgradeTabButton;

		public GuiBar DummyCraftProgressBar;

		public RectTransform DummyQualityPanel;

		public Image DummyMinStationLevelIcon;

		public static AugaCraftingPanel _instance;

		private CraftingRequirementsPanel _currentPanel;

		private Action<bool> _onShowCustomVariantDialog;

		private bool _multiCraftEnabled;

		private void Awake()
		{
			if ((Object)(object)_instance != (Object)null)
			{
				Debug.LogError((object)$"Too many instances of AugaCraftingPanel exist! other={_instance} parent={((Component)_instance).transform.parent}");
			}
			_instance = this;
		}

		public virtual void Initialize(InventoryGui inventoryGui)
		{
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_003f: Expected O, but got Unknown
			TabController.OnTabChanged += OnTabChanged;
			ActivatePanel(CraftingRequirementsPanel);
			((UnityEvent)CustomVariantButton.onClick).AddListener(new UnityAction(OnCustomVariantButtonClicked));
		}

		private void OnTabChanged(int previousTabIndex, int currentTabIndex)
		{
			VariantDialog.OnClose();
			InventoryGui instance = InventoryGui.instance;
			if ((Object)(object)instance != (Object)null)
			{
				switch (currentTabIndex)
				{
				case 0:
					ActivatePanel(CraftingRequirementsPanel);
					instance.OnTabCraftPressed();
					break;
				case 1:
					ActivatePanel(UpgradeRequirementsPanel);
					instance.OnTabUpgradePressed();
					break;
				default:
					ActivatePanel(GenericCraftingRequirementsPanel);
					((Selectable)instance.m_tabCraft).interactable = true;
					((Selectable)instance.m_tabUpgrade).interactable = true;
					instance.UpdateCraftingPanel(false);
					break;
				}
			}
		}

		public virtual void ActivatePanel(CraftingRequirementsPanel panel)
		{
			((Component)CraftingRequirementsPanel).gameObject.SetActive(false);
			((Component)UpgradeRequirementsPanel).gameObject.SetActive(false);
			((Component)MaxQualityUpgradeRequirementsPanel).gameObject.SetActive(false);
			((Component)GenericCraftingRequirementsPanel).gameObject.SetActive(false);
			InventoryGui instance = InventoryGui.instance;
			_currentPanel = panel;
			object obj;
			if (instance == null)
			{
				obj = null;
			}
			else
			{
				ItemData itemData = ((RecipeDataPair)(ref instance.m_selectedRecipe)).ItemData;
				obj = ((itemData != null) ? itemData.GetIcon() : null);
			}
			if ((Object)obj != (Object)null)
			{
				_currentPanel.Icon.sprite = ((RecipeDataPair)(ref instance.m_selectedRecipe)).ItemData.GetIcon();
			}
			SetRecipe(((RecipeDataPair)(ref instance.m_selectedRecipe)).Recipe, ((RecipeDataPair)(ref instance.m_selectedRecipe)).ItemData, instance.m_selectedVariant);
			((Component)panel).gameObject.SetActive(true);
			panel.Activate(instance, ItemInfo);
		}

		[UsedImplicitly]
		public virtual void OnEnable()
		{
			Player localPlayer = Player.m_localPlayer;
			if ((Object)(object)localPlayer != (Object)null && (Object)(object)localPlayer.m_currentStation == (Object)null)
			{
				OnTabChanged(-1, 0);
			}
			InventoryGui instance = InventoryGui.instance;
			SetRecipe(((RecipeDataPair)(ref instance.m_selectedRecipe)).Recipe, ((RecipeDataPair)(ref instance.m_selectedRecipe)).ItemData, instance.m_selectedVariant);
		}

		[UsedImplicitly]
		public virtual void OnDisable()
		{
			VariantDialog.OnClose();
		}

		public void SetRecipe(Recipe recipe, ItemData item, int variant)
		{
			if ((Object)(object)recipe == (Object)null)
			{
				((Component)ItemInfo).gameObject.SetActive(false);
			}
			else
			{
				if (item != null)
				{
					int quality = Mathf.Min(item.m_quality + 1, item.m_shared.m_maxQuality);
					ItemInfo.SetItem(item, quality, variant);
				}
				else
				{
					ItemInfo.SetItem(recipe.m_item.m_itemData, 1, variant);
				}
				((Component)ItemInfo).gameObj