Decompiled source of Quads Jet Skis v0.3.1

plugins/JetSkis.dll

Decompiled 15 hours 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.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Text.RegularExpressions;
using BepInEx;
using BepInEx.Bootstrap;
using BepInEx.Configuration;
using BepInEx.Logging;
using DHack.Shared;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using Newtonsoft.Json.Linq;
using TMPro;
using UnityEngine;
using UnityEngine.EventSystems;
using UnityEngine.Events;
using UnityEngine.UI;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: AssemblyMetadata("AI_Assisted_Creation", "This assembly was partially or fully created with the assistance of Generative AI (Claude Code).")]
[assembly: AssemblyMetadata("AI_Model_Vendor", "Anthropic")]
[assembly: AssemblyMetadata("ClaudeTools.Reload", "world")]
[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: AssemblyVersion("0.0.0.0")]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Embedded]
	[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace JetSkis
{
	internal sealed class Effects
	{
		internal static readonly Color[] Paints = (Color[])(object)new Color[7]
		{
			new Color(0.75f, 0.12f, 0.08f),
			new Color(0.14f, 0.3f, 0.75f),
			new Color(0.16f, 0.5f, 0.22f),
			new Color(0.12f, 0.6f, 0.6f),
			new Color(0.5f, 0.16f, 0.62f),
			new Color(0.13f, 0.12f, 0.11f),
			new Color(1f, 1f, 1f)
		};

		internal static readonly string[] PaintKeys = new string[7] { "jetskis_paint_red", "jetskis_paint_blue", "jetskis_paint_green", "jetskis_paint_teal", "jetskis_paint_purple", "jetskis_paint_black", "jetskis_paint_wood" };

		internal static float TestUntil;

		private static AudioClip _engineClip;

		private static readonly MethodInfo SetData = typeof(AudioClip).GetMethod("SetData", new Type[2]
		{
			typeof(float[]),
			typeof(int)
		});

		private readonly Transform _root;

		private readonly List<Object> _made = new List<Object>();

		private AudioSource _engine;

		private ParticleSystem[] _plume;

		private ParticleSystem[] _sprayL;

		private ParticleSystem[] _sprayR;

		private ParticleSystem[] _bowL;

		private ParticleSystem[] _bowR;

		private ParticleSystem _foam;

		private readonly Dictionary<ParticleSystem, float> _perRate = new Dictionary<ParticleSystem, float>();

		private readonly Dictionary<ParticleSystem, Vector3> _from = new Dictionary<ParticleSystem, Vector3>();

		private Light _light;

		private Material _glow;

		private Material _paint;

		private readonly Dictionary<Renderer, Material> _shared = new Dictionary<Renderer, Material>();

		private static readonly int _sprayLayer = LayerMask.NameToLayer("effect");

		private Color _glowBase;

		private float _rev;

		private float _flicker;

		private int _paintShown = -1;

		internal Effects(Transform root, Transform body)
		{
			//IL_0147: Unknown result type (might be due to invalid IL or missing references)
			//IL_0135: Unknown result type (might be due to invalid IL or missing references)
			//IL_014c: Unknown result type (might be due to invalid IL or missing references)
			_root = root;
			try
			{
				Engine();
			}
			catch (Exception ex)
			{
				Plugin.Log.LogWarning((object)("No engine sound: " + ex.Message));
			}
			try
			{
				Spray();
			}
			catch (Exception ex2)
			{
				Plugin.Log.LogWarning((object)("No spray: " + ex2.Message));
			}
			if ((Object)(object)body != (Object)null)
			{
				_light = ((Component)body).GetComponentInChildren<Light>(true);
				if ((Object)(object)_light != (Object)null && _sprayLayer >= 0)
				{
					Light light = _light;
					light.cullingMask &= ~(1 << _sprayLayer);
				}
				Transform obj = body.Find("Glow");
				Renderer val = ((obj != null) ? ((Component)obj).GetComponent<Renderer>() : null);
				Transform obj2 = body.Find("Paint");
				Renderer val2 = ((obj2 != null) ? ((Component)obj2).GetComponent<Renderer>() : null);
				if ((Object)(object)val != (Object)null)
				{
					_glow = Own(val, "Glow");
					_glowBase = (_glow.HasProperty("_EmissionColor") ? _glow.GetColor("_EmissionColor") : Color.black);
				}
				if ((Object)(object)val2 != (Object)null)
				{
					_paint = Own(val2, "Paint");
				}
			}
		}

		internal void Dispose()
		{
			foreach (KeyValuePair<Renderer, Material> item in _shared)
			{
				if ((Object)(object)item.Key != (Object)null)
				{
					item.Key.sharedMaterial = item.Value;
				}
			}
			_shared.Clear();
			foreach (Object item2 in _made)
			{
				if (item2 != (Object)null)
				{
					Object.Destroy(item2);
				}
			}
			_made.Clear();
		}

		private Material Own(Renderer r, string look)
		{
			if ((Object)(object)r.sharedMaterial == (Object)null)
			{
				r.sharedMaterial = Look.Of(look);
			}
			_shared[r] = r.sharedMaterial;
			Material material = r.material;
			_made.Add((Object)(object)material);
			return material;
		}

		internal void Tick(float speed, Speed throttle, float rudder, bool ridden, bool inWater, float water)
		{
			//IL_001f: 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_0054: Invalid comparison between Unknown and I4
			//IL_0056: Unknown result type (might be due to invalid IL or missing references)
			//IL_0058: Invalid comparison between Unknown and I4
			//IL_005a: Unknown result type (might be due to invalid IL or missing references)
			//IL_005c: Invalid comparison between Unknown and I4
			//IL_005e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0060: Invalid comparison between Unknown and I4
			//IL_01e7: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f8: Unknown result type (might be due to invalid IL or missing references)
			//IL_0202: Unknown result type (might be due to invalid IL or missing references)
			//IL_0207: Unknown result type (might be due to invalid IL or missing references)
			//IL_020c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0214: Unknown result type (might be due to invalid IL or missing references)
			//IL_0230: Unknown result type (might be due to invalid IL or missing references)
			//IL_03e0: Unknown result type (might be due to invalid IL or missing references)
			//IL_03e7: Unknown result type (might be due to invalid IL or missing references)
			float deltaTime = Time.deltaTime;
			if (Time.time < TestUntil)
			{
				speed = Plugin.TopSpeed.Value;
				throttle = (Speed)4;
				rudder = Mathf.Sin(Time.time * 0.8f);
				ridden = (inWater = true);
			}
			float num = Mathf.Max(1f, Plugin.TopSpeed.Value);
			float num2 = ((!ridden) ? 0f : (((int)throttle == 4) ? 1f : (((int)throttle == 3 || (int)throttle == 2) ? 0.65f : (((int)throttle == 1) ? 0.45f : 0.08f))));
			float num3 = Mathf.Clamp01(Mathf.Abs(speed) / num);
			_rev = Mathf.MoveTowards(_rev, Mathf.Max(num2 * 0.6f + num3 * 0.4f, ridden ? 0.08f : 0f), deltaTime * ((num2 > _rev) ? 1.6f : 0.9f));
			if ((Object)(object)_engine != (Object)null)
			{
				float num4 = (ridden ? ((0.16f + 0.42f * _rev) * Plugin.EngineVolume.Value) : 0f);
				_engine.volume = Mathf.MoveTowards(_engine.volume, num4, deltaTime * 0.8f);
				_engine.pitch = 0.75f + 1.75f * _rev + Mathf.Sin(Time.time * 7.3f) * 0.015f;
				if (_engine.volume > 0.001f && !_engine.isPlaying)
				{
					_engine.Play();
				}
				else if (_engine.volume <= 0.001f && _engine.isPlaying)
				{
					_engine.Stop();
				}
			}
			foreach (KeyValuePair<ParticleSystem, Vector3> item in _from)
			{
				Vector3 position = _root.TransformPoint(new Vector3(item.Value.x, 0f, item.Value.z));
				position.y = water + item.Value.y;
				((Component)item.Key).transform.position = position;
			}
			bool flag = inWater && speed > 2f;
			Rate(_plume, flag ? (Mathf.Pow(num3, 1.2f) * 70f) : 0f);
			Rate(_bowL, (flag && speed > 4f) ? (num3 * 22f) : 0f);
			Rate(_bowR, (flag && speed > 4f) ? (num3 * 22f) : 0f);
			float num5 = ((flag && speed > 3f) ? (Mathf.Abs(rudder) * num3 * 55f) : 0f);
			Rate(_sprayL, (rudder > 0.15f) ? num5 : 0f);
			Rate(_sprayR, (rudder < -0.15f) ? num5 : 0f);
			Rate(_foam, (inWater && Mathf.Abs(speed) > 1.5f) ? (Mathf.Abs(speed) * 1.6f) : 0f);
			_flicker = Mathf.Lerp(_flicker, Random.Range(-1f, 1f), deltaTime * 12f);
			float num6 = (ridden ? (0.85f + 1.6f * _rev + _flicker * 0.12f) : 0.7f);
			if ((Object)(object)_glow != (Object)null && _glow.HasProperty("_EmissionColor"))
			{
				_glow.SetColor("_EmissionColor", _glowBase * num6);
			}
			if ((Object)(object)_light != (Object)null)
			{
				_light.intensity = 1f * num6;
				_light.range = 2.5f + 2.5f * _rev;
			}
		}

		internal void Paint(int index)
		{
			//IL_0036: Unknown result type (might be due to invalid IL or missing references)
			index = Mathf.Clamp(index, 0, Paints.Length - 1);
			if (index != _paintShown && !((Object)(object)_paint == (Object)null))
			{
				_paint.color = Paints[index];
				_paintShown = index;
			}
		}

		private void Rate(ParticleSystem[] spray, float perSecond)
		{
			if (spray != null)
			{
				foreach (ParticleSystem val in spray)
				{
					Rate(val, perSecond * (_perRate.TryGetValue(val, out var value) ? value : 1f));
				}
			}
		}

		private static void Rate(ParticleSystem ps, float perSecond)
		{
			//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_0014: Unknown result type (might be due to invalid IL or missing references)
			if (!((Object)(object)ps == (Object)null))
			{
				EmissionModule emission = ps.emission;
				((EmissionModule)(ref emission)).rateOverTime = MinMaxCurve.op_Implicit(perSecond);
				if (perSecond > 0f && !ps.isPlaying)
				{
					ps.Play();
				}
			}
		}

		private void Engine()
		{
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_000b: Expected O, but got Unknown
			//IL_0032: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = new GameObject("Engine");
			val.transform.SetParent(_root, false);
			val.transform.localPosition = new Vector3(0f, 0.2f, -1.2f);
			_made.Add((Object)(object)val);
			_engine = val.AddComponent<AudioSource>();
			_engine.clip = EngineClip();
			_engine.loop = true;
			_engine.playOnAwake = false;
			_engine.volume = 0f;
			_engine.spatialBlend = 1f;
			_engine.rolloffMode = (AudioRolloffMode)1;
			_engine.minDistance = 4f;
			_engine.maxDistance = 50f;
			_engine.dopplerLevel = 0.4f;
			AudioSource[] componentsInChildren = ((Component)_root).GetComponentsInChildren<AudioSource>(true);
			foreach (AudioSource val2 in componentsInChildren)
			{
				if ((Object)(object)val2 != (Object)(object)_engine && (Object)(object)val2.outputAudioMixerGroup != (Object)null)
				{
					_engine.outputAudioMixerGroup = val2.outputAudioMixerGroup;
					break;
				}
			}
		}

		private static AudioClip EngineClip()
		{
			if ((Object)(object)_engineClip != (Object)null)
			{
				return _engineClip;
			}
			float[] array = new float[44100];
			Random random = new Random(7);
			for (int i = 0; i < 50; i++)
			{
				float num = 0.75f + 0.25f * (float)random.NextDouble();
				float num2 = 150f + 30f * (float)random.NextDouble();
				for (int j = 0; j < 882; j++)
				{
					float num3 = (float)j / 44100f;
					float num4 = Mathf.Exp((0f - num3) / 0.0065f);
					float num5 = (float)random.NextDouble() * 2f - 1f;
					array[i * 882 + j] = num * num4 * (0.6f * Mathf.Sin((float)Math.PI * 2f * num2 * num3) + 0.25f * Mathf.Sin((float)Math.PI * 4f * num2 * num3) + 0.45f * num5);
				}
			}
			float num6 = 0f;
			float num7 = 0f;
			float num8 = 0.001f;
			for (int k = 0; k < 44100; k++)
			{
				array[k] += 0.22f * Mathf.Sin((float)Math.PI * 100f * (float)k / 44100f);
				num6 += (array[k] - num6) * 0.3f;
				num7 = (array[k] = num7 + (num6 - num7) * 0.35f);
				num8 = Mathf.Max(num8, Mathf.Abs(num7));
			}
			for (int l = 0; l < 44100; l++)
			{
				array[l] *= 0.8f / num8;
			}
			_engineClip = AudioClip.Create("dh_jetski_engine", 44100, 1, 44100, false);
			SetData.Invoke(_engineClip, new object[2] { array, 0 });
			return _engineClip;
		}

		private void Spray()
		{
			//IL_00a4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b8: Unknown result type (might be due to invalid IL or missing references)
			//IL_0107: Unknown result type (might be due to invalid IL or missing references)
			//IL_011b: Unknown result type (might be due to invalid IL or missing references)
			//IL_016a: Unknown result type (might be due to invalid IL or missing references)
			//IL_017e: Unknown result type (might be due to invalid IL or missing references)
			//IL_01cd: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e1: Unknown result type (might be due to invalid IL or missing references)
			//IL_0230: Unknown result type (might be due to invalid IL or missing references)
			//IL_0244: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = (((Object)(object)ZNetScene.instance != (Object)null) ? ZNetScene.instance.GetPrefab("fx_float_hitwater") : null);
			object obj;
			if (!((Object)(object)val != (Object)null))
			{
				obj = null;
			}
			else
			{
				ParticleSystemRenderer component = val.GetComponent<ParticleSystemRenderer>();
				obj = ((component != null) ? ((Renderer)component).sharedMaterial : null);
			}
			Material val2 = (Material)obj;
			object obj2;
			if (!((Object)(object)val != (Object)null))
			{
				obj2 = null;
			}
			else
			{
				Transform obj3 = val.transform.Find("GameObject");
				if (obj3 == null)
				{
					obj2 = null;
				}
				else
				{
					ParticleSystemRenderer component2 = ((Component)obj3).GetComponent<ParticleSystemRenderer>();
					obj2 = ((component2 != null) ? ((Renderer)component2).sharedMaterial : null);
				}
			}
			Material val3 = (Material)obj2;
			if ((Object)(object)val2 != (Object)null && (Object)(object)val3 != (Object)null)
			{
				_plume = Pair(val2, val3, "Plume", new Vector3(0f, 0.12f, -1.6f), new Vector3(0f, 0.62f, -1f), 6f, 8f, 11.5f, 0.45f, 0.9f, 0.9f, 1.3f, 3.2f);
				_sprayL = Pair(val2, val3, "SprayLeft", new Vector3(-0.6f, 0.05f, -0.2f), new Vector3(-1f, 0.75f, -0.35f), 20f, 4.5f, 7.5f, 0.35f, 0.7f, 0.6f, 0.9f, 2.6f);
				_sprayR = Pair(val2, val3, "SprayRight", new Vector3(0.6f, 0.05f, -0.2f), new Vector3(1f, 0.75f, -0.35f), 20f, 4.5f, 7.5f, 0.35f, 0.7f, 0.6f, 0.9f, 2.6f);
				_bowL = Pair(val2, val3, "BowLeft", new Vector3(-0.42f, 0.05f, 1f), new Vector3(-1f, 0.5f, -0.5f), 12f, 2.5f, 4f, 0.2f, 0.4f, 0.35f, 0.55f, 2f);
				_bowR = Pair(val2, val3, "BowRight", new Vector3(0.42f, 0.05f, 1f), new Vector3(1f, 0.5f, -0.5f), 12f, 2.5f, 4f, 0.2f, 0.4f, 0.35f, 0.55f, 2f);
			}
			Transform val4 = _root.Find("WaterEffects/SpeedWake/aft_particles");
			if ((Object)(object)val4 != (Object)null && (Object)(object)((Component)val4).GetComponent<ParticleSystem>() != (Object)null)
			{
				_foam = Foam(val4);
			}
		}

		private ParticleSystem[] Pair(Material mist, Material drop, string name, Vector3 at, Vector3 toward, float spread, float speedMin, float speedMax, float sizeMin, float sizeMax, float lifeMin, float lifeMax, float grow)
		{
			//IL_000b: 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_003e: 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)
			return (ParticleSystem[])(object)new ParticleSystem[2]
			{
				Emitter(mist, name, at, toward, spread, speedMin, speedMax, sizeMin, sizeMax, lifeMin, lifeMax, 0.75f, grow, 1f),
				Emitter(drop, name + "Drops", at, toward, spread * 1.3f, speedMin * 1.05f, speedMax * 1.15f, 0.02f, 0.045f, lifeMin, lifeMax * 1.2f, 0.95f, 1f, 2.5f)
			};
		}

		private ParticleSystem Emitter(Material material, string name, Vector3 at, Vector3 toward, float spread, float speedMin, float speedMax, float sizeMin, float sizeMax, float lifeMin, float lifeMax, float alpha, float grow, float perRate)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Expected O, but got Unknown
			//IL_0045: Unknown result type (might be due to invalid IL or missing references)
			//IL_0053: Unknown result type (might be due to invalid IL or missing references)
			//IL_0058: Unknown result type (might be due to invalid IL or missing references)
			//IL_005d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0075: 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_00b2: 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_00d2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e8: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_011b: Unknown result type (might be due to invalid IL or missing references)
			//IL_013a: Unknown result type (might be due to invalid IL or missing references)
			//IL_013f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0166: Unknown result type (might be due to invalid IL or missing references)
			//IL_016b: 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_0190: Unknown result type (might be due to invalid IL or missing references)
			//IL_0195: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ae: 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_01c8: Unknown result type (might be due to invalid IL or missing references)
			//IL_01cf: Expected O, but got Unknown
			//IL_01d9: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e3: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e8: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ef: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f9: Unknown result type (might be due to invalid IL or missing references)
			//IL_01fe: Unknown result type (might be due to invalid IL or missing references)
			//IL_0215: Unknown result type (might be due to invalid IL or missing references)
			//IL_021a: Unknown result type (might be due to invalid IL or missing references)
			//IL_022b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0230: 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_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_026a: Unknown result type (might be due to invalid IL or missing references)
			//IL_02fd: Unknown result type (might be due to invalid IL or missing references)
			//IL_0302: Unknown result type (might be due to invalid IL or missing references)
			//IL_0313: Unknown result type (might be due to invalid IL or missing references)
			//IL_027e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0283: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a9: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ae: Unknown result type (might be due to invalid IL or missing references)
			//IL_02bf: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c4: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c9: Unknown result type (might be due to invalid IL or missing references)
			//IL_02d3: Expected O, but got Unknown
			//IL_02ce: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = new GameObject(name);
			val.SetActive(false);
			if (_sprayLayer >= 0)
			{
				val.layer = _sprayLayer;
			}
			val.transform.SetParent(_root, false);
			_made.Add((Object)(object)val);
			val.transform.localPosition = at;
			val.transform.localRotation = Quaternion.LookRotation(((Vector3)(ref toward)).normalized, Vector3.up);
			ParticleSystem val2 = val.AddComponent<ParticleSystem>();
			_from[val2] = at;
			_perRate[val2] = perRate;
			MainModule main = val2.main;
			((MainModule)(ref main)).duration = 1f;
			((MainModule)(ref main)).loop = true;
			((MainModule)(ref main)).playOnAwake = false;
			((MainModule)(ref main)).startSpeed = new MinMaxCurve(speedMin, speedMax);
			((MainModule)(ref main)).startSize = new MinMaxCurve(sizeMin, sizeMax);
			((MainModule)(ref main)).startLifetime = new MinMaxCurve(lifeMin, lifeMax);
			((MainModule)(ref main)).startRotation = new MinMaxCurve(0f, (float)Math.PI * 2f);
			((MainModule)(ref main)).startColor = MinMaxGradient.op_Implicit(new Color(0.94f, 0.97f, 1f, alpha));
			((MainModule)(ref main)).gravityModifier = MinMaxCurve.op_Implicit(0.5f);
			((MainModule)(ref main)).simulationSpace = (ParticleSystemSimulationSpace)1;
			((MainModule)(ref main)).maxParticles = 600;
			ShapeModule shape = val2.shape;
			((ShapeModule)(ref shape)).enabled = true;
			((ShapeModule)(ref shape)).shapeType = (ParticleSystemShapeType)4;
			((ShapeModule)(ref shape)).angle = spread;
			((ShapeModule)(ref shape)).radius = 0.08f;
			LimitVelocityOverLifetimeModule limitVelocityOverLifetime = val2.limitVelocityOverLifetime;
			((LimitVelocityOverLifetimeModule)(ref limitVelocityOverLifetime)).enabled = true;
			((LimitVelocityOverLifetimeModule)(ref limitVelocityOverLifetime)).limit = new MinMaxCurve(speedMax);
			((LimitVelocityOverLifetimeModule)(ref limitVelocityOverLifetime)).dampen = 0.08f;
			InheritVelocityModule inheritVelocity = val2.inheritVelocity;
			((InheritVelocityModule)(ref inheritVelocity)).enabled = true;
			((InheritVelocityModule)(ref inheritVelocity)).mode = (ParticleSystemInheritVelocityMode)0;
			((InheritVelocityModule)(ref inheritVelocity)).curve = new MinMaxCurve(0.3f);
			ColorOverLifetimeModule colorOverLifetime = val2.colorOverLifetime;
			((ColorOverLifetimeModule)(ref colorOverLifetime)).enabled = true;
			Gradient val3 = new Gradient();
			val3.SetKeys((GradientColorKey[])(object)new GradientColorKey[2]
			{
				new GradientColorKey(Color.white, 0f),
				new GradientColorKey(Color.white, 1f)
			}, (GradientAlphaKey[])(object)new GradientAlphaKey[4]
			{
				new GradientAlphaKey(0f, 0f),
				new GradientAlphaKey(1f, 0.06f),
				new GradientAlphaKey(0.75f, 0.55f),
				new GradientAlphaKey(0f, 1f)
			});
			((ColorOverLifetimeModule)(ref colorOverLifetime)).color = MinMaxGradient.op_Implicit(val3);
			if (grow > 1f)
			{
				SizeOverLifetimeModule sizeOverLifetime = val2.sizeOverLifetime;
				((SizeOverLifetimeModule)(ref sizeOverLifetime)).enabled = true;
				((SizeOverLifetimeModule)(ref sizeOverLifetime)).size = new MinMaxCurve(1f, new AnimationCurve((Keyframe[])(object)new Keyframe[2]
				{
					new Keyframe(0f, 1f / grow),
					new Keyframe(1f, 1f)
				}));
			}
			ParticleSystemRenderer component = val.GetComponent<ParticleSystemRenderer>();
			((Renderer)component).sharedMaterial = material;
			component.renderMode = (ParticleSystemRenderMode)0;
			component.maxParticleSize = 2f;
			EmissionModule emission = val2.emission;
			((EmissionModule)(ref emission)).enabled = true;
			((EmissionModule)(ref emission)).rateOverTime = MinMaxCurve.op_Implicit(0f);
			val.SetActive(true);
			val2.Play();
			return val2;
		}

		private ParticleSystem Foam(Transform like)
		{
			//IL_0046: 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_0066: 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_00d0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d5: 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_00fb: Unknown result type (might be due to invalid IL or missing references)
			//IL_0111: Unknown result type (might be due to invalid IL or missing references)
			//IL_0131: Unknown result type (might be due to invalid IL or missing references)
			//IL_0136: Unknown result type (might be due to invalid IL or missing references)
			//IL_015d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0162: Unknown result type (might be due to invalid IL or missing references)
			//IL_0190: Unknown result type (might be due to invalid IL or missing references)
			//IL_019b: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a0: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b1: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c2: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = Object.Instantiate<GameObject>(((Component)like).gameObject, _root, false);
			((Object)val).name = "Foam";
			val.SetActive(true);
			_made.Add((Object)(object)val);
			val.transform.localPosition = new Vector3(0f, 0.04f, -1.4f);
			val.transform.localRotation = Quaternion.identity;
			val.transform.localScale = Vector3.one;
			ParticleSystem component = val.GetComponent<ParticleSystem>();
			_from[component] = val.transform.localPosition;
			ParticleSystem[] componentsInChildren = val.GetComponentsInChildren<ParticleSystem>(true);
			foreach (ParticleSystem val2 in componentsInChildren)
			{
				if ((Object)(object)val2 != (Object)(object)component)
				{
					Object.Destroy((Object)(object)((Component)val2).gameObject);
				}
			}
			component.Stop(true, (ParticleSystemStopBehavior)0);
			MainModule main = component.main;
			((MainModule)(ref main)).loop = true;
			((MainModule)(ref main)).startSpeed = MinMaxCurve.op_Implicit(0f);
			((MainModule)(ref main)).startSize = new MinMaxCurve(1.2f, 2.4f);
			((MainModule)(ref main)).startLifetime = new MinMaxCurve(2.5f, 3.5f);
			((MainModule)(ref main)).startColor = MinMaxGradient.op_Implicit(new Color(0.95f, 0.97f, 1f, 0.5f));
			((MainModule)(ref main)).simulationSpace = (ParticleSystemSimulationSpace)1;
			((MainModule)(ref main)).scalingMode = (ParticleSystemScalingMode)2;
			((MainModule)(ref main)).maxParticles = 300;
			ShapeModule shape = component.shape;
			((ShapeModule)(ref shape)).enabled = true;
			((ShapeModule)(ref shape)).shapeType = (ParticleSystemShapeType)0;
			((ShapeModule)(ref shape)).radius = 0.25f;
			((ShapeModule)(ref shape)).scale = new Vector3(1f, 0.01f, 1f);
			EmissionModule emission = component.emission;
			((EmissionModule)(ref emission)).enabled = true;
			((EmissionModule)(ref emission)).rateOverTime = MinMaxCurve.op_Implicit(0f);
			((EmissionModule)(ref emission)).rateOverDistance = MinMaxCurve.op_Implicit(0f);
			component.Play();
			return component;
		}
	}
	internal static class GameUi
	{
		internal sealed class Edge
		{
			internal Image[] Sides;

			private Color _color;

			internal void SetColor(Color color, bool force = false)
			{
				//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_0003: Unknown result type (might be due to invalid IL or missing references)
				//IL_0005: Unknown result type (might be due to invalid IL or missing references)
				//IL_0029: 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)
				if (force || !(color == _color))
				{
					_color = color;
					Image[] sides = Sides;
					foreach (Image val in sides)
					{
						((Graphic)val).color = color;
						((Behaviour)val).enabled = color.a > 0.01f;
					}
				}
			}
		}

		internal sealed class Meter
		{
			internal RectTransform Groove;

			internal Image Fill;

			internal Image Trail;

			internal TMP_Text Text;

			internal TMP_Text Shadow;

			private float _fill = -1f;

			private float _trail = -1f;

			internal void Set(float fraction, float trail = -1f, bool force = false)
			{
				//IL_0037: 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)
				fraction = Mathf.Clamp01(fraction);
				if (force || Mathf.Abs(fraction - _fill) > 0.0005f)
				{
					_fill = fraction;
					((Graphic)Fill).rectTransform.anchorMax = new Vector2(fraction, 1f);
					((Behaviour)Fill).enabled = fraction > 0.002f;
				}
				if (!((Object)(object)Trail == (Object)null))
				{
					trail = Mathf.Clamp01(Mathf.Max(trail, _fill));
					if (force || Mathf.Abs(trail - _trail) > 0.0005f)
					{
						_trail = trail;
						((Graphic)Trail).rectTransform.anchorMax = new Vector2(trail, 1f);
					}
					((Behaviour)Trail).enabled = _trail > _fill + 0.002f;
				}
			}

			internal void SetColor(Color color)
			{
				//IL_0006: Unknown result type (might be due to invalid IL or missing references)
				//IL_000b: Unknown result type (might be due to invalid IL or missing references)
				//IL_0019: Unknown result type (might be due to invalid IL or missing references)
				if (((Graphic)Fill).color != color)
				{
					((Graphic)Fill).color = color;
				}
			}

			internal void SetText(string text)
			{
				GameUi.SetText(Text, text ?? "");
				GameUi.SetText(Shadow, text ?? "");
			}

			internal void SetActive(bool on)
			{
				if (((Component)Groove).gameObject.activeSelf != on)
				{
					((Component)Groove).gameObject.SetActive(on);
				}
			}
		}

		private const string CanvasName = "JetSkisCanvas";

		internal static Func<bool> IsOpen = () => false;

		internal static TMP_FontAsset Norse;

		internal static TMP_FontAsset Serif;

		internal static TMP_FontAsset Sans;

		private static Image _panel;

		private static Image _sunken;

		private static Image _braid;

		private static Button _button;

		private static Button _tab;

		private static GameObject _cell;

		private static float _cellSpace = 70f;

		private static bool _warned;

		internal static readonly Color Warm = new Color(1f, 0.86f, 0.55f);

		internal static readonly Color Text = new Color(0.94f, 0.9f, 0.82f);

		internal static readonly Color Dim = new Color(0.75f, 0.72f, 0.66f);

		internal static readonly Color Gold = new Color(1f, 0.78f, 0.3f);

		internal static readonly Color Warn = new Color(1f, 0.55f, 0.35f);

		internal static readonly Color Good = new Color(0.6f, 0.9f, 0.55f);

		private static Canvas _canvas;

		internal static Transform Canvas
		{
			get
			{
				//IL_00c7: Unknown result type (might be due to invalid IL or missing references)
				//IL_00cd: Expected O, but got Unknown
				if ((Object)(object)_canvas != (Object)null)
				{
					Match();
					return ((Component)_canvas).transform;
				}
				InventoryGui instance = InventoryGui.instance;
				if ((Object)(object)instance == (Object)null)
				{
					return null;
				}
				foreach (Transform item in (from Transform t in (IEnumerable)((Component)instance).transform.parent
					where ((Object)t).name == "JetSkisCanvas"
					select t).ToList())
				{
					Object.Destroy((Object)(object)((Component)item).gameObject);
				}
				Canvas val = ((Component)instance).GetComponentInChildren<Canvas>(true) ?? ((Component)instance).GetComponentInParent<Canvas>();
				GameObject val2 = new GameObject("JetSkisCanvas", new Type[1] { typeof(RectTransform) });
				val2.transform.SetParent(((Component)instance).transform.parent, false);
				_canvas = val2.AddComponent<Canvas>();
				_canvas.renderMode = (RenderMode)0;
				_canvas.sortingOrder = (((Object)(object)val != (Object)null) ? val.sortingOrder : 0) + 5;
				val2.AddComponent<CanvasScaler>();
				val2.AddComponent<GraphicRaycaster>();
				Match();
				return ((Component)_canvas).transform;
			}
		}

		internal static float CellSpace => _cellSpace;

		internal static Transform HudRoot
		{
			get
			{
				if (!((Object)(object)Hud.instance != (Object)null) || !((Object)(object)Hud.instance.m_rootObject != (Object)null))
				{
					return null;
				}
				return Hud.instance.m_rootObject.transform;
			}
		}

		internal static Vector2 ScreenSize
		{
			get
			{
				//IL_003c: 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: Invalid comparison between Unknown and I4
				//IL_0129: Unknown result type (might be due to invalid IL or missing references)
				//IL_0135: Unknown result type (might be due to invalid IL or missing references)
				//IL_0068: Unknown result type (might be due to invalid IL or missing references)
				//IL_007d: Unknown result type (might be due to invalid IL or missing references)
				//IL_0091: 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_00a5: Unknown result type (might be due to invalid IL or missing references)
				//IL_00ac: Unknown result type (might be due to invalid IL or missing references)
				//IL_00ba: Unknown result type (might be due to invalid IL or missing references)
				//IL_00c0: Invalid comparison between Unknown and I4
				//IL_00c3: Unknown result type (might be due to invalid IL or missing references)
				//IL_00c9: Invalid comparison between Unknown and I4
				Transform canvas = Canvas;
				CanvasScaler val = (((Object)(object)canvas != (Object)null) ? ((Component)canvas).GetComponent<CanvasScaler>() : null);
				Vector2 val2 = default(Vector2);
				((Vector2)(ref val2))..ctor((float)Screen.width, (float)Screen.height);
				float num = 1f;
				if ((Object)(object)val != (Object)null && (int)val.uiScaleMode == 0)
				{
					num = val.scaleFactor;
				}
				else if ((Object)(object)val != (Object)null && (int)val.uiScaleMode == 1 && val.referenceResolution.x > 0f && val.referenceResolution.y > 0f)
				{
					float num2 = val2.x / val.referenceResolution.x;
					float num3 = val2.y / val.referenceResolution.y;
					num = (((int)val.screenMatchMode == 1) ? Mathf.Min(num2, num3) : (((int)val.screenMatchMode == 2) ? Mathf.Max(num2, num3) : Mathf.Pow(2f, Mathf.Lerp(Mathf.Log(num2, 2f), Mathf.Log(num3, 2f), val.matchWidthOrHeight))));
				}
				else if ((Object)(object)_canvas != (Object)null)
				{
					num = _canvas.scaleFactor;
				}
				return val2 / Mathf.Max(0.01f, num);
			}
		}

		internal static bool Typing
		{
			get
			{
				EventSystem current = EventSystem.current;
				GameObject val = (((Object)(object)current != (Object)null) ? current.currentSelectedGameObject : null);
				TMP_InputField val2 = (((Object)(object)val != (Object)null) ? val.GetComponent<TMP_InputField>() : null);
				if ((Object)(object)val2 != (Object)null)
				{
					return val2.isFocused;
				}
				return false;
			}
		}

		private static void Match()
		{
			//IL_0054: 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_006c: Unknown result type (might be due to invalid IL or missing references)
			InventoryGui instance = InventoryGui.instance;
			CanvasScaler val = (((Object)(object)_canvas != (Object)null) ? ((Component)_canvas).GetComponent<CanvasScaler>() : null);
			CanvasScaler val2 = (((Object)(object)instance != (Object)null) ? (((Component)instance).GetComponentInChildren<CanvasScaler>(true) ?? ((Component)instance).GetComponentInParent<CanvasScaler>()) : null);
			if (!((Object)(object)val == (Object)null) && !((Object)(object)val2 == (Object)null))
			{
				val.uiScaleMode = val2.uiScaleMode;
				val.referenceResolution = val2.referenceResolution;
				val.screenMatchMode = val2.screenMatchMode;
				val.matchWidthOrHeight = val2.matchWidthOrHeight;
				val.scaleFactor = val2.scaleFactor;
				val.referencePixelsPerUnit = val2.referencePixelsPerUnit;
			}
		}

		internal static void Destroy()
		{
			if ((Object)(object)_canvas != (Object)null)
			{
				Object.Destroy((Object)(object)((Component)_canvas).gameObject);
			}
			_canvas = null;
			_panel = null;
			_button = null;
			_cell = null;
			IsOpen = () => false;
		}

		internal static bool Ready()
		{
			if ((Object)(object)_button != (Object)null && (Object)(object)_panel != (Object)null && (Object)(object)_cell != (Object)null)
			{
				return true;
			}
			InventoryGui instance = InventoryGui.instance;
			if ((Object)(object)instance == (Object)null)
			{
				return false;
			}
			Transform root = ((Component)instance).transform;
			_panel = Find<Image>("root/Crafting/Bkg") ?? Find<Image>("root/Player/Bkg");
			_sunken = Find<Image>("root/Player/sunken");
			_braid = Find<Image>("root/Crafting/BraidLineHorisontalMedium");
			_button = Find<Button>("root/Player/Container/TakeAll");
			_tab = Find<Button>("root/Crafting/TabsButtons/Craft");
			TMP_Text obj = Find<TMP_Text>("root/Crafting/topic");
			Norse = ((obj != null) ? obj.font : null);
			TMP_Text obj2 = Find<TMP_Text>("root/Crafting/TabsButtons/Craft/Text");
			Serif = ((obj2 != null) ? obj2.font : null);
			TMP_Text obj3 = Find<TMP_Text>("root/Crafting/Decription/Description");
			Sans = ((obj3 != null) ? obj3.font : null) ?? Serif;
			InventoryGrid playerGrid = instance.m_playerGrid;
			if ((Object)(object)playerGrid != (Object)null)
			{
				_cell = playerGrid.m_elementPrefab;
				_cellSpace = ((playerGrid.m_elementSpace > 1f) ? playerGrid.m_elementSpace : 70f);
			}
			if (((Object)(object)_button == (Object)null || (Object)(object)_panel == (Object)null || (Object)(object)_cell == (Object)null) && !_warned)
			{
				_warned = true;
				Debug.LogWarning((object)"JetSkisCanvas: the game's interface was not found where expected (a game update moved it?)");
			}
			if ((Object)(object)_button != (Object)null && (Object)(object)_panel != (Object)null)
			{
				return (Object)(object)_cell != (Object)null;
			}
			return false;
			T Find<T>(string path) where T : Component
			{
				Transform val = root.Find(path);
				if (!((Object)(object)val != (Object)null))
				{
					return default(T);
				}
				return ((Component)val).GetComponent<T>();
			}
		}

		internal static RectTransform Rect(Transform parent, string name, Vector2 anchor, Vector2 pivot, Vector2 pos, Vector2 size)
		{
			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
			//IL_001a: Expected O, but got Unknown
			//IL_0020: Unknown result type (might be due to invalid IL or missing references)
			//IL_0026: Expected O, but got Unknown
			//IL_0030: Unknown result type (might be due to invalid IL or missing references)
			//IL_0031: Unknown result type (might be due to invalid IL or missing references)
			//IL_0032: Unknown result type (might be due to invalid IL or missing references)
			//IL_0038: Unknown result type (might be due to invalid IL or missing references)
			//IL_003f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0046: Unknown result type (might be due to invalid IL or missing references)
			//IL_004e: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = new GameObject(name, new Type[1] { typeof(RectTransform) });
			RectTransform val2 = (RectTransform)val.transform;
			((Transform)val2).SetParent(parent, false);
			Vector2 anchorMin = (val2.anchorMax = anchor);
			val2.anchorMin = anchorMin;
			val2.pivot = pivot;
			val2.anchoredPosition = pos;
			val2.sizeDelta = size;
			return val2;
		}

		internal static RectTransform Window(string name, Vector2 size)
		{
			//IL_0010: 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_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)
			RectTransform val = Rect(Canvas, name, new Vector2(0.5f, 0.5f), new Vector2(0.5f, 0.5f), Vector2.zero, size);
			Copy(_panel, ((Component)val).gameObject.AddComponent<Image>());
			return val;
		}

		internal static RectTransform Box(Transform parent, Vector2 pos, Vector2 size)
		{
			//IL_0010: 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_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			//IL_0067: Unknown result type (might be due to invalid IL or missing references)
			RectTransform val = Rect(parent, "Box", new Vector2(0f, 1f), new Vector2(0f, 1f), pos, size);
			Image val2 = ((Component)val).gameObject.AddComponent<Image>();
			if ((Object)(object)_sunken != (Object)null)
			{
				Copy(_sunken, val2);
			}
			else
			{
				((Graphic)val2).color = new Color(0f, 0f, 0f, 0.35f);
			}
			return val;
		}

		internal static void Braid(Transform parent, Vector2 pos, float width)
		{
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			//IL_002d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0032: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_0063: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_0070: Unknown result type (might be due to invalid IL or missing references)
			if (!((Object)(object)_braid == (Object)null))
			{
				Vector2 anchor = new Vector2(0.5f, 1f);
				Vector2 pivot = new Vector2(0.5f, 0.5f);
				Rect rect = ((Graphic)_braid).rectTransform.rect;
				float num;
				if (!(((Rect)(ref rect)).height > 1f))
				{
					num = 16f;
				}
				else
				{
					rect = ((Graphic)_braid).rectTransform.rect;
					num = ((Rect)(ref rect)).height;
				}
				RectTransform val = Rect(parent, "Braid", anchor, pivot, pos, new Vector2(width, num));
				Copy(_braid, ((Component)val).gameObject.AddComponent<Image>());
			}
		}

		private static void Copy(Image from, Image to)
		{
			//IL_0018: 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)
			if (!((Object)(object)from == (Object)null))
			{
				to.sprite = from.sprite;
				to.type = from.type;
				((Graphic)to).material = ((Graphic)from).material;
				((Graphic)to).color = ((Graphic)from).color;
				to.pixelsPerUnitMultiplier = from.pixelsPerUnitMultiplier;
				to.fillCenter = from.fillCenter;
			}
		}

		internal static TMP_Text Label(Transform parent, string text, Vector2 pos, Vector2 size, float fontSize, Color color, TMP_FontAsset font = null, TextAlignmentOptions align = (TextAlignmentOptions)257, Vector2? anchor = null)
		{
			//IL_001f: 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_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002b: Unknown result type (might be due to invalid IL or missing references)
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_002d: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Unknown result type (might be due to invalid IL or missing references)
			//IL_005b: 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)
			Vector2 val = (Vector2)(((??)anchor) ?? new Vector2(0f, 1f));
			RectTransform val2 = Rect(parent, "Text", val, val, pos, size);
			TextMeshProUGUI val3 = ((Component)val2).gameObject.AddComponent<TextMeshProUGUI>();
			((TMP_Text)val3).font = font ?? Sans;
			((TMP_Text)val3).fontSize = fontSize;
			((Graphic)val3).color = color;
			((TMP_Text)val3).alignment = align;
			((TMP_Text)val3).richText = true;
			((TMP_Text)val3).textWrappingMode = (TextWrappingModes)1;
			((TMP_Text)val3).overflowMode = (TextOverflowModes)0;
			((TMP_Text)val3).text = text;
			((Graphic)val3).raycastTarget = false;
			return (TMP_Text)(object)val3;
		}

		internal static Button Button(Transform parent, string text, Vector2 pos, Vector2 size, Action click, bool enabled = true, float fontSize = 18f)
		{
			//IL_0015: 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_0038: Unknown result type (might be due to invalid IL or missing references)
			//IL_0031: Unknown result type (might be due to invalid IL or missing references)
			//IL_004f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0059: Expected O, but got Unknown
			Button val = Clone(_button, parent, text, pos, size, fontSize);
			((Selectable)val).interactable = enabled;
			((Graphic)Label(val)).color = (enabled ? Text : Dim);
			((UnityEvent)val.onClick).AddListener((UnityAction)delegate
			{
				click();
			});
			return val;
		}

		internal static Button Tab(Transform parent, string text, Vector2 pos, Vector2 size, bool chosen, Action click, float fontSize = 18f)
		{
			//IL_001e: 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_006a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0063: Unknown result type (might be due to invalid IL or missing references)
			//IL_0081: Unknown result type (might be due to invalid IL or missing references)
			//IL_008b: Expected O, but got Unknown
			Button val = Clone(_tab ?? _button, parent, text, pos, size, fontSize);
			Transform val2 = ((Component)val).transform.Find("Selected");
			if ((Object)(object)val2 != (Object)null)
			{
				((Component)val2).gameObject.SetActive(false);
			}
			((Selectable)val).interactable = !chosen;
			((Graphic)Label(val)).color = (chosen ? Gold : Text);
			((UnityEvent)val.onClick).AddListener((UnityAction)delegate
			{
				click();
			});
			return val;
		}

		internal static TMP_Text Label(Button b)
		{
			return ((IEnumerable<TMP_Text>)((Component)b).GetComponentsInChildren<TMP_Text>(true)).FirstOrDefault((Func<TMP_Text, bool>)((TMP_Text t) => ((Component)t).gameObject.activeSelf));
		}

		private static Button Clone(Button template, Transform parent, string text, Vector2 pos, Vector2 size, float fontSize)
		{
			//IL_00fe: Unknown result type (might be due to invalid IL or missing references)
			//IL_0104: Expected O, but got Unknown
			//IL_0117: Unknown result type (might be due to invalid IL or missing references)
			//IL_011e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0130: Unknown result type (might be due to invalid IL or missing references)
			//IL_013b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0142: 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_015b: Expected O, but got Unknown
			//IL_0212: Unknown result type (might be due to invalid IL or missing references)
			//IL_0219: Expected O, but got Unknown
			//IL_021b: 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_023d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0253: Unknown result type (might be due to invalid IL or missing references)
			//IL_0197: Unknown result type (might be due to invalid IL or missing references)
			//IL_019c: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a0: 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_01cf: Unknown result type (might be due to invalid IL or missing references)
			//IL_01de: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = Object.Instantiate<GameObject>(((Component)template).gameObject, parent, false);
			((Object)val).name = "Button";
			val.SetActive(true);
			foreach (Transform item in ((IEnumerable)val.transform).Cast<Transform>().ToList())
			{
				if (((Object)item).name.StartsWith("gamepad_hint"))
				{
					Object.Destroy((Object)(object)((Component)item).gameObject);
				}
			}
			UIGamePad[] componentsInChildren = val.GetComponentsInChildren<UIGamePad>(true);
			foreach (UIGamePad val2 in componentsInChildren)
			{
				Object.Destroy((Object)(object)val2);
			}
			ButtonTextColor[] componentsInChildren2 = val.GetComponentsInChildren<ButtonTextColor>(true);
			foreach (ButtonTextColor val3 in componentsInChildren2)
			{
				Object.Destroy((Object)(object)val3);
			}
			Localize[] componentsInChildren3 = val.GetComponentsInChildren<Localize>(true);
			foreach (Localize val4 in componentsInChildren3)
			{
				Object.Destroy((Object)(object)val4);
			}
			RectTransform val5 = (RectTransform)val.transform;
			Vector2 val6 = default(Vector2);
			((Vector2)(ref val6))..ctor(0f, 1f);
			val5.anchorMax = val6;
			val5.anchorMin = val6;
			val5.pivot = new Vector2(0f, 1f);
			val5.anchoredPosition = pos;
			val5.sizeDelta = size;
			Button component = val.GetComponent<Button>();
			component.onClick = new ButtonClickedEvent();
			TMP_Text val7 = ((IEnumerable<TMP_Text>)val.GetComponentsInChildren<TMP_Text>(true)).FirstOrDefault((Func<TMP_Text, bool>)((TMP_Text t) => ((Object)t).name == "Text"));
			if ((Object)(object)val7 == (Object)null)
			{
				val7 = Label(val.transform, text, Vector2.zero, size, fontSize, Text, Serif, (TextAlignmentOptions)514, (Vector2?)new Vector2(0.5f, 0.5f));
				((RectTransform)val7.transform).pivot = new Vector2(0.5f, 0.5f);
			}
			val7.text = text;
			val7.fontSize = fontSize;
			val7.enableAutoSizing = false;
			val7.textWrappingMode = (TextWrappingModes)0;
			val7.overflowMode = (TextOverflowModes)1;
			RectTransform val8 = (RectTransform)val7.transform;
			val8.anchorMin = Vector2.zero;
			val8.anchorMax = Vector2.one;
			val8.offsetMin = new Vector2(4f, 0f);
			val8.offsetMax = new Vector2(-4f, 0f);
			val7.alignment = (TextAlignmentOptions)514;
			TMP_Text[] componentsInChildren4 = val.GetComponentsInChildren<TMP_Text>(true);
			foreach (TMP_Text val9 in componentsInChildren4)
			{
				if ((Object)(object)val9 != (Object)(object)val7)
				{
					((Component)val9).gameObject.SetActive(false);
				}
			}
			return component;
		}

		internal static Image Icon(Transform parent, Vector2 pos, Vector2 size, Sprite sprite)
		{
			//IL_0010: 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_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			Image val = ((Component)Rect(parent, "Icon", new Vector2(0f, 1f), new Vector2(0f, 1f), pos, size)).gameObject.AddComponent<Image>();
			val.sprite = sprite;
			val.preserveAspect = true;
			((Graphic)val).raycastTarget = false;
			((Behaviour)val).enabled = (Object)(object)sprite != (Object)null;
			return val;
		}

		internal static float Chip(Transform parent, Vector2 pos, ItemData item, string amount, float size = 28f, float fontSize = 17f, Color? color = null)
		{
			//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_008e: 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_00b5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c1: Unknown result type (might be due to invalid IL or missing references)
			//IL_007f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0085: Unknown result type (might be due to invalid IL or missing references)
			//IL_00de: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d5: 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_011d: Unknown result type (might be due to invalid IL or missing references)
			//IL_012b: Unknown result type (might be due to invalid IL or missing references)
			Image val = Icon(parent, pos, new Vector2(size, size), item.GetIcon());
			((Graphic)val).raycastTarget = true;
			UITooltip val2 = ((!((Object)(object)_cell != (Object)null)) ? null : _cell.GetComponent<InventoryElement>()?.m_tooltip);
			if ((Object)(object)val2 != (Object)null)
			{
				UITooltip val3 = ((Component)val).gameObject.AddComponent<UITooltip>();
				val3.m_tooltipPrefab = val2.m_tooltipPrefab;
				val3.Set(item.m_shared.m_name, item.GetTooltip(-1), (RectTransform)null, default(Vector2));
			}
			TMP_Text val4 = Label(parent, amount, new Vector2(pos.x + size + 3f, pos.y - (size - fontSize * 1.3f) / 2f), new Vector2(80f, size), fontSize, (Color)(((??)color) ?? Text), null, (TextAlignmentOptions)257);
			val4.textWrappingMode = (TextWrappingModes)0;
			float x = val4.GetPreferredValues(amount, 200f, 0f).x;
			((RectTransform)val4.transform).sizeDelta = new Vector2(x + 2f, size);
			return size + 3f + x + 12f;
		}

		internal static RectTransform Bar(Transform parent, Vector2 pos, Vector2 size, float fraction, Color fill, string text, float fontSize = 15f)
		{
			//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)
			//IL_0019: 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_0037: Unknown result type (might be due to invalid IL or missing references)
			//IL_0046: Unknown result type (might be due to invalid IL or missing references)
			//IL_005c: 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_0085: 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_00a9: 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_00c8: Unknown result type (might be due to invalid IL or missing references)
			//IL_011e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0123: Unknown result type (might be due to invalid IL or missing references)
			//IL_0145: Unknown result type (might be due to invalid IL or missing references)
			//IL_012a: Unknown result type (might be due to invalid IL or missing references)
			RectTransform val = Box(parent, pos, size);
			RectTransform val2 = Rect((Transform)(object)val, "Fill", new Vector2(0f, 0f), new Vector2(0f, 0f), new Vector2(2f, 2f), new Vector2(0f, 0f));
			val2.anchorMax = new Vector2(0f, 1f);
			val2.offsetMax = new Vector2(2f + (size.x - 4f) * Mathf.Clamp01(fraction), -2f);
			Image val3 = ((Component)val2).gameObject.AddComponent<Image>();
			((Graphic)val3).color = new Color(fill.r * 0.8f, fill.g * 0.8f, fill.b * 0.8f, 0.9f);
			((Graphic)val3).raycastTarget = false;
			if (!string.IsNullOrEmpty(text))
			{
				bool[] array = new bool[2] { true, false };
				foreach (bool flag in array)
				{
					TMP_Text val4 = Label((Transform)(object)val, text, new Vector2(flag ? 1f : 0f, flag ? (-1f) : 0f), size, fontSize, (Color)(flag ? new Color(0f, 0f, 0f, 0.85f) : Color.white), Sans, (TextAlignmentOptions)514);
					val4.textWrappingMode = (TextWrappingModes)0;
				}
			}
			return val;
		}

		internal static InventoryElement Cell(Transform parent, Vector2 pos, ItemData item, string amount, bool selected, Action click)
		{
			//IL_0087: Unknown result type (might be due to invalid IL or missing references)
			//IL_008d: Expected O, but got Unknown
			//IL_00a0: 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_00b9: 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_012d: Unknown result type (might be due to invalid IL or missing references)
			//IL_027f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0285: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = Object.Instantiate<GameObject>(_cell, parent, false);
			((Object)val).name = "Cell";
			val.SetActive(true);
			UIDragHandler[] componentsInChildren = val.GetComponentsInChildren<UIDragHandler>(true);
			foreach (UIDragHandler val2 in componentsInChildren)
			{
				Object.Destroy((Object)(object)val2);
			}
			UIGamePad[] componentsInChildren2 = val.GetComponentsInChildren<UIGamePad>(true);
			foreach (UIGamePad val3 in componentsInChildren2)
			{
				Object.Destroy((Object)(object)val3);
			}
			RectTransform val4 = (RectTransform)val.transform;
			Vector2 val5 = default(Vector2);
			((Vector2)(ref val5))..ctor(0f, 1f);
			val4.anchorMax = val5;
			val4.anchorMin = val5;
			val4.pivot = new Vector2(0f, 1f);
			val4.anchoredPosition = pos;
			InventoryElement component = val.GetComponent<InventoryElement>();
			component.Initialize(0, 0);
			Transform val6 = val.transform.Find("binding");
			if ((Object)(object)val6 != (Object)null)
			{
				TMP_Text component2 = ((Component)val6).GetComponent<TMP_Text>();
				if (component2 != null)
				{
					((Behaviour)component2).enabled = false;
				}
			}
			((Behaviour)component.m_icon).enabled = true;
			component.m_icon.sprite = item.GetIcon();
			((Graphic)component.m_icon).color = Color.white;
			bool flag = item.m_shared.m_useDurability && item.m_durability < item.GetMaxDurability();
			((Component)component.m_durability).gameObject.SetActive(flag);
			if (flag)
			{
				component.m_durability.SetValue(item.GetDurabilityPercentage());
			}
			((Behaviour)component.m_equiped).enabled = item.m_equipped;
			((Behaviour)component.m_queued).enabled = false;
			((Behaviour)component.m_noteleport).enabled = false;
			((Behaviour)component.m_food).enabled = false;
			((Behaviour)component.m_quality).enabled = amount == null && item.m_shared.m_maxQuality > 1;
			if (((Behaviour)component.m_quality).enabled)
			{
				component.m_quality.text = item.m_quality.ToString();
			}
			((Behaviour)component.m_amount).enabled = amount != null || item.m_shared.m_maxStackSize > 1;
			component.m_amount.text = amount ?? $"{item.m_stack}/{item.m_shared.m_maxStackSize}";
			if ((Object)(object)component.m_selected != (Object)null)
			{
				component.m_selected.SetActive(selected);
			}
			UITooltip tooltip = component.m_tooltip;
			string name = item.m_shared.m_name;
			string tooltip2 = item.GetTooltip(-1);
			val5 = default(Vector2);
			tooltip.Set(name, tooltip2, (RectTransform)null, val5);
			UIInputHandler componentInChildren = val.GetComponentInChildren<UIInputHandler>(true);
			if ((Object)(object)componentInChildren != (Object)null && click != null)
			{
				componentInChildren.m_onLeftClick = delegate
				{
					click();
				};
			}
			return component;
		}

		internal static RectTransform Scroll(RectTransform box, float inset)
		{
			//IL_0078: Unknown result type (might be due to invalid IL or missing references)
			//IL_007d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0082: 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_00b0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00be: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ed: Unknown result type (might be due to invalid IL or missing references)
			//IL_0116: Unknown result type (might be due to invalid IL or missing references)
			//IL_0131: Unknown result type (might be due to invalid IL or missing references)
			//IL_0140: Unknown result type (might be due to invalid IL or missing references)
			//IL_0145: 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_015b: Unknown result type (might be due to invalid IL or missing references)
			//IL_022a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0231: Expected O, but got Unknown
			//IL_023d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0253: 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_027e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0297: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ac: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b6: Expected O, but got Unknown
			InventoryGui gui = InventoryGui.instance;
			ScrollRect val = (((Object)(object)gui != (Object)null) ? ((IEnumerable<ScrollRect>)((Component)gui).GetComponentsInChildren<ScrollRect>(true)).FirstOrDefault((Func<ScrollRect, bool>)((ScrollRect s) => (Object)(object)s.content == (Object)(object)gui.m_recipeListRoot)) : null);
			Scrollbar val2 = (((Object)(object)gui != (Object)null) ? gui.m_recipeListScroll : null);
			float num;
			if (!((Object)(object)val2 != (Object)null))
			{
				num = 0f;
			}
			else
			{
				Rect rect = ((RectTransform)((Component)val2).transform).rect;
				num = Mathf.Max(8f, ((Rect)(ref rect)).width);
			}
			float num2 = num;
			RectTransform val3 = Rect((Transform)(object)box, "View", new Vector2(0f, 1f), new Vector2(0f, 1f), new Vector2(inset, 0f - inset), box.sizeDelta - new Vector2(inset * 2f + ((num2 > 0f) ? (num2 + 4f) : 0f), inset * 2f));
			((Component)val3).gameObject.AddComponent<RectMask2D>();
			Image val4 = ((Component)val3).gameObject.AddComponent<Image>();
			((Graphic)val4).color = Color.clear;
			RectTransform val5 = Rect((Transform)(object)val3, "Content", new Vector2(0f, 1f), new Vector2(0f, 1f), Vector2.zero, new Vector2(val3.sizeDelta.x, 0f));
			ScrollRect val6 = ((Component)val3).gameObject.AddComponent<ScrollRect>();
			val6.content = val5;
			val6.viewport = val3;
			val6.horizontal = false;
			val6.movementType = (MovementType)2;
			val6.scrollSensitivity = (((Object)(object)val != (Object)null && val.scrollSensitivity > 0f) ? val.scrollSensitivity : 300f);
			val6.inertia = false;
			if ((Object)(object)val2 != (Object)null)
			{
				GameObject val7 = Object.Instantiate<GameObject>(((Component)val2).gameObject, (Transform)(object)box, false);
				((Object)val7).name = "Scrollbar";
				val7.SetActive(true);
				UIGamePad[] componentsInChildren = val7.GetComponentsInChildren<UIGamePad>(true);
				foreach (UIGamePad val8 in componentsInChildren)
				{
					Object.Destroy((Object)(object)val8);
				}
				RectTransform val9 = (RectTransform)val7.transform;
				val9.anchorMin = new Vector2(1f, 0f);
				val9.anchorMax = new Vector2(1f, 1f);
				val9.pivot = new Vector2(1f, 0.5f);
				val9.sizeDelta = new Vector2(num2, (0f - inset) * 2f);
				val9.anchoredPosition = new Vector2((0f - inset) * 0.5f, 0f);
				Scrollbar component = val7.GetComponent<Scrollbar>();
				component.onValueChanged = new ScrollEvent();
				val6.verticalScrollbar = component;
				val6.verticalScrollbarVisibility = (ScrollbarVisibility)1;
			}
			return val5;
		}

		internal static Button Toggle(Transform parent, string text, bool on, Vector2 pos, Vector2 size, Action click, float fontSize = 17f, Sprite icon = null)
		{
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			//IL_0026: Unknown result type (might be due to invalid IL or missing references)
			//IL_0045: 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_0061: 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_008f: 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_00c2: 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_00d2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e3: Unknown result type (might be due to invalid IL or missing references)
			Button val = Button(parent, text + ": " + Localization.instance.Localize(on ? "$hud_on" : "$hud_off"), pos, size, click, enabled: true, fontSize);
			TMP_Text val2 = Label(val);
			((Graphic)val2).color = (on ? Gold : Text);
			if ((Object)(object)icon != (Object)null)
			{
				float num = Mathf.Max(16f, size.y - 12f);
				Image val3 = Icon(((Component)val).transform, new Vector2(8f, (0f - (size.y - num)) / 2f), new Vector2(num, num), icon);
				((Graphic)val3).color = (Color)(on ? Color.white : new Color(1f, 1f, 1f, 0.4f));
				((RectTransform)val2.transform).offsetMin = new Vector2(num + 14f, 0f);
				val2.alignment = (TextAlignmentOptions)513;
			}
			return val;
		}

		internal static TMP_Text Stepper(Transform parent, Vector2 pos, float height, string value, int[] steps, Action<int> change, float buttonW = 48f, float valueW = 76f, float fontSize = 16f)
		{
			//IL_000e: 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_0057: Unknown result type (might be due to invalid IL or missing references)
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0095: 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_00a3: 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_00b8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c5: Unknown result type (might be due to invalid IL or missing references)
			//IL_013a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0140: Unknown result type (might be due to invalid IL or missing references)
			//IL_0148: Unknown result type (might be due to invalid IL or missing references)
			float num = pos.x;
			for (int i = 0; i < steps.Length; i++)
			{
				int num2 = steps[i];
				int d = -num2;
				Button(parent, "-" + num2, new Vector2(num, pos.y), new Vector2(buttonW, height), delegate
				{
					change(d);
				}, enabled: true, fontSize);
				num += buttonW + 4f;
			}
			RectTransform parent2 = Box(parent, new Vector2(num, pos.y), new Vector2(valueW, height));
			TMP_Text val = Label((Transform)(object)parent2, value, Vector2.zero, new Vector2(valueW, height), fontSize + 2f, Text, Sans, (TextAlignmentOptions)514);
			val.textWrappingMode = (TextWrappingModes)0;
			num += valueW + 4f;
			foreach (int item in steps.Reverse())
			{
				int d2 = item;
				Button(parent, "+" + item, new Vector2(num, pos.y), new Vector2(buttonW, height), delegate
				{
					change(d2);
				}, enabled: true, fontSize);
				num += buttonW + 4f;
			}
			return val;
		}

		internal static float StepperWidth(int steps, float buttonW = 48f, float valueW = 76f)
		{
			return (float)steps * 2f * (buttonW + 4f) + valueW;
		}

		internal static TMP_Text Line(Transform parent, string text, Vector2 pos, float width, float fontSize, Color color, TMP_FontAsset font = null, TextAlignmentOptions align = (TextAlignmentOptions)257, Vector2? anchor = null)
		{
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Expected I4, but got Unknown
			//IL_0046: 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_0050: 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)
			float num = fontSize * 1.35f;
			float num2 = fontSize * 1.8f;
			int num3 = align & 0xFF00;
			if (num3 != 256)
			{
				pos.y += ((num3 == 1024) ? (num2 - num) : ((num2 - num) / 2f));
			}
			TMP_Text val = Label(parent, text, pos, new Vector2(width, num2), fontSize, color, font, align, anchor);
			val.textWrappingMode = (TextWrappingModes)0;
			val.overflowMode = (TextOverflowModes)1;
			return val;
		}

		internal static float Width(TMP_Text like, string text)
		{
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			return like.GetPreferredValues(text, 4000f, 0f).x;
		}

		internal static RawImage Picture(Transform parent, Vector2 pos, Vector2 size, Texture texture)
		{
			//IL_0010: 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_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_002d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0097: 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_00ab: 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_0049: 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)
			RectTransform parent2 = Rect(parent, "Picture", new Vector2(0f, 1f), new Vector2(0f, 1f), pos, size);
			Vector2 size2 = size;
			if ((Object)(object)texture != (Object)null && texture.width > 0 && texture.height > 0)
			{
				float num = Mathf.Min(size.x / (float)texture.width, size.y / (float)texture.height);
				((Vector2)(ref size2))..ctor((float)texture.width * num, (float)texture.height * num);
			}
			RectTransform val = Rect((Transform)(object)parent2, "Image", new Vector2(0.5f, 0.5f), new Vector2(0.5f, 0.5f), Vector2.zero, size2);
			RawImage val2 = ((Component)val).gameObject.AddComponent<RawImage>();
			val2.texture = texture;
			((Graphic)val2).raycastTarget = false;
			((Behaviour)val2).enabled = (Object)(object)texture != (Object)null;
			return val2;
		}

		internal static Slider Slider(Transform parent, Vector2 pos, Vector2 size, float min, float max, float value, float step, Action<float> changed)
		{
			//IL_008d: Unknown result type (might be due to invalid IL or missing references)
			//IL_008e: Unknown result type (might be due to invalid IL or missing references)
			//IL_009a: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a0: 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_00ca: 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_00de: 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)
			//IL_00f5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fb: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d2: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d8: Expected O, but got Unknown
			//IL_01eb: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f2: 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_020f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0215: Unknown result type (might be due to invalid IL or missing references)
			//IL_021b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0228: 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_024b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0255: Expected O, but got Unknown
			//IL_025d: Unknown result type (might be due to invalid IL or missing references)
			//IL_026b: Unknown result type (might be due to invalid IL or missing references)
			Slider val = (((Object)(object)InventoryGui.instance != (Object)null && (Object)(object)InventoryGui.instance.m_splitDialog != (Object)null) ? InventoryGui.instance.m_splitDialog.m_splitSlider : null);
			if ((Object)(object)val == (Object)null)
			{
				float current = Snap(value);
				Button(parent, "-", pos, new Vector2(size.y + 8f, size.y), delegate
				{
					current = Snap(current - step);
					changed(current);
				});
				Button(parent, "+", new Vector2(pos.x + size.x - size.y - 8f, pos.y), new Vector2(size.y + 8f, size.y), delegate
				{
					current = Snap(current + step);
					changed(current);
				});
				return null;
			}
			GameObject val2 = Object.Instantiate<GameObject>(((Component)val).gameObject, parent, false);
			((Object)val2).name = "Slider";
			val2.SetActive(true);
			foreach (Transform item in (from t in val2.GetComponentsInChildren<Transform>(true)
				where ((Object)t).name.StartsWith("gamepad_hint")
				select t).ToList())
			{
				Object.Destroy((Object)(object)((Component)item).gameObject);
			}
			UIGamePad[] componentsInChildren = val2.GetComponentsInChildren<UIGamePad>(true);
			foreach (UIGamePad val3 in componentsInChildren)
			{
				Object.Destroy((Object)(object)val3);
			}
			RectTransform val4 = (RectTransform)val2.transform;
			Vector2 val5 = default(Vector2);
			((Vector2)(ref val5))..ctor(0f, 1f);
			val4.anchorMax = val5;
			val4.anchorMin = val5;
			val4.pivot = new Vector2(0f, 0.5f);
			val4.anchoredPosition = new Vector2(pos.x, pos.y - size.y / 2f);
			val4.sizeDelta = size;
			Slider s = val2.GetComponent<Slider>();
			s.onValueChanged = new SliderEvent();
			Slider obj = s;
			Navigation navigation = default(Navigation);
			((Navigation)(ref navigation)).mode = (Mode)0;
			((Selectable)obj).navigation = navigation;
			s.wholeNumbers = false;
			s.minValue = min;
			s.maxValue = max;
			s.SetValueWithoutNotify(Snap(value));
			((Selectable)s).interactable = true;
			((UnityEvent<float>)(object)s.onValueChanged).AddListener((UnityAction<float>)delegate(float v)
			{
				float num2 = Snap(v);
				if (!Mathf.Approximately(num2, v))
				{
					s.SetValueWithoutNotify(num2);
				}
				changed(num2);
			});
			return s;
			float Snap(float v)
			{
				return Mathf.Clamp((step > 0f) ? (Mathf.Round(v / step) * step) : v, min, max);
			}
		}

		internal static void SetBar(RectTransform bar, float fraction, string text = null, Color? fill = null)
		{
			//IL_002f: 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_0057: 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_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_0083: 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_009b: 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_00c1: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)bar == (Object)null)
			{
				return;
			}
			Transform obj = ((Transform)bar).Find("Fill");
			RectTransform val = (RectTransform)(object)((obj is RectTransform) ? obj : null);
			if ((Object)(object)val != (Object)null)
			{
				Vector2 val2 = default(Vector2);
				((Vector2)(ref val2))..ctor(2f + (bar.sizeDelta.x - 4f) * Mathf.Clamp01(fraction), -2f);
				if (val.offsetMax != val2)
				{
					val.offsetMax = val2;
				}
				if (fill.HasValue)
				{
					Image component = ((Component)val).GetComponent<Image>();
					if (component != null)
					{
						Color value = fill.Value;
						Color val3 = default(Color);
						((Color)(ref val3))..ctor(value.r * 0.8f, value.g * 0.8f, value.b * 0.8f, 0.9f);
						if (((Graphic)component).color != val3)
						{
							((Graphic)component).color = val3;
						}
					}
				}
			}
			if (text == null)
			{
				return;
			}
			TMP_Text[] componentsInChildren = ((Component)bar).GetComponentsInChildren<TMP_Text>(true);
			foreach (TMP_Text val4 in componentsInChildren)
			{
				if (val4.text != text)
				{
					val4.text = text;
				}
			}
		}

		internal static RectTransform Board(Transform parent, string name, Vector2 pos, Vector2 size)
		{
			//IL_000c: 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_0020: 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)
			RectTransform val = Rect(parent, name, new Vector2(0f, 1f), new Vector2(0f, 1f), pos, size);
			Copy(_panel, ((Component)val).gameObject.AddComponent<Image>());
			return val;
		}

		internal static RectTransform Over(RectTransform panel, string name, Vector2 minSize)
		{
			//IL_008d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0092: Unknown result type (might be due to invalid IL or missing references)
			//IL_0097: Unknown result type (might be due to invalid IL or missing references)
			//IL_009c: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a0: 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_00aa: Unknown result type (might be due to invalid IL or missing references)
			//IL_00af: Unknown result type (might be due to invalid IL or missing references)
			//IL_0107: 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_010a: Unknown result type (might be due to invalid IL or missing references)
			//IL_010f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0110: Unknown result type (might be due to invalid IL or missing references)
			//IL_0115: Unknown result type (might be due to invalid IL or missing references)
			//IL_0118: 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_0122: Unknown result type (might be due to invalid IL or missing references)
			//IL_0135: Unknown result type (might be due to invalid IL or missing references)
			//IL_0144: Unknown result type (might be due to invalid IL or missing references)
			//IL_0149: Unknown result type (might be due to invalid IL or missing references)
			//IL_014f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0156: Unknown result type (might be due to invalid IL or missing references)
			//IL_015d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0162: Unknown result type (might be due to invalid IL or missing references)
			//IL_0167: 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_00d7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00dc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e1: 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_00ec: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fb: 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_0105: Unknown result type (might be due to invalid IL or missing references)
			Transform parent = ((Transform)panel).parent;
			foreach (Transform item in (from Transform t in (IEnumerable)parent
				where ((Object)t).name == name
				select t).ToList())
			{
				Object.Destroy((Object)(object)((Component)item).gameObject);
			}
			Vector3[] array = (Vector3[])(object)new Vector3[4];
			panel.GetWorldCorners(array);
			Vector2 val = Vector2.op_Implicit(parent.InverseTransformPoint(array[0]));
			Vector2 val2 = Vector2.op_Implicit(parent.InverseTransformPoint(array[2]));
			Transform val3 = ((Transform)panel).Find("Bkg");
			RectTransform val4 = (RectTransform)(object)((val3 is RectTransform) ? val3 : null);
			if (val4 != null)
			{
				val4.GetWorldCorners(array);
				val = Vector2.Min(val, Vector2.op_Implicit(parent.InverseTransformPoint(array[0])));
				val2 = Vector2.Max(val2, Vector2.op_Implicit(parent.InverseTransformPoint(array[2])));
			}
			Vector2 size = Vector2.Max(val2 - val, minSize);
			Rect rect = ((RectTransform)parent).rect;
			RectTransform val5 = Rect(parent, name, new Vector2(0.5f, 0.5f), new Vector2(0f, 1f), new Vector2(val.x, val2.y) - ((Rect)(ref rect)).center, size);
			((Transform)val5).SetSiblingIndex(((Transform)panel).GetSiblingIndex() + 1);
			Copy(_panel, ((Component)val5).gameObject.AddComponent<Image>());
			return val5;
		}

		internal static RectTransform Stretch(RectTransform r, Vector2 offsetMin, Vector2 offsetMax)
		{
			//IL_0001: 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_0021: Unknown result type (might be due to invalid IL or missing references)
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0033: Unknown result type (might be due to invalid IL or missing references)
			r.anchorMin = Vector2.zero;
			r.anchorMax = Vector2.one;
			r.pivot = new Vector2(0.5f, 0.5f);
			r.offsetMin = offsetMin;
			r.offsetMax = offsetMax;
			return r;
		}

		internal static RectTransform Tag(Transform parent, string text, Vector2 pos, float height, float fontSize, Color fill, Color textColor, Vector2? anchor = null)
		{
			//IL_0020: 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_0025: Unknown result type (might be due to invalid IL or missing references)
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_002d: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0031: 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_0059: 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_007d: Unknown result type (might be due to invalid IL or missing references)
			//IL_009a: Unknown result type (might be due to invalid IL or missing references)
			//IL_009f: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ae: Expected O, but got Unknown
			//IL_00d0: 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)
			Vector2 val = (Vector2)(((??)anchor) ?? new Vector2(0f, 1f));
			RectTransform val2 = Rect(parent, "Tag", val, val, pos, new Vector2(height, height));
			Image val3 = ((Component)val2).gameObject.AddComponent<Image>();
			((Graphic)val3).color = fill;
			((Graphic)val3).raycastTarget = false;
			TMP_Text val4 = Label((Transform)(object)val2, text, Vector2.zero, new Vector2(height, height), fontSize, textColor, Sans, (TextAlignmentOptions)514, (Vector2?)new Vector2(0.5f, 0.5f));
			val4.textWrappingMode = (TextWrappingModes)0;
			Stretch((RectTransform)val4.transform, Vector2.zero, Vector2.zero);
			float num = Mathf.Max(3f, height * 0.3f);
			val2.sizeDelta = new Vector2(Mathf.Max(height, val4.GetPreferredValues(text, 1000f, 0f).x + num * 2f), height);
			return val2;
		}

		internal static RectTransform At(Transform parent, string name, float x, float y, float w, float h)
		{
			//IL_000c: 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_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			return Rect(parent, name, new Vector2(0f, 1f), new Vector2(0f, 1f), new Vector2(x, 0f - y), new Vector2(w, h));
		}

		internal static RectTransform Stretch(Transform parent, string name, float left = 0f, float bottom = 0f, float right = 0f, float top = 0f)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//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_0027: Unknown result type (might be due to invalid IL or missing references)
			//IL_0032: Unknown result type (might be due to invalid IL or missing references)
			//IL_0041: Unknown result type (might be due to invalid IL or missing references)
			//IL_0050: Unknown result type (might be due to invalid IL or missing references)
			RectTransform val = Rect(parent, name, Vector2.zero, new Vector2(0.5f, 0.5f), Vector2.zero, Vector2.zero);
			val.anchorMin = Vector2.zero;
			val.anchorMax = Vector2.one;
			val.offsetMin = new Vector2(0f - left, 0f - bottom);
			val.offsetMax = new Vector2(right, top);
			return val;
		}

		internal static Image Plain(RectTransform r, Color color)
		{
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			Image val = ((Component)r).gameObject.AddComponent<Image>();
			((Graphic)val).color = color;
			((Graphic)val).raycastTarget = false;
			return val;
		}

		internal static RawImage Picture(Transform parent, Vector2 pos, Vector2 size)
		{
			//IL_0010: 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_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			RawImage val = ((Component)Rect(parent, "Picture", new Vector2(0f, 1f), new Vector2(0f, 1f), pos, size)).gameObject.AddComponent<RawImage>();
			((Graphic)val).raycastTarget = false;
			((Behaviour)val).enabled = false;
			return val;
		}

		internal static void Show(RawImage img, Texture texture, Color tint)
		{
			//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_0019: Unknown result type (might be due to invalid IL or missing references)
			//IL_0064: Unknown result type (might be due to invalid IL or missing references)
			//IL_0069: 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_0082: 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_009c: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c5: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)img == (Object)null)
			{
				return;
			}
			if (((Graphic)img).color != tint)
			{
				((Graphic)img).color = tint;
			}
			if (!((Object)(object)img.texture == (Object)(object)texture))
			{
				img.texture = texture;
				((Behaviour)img).enabled = (Object)(object)texture != (Object)null;
				if (!((Object)(object)texture == (Object)null) && texture.width > 0 && texture.height > 0)
				{
					Rect rect = ((Graphic)img).rectTransform.rect;
					Vector2 size = ((Rect)(ref rect)).size;
					float num = (float)texture.width / (float)texture.height;
					float num2 = ((size.y > 0f) ? (size.x / size.y) : 1f);
					img.uvRect = ((num > num2) ? new Rect(0.5f - num2 / num / 2f, 0f, num2 / num, 1f) : new Rect(0f, 0.5f - num / num2 / 2f, 1f, num / num2));
				}
			}
		}

		internal static void SetText(TMP_Text label, string text)
		{
			if ((Object)(object)label != (Object)null && label.text != text)
			{
				label.text = text;
			}
		}

		internal static Sprite ArrowSprite()
		{
			Minimap instance = Minimap.instance;
			Image val = (((Object)(object)instance != (Object)null && (Object)(object)instance.m_smallMarker != (Object)null) ? ((Component)instance.m_smallMarker).GetComponentInChildren<Image>(true) : null);
			if (!((Object)(object)val != (Object)null))
			{
				return null;
			}
			return val.sprite;
		}

		internal static Edge Frame(Transform parent, float width, float outset, Color color)
		{
			//IL_002a: Unknown result type (might be due to invalid IL or missing references)
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0039: 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_004c: Unknown result type (might be due to invalid IL or missing references)
			//IL_005a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0069: 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_007b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0087: Unknown result type (might be due to invalid IL or missing references)
			//IL_0095: 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_00ae: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00dd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ed: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f6: Unknown result type (might be due to invalid IL or missing references)
			//IL_0102: 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)
			Edge edge = new Edge();
			edge.Sides = (Image[])(object)new Image[4]
			{
				Plain(Side("EdgeTop", new Vector2(0f, 1f), Vector2.one, new Vector2(0f - outset, outset - width), new Vector2(outset, outset)), color),
				Plain(Side("EdgeBottom", Vector2.zero, new Vector2(1f, 0f), new Vector2(0f - outset, 0f - outset), new Vector2(outset, width - outset)), color),
				Plain(Side("EdgeLeft", Vector2.zero, new Vector2(0f, 1f), new Vector2(0f - outset, width - outset), new Vector2(width - outset, outset - width)), color),
				Plain(Side("EdgeRight", new Vector2(1f, 0f), Vector2.one, new Vector2(outset - width, width - outset), new Vector2(outset, outset - width)), color)
			};
			edge.SetColor(color, force: true);
			return edge;
			RectTransform Side(string name, Vector2 min, Vector2 max, Vector2 offMin, Vector2 offMax)
			{
				//IL_0008: 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_0021: Unknown result type (might be due to invalid IL or missing references)
				//IL_002d: Unknown result type (might be due to invalid IL or missing references)
				//IL_0034: Unknown result type (might be due to invalid IL or missing references)
				//IL_003b: Unknown result type (might be due to invalid IL or missing references)
				//IL_0042: Unknown result type (might be due to invalid IL or missing references)
				RectTransform val = Rect(parent, name, Vector2.zero, new Vector2(0.5f, 0.5f), Vector2.zero, Vector2.zero);
				val.anchorMin = min;
				val.anchorMax = max;
				val.offsetMin = offMin;
				val.offsetMax = offMax;
				return val;
			}
		}

		internal static Meter LiveBar(Transform parent, Vector2 pos, Vector2 size, Color fill, bool trail = false, float fontSize = 0f)
		{
			//IL_0006: 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_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_0091: Unknown result type (might be due to invalid IL or missing references)
			//IL_0027: Unknown result type (might be due to invalid IL or missing references)
			//IL_0028: Unknown result type (might be due to invalid IL or missing references)
			//IL_009f: 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_00fd: Unknown result type (might be due to invalid IL or missing references)
			//IL_0153: Unknown result type (might be due to invalid IL or missing references)
			//IL_0158: Unknown result type (might be due to invalid IL or missing references)
			//IL_017a: Unknown result type (might be due to invalid IL or missing references)
			//IL_015f: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a8: Expected O, but got Unknown
			//IL_01aa: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b6: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d7: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c6: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f8: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e7: Unknown result type (might be due to invalid IL or missing references)
			Meter meter = new Meter();
			bool flag = size.y >= 10f && (Object)(object)_sunken != (Object)null;
			if (flag)
			{
				meter.Groove = Box(parent, pos, size);
				((Graphic)((Component)meter.Groove).GetComponent<Image>()).raycastTarget = false;
			}
			else
			{
				meter.Groove = Rect(parent, "Groove", new Vector2(0f, 1f), new Vector2(0f, 1f), pos, size);
				Plain(meter.Groove, new Color(0f, 0f, 0f, 0.6f));
			}
			float num = (flag ? 2f : ((size.y >= 4f) ? 1f : 0f));
			RectTransform inner = Stretch((Transform)(object)meter.Groove, "Inner", 0f - num, 0f - num, 0f - num, 0f - num);
			if (trail)
			{
				meter.Trail = Fill("Trail", new Color(1f, 0.92f, 0.85f, 0.55f));
			}
			meter.Fill = Fill("Fill", fill);
			if (fontSize > 0f)
			{
				bool[] array = new bool[2] { true, false };
				foreach (bool flag2 in array)
				{
					TMP_Text val = Label((Transform)(object)meter.Groove, "", Vector2.zero, size, fontSize, (Color)(flag2 ? new Color(0f, 0f, 0f, 0.85f) : Color.white), Sans, (TextAlignmentOptions)514);
					RectTransform val2 = (RectTransform)val.transform;
					val2.anchorMin = Vector2.zero;
					val2.anchorMax = Vector2.one;
					val2.offsetMin = (Vector2)(flag2 ? new Vector2(1f, -1f) : Vector2.zero);
					val2.offsetMax = (Vector2)(flag2 ? new Vector2(1f, -1f) : Vector2.zero);
					val.textWrappingMode = (TextWrappingModes)0;
					val.overflowMode = (TextOverflowModes)0;
					if (flag2)
					{
						meter.Shadow = val;
					}
					else
					{
						meter.Text = val;
					}
				}
			}
			meter.Set(0f, 0f, force: true);
			return meter;
			Image Fill(string name, Color color)
			{
				//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_0022: Unknown result type (might be due to invalid IL or missing references)
				//IL_0037: Unknown result type (might be due to invalid IL or missing references)
				//IL_0043: Unknown result type (might be due to invalid IL or missing references)
				//IL_0048: Unknown result type (might be due to invalid IL or missing references)
				//IL_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 missi