SandwinterQoLMod.dll

Decompiled a week ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using BepInEx;
using HarmonyLib;
using Landfall.TABS;
using Landfall.TABS.UnitEditor;
using UnityEngine;
using UnityEngine.EventSystems;
using UnityEngine.UI;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = "")]
[assembly: AssemblyCompany("SandwinterQoLMod")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyDescription("Quality of Life mod for TABS Unit Creator")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("SandwinterQoLMod")]
[assembly: AssemblyTitle("SandwinterQoLMod")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace SandwinterQoLMod;

[Serializable]
public class ThemeConfig
{
	public float backgroundAlpha = 0.85f;

	public float fontRed = 1f;

	public float fontGreen = 1f;

	public float fontBlue = 1f;

	public string customBgImageName = "";
}
public class SQOLThemeManager
{
	public static ThemeConfig currentTheme = new ThemeConfig();

	public static string GetThemeFolder()
	{
		string text = Path.Combine(Paths.PluginPath, "SandwinterQoLSaves", "Themes");
		if (!Directory.Exists(text))
		{
			Directory.CreateDirectory(text);
		}
		return text;
	}

	public static void SaveTheme()
	{
		try
		{
			string path = Path.Combine(GetThemeFolder(), "theme_config.json");
			string contents = JsonUtility.ToJson((object)currentTheme, true);
			File.WriteAllText(path, contents);
		}
		catch (Exception)
		{
		}
	}

	public static void LoadTheme()
	{
		try
		{
			string path = Path.Combine(GetThemeFolder(), "theme_config.json");
			if (File.Exists(path))
			{
				string text = File.ReadAllText(path);
				JsonUtility.FromJsonOverwrite(text, (object)currentTheme);
			}
		}
		catch (Exception)
		{
		}
	}
}
public struct PropTransformSnapshot
{
	public Vector3 scale;

	public Vector3 pos;

	public Vector3 rot;
}
public class SavedPropBlueprint
{
	public CharacterItem itemBase;

	public string itemNameForSave;

	public Vector3 scale;

	public Vector3 pos;

	public Vector3 rot;

	public int[] colors;

	public bool[] isTeamColors;

	public int equipMode = 0;
}
public class OutfitCartridge
{
	public string cartridgeName;

	public bool isSavedToFile = false;

	public string lastSavedFileName = "";

	public bool showDeleteConfirm = false;

	public List<SavedPropBlueprint> props = new List<SavedPropBlueprint>();
}
[BepInPlugin("com.sandwinter.qolmod", "Sandwinter QoL Mod", "1.6.5")]
public class Main : BaseUnityPlugin
{
	private bool isMinimized = true;

	private Rect miniRect = new Rect((float)(Screen.width - 100), 10f, 80f, 80f);

	private Rect hubRect = new Rect((float)(Screen.width - 220), 60f, 200f, 380f);

	private Rect transformRect = new Rect((float)(Screen.width - 560), 60f, 320f, 120f);

	private Rect visibilityRect = new Rect((float)(Screen.width - 560), 420f, 320f, 50f);

	private Rect powerToolsRect = new Rect((float)(Screen.width - 560), 490f, 320f, 100f);

	private Rect outfitRect = new Rect((float)(Screen.width - 560), 650f, 320f, 100f);

	private Rect scrollRect = new Rect((float)(Screen.width - 560), 770f, 320f, 100f);

	private Rect propListRect = new Rect((float)(Screen.width - 900), 60f, 320f, 400f);

	private Rect cameraRect = new Rect((float)(Screen.width - 900), 480f, 320f, 260f);

	private Rect settingsRect = new Rect((float)(Screen.width - 900), 100f, 320f, 340f);

	private bool showSettingsUI = false;

	public bool showTransformUI = false;

	private bool showVisibilityUI = false;

	private bool showPowerToolsUI = false;

	private bool showOutfitUI = false;

	private bool showScrollUI = false;

	private bool showPropListUI = false;

	private bool showCameraUI = false;

	private string currentPropName = "NO PROP SELECTED";

	private string scaleX = "1";

	private string scaleY = "1";

	private string scaleZ = "1";

	private string posX = "0";

	private string posY = "0";

	private string posZ = "0";

	private string rotX = "0";

	private string rotY = "0";

	private string rotZ = "0";

	private string groupUniformScale = "1.000";

	private string groupScaleX = "1.000";

	private string groupScaleY = "1.000";

	private string groupScaleZ = "1.000";

	private string groupPosX = "0.000";

	private string groupPosY = "0.000";

	private string groupPosZ = "0.000";

	private string groupRotX = "0";

	private string groupRotY = "0";

	private string groupRotZ = "0";

	public static bool scaleGroupDistance = true;

	private int visibilityMode = 0;

	public object lastSelectedWrapper = null;

	private string lastFocusedControl = "";

	private object nativeLastWrapper = null;

	private UnitEditorManager cachedEditorManager;

	private UnitEditorEquipedClothing cachedEquipedUI;

	private float uiSearchTimer = 0f;

	private float nextCheckTime = 0f;

	private object currentHoveredInList = null;

	private readonly int miniID = 1002;

	private readonly int hubID = 1003;

	private readonly int transformID = 2001;

	private readonly int visibilityID = 2002;

	private readonly int powerToolsID = 2003;

	private readonly int outfitID = 2004;

	private readonly int scrollID = 2005;

	private readonly int propListID = 2006;

	private readonly int cameraID = 2007;

	private readonly int settingsID = 2008;

	private bool isMouseInAnyWindow = false;

	private float pullSpeed = 800f;

	public static bool isCameraOverrideEnabled = false;

	public static float camMoveSpeed = 4f;

	public static float camZoomSpeed = 8f;

	public static Vector2 customPanOffset = Vector2.zero;

	public static float customZoomDelta = 0f;

	public static Vector2 pendingPanInput = Vector2.zero;

	public static float pendingZoomInput = 0f;

	public static bool requestCameraReset = false;

	public static bool isHoverXRayEnabled = true;

	public static int xrayFilterMode = -1;

	public static bool isDeleteModeEnabled = false;

	public static bool isMassCopyModeEnabled = false;

	public static bool isGroupModeEnabled = false;

	public static List<OutfitCartridge> savedCartridges = new List<OutfitCartridge>();

	private Vector2 cartridgeScrollPos = Vector2.zero;

	private Vector2 propListScrollPos = Vector2.zero;

	private Vector2 bgScrollPos = Vector2.zero;

	public List<object> currentEquippedWrappers = new List<object>();

	private Texture2D sqolLogo = null;

	private Texture2D customBgTexture = null;

	private Texture2D defaultBgTexture = null;

	private List<string> availableBgImages = new List<string>();

	private readonly EquipType[] equipTypes = (EquipType[])(object)new EquipType[3]
	{
		default(EquipType),
		(EquipType)1,
		(EquipType)2
	};

	public static Main Instance { get; private set; }

	private void Awake()
	{
		//IL_001f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0025: Expected O, but got Unknown
		//IL_0031: Unknown result type (might be due to invalid IL or missing references)
		//IL_0037: Expected O, but got Unknown
		try
		{
			Instance = this;
			((BaseUnityPlugin)this).Logger.LogInfo((object)"Sandwinter QoL Mod (V165 Stable UI Theme Fix) is loading...");
			Harmony val = new Harmony("com.sandwinter.qolmod.patch");
			val.PatchAll();
			GameObject val2 = new GameObject("SandwinterXRayManager");
			val2.AddComponent<HoverXRayGlobalManager>();
			Object.DontDestroyOnLoad((Object)(object)val2);
			SQOLThemeManager.LoadTheme();
			RefreshAvailableImages();
			LoadCustomBackgroundTexture();
			LoadAllCartridgesFromFolder();
			LoadLogoImage();
		}
		catch (Exception)
		{
		}
	}

	private void RefreshAvailableImages()
	{
		availableBgImages.Clear();
		try
		{
			string[] files = Directory.GetFiles(SQOLThemeManager.GetThemeFolder());
			string[] array = files;
			foreach (string path in array)
			{
				string text = Path.GetExtension(path).ToLower();
				if (text == ".png" || text == ".jpg" || text == ".jpeg")
				{
					availableBgImages.Add(Path.GetFileName(path));
				}
			}
		}
		catch (Exception)
		{
		}
	}

	private void LoadCustomBackgroundTexture()
	{
		//IL_004a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0054: Expected O, but got Unknown
		if (string.IsNullOrEmpty(SQOLThemeManager.currentTheme.customBgImageName))
		{
			customBgTexture = null;
			return;
		}
		try
		{
			string path = Path.Combine(SQOLThemeManager.GetThemeFolder(), SQOLThemeManager.currentTheme.customBgImageName);
			if (File.Exists(path))
			{
				byte[] array = File.ReadAllBytes(path);
				customBgTexture = new Texture2D(2, 2);
				ImageConversion.LoadImage(customBgTexture, array);
			}
		}
		catch (Exception)
		{
		}
	}

	private void ApplyThemeToGUI()
	{
		//IL_001f: 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_00b0: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ba: Expected O, but got Unknown
		//IL_00d6: Unknown result type (might be due to invalid IL or missing references)
		GUI.contentColor = new Color(SQOLThemeManager.currentTheme.fontRed, SQOLThemeManager.currentTheme.fontGreen, SQOLThemeManager.currentTheme.fontBlue);
		GUI.backgroundColor = new Color(1f, 1f, 1f, SQOLThemeManager.currentTheme.backgroundAlpha);
		if ((Object)(object)customBgTexture != (Object)null)
		{
			GUI.skin.window.normal.background = customBgTexture;
			GUI.skin.window.onNormal.background = customBgTexture;
			return;
		}
		if ((Object)(object)defaultBgTexture == (Object)null)
		{
			defaultBgTexture = new Texture2D(1, 1);
			defaultBgTexture.SetPixel(0, 0, new Color(0.1f, 0.1f, 0.1f, 0.95f));
			defaultBgTexture.Apply();
		}
		GUI.skin.window.normal.background = defaultBgTexture;
		GUI.skin.window.onNormal.background = defaultBgTexture;
	}

	public static void DecodePositionOffset(Vector3 encoded, out Vector3 rot, out Vector3 pos)
	{
		//IL_0002: Unknown result type (might be due to invalid IL or missing references)
		//IL_0007: Unknown result type (might be due to invalid IL or missing references)
		//IL_000d: Unknown result type (might be due to invalid IL or missing references)
		//IL_000e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0014: 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_0042: Unknown result type (might be due to invalid IL or missing references)
		rot = Vector3.zero;
		pos = encoded;
		rot.x = DecodeAxis(encoded.x, out pos.x);
		rot.y = DecodeAxis(encoded.y, out pos.y);
		rot.z = DecodeAxis(encoded.z, out pos.z);
	}

	private static float DecodeAxis(float encoded, out float pos)
	{
		pos = encoded;
		float result = 0f;
		float num = Mathf.Abs(encoded);
		if (num < 1000f)
		{
			return result;
		}
		int num2 = (int)num;
		int num3 = num2 - 1000;
		int num4 = num3 / 1000;
		int num5 = num3 % 1000;
		result = num4;
		if (result > 180f)
		{
			result -= 360f;
		}
		pos = ((encoded < 0f) ? (0f - (float)num5 / 100f) : ((float)num5 / 100f));
		return result;
	}

	public static Vector3 EncodePositionOffset(Vector3 rot, Vector3 pos)
	{
		//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_0009: Unknown result type (might be due to invalid IL or missing references)
		//IL_000f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0021: 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_0039: 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_004f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0050: Unknown result type (might be due to invalid IL or missing references)
		//IL_0053: Unknown result type (might be due to invalid IL or missing references)
		Vector3 zero = Vector3.zero;
		zero.x = EncodeAxis(rot.x, pos.x);
		zero.y = EncodeAxis(rot.y, pos.y);
		zero.z = EncodeAxis(rot.z, pos.z);
		return zero;
	}

	private static float EncodeAxis(float rot, float pos)
	{
		if (Mathf.Abs(rot) < 0.001f)
		{
			return pos;
		}
		float num = rot % 360f;
		if (num < 0f)
		{
			num += 360f;
		}
		int num2 = Mathf.RoundToInt(num) % 360;
		if (num2 == 0)
		{
			return pos;
		}
		int num3 = Mathf.Clamp(Mathf.RoundToInt(Mathf.Abs(pos) * 100f), 0, 999);
		float num4 = ((pos < 0f) ? (-1f) : 1f);
		return num4 * (float)(1000 + num2 * 1000 + num3);
	}

	public void ResetGroupSlidersToNeutral()
	{
		groupUniformScale = "1.000";
		groupScaleX = "1.000";
		groupScaleY = "1.000";
		groupScaleZ = "1.000";
		groupPosX = "0.000";
		groupPosY = "0.000";
		groupPosZ = "0.000";
		groupRotX = "0";
		groupRotY = "0";
		groupRotZ = "0";
	}

	private void LoadLogoImage()
	{
		//IL_004b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0055: Expected O, but got Unknown
		try
		{
			string searchPattern = "sqol_logo.png";
			string text = "";
			string[] files = Directory.GetFiles(Paths.PluginPath, searchPattern, SearchOption.AllDirectories);
			if (files.Length != 0)
			{
				text = files[0];
			}
			if (!string.IsNullOrEmpty(text) && File.Exists(text))
			{
				byte[] array = File.ReadAllBytes(text);
				sqolLogo = new Texture2D(2, 2);
				ImageConversion.LoadImage(sqolLogo, array);
			}
		}
		catch (Exception)
		{
		}
	}

	private string GetSaveFolder()
	{
		string pluginPath = Paths.PluginPath;
		string text = Path.Combine(pluginPath, "SandwinterQoLSaves");
		if (!Directory.Exists(text))
		{
			Directory.CreateDirectory(text);
		}
		return text;
	}

	private string GetSafeFileName(string name)
	{
		string text = new string(Path.GetInvalidFileNameChars()) + new string(Path.GetInvalidPathChars());
		string text2 = text;
		for (int i = 0; i < text2.Length; i++)
		{
			name = name.Replace(text2[i].ToString(), "");
		}
		return name.Replace(" ", "_");
	}

	public void SaveSingleCartridge(OutfitCartridge c)
	{
		try
		{
			string saveFolder = GetSaveFolder();
			if (!string.IsNullOrEmpty(c.lastSavedFileName) && c.lastSavedFileName != c.cartridgeName)
			{
				string path = Path.Combine(saveFolder, GetSafeFileName(c.lastSavedFileName) + ".txt");
				if (File.Exists(path))
				{
					File.Delete(path);
				}
			}
			string path2 = GetSafeFileName(c.cartridgeName) + ".txt";
			string path3 = Path.Combine(saveFolder, path2);
			List<string> list = new List<string> { "===SET===", c.cartridgeName };
			foreach (SavedPropBlueprint prop in c.props)
			{
				if (string.IsNullOrEmpty(prop.itemNameForSave))
				{
					continue;
				}
				list.Add("PROP|" + prop.itemNameForSave);
				list.Add($"S|{prop.scale.x}|{prop.scale.y}|{prop.scale.z}");
				list.Add($"P|{prop.pos.x}|{prop.pos.y}|{prop.pos.z}");
				list.Add($"R|{prop.rot.x}|{prop.rot.y}|{prop.rot.z}");
				list.Add($"E|{prop.equipMode}");
				string text = "C|";
				if (prop.colors != null)
				{
					for (int i = 0; i < prop.colors.Length; i++)
					{
						text = text + prop.colors[i] + ((i < prop.colors.Length - 1) ? "," : "");
					}
				}
				list.Add(text);
				string text2 = "T|";
				if (prop.isTeamColors != null)
				{
					for (int j = 0; j < prop.isTeamColors.Length; j++)
					{
						text2 = text2 + (prop.isTeamColors[j] ? "1" : "0") + ((j < prop.isTeamColors.Length - 1) ? "," : "");
					}
				}
				list.Add(text2);
			}
			File.WriteAllLines(path3, list.ToArray());
			c.isSavedToFile = true;
			c.lastSavedFileName = c.cartridgeName;
		}
		catch (Exception)
		{
		}
	}

	public void DeleteCartridgeFile(OutfitCartridge c)
	{
		try
		{
			string saveFolder = GetSaveFolder();
			string path = GetSafeFileName((!string.IsNullOrEmpty(c.lastSavedFileName)) ? c.lastSavedFileName : c.cartridgeName) + ".txt";
			string path2 = Path.Combine(saveFolder, path);
			if (File.Exists(path2))
			{
				File.Delete(path2);
			}
		}
		catch (Exception)
		{
		}
	}

	private void LoadAllCartridgesFromFolder()
	{
		//IL_019e: Unknown result type (might be due to invalid IL or missing references)
		//IL_01a3: Unknown result type (might be due to invalid IL or missing references)
		//IL_01fc: Unknown result type (might be due to invalid IL or missing references)
		//IL_0201: Unknown result type (might be due to invalid IL or missing references)
		//IL_025a: Unknown result type (might be due to invalid IL or missing references)
		//IL_025f: Unknown result type (might be due to invalid IL or missing references)
		string saveFolder = GetSaveFolder();
		if (!Directory.Exists(saveFolder))
		{
			return;
		}
		try
		{
			savedCartridges.Clear();
			string[] files = Directory.GetFiles(saveFolder, "*.txt");
			string[] array = files;
			foreach (string path in array)
			{
				string[] array2 = File.ReadAllLines(path);
				OutfitCartridge outfitCartridge = null;
				SavedPropBlueprint savedPropBlueprint = null;
				for (int j = 0; j < array2.Length; j++)
				{
					string text = array2[j].Trim();
					if (string.IsNullOrEmpty(text))
					{
						continue;
					}
					if (text == "===SET===")
					{
						if (outfitCartridge != null)
						{
							savedCartridges.Add(outfitCartridge);
						}
						string text2 = array2[j + 1].Trim();
						outfitCartridge = new OutfitCartridge
						{
							cartridgeName = text2,
							isSavedToFile = true,
							lastSavedFileName = text2,
							showDeleteConfirm = false
						};
						j++;
					}
					else if (text.StartsWith("PROP|") && outfitCartridge != null)
					{
						if (savedPropBlueprint != null)
						{
							outfitCartridge.props.Add(savedPropBlueprint);
						}
						SavedPropBlueprint savedPropBlueprint2 = new SavedPropBlueprint();
						savedPropBlueprint2.itemNameForSave = text.Split(new char[1] { '|' })[1];
						savedPropBlueprint2.equipMode = 0;
						savedPropBlueprint = savedPropBlueprint2;
					}
					else if (text.StartsWith("S|") && savedPropBlueprint != null)
					{
						string[] array3 = text.Split(new char[1] { '|' });
						savedPropBlueprint.scale = new Vector3(float.Parse(array3[1]), float.Parse(array3[2]), float.Parse(array3[3]));
					}
					else if (text.StartsWith("P|") && savedPropBlueprint != null)
					{
						string[] array4 = text.Split(new char[1] { '|' });
						savedPropBlueprint.pos = new Vector3(float.Parse(array4[1]), float.Parse(array4[2]), float.Parse(array4[3]));
					}
					else if (text.StartsWith("R|") && savedPropBlueprint != null)
					{
						string[] array5 = text.Split(new char[1] { '|' });
						savedPropBlueprint.rot = new Vector3(float.Parse(array5[1]), float.Parse(array5[2]), float.Parse(array5[3]));
					}
					else if (text.StartsWith("E|") && savedPropBlueprint != null)
					{
						string[] array6 = text.Split(new char[1] { '|' });
						if (array6.Length > 1)
						{
							savedPropBlueprint.equipMode = int.Parse(array6[1]);
						}
					}
					else if (text.StartsWith("C|") && savedPropBlueprint != null)
					{
						if (text.Length > 2)
						{
							string[] array7 = text.Substring(2).Split(new char[1] { ',' });
							savedPropBlueprint.colors = new int[array7.Length];
							for (int k = 0; k < array7.Length; k++)
							{
								savedPropBlueprint.colors[k] = int.Parse(array7[k]);
							}
						}
					}
					else if (text.StartsWith("T|") && savedPropBlueprint != null && text.Length > 2)
					{
						string[] array8 = text.Substring(2).Split(new char[1] { ',' });
						savedPropBlueprint.isTeamColors = new bool[array8.Length];
						for (int l = 0; l < array8.Length; l++)
						{
							savedPropBlueprint.isTeamColors[l] = array8[l] == "1";
						}
					}
				}
				if (savedPropBlueprint != null)
				{
					outfitCartridge?.props.Add(savedPropBlueprint);
				}
				if (outfitCartridge != null)
				{
					savedCartridges.Add(outfitCartridge);
				}
			}
		}
		catch (Exception)
		{
		}
	}

	public bool IsUCActive()
	{
		if ((Object)(object)cachedEquipedUI == (Object)null && Time.time > uiSearchTimer)
		{
			cachedEquipedUI = Object.FindObjectOfType<UnitEditorEquipedClothing>();
			uiSearchTimer = Time.time + 2f;
		}
		return (Object)(object)cachedEquipedUI != (Object)null && ((Component)cachedEquipedUI).gameObject.activeInHierarchy;
	}

	private void Update()
	{
		//IL_002a: Unknown result type (might be due to invalid IL or missing references)
		//IL_003a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0075: 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_0099: 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_00e3: Unknown result type (might be due to invalid IL or missing references)
		//IL_0108: Unknown result type (might be due to invalid IL or missing references)
		//IL_012d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0152: Unknown result type (might be due to invalid IL or missing references)
		//IL_0177: 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)
		try
		{
			if (!IsUCActive())
			{
				return;
			}
			if (!isMinimized)
			{
				CheckForSelectedPropUpdate();
			}
			Vector2 val = default(Vector2);
			((Vector2)(ref val))..ctor(Input.mousePosition.x, (float)Screen.height - Input.mousePosition.y);
			if (isMinimized)
			{
				isMouseInAnyWindow = ((Rect)(ref miniRect)).Contains(val);
				return;
			}
			isMouseInAnyWindow = ((Rect)(ref hubRect)).Contains(val);
			if (showTransformUI)
			{
				isMouseInAnyWindow |= ((Rect)(ref transformRect)).Contains(val);
			}
			if (showVisibilityUI)
			{
				isMouseInAnyWindow |= ((Rect)(ref visibilityRect)).Contains(val);
			}
			if (showPowerToolsUI)
			{
				isMouseInAnyWindow |= ((Rect)(ref powerToolsRect)).Contains(val);
			}
			if (showOutfitUI)
			{
				isMouseInAnyWindow |= ((Rect)(ref outfitRect)).Contains(val);
			}
			if (showScrollUI)
			{
				isMouseInAnyWindow |= ((Rect)(ref scrollRect)).Contains(val);
			}
			if (showPropListUI)
			{
				isMouseInAnyWindow |= ((Rect)(ref propListRect)).Contains(val);
			}
			if (showCameraUI)
			{
				isMouseInAnyWindow |= ((Rect)(ref cameraRect)).Contains(val);
			}
			if (showSettingsUI)
			{
				isMouseInAnyWindow |= ((Rect)(ref settingsRect)).Contains(val);
			}
		}
		catch (Exception)
		{
		}
	}

	private void LateUpdate()
	{
		if (IsUCActive() && isMouseInAnyWindow)
		{
			Input.ResetInputAxes();
		}
	}

	private void OnGUI()
	{
		//IL_0067: Unknown result type (might be due to invalid IL or missing references)
		//IL_0073: Unknown result type (might be due to invalid IL or missing references)
		//IL_0087: Expected O, but got Unknown
		//IL_0082: 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_002e: Unknown result type (might be due to invalid IL or missing references)
		//IL_003a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0053: Expected O, but got Unknown
		//IL_004e: 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_009e: 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_00be: Expected O, but got Unknown
		//IL_00b9: 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_00d5: 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_00f5: Expected O, but got Unknown
		//IL_00f0: 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_025e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0264: Invalid comparison between Unknown and I4
		//IL_010e: Unknown result type (might be due to invalid IL or missing references)
		//IL_011a: Unknown result type (might be due to invalid IL or missing references)
		//IL_012e: Expected O, but got Unknown
		//IL_0129: Unknown result type (might be due to invalid IL or missing references)
		//IL_012e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0147: 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_0167: Expected O, but got Unknown
		//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_0180: Unknown result type (might be due to invalid IL or missing references)
		//IL_018c: Unknown result type (might be due to invalid IL or missing references)
		//IL_01a0: Expected O, but got Unknown
		//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_01b9: Unknown result type (might be due to invalid IL or missing references)
		//IL_01c5: Unknown result type (might be due to invalid IL or missing references)
		//IL_01d9: Expected O, but got Unknown
		//IL_01d4: Unknown result type (might be due to invalid IL or missing references)
		//IL_01d9: Unknown result type (might be due to invalid IL or missing references)
		//IL_01f2: 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_0212: Expected O, but got Unknown
		//IL_020d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0212: Unknown result type (might be due to invalid IL or missing references)
		//IL_022b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0237: Unknown result type (might be due to invalid IL or missing references)
		//IL_024b: Expected O, but got Unknown
		//IL_0246: 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)
		if (!IsUCActive())
		{
			return;
		}
		ApplyThemeToGUI();
		try
		{
			if (isMinimized)
			{
				miniRect = GUILayout.Window(miniID, miniRect, new WindowFunction(DrawMiniWindow), "", GUIStyle.none, Array.Empty<GUILayoutOption>());
			}
			else
			{
				hubRect = GUILayout.Window(hubID, hubRect, new WindowFunction(DrawHubWindow), "QoL Hub", Array.Empty<GUILayoutOption>());
				if (showTransformUI)
				{
					transformRect = GUILayout.Window(transformID, transformRect, new WindowFunction(DrawTransformWindow), "Transform Tools", Array.Empty<GUILayoutOption>());
				}
				if (showVisibilityUI)
				{
					visibilityRect = GUILayout.Window(visibilityID, visibilityRect, new WindowFunction(DrawVisibilityWindow), "M-Equip", Array.Empty<GUILayoutOption>());
				}
				if (showPowerToolsUI)
				{
					powerToolsRect = GUILayout.Window(powerToolsID, powerToolsRect, new WindowFunction(DrawPowerToolsWindow), "Power Tools", Array.Empty<GUILayoutOption>());
				}
				if (showOutfitUI)
				{
					outfitRect = GUILayout.Window(outfitID, outfitRect, new WindowFunction(DrawOutfitWindow), "Saved Outfit Sets", Array.Empty<GUILayoutOption>());
				}
				if (showScrollUI)
				{
					scrollRect = GUILayout.Window(scrollID, scrollRect, new WindowFunction(DrawScrollWindow), "Scroll Settings", Array.Empty<GUILayoutOption>());
				}
				if (showPropListUI)
				{
					propListRect = GUILayout.Window(propListID, propListRect, new WindowFunction(DrawPropListWindow), "X-Ray Prop List", Array.Empty<GUILayoutOption>());
				}
				if (showCameraUI)
				{
					cameraRect = GUILayout.Window(cameraID, cameraRect, new WindowFunction(DrawCameraWindow), "Camera Tools", Array.Empty<GUILayoutOption>());
				}
				if (showSettingsUI)
				{
					settingsRect = GUILayout.Window(settingsID, settingsRect, new WindowFunction(DrawSettingsWindow), "UI Theme Settings", Array.Empty<GUILayoutOption>());
				}
			}
			if (isMouseInAnyWindow && (int)Event.current.type == 6)
			{
				Event.current.Use();
			}
		}
		catch (Exception)
		{
		}
	}

	private void DrawMiniWindow(int id)
	{
		//IL_00ab: Unknown result type (might be due to invalid IL or missing references)
		GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
		GUILayout.FlexibleSpace();
		if ((Object)(object)sqolLogo != (Object)null)
		{
			if (GUILayout.Button((Texture)(object)sqolLogo, GUIStyle.none, (GUILayoutOption[])(object)new GUILayoutOption[2]
			{
				GUILayout.Width(65f),
				GUILayout.Height(65f)
			}))
			{
				isMinimized = false;
			}
		}
		else if (GUILayout.Button("OPEN", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(30f) }))
		{
			isMinimized = false;
		}
		GUILayout.FlexibleSpace();
		GUILayout.EndHorizontal();
		GUI.DragWindow(new Rect(0f, 0f, 10000f, 100f));
	}

	private void DrawHubWindow(int id)
	{
		//IL_001b: 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_008a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0074: Unknown result type (might be due to invalid IL or missing references)
		//IL_00d2: 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_00f6: Unknown result type (might be due to invalid IL or missing references)
		//IL_017f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0169: 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_01dc: Unknown result type (might be due to invalid IL or missing references)
		//IL_0267: Unknown result type (might be due to invalid IL or missing references)
		//IL_0251: Unknown result type (might be due to invalid IL or missing references)
		//IL_02dc: Unknown result type (might be due to invalid IL or missing references)
		//IL_02c6: Unknown result type (might be due to invalid IL or missing references)
		//IL_0351: Unknown result type (might be due to invalid IL or missing references)
		//IL_033b: Unknown result type (might be due to invalid IL or missing references)
		//IL_03c6: Unknown result type (might be due to invalid IL or missing references)
		//IL_03b0: Unknown result type (might be due to invalid IL or missing references)
		//IL_0412: Unknown result type (might be due to invalid IL or missing references)
		//IL_0431: Unknown result type (might be due to invalid IL or missing references)
		GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
		GUI.backgroundColor = new Color(1f, 0.4f, 0.4f);
		if (GUILayout.Button("[-] MIN", (GUILayoutOption[])(object)new GUILayoutOption[2]
		{
			GUILayout.Width(65f),
			GUILayout.Height(20f)
		}))
		{
			isMinimized = true;
		}
		GUI.backgroundColor = Color.white;
		GUILayout.FlexibleSpace();
		GUI.backgroundColor = (Color)(showSettingsUI ? new Color(0.5f, 1f, 0.5f) : Color.white);
		if (GUILayout.Button("⚙ SETTINGS", (GUILayoutOption[])(object)new GUILayoutOption[2]
		{
			GUILayout.Width(85f),
			GUILayout.Height(20f)
		}))
		{
			showSettingsUI = !showSettingsUI;
		}
		GUI.backgroundColor = Color.white;
		GUILayout.EndHorizontal();
		GUILayout.Space(10f);
		GUI.backgroundColor = (Color)(showTransformUI ? new Color(0.5f, 1f, 0.5f) : Color.white);
		if (GUILayout.Button(showTransformUI ? "Transform: OPEN" : "Transform: CLOSED", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(30f) }))
		{
			showTransformUI = !showTransformUI;
		}
		GUILayout.Space(5f);
		GUI.backgroundColor = (Color)(showPropListUI ? new Color(0.5f, 1f, 0.5f) : Color.white);
		if (GUILayout.Button(showPropListUI ? "X-Ray List: OPEN" : "X-Ray List: CLOSED", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(30f) }))
		{
			showPropListUI = !showPropListUI;
		}
		GUILayout.Space(5f);
		GUI.backgroundColor = (Color)(showVisibilityUI ? new Color(0.5f, 1f, 0.5f) : Color.white);
		if (GUILayout.Button(showVisibilityUI ? "M-Equip: OPEN" : "M-Equip: CLOSED", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(30f) }))
		{
			showVisibilityUI = !showVisibilityUI;
		}
		GUILayout.Space(5f);
		GUI.backgroundColor = (Color)(showPowerToolsUI ? new Color(0.5f, 1f, 0.5f) : Color.white);
		if (GUILayout.Button(showPowerToolsUI ? "Power Tools: OPEN" : "Power Tools: CLOSED", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(30f) }))
		{
			showPowerToolsUI = !showPowerToolsUI;
		}
		GUILayout.Space(5f);
		GUI.backgroundColor = (Color)(showOutfitUI ? new Color(0.5f, 1f, 0.5f) : Color.white);
		if (GUILayout.Button(showOutfitUI ? "Outfit Sets: OPEN" : "Outfit Sets: CLOSED", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(30f) }))
		{
			showOutfitUI = !showOutfitUI;
		}
		GUILayout.Space(5f);
		GUI.backgroundColor = (Color)(showScrollUI ? new Color(0.5f, 1f, 0.5f) : Color.white);
		if (GUILayout.Button(showScrollUI ? "Scroll Tools: OPEN" : "Scroll Tools: CLOSED", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(30f) }))
		{
			showScrollUI = !showScrollUI;
		}
		GUILayout.Space(5f);
		GUI.backgroundColor = (Color)(showCameraUI ? new Color(0.5f, 1f, 0.5f) : Color.white);
		if (GUILayout.Button(showCameraUI ? "Camera Tools: OPEN" : "Camera Tools: CLOSED", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(30f) }))
		{
			showCameraUI = !showCameraUI;
		}
		GUI.backgroundColor = Color.white;
		GUI.DragWindow(new Rect(0f, 0f, 10000f, 25f));
	}

	private void DrawSettingsWindow(int id)
	{
		//IL_0199: 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_01b6: Unknown result type (might be due to invalid IL or missing references)
		//IL_01d3: Unknown result type (might be due to invalid IL or missing references)
		//IL_01cc: Unknown result type (might be due to invalid IL or missing references)
		//IL_0248: Unknown result type (might be due to invalid IL or missing references)
		//IL_0241: Unknown result type (might be due to invalid IL or missing references)
		//IL_029f: Unknown result type (might be due to invalid IL or missing references)
		//IL_02f4: Unknown result type (might be due to invalid IL or missing references)
		//IL_0328: Unknown result type (might be due to invalid IL or missing references)
		//IL_034d: Unknown result type (might be due to invalid IL or missing references)
		GUILayout.Space(5f);
		GUILayout.Label("\ud83c\udfa8 UI THEME & STYLE CUSTOMIZER", Array.Empty<GUILayoutOption>());
		GUILayout.Space(5f);
		GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
		GUILayout.Label("Background Opacity:", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(130f) });
		SQOLThemeManager.currentTheme.backgroundAlpha = GUILayout.HorizontalSlider(SQOLThemeManager.currentTheme.backgroundAlpha, 0.2f, 1f, Array.Empty<GUILayoutOption>());
		GUILayout.EndHorizontal();
		GUILayout.Space(5f);
		GUILayout.Label("Font Color (RGB):", Array.Empty<GUILayoutOption>());
		GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
		GUILayout.Label("R", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(15f) });
		SQOLThemeManager.currentTheme.fontRed = GUILayout.HorizontalSlider(SQOLThemeManager.currentTheme.fontRed, 0f, 1f, Array.Empty<GUILayoutOption>());
		GUILayout.Label("G", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(15f) });
		SQOLThemeManager.currentTheme.fontGreen = GUILayout.HorizontalSlider(SQOLThemeManager.currentTheme.fontGreen, 0f, 1f, Array.Empty<GUILayoutOption>());
		GUILayout.Label("B", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(15f) });
		SQOLThemeManager.currentTheme.fontBlue = GUILayout.HorizontalSlider(SQOLThemeManager.currentTheme.fontBlue, 0f, 1f, Array.Empty<GUILayoutOption>());
		GUILayout.EndHorizontal();
		GUILayout.Space(10f);
		GUILayout.Label("Available Images in 'Themes' folder:", Array.Empty<GUILayoutOption>());
		bgScrollPos = GUILayout.BeginScrollView(bgScrollPos, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(80f) });
		GUI.backgroundColor = (string.IsNullOrEmpty(SQOLThemeManager.currentTheme.customBgImageName) ? Color.cyan : Color.white);
		if (GUILayout.Button("NONE (Default Transparent)", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(25f) }))
		{
			SQOLThemeManager.currentTheme.customBgImageName = "";
			LoadCustomBackgroundTexture();
		}
		foreach (string availableBgImage in availableBgImages)
		{
			GUI.backgroundColor = ((SQOLThemeManager.currentTheme.customBgImageName == availableBgImage) ? Color.cyan : Color.white);
			if (GUILayout.Button(availableBgImage, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(25f) }))
			{
				SQOLThemeManager.currentTheme.customBgImageName = availableBgImage;
				LoadCustomBackgroundTexture();
			}
		}
		GUI.backgroundColor = Color.white;
		GUILayout.EndScrollView();
		GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
		if (GUILayout.Button("\ud83d\udd04 REFRESH FOLDER", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(25f) }))
		{
			RefreshAvailableImages();
		}
		GUI.backgroundColor = new Color(0.4f, 1f, 0.4f);
		if (GUILayout.Button("\ud83d\udcbe SAVE THEME", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(25f) }))
		{
			SQOLThemeManager.SaveTheme();
		}
		GUI.backgroundColor = Color.white;
		GUILayout.EndHorizontal();
		GUI.DragWindow(new Rect(0f, 0f, 10000f, 25f));
	}

	private void DrawCameraWindow(int id)
	{
		//IL_0029: Unknown result type (might be due to invalid IL or missing references)
		//IL_0013: Unknown result type (might be due to invalid IL or missing references)
		//IL_0072: Unknown result type (might be due to invalid IL or missing references)
		//IL_0496: Unknown result type (might be due to invalid IL or missing references)
		//IL_049b: Unknown result type (might be due to invalid IL or missing references)
		//IL_04a3: Unknown result type (might be due to invalid IL or missing references)
		//IL_04b5: Expected O, but got Unknown
		//IL_0199: Unknown result type (might be due to invalid IL or missing references)
		//IL_019e: Unknown result type (might be due to invalid IL or missing references)
		//IL_01b0: Expected O, but got Unknown
		//IL_01d1: Unknown result type (might be due to invalid IL or missing references)
		//IL_04cb: Unknown result type (might be due to invalid IL or missing references)
		//IL_0219: Unknown result type (might be due to invalid IL or missing references)
		//IL_0250: Unknown result type (might be due to invalid IL or missing references)
		//IL_0316: Unknown result type (might be due to invalid IL or missing references)
		//IL_0347: Unknown result type (might be due to invalid IL or missing references)
		//IL_034c: Unknown result type (might be due to invalid IL or missing references)
		//IL_035e: Expected O, but got Unknown
		//IL_0379: Unknown result type (might be due to invalid IL or missing references)
		//IL_03c0: Unknown result type (might be due to invalid IL or missing references)
		//IL_03f8: Unknown result type (might be due to invalid IL or missing references)
		//IL_0423: Unknown result type (might be due to invalid IL or missing references)
		//IL_046d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0452: Unknown result type (might be due to invalid IL or missing references)
		//IL_0457: Unknown result type (might be due to invalid IL or missing references)
		GUILayout.Space(5f);
		GUI.backgroundColor = (Color)(isCameraOverrideEnabled ? new Color(0.5f, 1f, 0.5f) : Color.white);
		if (GUILayout.Button(isCameraOverrideEnabled ? "\ud83d\udd12 UNLOCK CAMERA: ON" : "\ud83d\udd12 UNLOCK CAMERA: OFF", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(30f) }))
		{
			isCameraOverrideEnabled = !isCameraOverrideEnabled;
		}
		GUI.backgroundColor = Color.white;
		if (isCameraOverrideEnabled)
		{
			GUILayout.Space(5f);
			GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
			GUILayout.Label("MOVE SPEED:", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(95f) });
			camMoveSpeed = GUILayout.HorizontalSlider(camMoveSpeed, 1f, 30f, Array.Empty<GUILayoutOption>());
			GUILayout.Label(camMoveSpeed.ToString("F1"), (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(35f) });
			GUILayout.EndHorizontal();
			GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
			GUILayout.Label("ZOOM SPEED:", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(95f) });
			camZoomSpeed = GUILayout.HorizontalSlider(camZoomSpeed, 1f, 50f, Array.Empty<GUILayoutOption>());
			GUILayout.Label(camZoomSpeed.ToString("F1"), (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(35f) });
			GUILayout.EndHorizontal();
			GUILayout.Space(5f);
			GUILayout.Label("PAN CAMERA (HOLD TO MOVE)", new GUIStyle(GUI.skin.label)
			{
				alignment = (TextAnchor)4
			}, Array.Empty<GUILayoutOption>());
			GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
			GUILayout.FlexibleSpace();
			GUI.backgroundColor = new Color(0.8f, 0.8f, 1f);
			if (GUILayout.RepeatButton("▲ UP", (GUILayoutOption[])(object)new GUILayoutOption[2]
			{
				GUILayout.Width(70f),
				GUILayout.Height(30f)
			}))
			{
				pendingPanInput.y = 1f;
			}
			GUI.backgroundColor = Color.white;
			GUILayout.FlexibleSpace();
			GUILayout.EndHorizontal();
			GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
			GUILayout.FlexibleSpace();
			GUI.backgroundColor = new Color(0.8f, 0.8f, 1f);
			if (GUILayout.RepeatButton("◀ LEFT", (GUILayoutOption[])(object)new GUILayoutOption[2]
			{
				GUILayout.Width(70f),
				GUILayout.Height(30f)
			}))
			{
				pendingPanInput.x = -1f;
			}
			if (GUILayout.RepeatButton("▼ DOWN", (GUILayoutOption[])(object)new GUILayoutOption[2]
			{
				GUILayout.Width(70f),
				GUILayout.Height(30f)
			}))
			{
				pendingPanInput.y = -1f;
			}
			if (GUILayout.RepeatButton("RIGHT ▶", (GUILayoutOption[])(object)new GUILayoutOption[2]
			{
				GUILayout.Width(70f),
				GUILayout.Height(30f)
			}))
			{
				pendingPanInput.x = 1f;
			}
			GUI.backgroundColor = Color.white;
			GUILayout.FlexibleSpace();
			GUILayout.EndHorizontal();
			GUILayout.Space(5f);
			GUILayout.Label("ZOOM CAMERA", new GUIStyle(GUI.skin.label)
			{
				alignment = (TextAnchor)4
			}, Array.Empty<GUILayoutOption>());
			GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
			GUI.backgroundColor = new Color(0.5f, 1f, 0.5f);
			if (GUILayout.RepeatButton("➕ ZOOM IN", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(30f) }))
			{
				pendingZoomInput = -1f;
			}
			GUI.backgroundColor = new Color(1f, 0.5f, 0.5f);
			if (GUILayout.RepeatButton("➖ ZOOM OUT", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(30f) }))
			{
				pendingZoomInput = 1f;
			}
			GUI.backgroundColor = Color.white;
			GUILayout.EndHorizontal();
			GUILayout.Space(8f);
			GUI.backgroundColor = new Color(1f, 0.8f, 0.4f);
			if (GUILayout.Button("\ud83d\udd04 RESET CAMERA", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(25f) }))
			{
				customPanOffset = Vector2.zero;
				customZoomDelta = 0f;
				requestCameraReset = true;
			}
			GUI.backgroundColor = Color.white;
		}
		else
		{
			GUILayout.Space(15f);
			GUILayout.Label("Turn on 'Unlock Camera'\nto uncap zoom & pan freely.", new GUIStyle(GUI.skin.label)
			{
				alignment = (TextAnchor)4,
				fontStyle = (FontStyle)2
			}, Array.Empty<GUILayoutOption>());
		}
		GUI.DragWindow(new Rect(0f, 0f, 10000f, 25f));
	}

	private void DrawPropListWindow(int id)
	{
		//IL_001f: Unknown result type (might be due to invalid IL or missing references)
		//IL_003a: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b6: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ce: Unknown result type (might be due to invalid IL or missing references)
		//IL_00d3: Unknown result type (might be due to invalid IL or missing references)
		//IL_006b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0070: Unknown result type (might be due to invalid IL or missing references)
		//IL_0079: Unknown result type (might be due to invalid IL or missing references)
		//IL_0082: Expected O, but got Unknown
		//IL_0097: Unknown result type (might be due to invalid IL or missing references)
		//IL_03ce: Unknown result type (might be due to invalid IL or missing references)
		//IL_032d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0343: Unknown result type (might be due to invalid IL or missing references)
		//IL_0349: Invalid comparison between Unknown and I4
		//IL_015e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0164: Invalid comparison between Unknown and I4
		//IL_01d4: Unknown result type (might be due to invalid IL or missing references)
		//IL_017c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0182: Invalid comparison between Unknown and I4
		//IL_01fe: Unknown result type (might be due to invalid IL or missing references)
		//IL_01f1: Unknown result type (might be due to invalid IL or missing references)
		//IL_02e7: Unknown result type (might be due to invalid IL or missing references)
		//IL_02ec: Unknown result type (might be due to invalid IL or missing references)
		//IL_02f3: Unknown result type (might be due to invalid IL or missing references)
		//IL_02f8: Unknown result type (might be due to invalid IL or missing references)
		//IL_02fc: Unknown result type (might be due to invalid IL or missing references)
		if (currentEquippedWrappers.Count == 0)
		{
			GUILayout.Space(5f);
			GUI.contentColor = Color.gray;
			GUILayout.Label("No props equipped yet.", Array.Empty<GUILayoutOption>());
			GUI.contentColor = Color.white;
		}
		else
		{
			GUILayout.Space(5f);
			if (isGroupModeEnabled)
			{
				GUIStyle val = new GUIStyle(GUI.skin.label)
				{
					fontSize = 11,
					fontStyle = (FontStyle)2
				};
				val.normal.textColor = new Color(1f, 0.85f, 0.3f);
				GUILayout.Label("\ud83d\udca1 Right-Click items below to link/unlink Group!", val, Array.Empty<GUILayoutOption>());
			}
			propListScrollPos = GUILayout.BeginScrollView(propListScrollPos, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(340f) });
			object obj = null;
			for (int i = 0; i < currentEquippedWrappers.Count; i++)
			{
				object obj2 = currentEquippedWrappers[i];
				if (obj2 == null)
				{
					continue;
				}
				string text = "UNKNOWN PROP";
				string text2 = "";
				EquipedClothingWrapper val2 = (EquipedClothingWrapper)((obj2 is EquipedClothingWrapper) ? obj2 : null);
				if (val2 != null)
				{
					if ((Object)(object)((EquipedWrapper)val2).prop != (Object)null)
					{
						text = ((Object)((EquipedWrapper)val2).prop).name;
					}
					if (((EquipedWrapper)val2).propData != null)
					{
						if ((int)((EquipedWrapper)val2).propData.m_equip == 1)
						{
							text2 = " [L]";
						}
						else if ((int)((EquipedWrapper)val2).propData.m_equip == 2)
						{
							text2 = " [R]";
						}
					}
				}
				bool flag = isGroupModeEnabled && (Object)(object)HoverXRayGlobalManager.Instance != (Object)null && HoverXRayGlobalManager.Instance.markedForGroup.Contains(obj2);
				if (flag)
				{
					GUI.backgroundColor = new Color(1f, 0.85f, 0.3f);
				}
				else if (lastSelectedWrapper == obj2)
				{
					GUI.backgroundColor = Color.cyan;
				}
				else
				{
					GUI.backgroundColor = Color.white;
				}
				GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
				string text3 = (flag ? "\ud83d\udd17 " : "");
				if (GUILayout.Button($"{text3}{i + 1}. {text}{text2}", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(25f) }))
				{
					if (Event.current.button == 1 && isGroupModeEnabled && (Object)(object)HoverXRayGlobalManager.Instance != (Object)null)
					{
						HoverXRayGlobalManager.Instance.ToggleMarkForGroupWrapper(obj2);
						if (!showTransformUI)
						{
							showTransformUI = true;
						}
					}
					else
					{
						UpdateSelectedWrapper(obj2);
						if (!showTransformUI)
						{
							showTransformUI = true;
						}
					}
				}
				GUILayout.EndHorizontal();
				Rect lastRect = GUILayoutUtility.GetLastRect();
				Vector2 mousePosition = Event.current.mousePosition;
				if (((Rect)(ref lastRect)).Contains(mousePosition))
				{
					obj = obj2;
				}
			}
			GUI.backgroundColor = Color.white;
			GUILayout.EndScrollView();
			if ((int)Event.current.type == 7 && obj != currentHoveredInList)
			{
				currentHoveredInList = obj;
				if ((Object)(object)HoverXRayGlobalManager.Instance != (Object)null)
				{
					if (currentHoveredInList != null && isHoverXRayEnabled)
					{
						HoverXRayGlobalManager.Instance.HighlightPropFromWrapper(currentHoveredInList);
					}
					else
					{
						HoverXRayGlobalManager.Instance.ClearHighlight();
					}
				}
			}
		}
		GUI.DragWindow(new Rect(0f, 0f, 10000f, 25f));
	}

	private void DrawTransformWindow(int id)
	{
		//IL_04cb: Unknown result type (might be due to invalid IL or missing references)
		//IL_04d2: Expected O, but got Unknown
		//IL_04e8: Unknown result type (might be due to invalid IL or missing references)
		//IL_0598: 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_005e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0068: Expected O, but got Unknown
		//IL_007e: Unknown result type (might be due to invalid IL or missing references)
		//IL_05f0: 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_0211: Unknown result type (might be due to invalid IL or missing references)
		//IL_0219: Unknown result type (might be due to invalid IL or missing references)
		//IL_0224: Expected O, but got Unknown
		//IL_023a: Unknown result type (might be due to invalid IL or missing references)
		//IL_02e2: Unknown result type (might be due to invalid IL or missing references)
		//IL_0333: Unknown result type (might be due to invalid IL or missing references)
		//IL_0371: Unknown result type (might be due to invalid IL or missing references)
		//IL_066f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0639: Unknown result type (might be due to invalid IL or missing references)
		//IL_0640: Expected O, but got Unknown
		GUILayout.Space(5f);
		if (isGroupModeEnabled && (Object)(object)HoverXRayGlobalManager.Instance != (Object)null && HoverXRayGlobalManager.Instance.markedForGroup.Count > 0)
		{
			int count = HoverXRayGlobalManager.Instance.markedForGroup.Count;
			GUIStyle val = new GUIStyle(GUI.skin.label)
			{
				fontStyle = (FontStyle)1
			};
			val.normal.textColor = new Color(1f, 0.85f, 0.3f);
			GUILayout.Label($"\ud83d\udd17 GROUP LINK ACTIVE ({count} ITEMS)", val, Array.Empty<GUILayoutOption>());
			bool flag = GUILayout.Toggle(scaleGroupDistance, " Scale Distance as 1 Combined Object", Array.Empty<GUILayoutOption>());
			if (flag != scaleGroupDistance)
			{
				scaleGroupDistance = flag;
				ApplyGroupTransform();
			}
			GUILayout.Space(5f);
			GUILayout.Label("GROUP SCALE MULTIPLIER (1 = Original Size)", Array.Empty<GUILayoutOption>());
			DrawGroupUniformScaleControl();
			DrawGroupAxisControl("X:", "GrpScaleXField", ref groupScaleX, 0.1f, 5f, 0);
			DrawGroupAxisControl("Y:", "GrpScaleYField", ref groupScaleY, 0.1f, 5f, 0);
			DrawGroupAxisControl("Z:", "GrpScaleZField", ref groupScaleZ, 0.1f, 5f, 0);
			GUILayout.Space(5f);
			GUILayout.Label("GROUP MOVE OFFSET (Shift All Together)", Array.Empty<GUILayoutOption>());
			DrawGroupAxisControl("X:", "GrpPosXField", ref groupPosX, -5f, 5f, 1);
			DrawGroupAxisControl("Y:", "GrpPosYField", ref groupPosY, -5f, 5f, 1);
			DrawGroupAxisControl("Z:", "GrpPosZField", ref groupPosZ, -5f, 5f, 1);
			GUILayout.Space(8f);
			GUILayout.Label("GROUP ROTATION OFFSET (X, Y, Z)", Array.Empty<GUILayoutOption>());
			GUIStyle val2 = new GUIStyle(GUI.skin.label)
			{
				fontStyle = (FontStyle)1,
				fontSize = 11
			};
			val2.normal.textColor = new Color(1f, 0.75f, 0.2f);
			GUILayout.Label("⚠\ufe0f NOT VANILLA FRIENDLY (Keep 0 for Vanilla)", val2, Array.Empty<GUILayoutOption>());
			DrawGroupAxisControl("X:", "GrpRotXField", ref groupRotX, -180f, 180f, 2);
			DrawGroupAxisControl("Y:", "GrpRotYField", ref groupRotY, -180f, 180f, 2);
			DrawGroupAxisControl("Z:", "GrpRotZField", ref groupRotZ, -180f, 180f, 2);
			GUILayout.Space(6f);
			GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
			GUI.backgroundColor = new Color(0.4f, 1f, 0.5f);
			if (GUILayout.Button("\ud83d\udccc LOCK AS NEW BASE", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(24f) }))
			{
				HoverXRayGlobalManager.Instance.RebakeGroupSnapshots();
				ResetGroupSlidersToNeutral();
			}
			GUI.backgroundColor = new Color(1f, 0.6f, 0.4f);
			if (GUILayout.Button("↩ UNDO CHANGE", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(24f) }))
			{
				ResetGroupSlidersToNeutral();
				ApplyGroupTransform();
			}
			GUI.backgroundColor = Color.white;
			GUILayout.EndHorizontal();
		}
		else
		{
			GUILayout.Label("SELECTED: " + currentPropName, Array.Empty<GUILayoutOption>());
			GUILayout.Space(5f);
			GUILayout.Label("PROP SCALE (X, Y, Z)", Array.Empty<GUILayoutOption>());
			DrawAxisControl("X:", "ScaleXField", ref scaleX, -10f, 10f, 0);
			DrawAxisControl("Y:", "ScaleYField", ref scaleY, -10f, 10f, 0);
			DrawAxisControl("Z:", "ScaleZField", ref scaleZ, -10f, 10f, 0);
			GUILayout.Space(5f);
			GUILayout.Label("PROP POSITION (X, Y, Z)", Array.Empty<GUILayoutOption>());
			DrawAxisControl("X:", "PosXField", ref posX, -10f, 10f, 1);
			DrawAxisControl("Y:", "PosYField", ref posY, -10f, 10f, 1);
			DrawAxisControl("Z:", "PosZField", ref posZ, -10f, 10f, 1);
			GUILayout.Space(8f);
			GUILayout.Label("PROP ROTATION (X, Y, Z)", Array.Empty<GUILayoutOption>());
			GUIStyle val3 = new GUIStyle(GUI.skin.label);
			val3.normal.textColor = new Color(1f, 0.75f, 0.2f);
			val3.fontStyle = (FontStyle)1;
			val3.fontSize = 11;
			GUILayout.Label("⚠\ufe0f NOT VANILLA FRIENDLY (Keep 0 for Vanilla)", val3, Array.Empty<GUILayoutOption>());
			DrawAxisControl("X:", "RotXField", ref rotX, -180f, 180f, 2);
			DrawAxisControl("Y:", "RotYField", ref rotY, -180f, 180f, 2);
			DrawAxisControl("Z:", "RotZField", ref rotZ, -180f, 180f, 2);
			GUILayout.Space(4f);
			GUI.backgroundColor = new Color(1f, 0.7f, 0.4f);
			if (GUILayout.Button("RESET ROTATION (0, 0, 0)", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(22f) }))
			{
				rotX = "0";
				rotY = "0";
				rotZ = "0";
				ApplyTransformToSelectedProp();
			}
			GUI.backgroundColor = Color.white;
		}
		string nameOfFocusedControl = GUI.GetNameOfFocusedControl();
		if (nameOfFocusedControl != lastFocusedControl && nameOfFocusedControl.EndsWith("Field"))
		{
			TextEditor val4 = (TextEditor)GUIUtility.GetStateObject(typeof(TextEditor), GUIUtility.keyboardControl);
			if (val4 != null)
			{
				val4.SelectAll();
			}
			lastFocusedControl = nameOfFocusedControl;
		}
		GUI.DragWindow(new Rect(0f, 0f, 10000f, 25f));
	}

	private void DrawGroupUniformScaleControl()
	{
		//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_0024: Expected O, but got Unknown
		//IL_0039: Unknown result type (might be due to invalid IL or missing references)
		GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
		GUIStyle val = new GUIStyle(GUI.skin.label)
		{
			fontStyle = (FontStyle)1
		};
		val.normal.textColor = new Color(0.6f, 0.9f, 1f);
		GUILayout.Label("ALL:", val, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(40f) });
		float result = 1f;
		float.TryParse(groupUniformScale, out result);
		GUI.SetNextControlName("GrpUniformScaleField");
		string text = GUILayout.TextField(groupUniformScale, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(50f) });
		float num = GUILayout.HorizontalSlider(result, 0.1f, 5f, Array.Empty<GUILayoutOption>());
		GUILayout.EndHorizontal();
		bool flag = false;
		if (Mathf.Abs(num - result) > 0.001f)
		{
			groupUniformScale = num.ToString("F3");
			groupScaleX = groupUniformScale;
			groupScaleY = groupUniformScale;
			groupScaleZ = groupUniformScale;
			flag = true;
		}
		else if (text != groupUniformScale)
		{
			groupUniformScale = text;
			if (float.TryParse(groupUniformScale, out var _))
			{
				groupScaleX = groupUniformScale;
				groupScaleY = groupUniformScale;
				groupScaleZ = groupUniformScale;
				flag = true;
			}
		}
		if (flag)
		{
			ApplyGroupTransform();
		}
	}

	private void DrawGroupAxisControl(string label, string controlName, ref string valStr, float min, float max, int mode)
	{
		//IL_0084: Unknown result type (might be due to invalid IL or missing references)
		//IL_006e: Unknown result type (might be due to invalid IL or missing references)
		//IL_00e5: Unknown result type (might be due to invalid IL or missing references)
		GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
		GUILayout.Label(label, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(15f) });
		float result = ((mode == 0) ? 1f : 0f);
		float.TryParse(valStr, out result);
		string text = ((mode == 2) ? "F0" : "F3");
		bool flag = result < 0f;
		GUI.backgroundColor = (flag ? new Color(1f, 0.5f, 0.5f) : new Color(0.5f, 1f, 0.5f));
		if (GUILayout.Button(flag ? "-" : "+", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(25f) }) && float.TryParse(valStr, out var result2))
		{
			valStr = (0f - result2).ToString(text);
			ApplyGroupTransform();
		}
		GUI.backgroundColor = Color.white;
		GUI.SetNextControlName(controlName);
		string text2 = GUILayout.TextField(valStr, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(50f) });
		float num = GUILayout.HorizontalSlider(result, min, max, Array.Empty<GUILayoutOption>());
		if (mode == 2)
		{
			num = Mathf.Round(num);
		}
		GUILayout.EndHorizontal();
		bool flag2 = false;
		if (Mathf.Abs(num - result) > 0.001f)
		{
			valStr = num.ToString(text);
			flag2 = true;
		}
		else if (text2 != valStr)
		{
			valStr = text2;
			if (float.TryParse(valStr, out var _))
			{
				flag2 = true;
			}
		}
		if (flag2)
		{
			ApplyGroupTransform();
		}
	}

	private void DrawVisibilityWindow(int id)
	{
		//IL_006f: Unknown result type (might be due to invalid IL or missing references)
		GUILayout.Space(5f);
		int num = GUILayout.Toolbar(visibilityMode, new string[3] { "Both", "Left Only", "Right Only" }, Array.Empty<GUILayoutOption>());
		if (num != visibilityMode)
		{
			visibilityMode = num;
			ApplyVisibilityAndRefresh();
		}
		GUI.DragWindow(new Rect(0f, 0f, 10000f, 25f));
	}

	private void DrawPowerToolsWindow(int id)
	{
		//IL_001a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0013: Unknown result type (might be due to invalid IL or missing references)
		//IL_0087: 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_0235: Unknown result type (might be due to invalid IL or missing references)
		//IL_00d4: Unknown result type (might be due to invalid IL or missing references)
		//IL_00cd: Unknown result type (might be due to invalid IL or missing references)
		//IL_0126: Unknown result type (might be due to invalid IL or missing references)
		//IL_011f: 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_0173: Unknown result type (might be due to invalid IL or missing references)
		//IL_0332: Unknown result type (might be due to invalid IL or missing references)
		//IL_0427: Unknown result type (might be due to invalid IL or missing references)
		//IL_0411: Unknown result type (might be due to invalid IL or missing references)
		//IL_03ed: Unknown result type (might be due to invalid IL or missing references)
		//IL_039e: 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_01c8: Unknown result type (might be due to invalid IL or missing references)
		//IL_0211: Unknown result type (might be due to invalid IL or missing references)
		//IL_04cf: Unknown result type (might be due to invalid IL or missing references)
		//IL_04b9: Unknown result type (might be due to invalid IL or missing references)
		//IL_054f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0593: Unknown result type (might be due to invalid IL or missing references)
		//IL_0698: Unknown result type (might be due to invalid IL or missing references)
		//IL_05d8: Unknown result type (might be due to invalid IL or missing references)
		//IL_0632: Unknown result type (might be due to invalid IL or missing references)
		//IL_0677: Unknown result type (might be due to invalid IL or missing references)
		GUILayout.Space(5f);
		GUI.backgroundColor = (isHoverXRayEnabled ? Color.cyan : Color.white);
		if (GUILayout.Button(isHoverXRayEnabled ? "HOVER X-RAY: ON" : "HOVER X-RAY: OFF", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(30f) }))
		{
			isHoverXRayEnabled = !isHoverXRayEnabled;
			if (!isHoverXRayEnabled && (Object)(object)HoverXRayGlobalManager.Instance != (Object)null)
			{
				HoverXRayGlobalManager.Instance.ClearHighlight();
			}
		}
		GUI.backgroundColor = Color.white;
		if (isHoverXRayEnabled)
		{
			GUILayout.Space(5f);
			GUILayout.Label("X-RAY FILTER (M-EQUIP):", Array.Empty<GUILayoutOption>());
			GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
			GUI.backgroundColor = ((xrayFilterMode == -1) ? Color.cyan : Color.white);
			if (GUILayout.Button("ALL", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(25f) }))
			{
				xrayFilterMode = -1;
				HoverXRayGlobalManager.Instance.ClearHighlight();
			}
			int num = 0;
			GUI.backgroundColor = ((xrayFilterMode == num) ? Color.cyan : Color.white);
			if (GUILayout.Button("BOTH", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(25f) }))
			{
				xrayFilterMode = num;
				HoverXRayGlobalManager.Instance.ClearHighlight();
			}
			int num2 = 1;
			GUI.backgroundColor = ((xrayFilterMode == num2) ? Color.cyan : Color.white);
			if (GUILayout.Button("LEFT", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(25f) }))
			{
				xrayFilterMode = num2;
				HoverXRayGlobalManager.Instance.ClearHighlight();
			}
			int num3 = 2;
			GUI.backgroundColor = ((xrayFilterMode == num3) ? Color.cyan : Color.white);
			if (GUILayout.Button("RIGHT", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(25f) }))
			{
				xrayFilterMode = num3;
				HoverXRayGlobalManager.Instance.ClearHighlight();
			}
			GUI.backgroundColor = Color.white;
			GUILayout.EndHorizontal();
		}
		GUILayout.Space(10f);
		GUI.backgroundColor = (Color)(isGroupModeEnabled ? new Color(1f, 0.85f, 0.3f) : Color.white);
		if (GUILayout.Button(isGroupModeEnabled ? "\ud83d\udd17 GROUP LINK (Right-Click): ON" : "\ud83d\udd17 GROUP LINK (Right-Click): OFF", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(30f) }))
		{
			isGroupModeEnabled = !isGroupModeEnabled;
			if (isGroupModeEnabled)
			{
				isDeleteModeEnabled = false;
				isMassCopyModeEnabled = false;
				if (!showTransformUI)
				{
					showTransformUI = true;
				}
			}
			if ((Object)(object)HoverXRayGlobalManager.Instance != (Object)null)
			{
				HoverXRayGlobalManager.Instance.ClearAllMarks();
			}
			ResetGroupSlidersToNeutral();
		}
		if (isGroupModeEnabled && (Object)(object)HoverXRayGlobalManager.Instance != (Object)null)
		{
			int count = HoverXRayGlobalManager.Instance.markedForGroup.Count;
			GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
			GUI.backgroundColor = new Color(1f, 0.9f, 0.4f);
			if (GUILayout.Button("SELECT ALL PROPS", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(25f) }))
			{
				HoverXRayGlobalManager.Instance.SelectAllForGroup();
				if (!showTransformUI)
				{
					showTransformUI = true;
				}
			}
			if (count > 0)
			{
				GUI.backgroundColor = new Color(1f, 0.5f, 0.5f);
				if (GUILayout.Button($"CLEAR ({count})", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(25f) }))
				{
					HoverXRayGlobalManager.Instance.ClearAllMarks();
					ResetGroupSlidersToNeutral();
				}
			}
			GUI.backgroundColor = Color.white;
			GUILayout.EndHorizontal();
		}
		GUILayout.Space(5f);
		GUI.backgroundColor = (Color)(isDeleteModeEnabled ? new Color(1f, 0.4f, 0.4f) : Color.white);
		if (GUILayout.Button(isDeleteModeEnabled ? "MASS DELETE (Right-Click): ON" : "MASS DELETE (Right-Click): OFF", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(30f) }))
		{
			isDeleteModeEnabled = !isDeleteModeEnabled;
			if (isDeleteModeEnabled)
			{
				isMassCopyModeEnabled = false;
				isGroupModeEnabled = false;
			}
			if ((Object)(object)HoverXRayGlobalManager.Instance != (Object)null)
			{
				HoverXRayGlobalManager.Instance.ClearAllMarks();
			}
		}
		GUILayout.Space(5f);
		GUI.backgroundColor = (Color)(isMassCopyModeEnabled ? new Color(0.4f, 1f, 0.4f) : Color.white);
		if (GUILayout.Button(isMassCopyModeEnabled ? "MASS COPY TO SET (Right-Click): ON" : "MASS COPY TO SET (Right-Click): OFF", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(30f) }))
		{
			isMassCopyModeEnabled = !isMassCopyModeEnabled;
			if (isMassCopyModeEnabled)
			{
				isDeleteModeEnabled = false;
				isGroupModeEnabled = false;
			}
			if ((Object)(object)HoverXRayGlobalManager.Instance != (Object)null)
			{
				HoverXRayGlobalManager.Instance.ClearAllMarks();
			}
		}
		GUI.backgroundColor = Color.white;
		if (isDeleteModeEnabled && (Object)(object)HoverXRayGlobalManager.Instance != (Object)null)
		{
			int count2 = HoverXRayGlobalManager.Instance.markedForDeletion.Count;
			if (count2 > 0)
			{
				GUI.backgroundColor = Color.red;
				if (GUILayout.Button($"CONFIRM DELETE ({count2} ITEMS)", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(35f) }))
				{
					HoverXRayGlobalManager.Instance.ExecuteMassDelete();
				}
				GUI.backgroundColor = Color.white;
			}
		}
		else if (isMassCopyModeEnabled && (Object)(object)HoverXRayGlobalManager.Instance != (Object)null)
		{
			int count3 = HoverXRayGlobalManager.Instance.markedForCopy.Count;
			if (count3 > 0)
			{
				GUI.backgroundColor = new Color(0.2f, 0.8f, 0.2f);
				if (GUILayout.Button($"SAVE SET ({count3} ITEMS)", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(35f) }))
				{
					HoverXRayGlobalManager.Instance.ExecuteMassCopy();
				}
				GUI.backgroundColor = Color.white;
			}
		}
		GUI.DragWindow(new Rect(0f, 0f, 10000f, 25f));
	}

	private void DrawOutfitWindow(int id)
	{
		//IL_0058: Unknown result type (might be due to invalid IL or missing references)
		//IL_0070: Unknown result type (might be due to invalid IL or missing references)
		//IL_0075: Unknown result type (might be due to invalid IL or missing references)
		//IL_001e: 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_03d3: 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_00eb: 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_02d3: Unknown result type (might be due to invalid IL or missing references)
		//IL_0273: Unknown result type (might be due to invalid IL or missing references)
		//IL_028d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0292: Unknown result type (might be due to invalid IL or missing references)
		//IL_02bf: Expected O, but got Unknown
		//IL_01f7: Unknown result type (might be due to invalid IL or missing references)
		//IL_0323: Unknown result type (might be due to invalid IL or missing references)
		//IL_033d: Unknown result type (might be due to invalid IL or missing references)
		//IL_038c: Unknown result type (might be due to invalid IL or missing references)
		if (savedCartridges.Count == 0)
		{
			GUILayout.Space(5f);
			GUI.contentColor = Color.gray;
			GUILayout.Label(" No outfit sets saved yet.", Array.Empty<GUILayoutOption>());
			GUI.contentColor = Color.white;
		}
		else
		{
			GUILayout.Space(5f);
			cartridgeScrollPos = GUILayout.BeginScrollView(cartridgeScrollPos, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(200f) });
			for (int i = 0; i < savedCartridges.Count; i++)
			{
				GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
				GUI.backgroundColor = new Color(0.4f, 1f, 0.4f);
				if (GUILayout.Button("APPLY", (GUILayoutOption[])(object)new GUILayoutOption[2]
				{
					GUILayout.Width(45f),
					GUILayout.Height(25f)
				}))
				{
					HoverXRayGlobalManager.Instance.ExecuteApplyCartridge(savedCartridges[i]);
				}
				GUI.backgroundColor = Color.white;
				string cartridgeName = savedCartridges[i].cartridgeName;
				savedCartridges[i].cartridgeName = GUILayout.TextField(savedCartridges[i].cartridgeName, (GUILayoutOption[])(object)new GUILayoutOption[2]
				{
					GUILayout.Width(130f),
					GUILayout.Height(25f)
				});
				if (cartridgeName != savedCartridges[i].cartridgeName)
				{
					savedCartridges[i].isSavedToFile = false;
				}
				if (savedCartridges[i].showDeleteConfirm)
				{
					GUI.backgroundColor = Color.red;
					if (GUILayout.Button("DEL?", (GUILayoutOption[])(object)new GUILayoutOption[2]
					{
						GUILayout.Width(40f),
						GUILayout.Height(25f)
					}))
					{
						DeleteCartridgeFile(savedCartridges[i]);
						savedCartridges.RemoveAt(i);
						i--;
					}
					else
					{
						GUI.backgroundColor = Color.gray;
						if (GUILayout.Button("NO", (GUILayoutOption[])(object)new GUILayoutOption[2]
						{
							GUILayout.Width(35f),
							GUILayout.Height(25f)
						}))
						{
							savedCartridges[i].showDeleteConfirm = false;
						}
					}
				}
				else
				{
					if (savedCartridges[i].isSavedToFile)
					{
						GUI.backgroundColor = new Color(0.2f, 0.8f, 0.2f);
						GUILayout.Label("[ SAVED ]", new GUIStyle(GUI.skin.label)
						{
							alignment = (TextAnchor)4
						}, (GUILayoutOption[])(object)new GUILayoutOption[2]
						{
							GUILayout.Width(60f),
							GUILayout.Height(25f)
						});
					}
					else
					{
						GUI.backgroundColor = new Color(1f, 0.8f, 0.4f);
						if (GUILayout.Button("[ S ]", (GUILayoutOption[])(object)new GUILayoutOption[2]
						{
							GUILayout.Width(60f),
							GUILayout.Height(25f)
						}))
						{
							SaveSingleCartridge(savedCartridges[i]);
						}
					}
					GUI.backgroundColor = Color.white;
					GUI.backgroundColor = new Color(1f, 0.4f, 0.4f);
					if (GUILayout.Button("X", (GUILayoutOption[])(object)new GUILayoutOption[2]
					{
						GUILayout.Width(25f),
						GUILayout.Height(25f)
					}))
					{
						savedCartridges[i].showDeleteConfirm = true;
					}
				}
				GUI.backgroundColor = Color.white;
				GUILayout.EndHorizontal();
			}
			GUILayout.EndScrollView();
		}
		GUI.DragWindow(new Rect(0f, 0f, 10000f, 25f));
	}

	private void DrawScrollWindow(int id)
	{
		//IL_009d: 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_011c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0141: Unknown result type (might be due to invalid IL or missing references)
		GUILayout.Space(5f);
		GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
		GUILayout.Label("SPEED:", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(50f) });
		pullSpeed = GUILayout.HorizontalSlider(pullSpeed, 100f, 5000f, Array.Empty<GUILayoutOption>());
		GUILayout.Label(((int)pullSpeed).ToString(), (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(40f) });
		GUILayout.EndHorizontal();
		GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
		GUI.backgroundColor = new Color(0.2f, 0.8f, 0.2f);
		if (GUILayout.RepeatButton("▲\nSCROLL UP", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(40f) }))
		{
			PullCardGrid(-1f);
		}
		GUI.backgroundColor = new Color(0.8f, 0.2f, 0.2f);
		if (GUILayout.RepeatButton("▼\nSCROLL DOWN", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(40f) }))
		{
			PullCardGrid(1f);
		}
		GUI.backgroundColor = Color.white;
		GUILayout.EndHorizontal();
		GUI.DragWindow(new Rect(0f, 0f, 10000f, 25f));
	}

	private void DrawAxisControl(string label, string controlName, ref string valStr, float min, float max, int mode)
	{
		//IL_0084: Unknown result type (might be due to invalid IL or missing references)
		//IL_006e: Unknown result type (might be due to invalid IL or missing references)
		//IL_00e5: Unknown result type (might be due to invalid IL or missing references)
		GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
		GUILayout.Label(label, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(15f) });
		float result = ((mode == 0) ? 1f : 0f);
		float.TryParse(valStr, out result);
		string text = ((mode == 2) ? "F0" : "F3");
		bool flag = result < 0f;
		GUI.backgroundColor = (flag ? new Color(1f, 0.5f, 0.5f) : new Color(0.5f, 1f, 0.5f));
		if (GUILayout.Button(flag ? "-" : "+", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(25f) }) && float.TryParse(valStr, out var result2))
		{
			valStr = (0f - result2).ToString(text);
			ApplyTransformToSelectedProp();
		}
		GUI.backgroundColor = Color.white;
		GUI.SetNextControlName(controlName);
		string text2 = GUILayout.TextField(valStr, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(50f) });
		float num = GUILayout.HorizontalSlider(result, min, max, Array.Empty<GUILayoutOption>());
		if (mode == 2)
		{
			num = Mathf.Round(num);
		}
		GUILayout.EndHorizontal();
		bool flag2 = false;
		if (Mathf.Abs(num - result) > 0.001f)
		{
			valStr = num.ToString(text);
			flag2 = true;
		}
		else if (text2 != valStr)
		{
			valStr = text2;
			if (float.TryParse(valStr, out var _))
			{
				flag2 = true;
			}
		}
		if (flag2)
		{
			ApplyTransformToSelectedProp();
		}
	}

	private void PullCardGrid(float direction)
	{
		//IL_0029: 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_0073: Unknown result type (might be due to invalid IL or missing references)
		//IL_008c: Unknown result type (might be due to invalid IL or missing references)
		ScrollRect[] array = Object.FindObjectsOfType<ScrollRect>();
		ScrollRect[] array2 = array;
		foreach (ScrollRect val in array2)
		{
			if (((Component)val).gameObject.activeInHierarchy && ((Component)val).transform.position.x < (float)(Screen.width / 2) && val.vertical)
			{
				RectTransform content = val.content;
				if ((Object)(object)content != (Object)null)
				{
					content.anchoredPosition = new Vector2(content.anchoredPosition.x, content.anchoredPosition.y + direction * pullSpeed * Time.deltaTime);
				}
			}
		}
	}

	public void UpdateSelectedWrapper(object wrapper)
	{
		//IL_00ca: Unknown result type (might be due to invalid IL or missing references)
		//IL_00cf: Unknown result type (might be due to invalid IL or missing references)
		//IL_0147: 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_014e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0212: Unknown result type (might be due to invalid IL or missing references)
		//IL_0217: Unknown result type (might be due to invalid IL or missing references)
		//IL_022f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0231: Invalid comparison between I4 and Unknown
		if (wrapper == null)
		{
			return;
		}
		FieldInfo field = wrapper.GetType().GetField("propData", BindingFlags.Instance | BindingFlags.Public);
		FieldInfo field2 = wrapper.GetType().GetField("prop", BindingFlags.Instance | BindingFlags.Public);
		if (!(field != null) || !(field2 != null))
		{
			return;
		}
		object value = field.GetValue(wrapper);
		object? value2 = field2.GetValue(wrapper);
		CharacterItem val = (CharacterItem)((value2 is CharacterItem) ? value2 : null);
		if (value == null)
		{
			return;
		}
		if ((Object)(object)val != (Object)null)
		{
			currentPropName = ((Object)val).name;
		}
		else
		{
			currentPropName = "UNKNOWN PROP";
		}
		FieldInfo field3 = value.GetType().GetField("m_scale", BindingFlags.Instance | BindingFlags.Public);
		if (field3 != null)
		{
			Vector3 val2 = (Vector3)field3.GetValue(value);
			scaleX = val2.x.ToString("F3");
			scaleY = val2.y.ToString("F3");
			scaleZ = val2.z.ToString("F3");
		}
		FieldInfo field4 = value.GetType().GetField("m_positionOffset", BindingFlags.Instance | BindingFlags.Public);
		if (field4 != null)
		{
			Vector3 encoded = (Vector3)field4.GetValue(value);
			DecodePositionOffset(encoded, out var rot, out var pos);
			posX = pos.x.ToString("F3");
			posY = pos.y.ToString("F3");
			posZ = pos.z.ToString("F3");
			rotX = rot.x.ToString("F0");
			rotY = rot.y.ToString("F0");
			rotZ = rot.z.ToString("F0");
		}
		FieldInfo field5 = value.GetType().GetField("m_equip", BindingFlags.Instance | BindingFlags.Public);
		if (field5 != null)
		{
			EquipType val3 = (EquipType)field5.GetValue(value);
			visibilityMode = 0;
			for (int i = 0; i < equipTypes.Length; i++)
			{
				if ((int)equipTypes[i] == (int)val3)
				{
					visibilityMode = i;
					break;
				}
			}
		}
		lastSelectedWrapper = wrapper;
	}

	private void CheckForSelectedPropUpdate()
	{
		if (Time.time < nextCheckTime)
		{
			return;
		}
		nextCheckTime = Time.time + 0.2f;
		if ((Object)(object)cachedEditorManager == (Object)null)
		{
			cachedEditorManager = Object.FindObjectOfType<UnitEditorManager>();
		}
		if ((Object)(object)cachedEquipedUI == (Object)null && Time.time > uiSearchTimer)
		{
			cachedEquipedUI = Object.FindObjectOfType<UnitEditorEquipedClothing>();
			uiSearchTimer = Time.time + 2f;
		}
		if ((Object)(object)cachedEditorManager != (Object)null)
		{
			FieldInfo field = typeof(UnitEditorManager).GetField("equipedClothes", BindingFlags.Instance | BindingFlags.NonPublic);
			if (field != null && field.GetValue(cachedEditorManager) is IList list)
			{
				currentEquippedWrappers.Clear();
				foreach (object item in list)
				{
					currentEquippedWrappers.Add(item);
				}
			}
		}
		if ((Object)(object)cachedEquipedUI != (Object)null && ((Component)cachedEquipedUI).gameObject.activeInHierarchy)
		{
			FieldInfo field2 = typeof(UnitEditorEquipedClothing).GetField("wrapper", BindingFlags.Instance | BindingFlags.NonPublic);
			if (field2 != null)
			{
				object value = field2.GetValue(cachedEquipedUI);
				if (value != null && value != nativeLastWrapper)
				{
					nativeLastWrapper = value;
					UpdateSelectedWrapper(value);
				}
			}
		}
		else
		{
			nativeLastWrapper = null;
		}
	}

	private void ApplyTransformToSelectedProp()
	{
		//IL_00f9: 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_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_010b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0110: Unknown result type (might be due to invalid IL or missing references)
		//IL_0135: 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_015d: Unknown result type (might be due to invalid IL or missing references)
		if (lastSelectedWrapper == null || !float.TryParse(scaleX, out var result) || !float.TryParse(scaleY, out var result2) || !float.TryParse(scaleZ, out var result3) || !float.TryParse(posX, out var result4) || !float.TryParse(posY, out var result5) || !float.TryParse(posZ, out var result6) || !float.TryParse(rotX, out var result7) || !float.TryParse(rotY, out var result8) || !float.TryParse(rotZ, out var result9))
		{
			return;
		}
		object obj = lastSelectedWrapper;
		EquipedClothingWrapper val = (EquipedClothingWrapper)((obj is EquipedClothingWrapper) ? obj : null);
		if (val != null && ((EquipedWrapper)val).propData != null)
		{
			Vector3 val2 = default(Vector3);
			((Vector3)(ref val2))..ctor(result, result2, result3);
			Vector3 val3 = default(Vector3);
			((Vector3)(ref val3))..ctor(result4, result5, result6);
			Vector3 val4 = default(Vector3);
			((Vector3)(ref val4))..ctor(result7, result8, result9);
			((EquipedWrapper)val).propData.m_scale = val2;
			((EquipedWrapper)val).propData.m_positionOffset = EncodePositionOffset(val4, val3);
			if ((Object)(object)((EquipedWrapper)val).spawnedProp != (Object)null)
			{
				((Component)((EquipedWrapper)val).spawnedProp).transform.localScale = val2;
				((Component)((EquipedWrapper)val).spawnedProp).transform.localPosition = val3;
				((Component)((EquipedWrapper)val).spawnedProp).transform.localEulerAngles = val4;
			}
		}
	}

	public void ApplyGroupTransform()
	{
		//IL_00c5: 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_0150: Unknown result type (might be due to invalid IL or missing references)
		//IL_015e: Unknown result type (might be due to invalid IL or missing references)
		//IL_016c: Unknown result type (might be due to invalid IL or missing references)
		//IL_01d3: Unknown result type (might be due to invalid IL or missing references)
		//IL_01d8: Unknown result type (might be due to invalid IL or missing references)
		//IL_01da: Unknown result type (might be due to invalid IL or missing references)
		//IL_01df: Unknown result type (might be due to invalid IL or missing references)
		//IL_018b: 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_0192: 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_019b: Unknown result type (might be due to invalid IL or missing references)
		//IL_01a4: Unknown result type (might be due to invalid IL or missing references)
		//IL_01ad: Unknown result type (might be due to invalid IL or missing references)
		//IL_01bb: Unknown result type (might be due to invalid IL or missing references)
		//IL_01bd: Unknown result type (might be due to invalid IL or missing references)
		//IL_01bf: Unknown result type (might be due to invalid IL or missing references)
		//IL_01c4: 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_01cb: Unknown result type (might be due to invalid IL or missing references)
		//IL_01e4: Unknown result type (might be due to invalid IL or missing references)
		//IL_01e9: Unknown result type (might be due to invalid IL or missing references)
		//IL_01eb: Unknown result type (might be due to invalid IL or missing references)
		//IL_01f0: 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_01fb: 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_0209: Unknown result type (might be due to invalid IL or missing references)
		//IL_020b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0210: Unknown result type (might be due to invalid IL or missing references)
		//IL_0235: Unknown result type (might be due to invalid IL or missing references)
		//IL_0249: Unknown result type (might be due to invalid IL or missing references)
		//IL_025d: Unknown result type (might be due to invalid IL or missing references)
		if ((Object)(object)HoverXRayGlobalManager.Instance == (Object)null || HoverXRayGlobalManager.Instance.markedForGroup.Count == 0 || !float.TryParse(groupScaleX, out var result) || !float.TryParse(groupScaleY, out var result2) || !float.TryParse(groupScaleZ, out var result3) || !float.TryParse(groupPosX, out var result4) || !float.TryParse(groupPosY, out var result5) || !float.TryParse(groupPosZ, out var result6) || !float.TryParse(groupRotX, out var result7) || !float.TryParse(groupRotY, out var result8) || !float.TryParse(groupRotZ, out var result9))
		{
			return;
		}
		Vector3 groupPivot = HoverXRayGlobalManager.Instance.groupPivot;
		Vector3 val = default(Vector3);
		((Vector3)(ref val))..ctor(result4, result5, result6);
		Vector3 val2 = default(Vector3);
		((Vector3)(ref val2))..ctor(result7, result8, result9);
		Vector3 val4 = default(Vector3);
		Vector3 val6 = default(Vector3);
		foreach (object item in HoverXRayGlobalManager.Instance.markedForGroup)
		{
			EquipedClothingWrapper val3 = (EquipedClothingWrapper)((item is EquipedClothingWrapper) ? item : null);
			if (val3 != null && ((EquipedWrapper)val3).propData != null && HoverXRayGlobalManager.Instance.groupBaseSnapshots.TryGetValue(item, out var value))
			{
				((Vector3)(ref val4))..ctor(value.scale.x * result, value.scale.y * result2, value.scale.z * result3);
				Vector3 val7;
				if (scaleGroupDistance)
				{
					Vector3 val5 = value.pos - groupPivot;
					((Vector3)(ref val6))..ctor(val5.x * result, val5.y * result2, val5.z * result3);
					val7 = groupPivot + val6 + val;
				}
				else
				{
					val7 = value.pos + val;
				}
				Vector3 val8 = value.rot + val2;
				((EquipedWrapper)val3).propData.m_scale = val4;
				((EquipedWrapper)val3).propData.m_positionOffset = EncodePositionOffset(val8, val7);
				if ((Object)(object)((EquipedWrapper)val3).spawnedProp != (Object)null)
				{
					((Component)((EquipedWrapper)val3).spawnedProp).transform.localScale = val4;
					((Component)((EquipedWrapper)val3).spawnedProp).transform.localPosition = val7;
					((Component)((EquipedWrapper)val3).spawnedProp).transform.localEulerAngles = val8;
				}
			}
		}
	}

	private void ApplyVisibilityAndRefresh()
	{
		//IL_003c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0134: Unknown result type (might be due to invalid IL or missing references)
		//IL_0135: 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_00b6: 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_00d6: Unknown result type (might be due to invalid IL or missing references)
		if ((Object)(object)HoverXRayGlobalManager.Instance != (Object)null)
		{
			HoverXRayGlobalManager.Instance.ClearHighlight();
		}
		int num = Mathf.Clamp(visibilityMode, 0, equipTypes.Length - 1);
		EquipType val = equipTypes[num];
		if (isGroupModeEnabled && (Object)(object)HoverXRayGlobalManager.Instance != (Object)null && HoverXRayGlobalManager.Instance.markedForGroup.Count > 0)
		{
			foreach (object item in HoverXRayGlobalManager.Instance.markedForGroup)
			{
				EquipedClothingWrapper val2 = (EquipedClothingWrapper)((item is EquipedClothingWrapper) ? item : null);
				if (val2 != null && ((EquipedWrapper)val2).propData != null)
				{
					((EquipedWrapper)val2).propData.m_equip = val;
					if ((Object)(object)((EquipedWrapper)val2).spawnedProp != (Object)null)
					{
						((EquipedWrapper)val2).spawnedProp.SetEquipType(val);
					}
				}
			}
			return;
		}
		if (lastSelectedWrapper == null)
		{
			return;
		}
		object obj = lastSelectedWrapper;
		EquipedClothingWrapper val3 = (EquipedClothingWrapper)((obj is EquipedClothingWrapper) ? obj : null);
		if (val3 != null && ((EquipedWrapper)val3).propData != null)
		{
			((EquipedWrapper)val3).propData.m_equip = val;
			if ((Object)(object)((EquipedWrapper)val3).spawnedProp != (Object)null)
			{
				((EquipedWrapper)val3).spawnedProp.SetEquipType(val);
			}
		}
	}
}
public class HoverXRayGlobalManager : MonoBehaviour
{
	private Dictionary<Renderer, Material[]> originalMaterials = new Dictionary<Renderer, Material[]>();

	private Material xrayMaterial;

	private float nextInjectionTime = 0f;

	public HashSet<object> markedForDeletion = new HashSet<object>();

	public HashSet<object> markedForCopy = new HashSet<object>();

	public HashSet<object> markedForGroup = new HashSet<object>();

	public Dictionary<object, PropTransformSnapshot> groupBaseSnapshots = new Dictionary<object, PropTransformSnapshot>();

	public Vector3 groupPivot = Vector3.zero;

	public Dictionary<object, UnitEditorEquipedClothingCell> wrapperToCell = new Dictionary<object, UnitEditorEquipedClothingCell>();

	private Dictionary<string, CharacterItem> itemCache = new Dictionary<string, CharacterItem>();

	public static HoverXRayGlobalManager Instance { get; private set; }

	private void Awake()
	{
		Instance = this;
	}

	private void Start()
	{
		//IL_001a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0024: Expected O, but got Unknown
		//IL_003e: Unknown result type (might be due to invalid IL or missing references)
		Shader val = Shader.Find("GUI/Text Shader");
		if ((Object)(object)val != (Object)null)
		{
			xrayMaterial = new Material(val);
			xrayMaterial.color = new Color(0f, 1f, 1f, 0.8f);
		}
	}

	private void Update()
	{
		try
		{
			if ((!((Object)(object)Main.Instance != (Object)null) || Main.Instance.IsUCActive()) && Time.time > nextInjectionTime)
			{
				InjectPointerEventsToCells();
				nextInjectionTime = Time.time + 1f;
			}
		}
		catch (Exception)
		{
		}
	}

	private void InjectPointerEventsToCells()
	{
		if (!((Object)(object)Main.Instance != (Object)null) || !Main.Instance.IsUCActive())
		{
			return;
		}
		UnitEditorEquipedClothingGrid val = Object.FindObjectOfType<UnitEditorEquipedClothingGrid>();
		if (!((Object)(object)val != (Object)null))
		{
			return;
		}
		UnitEditorEquipedClothingCell[] componentsInChildren = ((Component)val).GetComponentsInChildren<UnitEditorEquipedClothingCell>(true);
		FieldInfo field = typeof(UnitEditorEquipedClothingCell).GetField("wrapper", BindingFlags.Instance | BindingFlags.NonPublic);
		UnitEditorEquipedClothingCell[] array = componentsInChildren;
		foreach (UnitEditorEquipedClothingCell val2 in array)
		{
			if (!((Object)(object)val2 != (Object)null) || !((Component)val2).gameObject.activeInHierarchy)
			{
				continue;
			}
			if (field != null)
			{
				object value = field.GetValue(val2);
				if (value != null)
				{
					wrapperToCell[value] = val2;
				}
			}
			if ((Object)(object)((Component)val2).gameObject.GetComponent<XRayCellListener>() == (Object)null)
			{
				XRayCellListener xRayCellListener = ((Component)val2).gameObject.AddComponent<XRayCellListener>();
				xRayCellListener.Setup(val2);
			}
		}
	}

	public void HighlightPropFromCell(UnitEditorEquipedClothingCell cell)
	{
		if (Main.isHoverXRayEnabled)
		{
			FieldInfo field = typeof(UnitEditorEquipedClothingCell).GetField("wrapper", BindingFlags.Instance | BindingFlags.NonPublic);
			if (!(field == null))
			{
				object value = field.GetValue(cell);
				HighlightPropFromWrapper(value);
			}
		}
	}

	public void HighlightPropFromWrapper(object wrapper)
	{
		//IL_0044: Unknown result type (might be due to invalid IL or missing references)
		//IL_004a: Expected I4, but got Unknown
		if (wrapper == null || !Main.isHoverXRayEnabled || (Object)(object)xrayMaterial == (Object)null)
		{
			return;
		}
		EquipedClothingWrapper val = (EquipedClothingWrapper)((wrapper is EquipedClothingWrapper) ? wrapper : null);
		if (val != null && ((EquipedWrapper)val).propData != null)
		{
			int num = (int)((EquipedWrapper)val).propData.m_equip;
			if (Main.xrayFilterMode != -1 && num != Main.xrayFilterMode)
			{
				return;
			}
		}
		ClearHighlight();
		if (val == null || !((Object)(object)((EquipedWrapper)val).spawnedProp != (Object)null))
		{
			return;
		}
		HashSet<Renderer> hashSet = CollectAllPropRenderers(((EquipedWrapper)val).spawnedProp);
		foreach (Renderer item in hashSet)
		{
			ApplyXRayToRenderer(item);
		}
	}

	private HashSet<Renderer> CollectAllPropRenderers(CharacterItem spawnedProp)
	{
		HashSet<Renderer> hashSet = new HashSet<Renderer>();
		if ((Object)(object)spawnedProp == (Object)null)
		{
			return hashSet;
		}
		if ((Object)(object)((Component)spawnedProp).gameObject != (Object)null)
		{
			Renderer[] componentsInChildren = ((Component)spawnedProp).gameObject.GetComponentsInChildren<Renderer>(true);
			foreach (Renderer val in componentsInChildren)
			{
				if ((Object)(object)val != (Object)null)
				{
					hashSet.Add(val);
				}
			}
		}
		Type type = ((object)spawnedProp).GetType();
		while (type != null && type != typeof(MonoBehaviour) && type != typeof(Component) && type != typeof(object))
		{
			FieldInfo[] fields = type.GetFields(BindingFlags.DeclaredOnly | BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
			FieldInfo[] array = fields;
			foreach (FieldInfo fieldInfo in array)
			{
				try
				{
					string text = fieldInfo.Name.ToLower();
					if (!text.Contains("unit") && !text.Contains("root") && !text.Contains("parent") && !text.Contains("catalog"))
					{
						object value = fieldInfo.GetValue(spawnedProp);
						if (value != null)
						{
							ExtractRenderersFromFieldObject(value, text, hashSet);
						}
					}
				}
				catch (Exception)
				{
				}
			}
			type = type.BaseType;
		}
		return hashSet;
	}

	private void ExtractRenderersFromFieldObject(object val, string fieldName, HashSet<Renderer> renderers)
	{
		if (val == null)
		{
			return;
		}
		Renderer val2 = (Renderer)((val is Renderer) ? val : null);
		if (val2 != null)
		{
			renderers.Add(val2);
			return;
		}
		GameObject val3 = (GameObject)((val is GameObject) ? val : null);
		if (val3 != null)
		{
			if (!IsSafePropSubObject(val3) || (!fieldName.Contains("right") && !fieldName.Contains("left") && !fieldName.Contains("rig") && !fieldName.Contains("obj") && !fieldName.Contains("prop") && !fieldName.Contains("mesh")))
			{
				return;
			}
			Renderer[] componentsInChildren = val3.GetComponentsInChildren<Renderer>(true);
			foreach (Renderer val4 in componentsInChildren)
			{
				if ((Object)(object)val4 != (Object)null)
				{
					renderers.Add(val4);
				}
			}
		}
		else
		{
			if (!(val is IEnumerable enumerable) || val is string || val is Transform)
			{
				return;
			}
			foreach (object item in enumerable)
			{
				if (item == null)
				{
					continue;
				}
				Renderer val5 = (Renderer)((item is Renderer) ? item : null);
				if (val5 != null)
				{
					renderers.Add(val5);
					continue;
				}
				GameObject val6 = (GameObject)((item is GameObject) ? item : null);
				if (val6 != null)
				{
					if (!IsSafePropSubObject(val6))
					{
						continue;
					}
					Renderer[] componentsInChildren2 = val6.GetComponentsInChildren<Renderer>(true);
					foreach (Renderer val7 in componentsInChildren2)
					{
						if ((Object)(object)val7 != (Object)null)
						{
							renderers.Add(val7);
						}
					}
					continue;
				}
				FieldInfo[] fields = item.GetType().GetFields(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
				FieldInfo[] array = fields;
				foreach (FieldInfo fieldInfo in array)
				{
					if (typeof(Renderer).IsAssignableFrom(fieldInfo.FieldType))
					{
						object? value = fieldInfo.GetValue(item);
						Renderer val8 = (Renderer)((value is Renderer) ? value : null);
						if ((Object)(object)val8 != (Object)null)
						{
							renderers.Add(val8);
						}
					}
				}
			}
		}
	}

	private bool IsSafePropSubObject(GameObject go)
	{
		if ((Object)(object)go == (Object)null)
		{
			return false;
		}
		if ((Object)(object)go.GetComponent<Unit>() != (Object)null || (Object)(object)go.GetComponent<UnitRig>() != (Object)null)
		{
			return false;
		}
		return true;
	}

	private void ApplyXRayToRenderer(Renderer r)
	{
		if (!((Object)(object)r == (Object)null) && !((Object)(object)xrayMaterial == (Object)null) && !originalMaterials.ContainsKey(r))
		{
			originalMaterials[r] = r.sharedMaterials;
			Material[] array = (Material[])(object)new Material[r.sharedMaterials.Length];
			for (int i = 0; i < array.Length; i++)
			{
				array[i] = xrayMaterial;
			}
			r.sharedMaterials = array;
		}
	}

	public void ClearHighlight()
	{
		foreach (KeyValuePair<Renderer, Material[]> originalMaterial in originalMaterials)
		{
			if ((Object)(object)originalMaterial.Key != (Object)null)
			{
				originalMaterial.Key.sharedMaterials = originalMaterial.Value;
			}
		}
		originalMaterials.Clear();
	}

	private void TintCell(UnitEditorEquipedClothingCell cell, Color color)
	{
		//IL_0021: 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)
		if ((Object)(object)cell == (Object)null)
		{
			return;
		}
		Image component = ((Component)cell).GetComponent<Image>();
		if ((Object)(object)component != (Object)null)
		{
			((Graphic)component).color = color;
		}
		FieldInfo field = typeof(UnitEditorEquipedClothingCell).GetField("icon", BindingFlags.Instance | BindingFlags.NonPublic);
		if (field != null)
		{
			object? value = field.GetValue(cell);
			Image val = (Image)((value is Image) ? value : null);
			if ((Object)(object)val != (Object)null)
			{
				((Graphic)val).color = color;
			}
		}
	}

	public void ClearAllMarks()
	{
		//IL_002a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0080: Unknown result type (might be due to invalid IL or missing references)
		//IL_0085: Unknown result type (might be due to invalid IL or missing references)
		foreach (UnitEditorEquipedClothingCell value in wrapperToCell.Values)
		{
			if ((Object)(object)value != (Object)null)
			{
				TintCell(value, Color.white);
			}
		}
		markedForDeletion.Clear();
		markedForCopy.Clear();
		markedForGroup.Clear();
		groupBaseSnapshots.Clear();
		groupPivot = Vector3.zero;
	}

	public void RebakeGroupSnapshots()
	{
		//IL_0030: Unknown result type (might be due to invalid IL or missing references)
		//IL_0035: Unknown result type (might be due to invalid IL or missing references)
		//IL_0021: Unknown result type (might be due to invalid IL or missing references)
		//IL_0026: Unknown result type (might be due to invalid IL or missing references)
		//IL_0104: 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_00fd: Unknown result type (might be due to invalid IL or missing references)
		//IL_007c: Unknown result type (might be due to invalid IL or missing references)
		//IL_009c: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a1: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a8: 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_00b1: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b3: Unknown result type (might be due to invalid IL or missing references)
		//IL_00cc: Unknown result type (might be due to invalid IL or missing references)
		//IL_00cd: Unknown result type (might be due to invalid IL or missing references)
		//IL_00cf: Unknown result type (might be due to invalid IL or missing references)
		//IL_00d4: Unknown result type (might be due to invalid IL or missing references)
		//IL_010c: Unknown result type (might be due to invalid IL or missing references)
		groupBaseSnapshots.Clear();
		if (markedForGroup.Count == 0)
		{