Decompiled source of Crawl Braised Ducks UC Kit v1.1.0

ClothingEquipEditor.dll

Decompiled a week ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Reflection.Emit;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using System.Text;
using BepInEx;
using BepInEx.Logging;
using DM;
using HarmonyLib;
using Landfall.TABS;
using Landfall.TABS.UnitEditor;
using Landfall.TABS.Workshop;
using Microsoft.CodeAnalysis;
using UnityEngine;
using UnityEngine.SceneManagement;
using UnityEngine.UI;

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

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace ClothingEquipEditor
{
	public class EquipEditorUI : MonoBehaviour
	{
		private class ClothingListEntry
		{
			public EquipedWrapper wrapper;

			public string displayName;

			public string equipSide;

			public int index;
		}

		public class SideTransforms
		{
			public Vector3 leftPosition = Vector3.zero;

			public Vector3 leftRotation = Vector3.zero;

			public Vector3 leftScale = Vector3.one;

			public Vector3 rightPosition = Vector3.zero;

			public Vector3 rightRotation = Vector3.zero;

			public Vector3 rightScale = Vector3.one;

			public bool HasRightOverride()
			{
				//IL_0001: 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_0019: Unknown result type (might be due to invalid IL or missing references)
				//IL_001f: Unknown result type (might be due to invalid IL or missing references)
				//IL_0031: Unknown result type (might be due to invalid IL or missing references)
				//IL_0037: Unknown result type (might be due to invalid IL or missing references)
				if (!(Vector3.Distance(leftPosition, rightPosition) > 0.001f) && !(Vector3.Distance(leftRotation, rightRotation) > 0.001f))
				{
					return Vector3.Distance(leftScale, rightScale) > 0.001f;
				}
				return true;
			}
		}

		private bool showUI;

		private Rect windowRect = new Rect(0f, 0f, 380f, 680f);

		private const float BASE_WIDTH = 1920f;

		private const float BASE_HEIGHT = 1080f;

		private float uiScale = 1f;

		private int lastScreenWidth;

		private int lastScreenHeight;

		private EquipedClothingWrapper currentWrapper;

		private string[] equipTypeNames = new string[3] { "CEE_EQUIP_BOTH", "CEE_EQUIP_LEFT", "CEE_EQUIP_RIGHT" };

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

		private int selectedEquipIndex;

		private Vector3 positionOffset = Vector3.zero;

		private Vector3 scale = Vector3.one;

		private Vector3 rotation = Vector3.zero;

		private bool showPositionSection = true;

		private bool showRotationSection = true;

		private bool showScaleSection = true;

		private bool showEquipSection = true;

		private bool showClothingListSection = true;

		private bool memoryMode;

		private int editTargetSide;

		private string[] editTargetNames = new string[3] { "CEE_TARGET_BOTH", "CEE_TARGET_LEFT", "CEE_TARGET_RIGHT" };

		private List<ClothingListEntry> clothingList = new List<ClothingListEntry>();

		private int selectedClothingIndex = -1;

		private Vector2 clothingScrollPos = Vector2.zero;

		private float clothingListRefreshTimer;

		private const float CLOTHING_LIST_REFRESH_INTERVAL = 0.5f;

		private Texture2D texWindowBg;

		private Texture2D texHeaderBg;

		private Texture2D texSectionBg;

		private Texture2D texBtnNormal;

		private Texture2D texBtnHover;

		private Texture2D texBtnActive;

		private Texture2D texBtnSelected;

		private Texture2D texCloseNormal;

		private Texture2D texCloseHover;

		private Texture2D texInputBg;

		private Texture2D texSliderBg;

		private Texture2D texSliderFill;

		private Texture2D texSepLine;

		private Texture2D texItemNormal;

		private Texture2D texItemSelected;

		private GUIStyle styleWindow;

		private GUIStyle styleHeaderLabel;

		private GUIStyle styleSectionToggle;

		private GUIStyle styleAxisLabel;

		private GUIStyle styleTextField;

		private GUIStyle styleCloseBtn;

		private GUIStyle styleActionBtn;

		private GUIStyle styleEquipBtn;

		private GUIStyle styleEquipBtnSel;

		private GUIStyle styleClothingName;

		private GUIStyle styleSlider;

		private GUIStyle styleSliderThumb;

		private GUIStyle styleItemBtn;

		private GUIStyle styleItemBtnSel;

		private GUIStyle styleItemLabel;

		private GUIStyle styleItemSideLabel;

		private bool stylesInitialized;

		private bool translationsInjected;

		private static readonly string L_TITLE = "CEE_TITLE";

		private static readonly string L_CURR_CLOTHING = "CEE_CURR_CLOTHING";

		private static readonly string L_UNKNOWN = "CEE_UNKNOWN";

		private static readonly string L_SEC_EQUIP = "CEE_SEC_EQUIP";

		private static readonly string L_SEC_ROTATION = "CEE_SEC_ROTATION";

		private static readonly string L_SEC_POSITION = "CEE_SEC_POSITION";

		private static readonly string L_SEC_SCALE = "CEE_SEC_SCALE";

		private static readonly string L_EQUIP_BOTH = "CEE_EQUIP_BOTH";

		private static readonly string L_EQUIP_LEFT = "CEE_EQUIP_LEFT";

		private static readonly string L_EQUIP_RIGHT = "CEE_EQUIP_RIGHT";

		private static readonly string L_RESET_ROT = "CEE_RESET_ROTATION";

		private static readonly string L_RESET_POS = "CEE_RESET_POSITION";

		private static readonly string L_RESET_SCALE = "CEE_RESET_SCALE";

		private static readonly string L_RESET_ALL = "CEE_RESET_ALL";

		private static readonly string L_CLOSE = "CEE_CLOSE";

		private static readonly string L_SEC_CLOTHING_LIST = "CEE_SEC_CLOTHING_LIST";

		private static readonly string L_NO_CLOTHING = "CEE_NO_CLOTHING";

		private static readonly string L_SEC_TARGET = "CEE_SEC_TARGET";

		private static readonly string L_TARGET_BOTH = "CEE_TARGET_BOTH";

		private static readonly string L_TARGET_LEFT = "CEE_TARGET_LEFT";

		private static readonly string L_TARGET_RIGHT = "CEE_TARGET_RIGHT";

		private static readonly string W_TITLE = "WEE_TITLE";

		private static readonly string W_CURR_WEAPON = "WEE_CURR_WEAPON";

		private static readonly string W_RIGHT_HAND = "WEE_RIGHT_HAND";

		private static readonly string W_LEFT_HAND = "WEE_LEFT_HAND";

		private static readonly string W_NO_WEAPON = "WEE_NO_WEAPON";

		private string[] textFieldValues = new string[18];

		private bool[] textFieldFocused = new bool[18];

		private bool showWeaponUI;

		private Rect weaponWindowRect = new Rect(0f, 0f, 380f, 500f);

		private EquipedWeaponWrapper currentWeapon;

		private bool currentWeaponIsRight = true;

		private Vector3 weaponPosition = Vector3.zero;

		private Vector3 weaponRotation = Vector3.zero;

		private Vector3 weaponScale = Vector3.one;

		private Holdable currentWeaponHoldable;

		private Vector3 baseRelativePosition;

		private Vector3 baseForwardRotation;

		private Vector3 baseUpRotation;

		private bool showWeaponRotationSection = true;

		private bool showWeaponPositionSection = true;

		private bool showWeaponScaleSection = true;

		public static Dictionary<PropItemData, SideTransforms> sideOverrides = new Dictionary<PropItemData, SideTransforms>();

		private static readonly FieldInfo f_gameObjects = typeof(CharacterItem).GetField("m_gameObjects", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);

		private bool IsInUnitEditor
		{
			get
			{
				//IL_0005: Unknown result type (might be due to invalid IL or missing references)
				//IL_000a: Unknown result type (might be due to invalid IL or missing references)
				for (int i = 0; i < SceneManager.sceneCount; i++)
				{
					Scene sceneAt = SceneManager.GetSceneAt(i);
					if (((Scene)(ref sceneAt)).name == "UnitCreator_GamepadUI")
					{
						return true;
					}
				}
				return false;
			}
		}

		private Event current => Event.current;

		private static string GetSideDataFilePath()
		{
			return Path.Combine(Paths.ConfigPath, "ClothingEquipEditor_sides.txt");
		}

		public static void SaveSideData(string unitName, PropItemData[] propData)
		{
			if (string.IsNullOrEmpty(unitName) || propData == null)
			{
				return;
			}
			try
			{
				string sideDataFilePath = GetSideDataFilePath();
				Dictionary<string, List<string>> dictionary = new Dictionary<string, List<string>>();
				if (File.Exists(sideDataFilePath))
				{
					string text = null;
					string[] array = File.ReadAllLines(sideDataFilePath);
					foreach (string text2 in array)
					{
						if (text2.StartsWith("[") && text2.EndsWith("]"))
						{
							text = text2.Substring(1, text2.Length - 2);
							if (!dictionary.ContainsKey(text))
							{
								dictionary[text] = new List<string>();
							}
						}
						else if (text != null && text2.Contains("|"))
						{
							dictionary[text].Add(text2);
						}
					}
				}
				List<string> list = new List<string>();
				for (int j = 0; j < propData.Length; j++)
				{
					if (propData[j] != null && sideOverrides.TryGetValue(propData[j], out var value) && value.HasRightOverride())
					{
						list.Add(string.Format(CultureInfo.InvariantCulture, "{0}|{1},{2},{3}|{4},{5},{6}|{7},{8},{9}", j, value.rightPosition.x, value.rightPosition.y, value.rightPosition.z, value.rightRotation.x, value.rightRotation.y, value.rightRotation.z, value.rightScale.x, value.rightScale.y, value.rightScale.z));
					}
				}
				if (list.Count > 0)
				{
					dictionary[unitName] = list;
				}
				else
				{
					dictionary.Remove(unitName);
				}
				using StreamWriter streamWriter = new StreamWriter(sideDataFilePath, append: false, Encoding.UTF8);
				foreach (KeyValuePair<string, List<string>> item in dictionary)
				{
					if (item.Value.Count == 0)
					{
						continue;
					}
					streamWriter.WriteLine("[" + item.Key + "]");
					foreach (string item2 in item.Value)
					{
						streamWriter.WriteLine(item2);
					}
				}
			}
			catch (Exception ex)
			{
				Plugin.Log.LogError((object)("[EquipEditorUI] SaveSideData error: " + ex.Message));
			}
		}

		public static void LoadSideData(string unitName, PropItemData[] propData)
		{
			//IL_00cf: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00da: Unknown result type (might be due to invalid IL or missing references)
			//IL_00df: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ea: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f0: Unknown result type (might be due to invalid IL or missing references)
			//IL_010d: Unknown result type (might be due to invalid IL or missing references)
			//IL_010f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0115: Unknown result type (might be due to invalid IL or missing references)
			//IL_0117: Unknown result type (might be due to invalid IL or missing references)
			//IL_0121: 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_012c: 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_0134: Unknown result type (might be due to invalid IL or missing references)
			//IL_0136: Unknown result type (might be due to invalid IL or missing references)
			//IL_013c: Unknown result type (might be due to invalid IL or missing references)
			//IL_013e: Unknown result type (might be due to invalid IL or missing references)
			if (string.IsNullOrEmpty(unitName) || propData == null)
			{
				return;
			}
			try
			{
				string sideDataFilePath = GetSideDataFilePath();
				if (!File.Exists(sideDataFilePath))
				{
					return;
				}
				bool flag = false;
				string[] array = File.ReadAllLines(sideDataFilePath);
				foreach (string text in array)
				{
					if (text.StartsWith("[") && text.EndsWith("]"))
					{
						flag = text.Substring(1, text.Length - 2) == unitName;
					}
					else if (flag && text.Contains("|"))
					{
						string[] array2 = text.Split(new char[1] { '|' });
						if (array2.Length == 4 && int.TryParse(array2[0], out var result) && result >= 0 && result < propData.Length && propData[result] != null)
						{
							Vector3 rightPosition = ParseVector3(array2[1]);
							Vector3 rightRotation = ParseVector3(array2[2]);
							Vector3 rightScale = ParseVector3(array2[3]);
							DecodePositionOffset(propData[result].m_positionOffset, out var rot, out var pos);
							sideOverrides[propData[result]] = new SideTransforms
							{
								leftPosition = pos,
								leftRotation = rot,
								leftScale = propData[result].m_scale,
								rightPosition = rightPosition,
								rightRotation = rightRotation,
								rightScale = rightScale
							};
						}
					}
				}
			}
			catch (Exception ex)
			{
				Plugin.Log.LogError((object)("[EquipEditorUI] LoadSideData error: " + ex.Message));
			}
		}

		private static Vector3 ParseVector3(string s)
		{
			//IL_0060: Unknown result type (might be due to invalid IL or missing references)
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			string[] array = s.Split(new char[1] { ',' });
			if (array.Length != 3)
			{
				return Vector3.zero;
			}
			float.TryParse(array[0], NumberStyles.Float, CultureInfo.InvariantCulture, out var result);
			float.TryParse(array[1], NumberStyles.Float, CultureInfo.InvariantCulture, out var result2);
			float.TryParse(array[2], NumberStyles.Float, CultureInfo.InvariantCulture, out var result3);
			return new Vector3(result, result2, result3);
		}

		private void RefreshClothingList()
		{
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			//IL_001d: Expected O, but got Unknown
			//IL_0113: Unknown result type (might be due to invalid IL or missing references)
			//IL_011a: Expected I4, but got Unknown
			//IL_007e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0085: Expected O, but got Unknown
			//IL_008e: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ad: Expected O, but got Unknown
			//IL_00c2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cd: Expected O, but got Unknown
			clothingList.Clear();
			try
			{
				UnitEditorManager val = Object.FindObjectOfType<UnitEditorManager>();
				if ((Object)val == (Object)null)
				{
					return;
				}
				FieldInfo field = typeof(UnitEditorManager).GetField("equipedClothes", BindingFlags.Instance | BindingFlags.NonPublic);
				if (field == null || !(field.GetValue(val) is IList list))
				{
					return;
				}
				for (int i = 0; i < list.Count; i++)
				{
					object obj = list[i];
					if (obj == null)
					{
						continue;
					}
					EquipedWrapper val2 = (EquipedWrapper)((obj is EquipedWrapper) ? obj : null);
					if (val2 == null || (int)val2.GetWrapperType() != 0)
					{
						continue;
					}
					EquipedClothingWrapper val3 = (EquipedClothingWrapper)((val2 is EquipedClothingWrapper) ? val2 : null);
					if (val3 == null)
					{
						continue;
					}
					string displayName = "???";
					try
					{
						if ((Object)val2.prop != (Object)null)
						{
							displayName = GetLocalizedName(val3);
						}
						else if (val2.propData != null)
						{
							displayName = "Item #" + i;
						}
					}
					catch
					{
					}
					string equipSide = "?";
					try
					{
						if (val2.propData != null)
						{
							switch ((int)val2.propData.m_equip)
							{
							case 0:
								equipSide = T(L_EQUIP_BOTH);
								break;
							case 1:
								equipSide = T(L_EQUIP_LEFT);
								break;
							case 2:
								equipSide = T(L_EQUIP_RIGHT);
								break;
							}
						}
					}
					catch
					{
					}
					clothingList.Add(new ClothingListEntry
					{
						wrapper = val2,
						displayName = displayName,
						equipSide = equipSide,
						index = i
					});
				}
				if (currentWrapper == null)
				{
					return;
				}
				for (int j = 0; j < clothingList.Count; j++)
				{
					if ((object)clothingList[j].wrapper == currentWrapper)
					{
						selectedClothingIndex = j;
						break;
					}
				}
			}
			catch (Exception ex)
			{
				Plugin.Log.LogError((object)("[EquipEditorUI] RefreshClothingList error: " + ex.Message));
			}
		}

		private void SelectClothingByIndex(int listIndex)
		{
			//IL_0037: Unknown result type (might be due to invalid IL or missing references)
			//IL_003d: Expected O, but got Unknown
			if (listIndex >= 0 && listIndex < clothingList.Count)
			{
				ClothingListEntry clothingListEntry = clothingList[listIndex];
				selectedClothingIndex = listIndex;
				EquipedWrapper wrapper = clothingListEntry.wrapper;
				EquipedClothingWrapper val = (EquipedClothingWrapper)((wrapper is EquipedClothingWrapper) ? wrapper : null);
				if (val != null)
				{
					SetCurrentWrapper(val);
				}
			}
		}

		public void SetCurrentWrapper(EquipedClothingWrapper wrapper)
		{
			//IL_007f: 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)
			currentWrapper = wrapper;
			showUI = wrapper != null && IsInUnitEditor;
			if (showUI)
			{
				showWeaponUI = false;
				currentWeapon = null;
			}
			if (wrapper != null && ((EquipedWrapper)wrapper).propData != null)
			{
				PropItemData propData = ((EquipedWrapper)wrapper).propData;
				EnsureSideTransforms(propData);
				if (memoryMode)
				{
					selectedEquipIndex = GetEquipTypeIndex(propData.m_equip);
					ApplyRotation();
					ApplyPosition();
					ApplyScale();
					ApplyEquipType();
				}
				else
				{
					selectedEquipIndex = GetEquipTypeIndex(propData.m_equip);
					LoadValuesForSide(editTargetSide);
				}
			}
			RefreshClothingList();
		}

		private void EnsureSideTransforms(PropItemData propData)
		{
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_0020: Unknown result type (might be due to invalid IL or missing references)
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			//IL_0075: Unknown result type (might be due to invalid IL or missing references)
			//IL_0076: Unknown result type (might be due to invalid IL or missing references)
			//IL_007c: Unknown result type (might be due to invalid IL or missing references)
			//IL_007d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0084: Unknown result type (might be due to invalid IL or missing references)
			//IL_0089: Unknown result type (might be due to invalid IL or missing references)
			//IL_008f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0090: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: Unknown result type (might be due to invalid IL or missing references)
			//IL_0097: Unknown result type (might be due to invalid IL or missing references)
			//IL_009d: Unknown result type (might be due to invalid IL or missing references)
			//IL_009e: Unknown result type (might be due to invalid IL or missing references)
			//IL_003d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0048: Expected O, but got Unknown
			//IL_0055: Unknown result type (might be due to invalid IL or missing references)
			//IL_0060: Expected O, but got Unknown
			//IL_0069: Unknown result type (might be due to invalid IL or missing references)
			//IL_006e: Unknown result type (might be due to invalid IL or missing references)
			if (sideOverrides.ContainsKey(propData))
			{
				return;
			}
			DecodePositionOffset(propData.m_positionOffset, out var rot, out var pos);
			Vector3 localScale = propData.m_scale;
			if (currentWrapper != null)
			{
				CharacterItem spawnedProp = ((EquipedWrapper)currentWrapper).spawnedProp;
				if ((Object)spawnedProp != (Object)null)
				{
					GameObject mirrorObject = GetMirrorObject(spawnedProp);
					if ((Object)mirrorObject != (Object)null)
					{
						localScale = mirrorObject.transform.localScale;
					}
				}
			}
			SideTransforms value = new SideTransforms
			{
				leftPosition = pos,
				leftRotation = rot,
				leftScale = propData.m_scale,
				rightPosition = pos,
				rightRotation = rot,
				rightScale = localScale
			};
			sideOverrides[propData] = value;
		}

		private void LoadValuesForSide(int side)
		{
			//IL_0052: Unknown result type (might be due to invalid IL or missing references)
			//IL_0057: Unknown result type (might be due to invalid IL or missing references)
			//IL_005e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0063: Unknown result type (might be due to invalid IL or missing references)
			//IL_006a: Unknown result type (might be due to invalid IL or missing references)
			//IL_006f: Unknown result type (might be due to invalid IL or missing references)
			//IL_002d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0032: Unknown result type (might be due to invalid IL or missing references)
			//IL_0039: Unknown result type (might be due to invalid IL or missing references)
			//IL_003e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0045: Unknown result type (might be due to invalid IL or missing references)
			//IL_004a: Unknown result type (might be due to invalid IL or missing references)
			if (currentWrapper == null)
			{
				return;
			}
			PropItemData propData = ((EquipedWrapper)currentWrapper).propData;
			if (propData != null && sideOverrides.TryGetValue(propData, out var value))
			{
				if (side == 2)
				{
					positionOffset = value.rightPosition;
					rotation = value.rightRotation;
					scale = value.rightScale;
				}
				else
				{
					positionOffset = value.leftPosition;
					rotation = value.leftRotation;
					scale = value.leftScale;
				}
			}
		}

		private void InjectTranslations()
		{
			//IL_0ffb: Unknown result type (might be due to invalid IL or missing references)
			//IL_100a: Unknown result type (might be due to invalid IL or missing references)
			if (translationsInjected)
			{
				return;
			}
			try
			{
				FieldInfo field = typeof(Localizer).GetField("m_localization", BindingFlags.Static | BindingFlags.NonPublic);
				if (field == null)
				{
					return;
				}
				Dictionary<Language, Dictionary<string, string>> dictionary = (Dictionary<Language, Dictionary<string, string>>)field.GetValue(null);
				if (dictionary == null)
				{
					return;
				}
				foreach (KeyValuePair<Language, Dictionary<string, string>> item in new Dictionary<Language, Dictionary<string, string>>
				{
					[(Language)0] = new Dictionary<string, string>
					{
						{ L_TITLE, "Clothing Equip Editor" },
						{ L_CURR_CLOTHING, "Current Clothing:" },
						{ L_UNKNOWN, "Unknown Clothing" },
						{ L_SEC_EQUIP, "Equip Type (m_equip)" },
						{ L_SEC_ROTATION, "Rotation" },
						{ L_SEC_POSITION, "Position Offset (m_positionOffset)" },
						{ L_SEC_SCALE, "Scale (m_scale)" },
						{ L_EQUIP_BOTH, "Both" },
						{ L_EQUIP_LEFT, "Left" },
						{ L_EQUIP_RIGHT, "Right" },
						{ L_RESET_ROT, "Reset Rotation" },
						{ L_RESET_POS, "Reset Position" },
						{ L_RESET_SCALE, "Reset Scale" },
						{ L_RESET_ALL, "Reset All" },
						{ L_CLOSE, "Close Editor" },
						{ "CEE_MEMORY_MODE", "Memory Mode (keep values when switching)" },
						{ L_SEC_CLOTHING_LIST, "Clothing Items" },
						{ L_NO_CLOTHING, "No clothing equipped" },
						{ L_SEC_TARGET, "Edit Target Side" },
						{ L_TARGET_BOTH, "Both" },
						{ L_TARGET_LEFT, "Left" },
						{ L_TARGET_RIGHT, "Right" },
						{ W_TITLE, "Weapon Editor" },
						{ W_CURR_WEAPON, "Current Weapon:" },
						{ W_RIGHT_HAND, "Right Hand" },
						{ W_LEFT_HAND, "Left Hand" },
						{ W_NO_WEAPON, "No weapon equipped" }
					},
					[(Language)7] = new Dictionary<string, string>
					{
						{ L_TITLE, "服装属性编辑器" },
						{ L_CURR_CLOTHING, "当前服装:" },
						{ L_UNKNOWN, "未知服装" },
						{ L_SEC_EQUIP, "装备位置 (m_equip)" },
						{ L_SEC_ROTATION, "旋转" },
						{ L_SEC_POSITION, "位置偏移 (m_positionOffset)" },
						{ L_SEC_SCALE, "缩放大小 (m_scale)" },
						{ L_EQUIP_BOTH, "双手" },
						{ L_EQUIP_LEFT, "左手" },
						{ L_EQUIP_RIGHT, "右手" },
						{ L_RESET_ROT, "重置旋转" },
						{ L_RESET_POS, "重置位置" },
						{ L_RESET_SCALE, "重置缩放" },
						{ L_RESET_ALL, "重置全部" },
						{ L_CLOSE, "关闭编辑器" },
						{ "CEE_MEMORY_MODE", "记忆模式(切换服装时保持数值)" },
						{ L_SEC_CLOTHING_LIST, "服装列表" },
						{ L_NO_CLOTHING, "未装备服装" },
						{ L_SEC_TARGET, "编辑目标侧" },
						{ L_TARGET_BOTH, "双侧" },
						{ L_TARGET_LEFT, "左侧" },
						{ L_TARGET_RIGHT, "右侧" },
						{ W_TITLE, "武器编辑器" },
						{ W_CURR_WEAPON, "当前武器:" },
						{ W_RIGHT_HAND, "右手" },
						{ W_LEFT_HAND, "左手" },
						{ W_NO_WEAPON, "未装备武器" }
					},
					[(Language)8] = new Dictionary<string, string>
					{
						{ L_TITLE, "装備エディター" },
						{ L_CURR_CLOTHING, "現在の装備:" },
						{ L_UNKNOWN, "不明な装備" },
						{ L_SEC_EQUIP, "装備位置 (m_equip)" },
						{ L_SEC_ROTATION, "回転" },
						{ L_SEC_POSITION, "位置オフセット (m_positionOffset)" },
						{ L_SEC_SCALE, "スケール (m_scale)" },
						{ L_EQUIP_BOTH, "両手" },
						{ L_EQUIP_LEFT, "左手" },
						{ L_EQUIP_RIGHT, "右手" },
						{ L_RESET_ROT, "回転リセット" },
						{ L_RESET_POS, "位置リセット" },
						{ L_RESET_SCALE, "スケールリセット" },
						{ L_RESET_ALL, "全リセット" },
						{ L_CLOSE, "エディターを閉じる" },
						{ "CEE_MEMORY_MODE", "メモリモード(切り替え時に値を保持)" },
						{ L_SEC_CLOTHING_LIST, "装備リスト" },
						{ L_NO_CLOTHING, "装備なし" },
						{ L_SEC_TARGET, "編集対象" },
						{ L_TARGET_BOTH, "両側" },
						{ L_TARGET_LEFT, "左側" },
						{ L_TARGET_RIGHT, "右側" },
						{ W_TITLE, "武器エディター" },
						{ W_CURR_WEAPON, "現在の武器:" },
						{ W_RIGHT_HAND, "右手" },
						{ W_LEFT_HAND, "左手" },
						{ W_NO_WEAPON, "武器なし" }
					},
					[(Language)1] = new Dictionary<string, string>
					{
						{ L_TITLE, "Editeur d'Equipement" },
						{ L_CURR_CLOTHING, "Vetement actuel :" },
						{ L_UNKNOWN, "Vetement inconnu" },
						{ L_SEC_EQUIP, "Type d'equipement (m_equip)" },
						{ L_SEC_ROTATION, "Rotation" },
						{ L_SEC_POSITION, "Decalage de position (m_positionOffset)" },
						{ L_SEC_SCALE, "Echelle (m_scale)" },
						{ L_EQUIP_BOTH, "Les deux" },
						{ L_EQUIP_LEFT, "Gauche" },
						{ L_EQUIP_RIGHT, "Droite" },
						{ L_RESET_ROT, "Reinitialiser rotation" },
						{ L_RESET_POS, "Reinitialiser position" },
						{ L_RESET_SCALE, "Reinitialiser echelle" },
						{ L_RESET_ALL, "Tout reinitialiser" },
						{ L_CLOSE, "Fermer l'editeur" },
						{ "CEE_MEMORY_MODE", "Mode memoire (garder les valeurs au changement)" },
						{ L_SEC_CLOTHING_LIST, "Liste des vetements" },
						{ L_NO_CLOTHING, "Aucun vetement equipe" },
						{ L_SEC_TARGET, "Cote a editer" },
						{ L_TARGET_BOTH, "Les deux" },
						{ L_TARGET_LEFT, "Gauche" },
						{ L_TARGET_RIGHT, "Droite" },
						{ W_TITLE, "Editeur d'Armes" },
						{ W_CURR_WEAPON, "Arme actuelle :" },
						{ W_RIGHT_HAND, "Main droite" },
						{ W_LEFT_HAND, "Main gauche" },
						{ W_NO_WEAPON, "Aucune arme equipee" }
					},
					[(Language)3] = new Dictionary<string, string>
					{
						{ L_TITLE, "Ausruestungs-Editor" },
						{ L_CURR_CLOTHING, "Aktuelle Kleidung:" },
						{ L_UNKNOWN, "Unbekannte Kleidung" },
						{ L_SEC_EQUIP, "Ausruestungstyp (m_equip)" },
						{ L_SEC_ROTATION, "Rotation" },
						{ L_SEC_POSITION, "Positionsversatz (m_positionOffset)" },
						{ L_SEC_SCALE, "Skalierung (m_scale)" },
						{ L_EQUIP_BOTH, "Beide" },
						{ L_EQUIP_LEFT, "Links" },
						{ L_EQUIP_RIGHT, "Rechts" },
						{ L_RESET_ROT, "Rotation zuruecksetzen" },
						{ L_RESET_POS, "Position zuruecksetzen" },
						{ L_RESET_SCALE, "Skalierung zuruecksetzen" },
						{ L_RESET_ALL, "Alles zuruecksetzen" },
						{ L_CLOSE, "Editor schliessen" },
						{ "CEE_MEMORY_MODE", "Speichermodus (Werte beim Wechseln behalten)" },
						{ L_SEC_CLOTHING_LIST, "Kleidungsliste" },
						{ L_NO_CLOTHING, "Keine Kleidung ausgeruestet" },
						{ L_SEC_TARGET, "Zielseite" },
						{ L_TARGET_BOTH, "Beide" },
						{ L_TARGET_LEFT, "Links" },
						{ L_TARGET_RIGHT, "Rechts" },
						{ W_TITLE, "Waffen-Editor" },
						{ W_CURR_WEAPON, "Aktuelle Waffe:" },
						{ W_RIGHT_HAND, "Rechte Hand" },
						{ W_LEFT_HAND, "Linke Hand" },
						{ W_NO_WEAPON, "Keine Waffe ausgeruestet" }
					},
					[(Language)4] = new Dictionary<string, string>
					{
						{ L_TITLE, "Editor de Equipamiento" },
						{ L_CURR_CLOTHING, "Ropa actual:" },
						{ L_UNKNOWN, "Ropa desconocida" },
						{ L_SEC_EQUIP, "Tipo de equipamiento (m_equip)" },
						{ L_SEC_ROTATION, "Rotacion" },
						{ L_SEC_POSITION, "Desplazamiento de posicion (m_positionOffset)" },
						{ L_SEC_SCALE, "Escala (m_scale)" },
						{ L_EQUIP_BOTH, "Ambos" },
						{ L_EQUIP_LEFT, "Izquierdo" },
						{ L_EQUIP_RIGHT, "Derecho" },
						{ L_RESET_ROT, "Reiniciar rotacion" },
						{ L_RESET_POS, "Reiniciar posicion" },
						{ L_RESET_SCALE, "Reiniciar escala" },
						{ L_RESET_ALL, "Reiniciar todo" },
						{ L_CLOSE, "Cerrar editor" },
						{ "CEE_MEMORY_MODE", "Modo memoria (mantener valores al cambiar)" },
						{ L_SEC_CLOTHING_LIST, "Lista de ropa" },
						{ L_NO_CLOTHING, "Sin ropa equipada" },
						{ L_SEC_TARGET, "Lado objetivo" },
						{ L_TARGET_BOTH, "Ambos" },
						{ L_TARGET_LEFT, "Izquierdo" },
						{ L_TARGET_RIGHT, "Derecho" },
						{ W_TITLE, "Editor de Armas" },
						{ W_CURR_WEAPON, "Arma actual:" },
						{ W_RIGHT_HAND, "Mano derecha" },
						{ W_LEFT_HAND, "Mano izquierda" },
						{ W_NO_WEAPON, "Sin arma equipada" }
					},
					[(Language)2] = new Dictionary<string, string>
					{
						{ L_TITLE, "Editor Equipaggiamento" },
						{ L_CURR_CLOTHING, "Vestito attuale:" },
						{ L_UNKNOWN, "Vestito sconosciuto" },
						{ L_SEC_EQUIP, "Tipo equipaggiamento (m_equip)" },
						{ L_SEC_ROTATION, "Rotazione" },
						{ L_SEC_POSITION, "Scostamento posizione (m_positionOffset)" },
						{ L_SEC_SCALE, "Scala (m_scale)" },
						{ L_EQUIP_BOTH, "Entrambi" },
						{ L_EQUIP_LEFT, "Sinistro" },
						{ L_EQUIP_RIGHT, "Destro" },
						{ L_RESET_ROT, "Reimposta rotazione" },
						{ L_RESET_POS, "Reimposta posizione" },
						{ L_RESET_SCALE, "Reimposta scala" },
						{ L_RESET_ALL, "Reimposta tutto" },
						{ L_CLOSE, "Chiudi editor" },
						{ "CEE_MEMORY_MODE", "Modalita memoria (mantieni valori al cambio)" },
						{ L_SEC_CLOTHING_LIST, "Lista vestiti" },
						{ L_NO_CLOTHING, "Nessun vestito equipaggiato" },
						{ L_SEC_TARGET, "Lato obiettivo" },
						{ L_TARGET_BOTH, "Entrambi" },
						{ L_TARGET_LEFT, "Sinistro" },
						{ L_TARGET_RIGHT, "Destro" },
						{ W_TITLE, "Editor Armi" },
						{ W_CURR_WEAPON, "Arma attuale:" },
						{ W_RIGHT_HAND, "Mano destra" },
						{ W_LEFT_HAND, "Mano sinistra" },
						{ W_NO_WEAPON, "Nessuna arma equipaggiata" }
					},
					[(Language)5] = new Dictionary<string, string>
					{
						{ L_TITLE, "Editor de Equipamento" },
						{ L_CURR_CLOTHING, "Roupa atual:" },
						{ L_UNKNOWN, "Roupa desconhecida" },
						{ L_SEC_EQUIP, "Tipo de equipamento (m_equip)" },
						{ L_SEC_ROTATION, "Rotacao" },
						{ L_SEC_POSITION, "Deslocamento de posicao (m_positionOffset)" },
						{ L_SEC_SCALE, "Escala (m_scale)" },
						{ L_EQUIP_BOTH, "Ambos" },
						{ L_EQUIP_LEFT, "Esquerdo" },
						{ L_EQUIP_RIGHT, "Direito" },
						{ L_RESET_ROT, "Reiniciar rotacao" },
						{ L_RESET_POS, "Reiniciar posicao" },
						{ L_RESET_SCALE, "Reiniciar escala" },
						{ L_RESET_ALL, "Reiniciar tudo" },
						{ L_CLOSE, "Fechar editor" },
						{ "CEE_MEMORY_MODE", "Modo memoria (manter valores ao trocar)" },
						{ L_SEC_CLOTHING_LIST, "Lista de roupas" },
						{ L_NO_CLOTHING, "Sem roupa equipada" },
						{ L_SEC_TARGET, "Lado alvo" },
						{ L_TARGET_BOTH, "Ambos" },
						{ L_TARGET_LEFT, "Esquerdo" },
						{ L_TARGET_RIGHT, "Direito" },
						{ W_TITLE, "Editor de Armas" },
						{ W_CURR_WEAPON, "Arma atual:" },
						{ W_RIGHT_HAND, "Mao direita" },
						{ W_LEFT_HAND, "Mao esquerda" },
						{ W_NO_WEAPON, "Sem arma equipada" }
					},
					[(Language)6] = new Dictionary<string, string>
					{
						{ L_TITLE, "Редактор экипировки" },
						{ L_CURR_CLOTHING, "Текущая одежда:" },
						{ L_UNKNOWN, "Неизвестная одежда" },
						{ L_SEC_EQUIP, "Тип экипировки (m_equip)" },
						{ L_SEC_ROTATION, "Вращение" },
						{ L_SEC_POSITION, "Смещение позиции (m_positionOffset)" },
						{ L_SEC_SCALE, "Масштаб (m_scale)" },
						{ L_EQUIP_BOTH, "Обе руки" },
						{ L_EQUIP_LEFT, "Левая" },
						{ L_EQUIP_RIGHT, "Правая" },
						{ L_RESET_ROT, "Сбросить вращение" },
						{ L_RESET_POS, "Сбросить позицию" },
						{ L_RESET_SCALE, "Сбросить масштаб" },
						{ L_RESET_ALL, "Сбросить все" },
						{ L_CLOSE, "Закрыть редактор" },
						{ "CEE_MEMORY_MODE", "Режим памяти (сохранять значения при переключении)" },
						{ L_SEC_CLOTHING_LIST, "Список одежды" },
						{ L_NO_CLOTHING, "Одежда не экипирована" },
						{ L_SEC_TARGET, "Сторона редактирования" },
						{ L_TARGET_BOTH, "Обе" },
						{ L_TARGET_LEFT, "Левая" },
						{ L_TARGET_RIGHT, "Правая" },
						{ W_TITLE, "Редактор оружия" },
						{ W_CURR_WEAPON, "Текущее оружие:" },
						{ W_RIGHT_HAND, "Правая рука" },
						{ W_LEFT_HAND, "Левая рука" },
						{ W_NO_WEAPON, "Оружие не экипировано" }
					}
				})
				{
					if (!dictionary.ContainsKey(item.Key))
					{
						continue;
					}
					Dictionary<string, string> dictionary2 = dictionary[item.Key];
					foreach (KeyValuePair<string, string> item2 in item.Value)
					{
						if (!dictionary2.ContainsKey(item2.Key))
						{
							dictionary2.Add(item2.Key, item2.Value);
						}
						else
						{
							dictionary2[item2.Key] = item2.Value;
						}
					}
				}
				field.SetValue(null, dictionary);
				translationsInjected = true;
			}
			catch (Exception ex)
			{
				Plugin.Log.LogError((object)("[EquipEditorUI] Failed to inject translations: " + ex.Message));
			}
		}

		private string T(string key)
		{
			try
			{
				string singlePhrase = Localizer.GetSinglePhrase(key, Array.Empty<string>());
				if (!string.IsNullOrEmpty(singlePhrase) && singlePhrase != key)
				{
					return singlePhrase;
				}
			}
			catch
			{
			}
			return key;
		}

		private string GetLocalizedName(EquipedClothingWrapper wrapper)
		{
			//IL_0009: Unknown result type (might be due to invalid IL or missing references)
			//IL_0014: Expected O, but got Unknown
			if (wrapper == null || (Object)((EquipedWrapper)wrapper).prop == (Object)null)
			{
				return T(L_UNKNOWN);
			}
			string displayName = ((EquipedWrapper)wrapper).prop.DisplayName;
			try
			{
				string singlePhrase = Localizer.GetSinglePhrase(displayName, Array.Empty<string>());
				if (!string.IsNullOrEmpty(singlePhrase) && singlePhrase != displayName)
				{
					return singlePhrase;
				}
			}
			catch
			{
			}
			return displayName;
		}

		private void InitTextures()
		{
			//IL_0018: 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_0066: Unknown result type (might be due to invalid IL or missing references)
			//IL_008d: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00db: Unknown result type (might be due to invalid IL or missing references)
			//IL_0102: Unknown result type (might be due to invalid IL or missing references)
			//IL_0129: Unknown result type (might be due to invalid IL or missing references)
			//IL_0150: 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_019e: 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_01ec: Unknown result type (might be due to invalid IL or missing references)
			//IL_0213: Unknown result type (might be due to invalid IL or missing references)
			//IL_023a: Unknown result type (might be due to invalid IL or missing references)
			texWindowBg = MakeTex(2, 2, new Color(0.06f, 0.09f, 0.18f, 0.98f));
			texHeaderBg = MakeTex(2, 2, new Color(0.08f, 0.14f, 0.3f, 1f));
			texSectionBg = MakeTex(2, 2, new Color(0.07f, 0.11f, 0.24f, 1f));
			texBtnNormal = MakeTex(2, 2, new Color(0.1f, 0.16f, 0.34f, 1f));
			texBtnHover = MakeTex(2, 2, new Color(0.15f, 0.22f, 0.42f, 1f));
			texBtnActive = MakeTex(2, 2, new Color(0.2f, 0.28f, 0.5f, 1f));
			texBtnSelected = MakeTex(2, 2, new Color(0.15f, 0.4f, 0.8f, 1f));
			texCloseNormal = MakeTex(2, 2, new Color(0.5f, 0.14f, 0.14f, 1f));
			texCloseHover = MakeTex(2, 2, new Color(0.65f, 0.2f, 0.2f, 1f));
			texInputBg = MakeTex(2, 2, new Color(0.03f, 0.05f, 0.12f, 1f));
			texSliderBg = MakeTex(2, 2, new Color(0.06f, 0.1f, 0.22f, 1f));
			texSliderFill = MakeTex(2, 2, new Color(0.15f, 0.4f, 0.8f, 1f));
			texSepLine = MakeTex(2, 2, new Color(0.12f, 0.18f, 0.34f, 1f));
			texItemNormal = MakeTex(2, 2, new Color(0.08f, 0.12f, 0.26f, 1f));
			texItemSelected = MakeTex(2, 2, new Color(0.12f, 0.32f, 0.65f, 1f));
		}

		private void InitStyles()
		{
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_002d: Expected O, but got Unknown
			//IL_00f7: Unknown result type (might be due to invalid IL or missing references)
			//IL_0125: Unknown result type (might be due to invalid IL or missing references)
			//IL_012f: Expected O, but got Unknown
			//IL_0139: Unknown result type (might be due to invalid IL or missing references)
			//IL_0143: Expected O, but got Unknown
			//IL_014e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0158: Expected O, but got Unknown
			//IL_018b: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ac: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b6: Expected O, but got Unknown
			//IL_01e9: Unknown result type (might be due to invalid IL or missing references)
			//IL_020a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0214: Expected O, but got Unknown
			//IL_0247: Unknown result type (might be due to invalid IL or missing references)
			//IL_026b: Unknown result type (might be due to invalid IL or missing references)
			//IL_028f: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_02d7: Unknown result type (might be due to invalid IL or missing references)
			//IL_02fb: Unknown result type (might be due to invalid IL or missing references)
			//IL_0393: Unknown result type (might be due to invalid IL or missing references)
			//IL_039d: Expected O, but got Unknown
			//IL_03a8: Unknown result type (might be due to invalid IL or missing references)
			//IL_03b2: Expected O, but got Unknown
			//IL_03da: Unknown result type (might be due to invalid IL or missing references)
			//IL_03ef: Unknown result type (might be due to invalid IL or missing references)
			//IL_03f9: Expected O, but got Unknown
			//IL_0429: Unknown result type (might be due to invalid IL or missing references)
			//IL_0433: Expected O, but got Unknown
			//IL_048f: Unknown result type (might be due to invalid IL or missing references)
			//IL_04a4: Unknown result type (might be due to invalid IL or missing references)
			//IL_04d1: Unknown result type (might be due to invalid IL or missing references)
			//IL_04db: Expected O, but got Unknown
			//IL_04e5: Unknown result type (might be due to invalid IL or missing references)
			//IL_04ef: Expected O, but got Unknown
			//IL_04fa: Unknown result type (might be due to invalid IL or missing references)
			//IL_0504: Expected O, but got Unknown
			//IL_0524: Unknown result type (might be due to invalid IL or missing references)
			//IL_052e: Expected O, but got Unknown
			//IL_0548: Unknown result type (might be due to invalid IL or missing references)
			//IL_0552: Expected O, but got Unknown
			//IL_055d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0567: Expected O, but got Unknown
			//IL_059f: Unknown result type (might be due to invalid IL or missing references)
			//IL_05d0: Unknown result type (might be due to invalid IL or missing references)
			//IL_0609: Unknown result type (might be due to invalid IL or missing references)
			//IL_0613: Expected O, but got Unknown
			//IL_061e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0628: Expected O, but got Unknown
			//IL_0684: Unknown result type (might be due to invalid IL or missing references)
			//IL_06a8: Unknown result type (might be due to invalid IL or missing references)
			//IL_06bd: Unknown result type (might be due to invalid IL or missing references)
			//IL_06de: Unknown result type (might be due to invalid IL or missing references)
			//IL_06e8: Expected O, but got Unknown
			//IL_06f2: Unknown result type (might be due to invalid IL or missing references)
			//IL_06fc: Expected O, but got Unknown
			//IL_0703: Unknown result type (might be due to invalid IL or missing references)
			//IL_070d: Expected O, but got Unknown
			//IL_0745: Unknown result type (might be due to invalid IL or missing references)
			//IL_075f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0774: Unknown result type (might be due to invalid IL or missing references)
			//IL_0789: Unknown result type (might be due to invalid IL or missing references)
			//IL_0793: Expected O, but got Unknown
			//IL_07ef: Unknown result type (might be due to invalid IL or missing references)
			//IL_0813: Unknown result type (might be due to invalid IL or missing references)
			//IL_0828: Unknown result type (might be due to invalid IL or missing references)
			//IL_084b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0855: Expected O, but got Unknown
			//IL_085f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0869: Expected O, but got Unknown
			//IL_0874: Unknown result type (might be due to invalid IL or missing references)
			//IL_087e: Expected O, but got Unknown
			//IL_08cc: Unknown result type (might be due to invalid IL or missing references)
			//IL_08f5: Unknown result type (might be due to invalid IL or missing references)
			//IL_090a: Unknown result type (might be due to invalid IL or missing references)
			//IL_091f: Unknown result type (might be due to invalid IL or missing references)
			//IL_094e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0958: Expected O, but got Unknown
			//IL_0962: Unknown result type (might be due to invalid IL or missing references)
			//IL_096c: Expected O, but got Unknown
			//IL_0977: Unknown result type (might be due to invalid IL or missing references)
			//IL_0981: Expected O, but got Unknown
			//IL_09dd: Unknown result type (might be due to invalid IL or missing references)
			//IL_09f2: Unknown result type (might be due to invalid IL or missing references)
			//IL_0a1f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0a29: Expected O, but got Unknown
			//IL_0a33: Unknown result type (might be due to invalid IL or missing references)
			//IL_0a3d: Expected O, but got Unknown
			//IL_0a47: Unknown result type (might be due to invalid IL or missing references)
			//IL_0a51: Expected O, but got Unknown
			//IL_0a58: Unknown result type (might be due to invalid IL or missing references)
			//IL_0a62: Expected O, but got Unknown
			//IL_0a99: Unknown result type (might be due to invalid IL or missing references)
			//IL_0aba: Unknown result type (might be due to invalid IL or missing references)
			//IL_0ac4: Expected O, but got Unknown
			//IL_0af7: Unknown result type (might be due to invalid IL or missing references)
			//IL_0b0c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0b16: Expected O, but got Unknown
			//IL_0b49: Unknown result type (might be due to invalid IL or missing references)
			if (!stylesInitialized)
			{
				stylesInitialized = true;
				InitTextures();
				styleWindow = new GUIStyle(GUI.skin.window);
				styleWindow.normal.background = texWindowBg;
				styleWindow.onNormal.background = texWindowBg;
				styleWindow.hover.background = texWindowBg;
				styleWindow.onHover.background = texWindowBg;
				styleWindow.active.background = texWindowBg;
				styleWindow.onActive.background = texWindowBg;
				styleWindow.focused.background = texWindowBg;
				styleWindow.onFocused.background = texWindowBg;
				styleWindow.normal.textColor = new Color(0.85f, 0.9f, 1f);
				styleWindow.fontSize = 16;
				styleWindow.fontStyle = (FontStyle)1;
				styleWindow.padding = new RectOffset(6, 6, 24, 6);
				styleWindow.border = new RectOffset(4, 4, 4, 4);
				styleHeaderLabel = new GUIStyle(GUI.skin.label);
				styleHeaderLabel.fontSize = 14;
				styleHeaderLabel.fontStyle = (FontStyle)1;
				styleHeaderLabel.normal.textColor = new Color(0.92f, 0.94f, 1f);
				styleHeaderLabel.alignment = (TextAnchor)3;
				styleClothingName = new GUIStyle(GUI.skin.label);
				styleClothingName.fontSize = 15;
				styleClothingName.fontStyle = (FontStyle)1;
				styleClothingName.normal.textColor = new Color(0.7f, 0.82f, 1f);
				styleClothingName.alignment = (TextAnchor)3;
				styleSectionToggle = new GUIStyle(GUI.skin.toggle);
				styleSectionToggle.fontSize = 13;
				styleSectionToggle.fontStyle = (FontStyle)1;
				styleSectionToggle.normal.textColor = new Color(0.55f, 0.72f, 1f);
				styleSectionToggle.hover.textColor = new Color(0.65f, 0.8f, 1f);
				styleSectionToggle.active.textColor = new Color(0.75f, 0.88f, 1f);
				styleSectionToggle.onNormal.textColor = new Color(0.55f, 0.72f, 1f);
				styleSectionToggle.onHover.textColor = new Color(0.65f, 0.8f, 1f);
				styleSectionToggle.onActive.textColor = new Color(0.75f, 0.88f, 1f);
				styleSectionToggle.normal.background = texSectionBg;
				styleSectionToggle.onNormal.background = texSectionBg;
				styleSectionToggle.hover.background = texSectionBg;
				styleSectionToggle.onHover.background = texSectionBg;
				styleSectionToggle.active.background = texSectionBg;
				styleSectionToggle.onActive.background = texSectionBg;
				styleSectionToggle.border = new RectOffset(4, 4, 4, 4);
				styleSectionToggle.padding = new RectOffset(14, 8, 6, 6);
				styleSectionToggle.alignment = (TextAnchor)3;
				styleSectionToggle.imagePosition = (ImagePosition)0;
				styleSectionToggle.contentOffset = new Vector2(0f, 0f);
				styleAxisLabel = new GUIStyle(GUI.skin.label);
				styleAxisLabel.fontSize = 12;
				styleAxisLabel.fontStyle = (FontStyle)1;
				styleAxisLabel.alignment = (TextAnchor)4;
				styleTextField = new GUIStyle(GUI.skin.textField);
				styleTextField.normal.background = texInputBg;
				styleTextField.focused.background = texInputBg;
				styleTextField.hover.background = texInputBg;
				styleTextField.normal.textColor = new Color(0.9f, 0.92f, 1f);
				styleTextField.focused.textColor = Color.white;
				styleTextField.fontSize = 12;
				styleTextField.alignment = (TextAnchor)4;
				styleTextField.border = new RectOffset(2, 2, 2, 2);
				styleTextField.padding = new RectOffset(4, 4, 3, 3);
				styleSlider = new GUIStyle(GUI.skin.horizontalSlider);
				styleSlider.normal.background = texSliderBg;
				styleSlider.border = new RectOffset(3, 3, 3, 3);
				styleSlider.fixedHeight = 16f;
				styleSlider.padding = new RectOffset(4, 4, 4, 4);
				styleSliderThumb = new GUIStyle(GUI.skin.horizontalSliderThumb);
				styleSliderThumb.normal.background = texBtnSelected;
				styleSliderThumb.hover.background = MakeTex(2, 2, new Color(0.2f, 0.5f, 0.9f, 1f));
				styleSliderThumb.active.background = MakeTex(2, 2, new Color(0.25f, 0.55f, 0.95f, 1f));
				styleSliderThumb.fixedWidth = 14f;
				styleSliderThumb.fixedHeight = 18f;
				styleSliderThumb.border = new RectOffset(3, 3, 3, 3);
				styleEquipBtn = new GUIStyle(GUI.skin.button);
				styleEquipBtn.normal.background = texBtnNormal;
				styleEquipBtn.hover.background = texBtnHover;
				styleEquipBtn.active.background = texBtnActive;
				styleEquipBtn.normal.textColor = new Color(0.76f, 0.81f, 0.92f);
				styleEquipBtn.hover.textColor = new Color(0.88f, 0.92f, 1f);
				styleEquipBtn.active.textColor = Color.white;
				styleEquipBtn.fontSize = 12;
				styleEquipBtn.padding = new RectOffset(8, 8, 6, 6);
				styleEquipBtn.border = new RectOffset(3, 3, 3, 3);
				styleEquipBtnSel = new GUIStyle(styleEquipBtn);
				styleEquipBtnSel.normal.background = texBtnSelected;
				styleEquipBtnSel.hover.background = MakeTex(2, 2, new Color(0.2f, 0.48f, 0.88f, 1f));
				styleEquipBtnSel.normal.textColor = Color.white;
				styleEquipBtnSel.hover.textColor = Color.white;
				styleActionBtn = new GUIStyle(GUI.skin.button);
				styleActionBtn.normal.background = texBtnNormal;
				styleActionBtn.hover.background = texBtnHover;
				styleActionBtn.active.background = texBtnActive;
				styleActionBtn.normal.textColor = new Color(0.76f, 0.81f, 0.92f);
				styleActionBtn.hover.textColor = new Color(0.88f, 0.92f, 1f);
				styleActionBtn.active.textColor = Color.white;
				styleActionBtn.fontSize = 12;
				styleActionBtn.padding = new RectOffset(10, 10, 5, 5);
				styleActionBtn.border = new RectOffset(3, 3, 3, 3);
				styleCloseBtn = new GUIStyle(GUI.skin.button);
				styleCloseBtn.normal.background = texCloseNormal;
				styleCloseBtn.hover.background = texCloseHover;
				styleCloseBtn.active.background = MakeTex(2, 2, new Color(0.75f, 0.25f, 0.25f, 1f));
				styleCloseBtn.normal.textColor = new Color(0.95f, 0.85f, 0.85f);
				styleCloseBtn.hover.textColor = Color.white;
				styleCloseBtn.active.textColor = Color.white;
				styleCloseBtn.fontSize = 13;
				styleCloseBtn.fontStyle = (FontStyle)1;
				styleCloseBtn.padding = new RectOffset(10, 10, 6, 6);
				styleCloseBtn.border = new RectOffset(3, 3, 3, 3);
				styleItemBtn = new GUIStyle(GUI.skin.button);
				styleItemBtn.normal.background = texItemNormal;
				styleItemBtn.hover.background = texBtnHover;
				styleItemBtn.active.background = texBtnActive;
				styleItemBtn.normal.textColor = new Color(0.8f, 0.85f, 0.95f);
				styleItemBtn.hover.textColor = Color.white;
				styleItemBtn.fontSize = 12;
				styleItemBtn.alignment = (TextAnchor)3;
				styleItemBtn.padding = new RectOffset(8, 8, 4, 4);
				styleItemBtn.border = new RectOffset(2, 2, 2, 2);
				styleItemBtn.margin = new RectOffset(0, 0, 1, 1);
				styleItemBtnSel = new GUIStyle(styleItemBtn);
				styleItemBtnSel.normal.background = texItemSelected;
				styleItemBtnSel.hover.background = texItemSelected;
				styleItemBtnSel.normal.textColor = Color.white;
				styleItemBtnSel.fontStyle = (FontStyle)1;
				styleItemLabel = new GUIStyle(GUI.skin.label);
				styleItemLabel.fontSize = 12;
				styleItemLabel.alignment = (TextAnchor)3;
				styleItemLabel.normal.textColor = new Color(0.85f, 0.9f, 1f);
				styleItemSideLabel = new GUIStyle(GUI.skin.label);
				styleItemSideLabel.fontSize = 10;
				styleItemSideLabel.alignment = (TextAnchor)5;
				styleItemSideLabel.normal.textColor = new Color(0.55f, 0.7f, 0.95f);
				styleItemSideLabel.fontStyle = (FontStyle)2;
			}
		}

		private void OnGUI()
		{
			//IL_00d9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00de: Unknown result type (might be due to invalid IL or missing references)
			//IL_011e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0123: Unknown result type (might be due to invalid IL or missing references)
			//IL_0134: Unknown result type (might be due to invalid IL or missing references)
			//IL_013e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0148: Unknown result type (might be due to invalid IL or missing references)
			//IL_014d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0152: Unknown result type (might be due to invalid IL or missing references)
			//IL_0168: Unknown result type (might be due to invalid IL or missing references)
			//IL_016d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0181: Unknown result type (might be due to invalid IL or missing references)
			//IL_018d: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b7: Expected O, but got Unknown
			//IL_01b2: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b7: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c6: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d2: Unknown result type (might be due to invalid IL or missing references)
			//IL_01fc: Expected O, but got Unknown
			//IL_01f7: 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)
			bool flag = showUI && currentWrapper != null && IsInUnitEditor && !UnitEditorManager.isTestingUnit;
			bool flag2 = showWeaponUI && IsInUnitEditor && !UnitEditorManager.isTestingUnit;
			if (flag || flag2)
			{
				if (Screen.width != lastScreenWidth || Screen.height != lastScreenHeight)
				{
					lastScreenWidth = Screen.width;
					lastScreenHeight = Screen.height;
					uiScale = Mathf.Min((float)Screen.width / 1920f, (float)Screen.height / 1080f);
					windowRect = new Rect((float)Screen.width / uiScale - ((Rect)(ref windowRect)).width - 20f, 60f, ((Rect)(ref windowRect)).width, ((Rect)(ref windowRect)).height);
					weaponWindowRect = new Rect((float)Screen.width / uiScale - ((Rect)(ref weaponWindowRect)).width - 20f, 60f, ((Rect)(ref weaponWindowRect)).width, ((Rect)(ref weaponWindowRect)).height);
				}
				InjectTranslations();
				InitStyles();
				GUI.backgroundColor = Color.white;
				GUI.color = Color.white;
				Matrix4x4 matrix = GUI.matrix;
				GUI.matrix = Matrix4x4.TRS(Vector3.zero, Quaternion.identity, new Vector3(uiScale, uiScale, 1f));
				if (flag)
				{
					windowRect = GUILayout.Window(123456, windowRect, new WindowFunction(DrawWindow), "  " + T(L_TITLE), styleWindow, Array.Empty<GUILayoutOption>());
				}
				if (flag2)
				{
					weaponWindowRect = GUILayout.Window(123457, weaponWindowRect, new WindowFunction(DrawWeaponWindow), "  " + T(W_TITLE), styleWindow, Array.Empty<GUILayoutOption>());
				}
				GUI.matrix = matrix;
			}
		}

		private void DrawWindow(int windowID)
		{
			//IL_025f: 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_00d8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f8: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ac: Unknown result type (might be due to invalid IL or missing references)
			//IL_04f2: Unknown result type (might be due to invalid IL or missing references)
			//IL_0506: Unknown result type (might be due to invalid IL or missing references)
			//IL_051a: Unknown result type (might be due to invalid IL or missing references)
			//IL_05e9: Unknown result type (might be due to invalid IL or missing references)
			//IL_05fd: Unknown result type (might be due to invalid IL or missing references)
			//IL_0611: Unknown result type (might be due to invalid IL or missing references)
			//IL_0560: Unknown result type (might be due to invalid IL or missing references)
			//IL_0565: Unknown result type (might be due to invalid IL or missing references)
			//IL_06e0: Unknown result type (might be due to invalid IL or missing references)
			//IL_06f4: Unknown result type (might be due to invalid IL or missing references)
			//IL_0708: Unknown result type (might be due to invalid IL or missing references)
			//IL_0657: Unknown result type (might be due to invalid IL or missing references)
			//IL_065c: Unknown result type (might be due to invalid IL or missing references)
			//IL_079b: Unknown result type (might be due to invalid IL or missing references)
			//IL_07a0: Unknown result type (might be due to invalid IL or missing references)
			//IL_07a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_07ab: Unknown result type (might be due to invalid IL or missing references)
			//IL_07b1: Unknown result type (might be due to invalid IL or missing references)
			//IL_07b6: Unknown result type (might be due to invalid IL or missing references)
			//IL_074e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0753: Unknown result type (might be due to invalid IL or missing references)
			//IL_0828: Unknown result type (might be due to invalid IL or missing references)
			//IL_0839: Unknown result type (might be due to invalid IL or missing references)
			//IL_0841: Unknown result type (might be due to invalid IL or missing references)
			//IL_0847: Invalid comparison between Unknown and I4
			//IL_084a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0850: Invalid comparison between Unknown and I4
			//IL_0853: Unknown result type (might be due to invalid IL or missing references)
			//IL_0859: Invalid comparison between Unknown and I4
			GUILayout.Space(4f);
			showClothingListSection = GUILayout.Toggle(showClothingListSection, "  ▼ " + T(L_SEC_CLOTHING_LIST) + " (" + clothingList.Count + ")", styleSectionToggle, Array.Empty<GUILayoutOption>());
			if (showClothingListSection)
			{
				GUILayout.Space(4f);
				if (clothingList.Count == 0)
				{
					GUILayout.Label("  " + T(L_NO_CLOTHING), styleItemLabel, Array.Empty<GUILayoutOption>());
				}
				else
				{
					float num = Mathf.Min((float)clothingList.Count * 28f, 140f);
					clothingScrollPos = GUILayout.BeginScrollView(clothingScrollPos, false, false, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(num) });
					for (int i = 0; i < clothingList.Count; i++)
					{
						ClothingListEntry clothingListEntry = clothingList[i];
						GUIStyle val = ((i == selectedClothingIndex) ? styleItemBtnSel : styleItemBtn);
						GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
						if (GUILayout.Button(i + 1 + ". " + clothingListEntry.displayName, val, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(24f) }))
						{
							SelectClothingByIndex(i);
						}
						GUILayout.Label("[" + clothingListEntry.equipSide + "]", styleItemSideLabel, (GUILayoutOption[])(object)new GUILayoutOption[2]
						{
							GUILayout.Width(50f),
							GUILayout.Height(24f)
						});
						GUILayout.EndHorizontal();
					}
					GUILayout.EndScrollView();
				}
			}
			DrawSep();
			GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
			GUILayout.Label(T(L_CURR_CLOTHING), styleHeaderLabel, Array.Empty<GUILayoutOption>());
			GUILayout.Label(GetLocalizedName(currentWrapper), styleClothingName, Array.Empty<GUILayoutOption>());
			GUILayout.FlexibleSpace();
			GUILayout.EndHorizontal();
			GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
			GUI.backgroundColor = (Color)(memoryMode ? new Color(0.3f, 1f, 0.3f) : Color.white);
			bool flag = GUILayout.Toggle(memoryMode, "  " + T("CEE_MEMORY_MODE"), GUI.skin.button, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(26f) });
			GUI.backgroundColor = Color.white;
			GUILayout.EndHorizontal();
			if (flag != memoryMode)
			{
				memoryMode = flag;
				if (memoryMode && currentWrapper != null && ((EquipedWrapper)currentWrapper).propData != null)
				{
					ApplyRotation();
					ApplyPosition();
					ApplyScale();
				}
			}
			DrawSep();
			GUILayout.Label("  " + T(L_SEC_TARGET), styleHeaderLabel, Array.Empty<GUILayoutOption>());
			GUILayout.Space(2f);
			GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
			for (int j = 0; j < editTargetNames.Length; j++)
			{
				GUIStyle val2 = ((j == editTargetSide) ? styleEquipBtnSel : styleEquipBtn);
				if (GUILayout.Button(T(editTargetNames[j]), val2, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(28f) }))
				{
					editTargetSide = j;
					LoadValuesForSide(j);
				}
			}
			GUILayout.EndHorizontal();
			DrawSep();
			showEquipSection = GUILayout.Toggle(showEquipSection, "  ▼ " + T(L_SEC_EQUIP), styleSectionToggle, Array.Empty<GUILayoutOption>());
			if (showEquipSection)
			{
				GUILayout.Space(4f);
				GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
				for (int k = 0; k < equipTypeNames.Length; k++)
				{
					GUIStyle val3 = ((k == selectedEquipIndex) ? styleEquipBtnSel : styleEquipBtn);
					if (GUILayout.Button(T(equipTypeNames[k]), val3, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(30f) }))
					{
						selectedEquipIndex = k;
						ApplyEquipType();
					}
				}
				GUILayout.EndHorizontal();
			}
			DrawSep();
			showRotationSection = GUILayout.Toggle(showRotationSection, "  ▼ " + T(L_SEC_ROTATION), styleSectionToggle, Array.Empty<GUILayoutOption>());
			if (showRotationSection)
			{
				GUILayout.Space(4f);
				DrawVector3Control(ref rotation, -180f, 180f, ApplyRotation, 0, new Color(0.95f, 0.4f, 0.4f), new Color(0.4f, 0.9f, 0.4f), new Color(0.4f, 0.6f, 0.95f));
				GUILayout.Space(2f);
				if (GUILayout.Button(T(L_RESET_ROT), styleActionBtn, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(26f) }))
				{
					rotation = Vector3.zero;
					ApplyRotation();
				}
			}
			DrawSep();
			showPositionSection = GUILayout.Toggle(showPositionSection, "  ▼ " + T(L_SEC_POSITION), styleSectionToggle, Array.Empty<GUILayoutOption>());
			if (showPositionSection)
			{
				GUILayout.Space(4f);
				DrawVector3Control(ref positionOffset, -10f, 10f, ApplyPosition, 3, new Color(0.95f, 0.4f, 0.4f), new Color(0.4f, 0.9f, 0.4f), new Color(0.4f, 0.6f, 0.95f), useDynamicRange: true);
				GUILayout.Space(2f);
				if (GUILayout.Button(T(L_RESET_POS), styleActionBtn, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(26f) }))
				{
					positionOffset = Vector3.zero;
					ApplyPosition();
				}
			}
			DrawSep();
			showScaleSection = GUILayout.Toggle(showScaleSection, "  ▼ " + T(L_SEC_SCALE), styleSectionToggle, Array.Empty<GUILayoutOption>());
			if (showScaleSection)
			{
				GUILayout.Space(4f);
				DrawVector3Control(ref scale, 0.1f, 10f, ApplyScale, 6, new Color(0.95f, 0.4f, 0.4f), new Color(0.4f, 0.9f, 0.4f), new Color(0.4f, 0.6f, 0.95f), useDynamicRange: true);
				GUILayout.Space(2f);
				if (GUILayout.Button(T(L_RESET_SCALE), styleActionBtn, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(26f) }))
				{
					scale = Vector3.one;
					ApplyScale();
					CorrectMirrorAfterReset();
				}
			}
			DrawSep();
			if (GUILayout.Button(T(L_RESET_ALL), styleCloseBtn, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(30f) }))
			{
				rotation = Vector3.zero;
				positionOffset = Vector3.zero;
				scale = Vector3.one;
				ApplyRotation();
				ApplyPosition();
				ApplyScale();
				CorrectMirrorAfterReset();
			}
			GUILayout.Space(8f);
			if (GUILayout.Button(T(L_CLOSE), styleActionBtn, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(30f) }))
			{
				showUI = false;
			}
			GUI.DragWindow(new Rect(0f, 0f, 10000f, 30f));
			Event val4 = Event.current;
			if ((int)val4.type == 0 || (int)val4.type == 3 || (int)val4.type == 1 || (int)val4.type == 6)
			{
				val4.Use();
			}
		}

		private void DrawVector3Control(ref Vector3 value, float defaultMin, float defaultMax, Action applyAction, int baseIndex, Color colorX, Color colorY, Color colorZ, bool useDynamicRange = false)
		{
			//IL_0027: Unknown result type (might be due to invalid IL or missing references)
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_0030: Unknown result type (might be due to invalid IL or missing references)
			//IL_0032: Unknown result type (might be due to invalid IL or missing references)
			//IL_0039: Unknown result type (might be due to invalid IL or missing references)
			//IL_003b: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f0: Expected O, but got Unknown
			//IL_00f9: Unknown result type (might be due to invalid IL or missing references)
			//IL_0178: Unknown result type (might be due to invalid IL or missing references)
			//IL_017d: Unknown result type (might be due to invalid IL or missing references)
			//IL_02eb: Unknown result type (might be due to invalid IL or missing references)
			//IL_02f2: Invalid comparison between Unknown and I4
			//IL_02fa: Unknown result type (might be due to invalid IL or missing references)
			//IL_0304: Invalid comparison between Unknown and I4
			//IL_02c5: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ca: Unknown result type (might be due to invalid IL or missing references)
			//IL_0326: Unknown result type (might be due to invalid IL or missing references)
			//IL_032b: Unknown result type (might be due to invalid IL or missing references)
			string[] array = new string[3] { "X", "Y", "Z" };
			Color[] array2 = (Color[])(object)new Color[3] { colorX, colorY, colorZ };
			float[] array3 = new float[3] { value.x, value.y, value.z };
			for (int i = 0; i < 3; i++)
			{
				int num = baseIndex + i;
				float num2 = Mathf.Abs(array3[i]);
				float num3 = ((num2 >= 1f) ? Mathf.Pow(10f, Mathf.Floor(Mathf.Log10(num2))) : 1f);
				float num4 = (useDynamicRange ? ((0f - num3) * 10f) : defaultMin);
				float num5 = (useDynamicRange ? (num3 * 10f) : defaultMax);
				GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
				GUILayout.Space(4f);
				GUIStyle val = new GUIStyle(styleAxisLabel);
				val.normal.textColor = array2[i];
				GUILayout.Label(array[i], val, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(18f) });
				float num6 = GUILayout.HorizontalSlider(array3[i], num4, num5, styleSlider, styleSliderThumb, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(18f) });
				if (Mathf.Abs(num6 - array3[i]) > 0.001f)
				{
					array3[i] = num6;
					value = new Vector3(array3[0], array3[1], array3[2]);
					textFieldValues[num] = array3[i].ToString("F2");
					applyAction();
				}
				GUI.SetNextControlName("TextField_" + num);
				bool num7 = textFieldFocused[num];
				textFieldFocused[num] = GUI.GetNameOfFocusedControl() == "TextField_" + num;
				if (!num7 && textFieldFocused[num])
				{
					textFieldValues[num] = array3[i].ToString("F2");
				}
				if (string.IsNullOrEmpty(textFieldValues[num]) || !textFieldFocused[num])
				{
					textFieldValues[num] = array3[i].ToString("F2");
				}
				string text = GUILayout.TextField(textFieldValues[num], styleTextField, (GUILayoutOption[])(object)new GUILayoutOption[2]
				{
					GUILayout.Width(58f),
					GUILayout.Height(22f)
				});
				textFieldValues[num] = text;
				if (!textFieldFocused[num])
				{
					if (float.TryParse(text, out var result) && Mathf.Abs(result - array3[i]) > 0.001f)
					{
						array3[i] = result;
						value = new Vector3(array3[0], array3[1], array3[2]);
						applyAction();
					}
				}
				else if (current.isKey && ((int)current.keyCode == 13 || (int)current.keyCode == 271))
				{
					GUI.FocusControl((string)null);
					if (float.TryParse(text, out var result2))
					{
						array3[i] = result2;
						value = new Vector3(array3[0], array3[1], array3[2]);
						textFieldValues[num] = array3[i].ToString("F2");
						applyAction();
					}
				}
				GUILayout.Space(4f);
				GUILayout.EndHorizontal();
				GUILayout.Space(2f);
			}
		}

		private void DrawSep()
		{
			//IL_000a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0010: Expected O, but got Unknown
			//IL_0031: Unknown result type (might be due to invalid IL or missing references)
			//IL_003b: Expected O, but got Unknown
			GUILayout.Space(4f);
			GUIStyle val = new GUIStyle();
			val.normal.background = texSepLine;
			val.fixedHeight = 1f;
			val.margin = new RectOffset(4, 4, 0, 0);
			GUILayout.Box("", val, (GUILayoutOption[])(object)new GUILayoutOption[2]
			{
				GUILayout.ExpandWidth(true),
				GUILayout.Height(1f)
			});
			GUILayout.Space(4f);
		}

		private void ApplyEquipType()
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_0030: Unknown result type (might be due to invalid IL or missing references)
			//IL_0031: 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_004e: Expected O, but got Unknown
			//IL_0058: Unknown result type (might be due to invalid IL or missing references)
			//IL_0063: Expected O, but got Unknown
			//IL_0066: Unknown result type (might be due to invalid IL or missing references)
			if (currentWrapper == null || ((EquipedWrapper)currentWrapper).propData == null)
			{
				return;
			}
			try
			{
				EquipType val = equipTypes[selectedEquipIndex];
				((EquipedWrapper)currentWrapper).propData.m_equip = val;
				CharacterItem spawnedProp = ((EquipedWrapper)currentWrapper).spawnedProp;
				if ((Object)spawnedProp != (Object)null)
				{
					CharacterItem component = ((Component)spawnedProp).GetComponent<CharacterItem>();
					if ((Object)component != (Object)null)
					{
						component.SetEquipType(val);
					}
				}
				RefreshClothingList();
			}
			catch (Exception ex)
			{
				Plugin.Log.LogError((object)("[EquipEditorUI] ApplyEquipType error: " + ex.Message));
			}
		}

		private void ApplyRotation()
		{
			//IL_0049: Unknown result type (might be due to invalid IL or missing references)
			//IL_004e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0066: Unknown result type (might be due to invalid IL or missing references)
			//IL_006b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0071: Unknown result type (might be due to invalid IL or missing references)
			//IL_0077: 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_0081: Unknown result type (might be due to invalid IL or missing references)
			//IL_0083: Unknown result type (might be due to invalid IL or missing references)
			//IL_0084: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a1: Expected O, but got Unknown
			//IL_00cc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e3: Expected O, but got Unknown
			//IL_00fe: Unknown result type (might be due to invalid IL or missing references)
			if (currentWrapper == null || ((EquipedWrapper)currentWrapper).propData == null)
			{
				return;
			}
			try
			{
				PropItemData propData = ((EquipedWrapper)currentWrapper).propData;
				EnsureSideTransforms(propData);
				SideTransforms sideTransforms = sideOverrides[propData];
				if (editTargetSide == 0 || editTargetSide == 1)
				{
					sideTransforms.leftRotation = rotation;
				}
				if (editTargetSide == 0 || editTargetSide == 2)
				{
					sideTransforms.rightRotation = rotation;
				}
				Vector3 val = EncodePositionOffset(sideTransforms.leftRotation, sideTransforms.leftPosition);
				propData.m_positionOffset = val;
				CharacterItem spawnedProp = ((EquipedWrapper)currentWrapper).spawnedProp;
				if ((Object)spawnedProp != (Object)null)
				{
					GameObject gameObject = ((Component)spawnedProp).gameObject;
					GameObject mirrorObject = GetMirrorObject(spawnedProp);
					if (editTargetSide == 0 || editTargetSide == 1)
					{
						gameObject.transform.localEulerAngles = sideTransforms.leftRotation;
					}
					if ((Object)mirrorObject != (Object)null && (editTargetSide == 0 || editTargetSide == 2))
					{
						mirrorObject.transform.localEulerAngles = sideTransforms.rightRotation;
					}
				}
			}
			catch (Exception ex)
			{
				Plugin.Log.LogError((object)("[EquipEditorUI] ApplyRotation error: " + ex.Message));
			}
		}

		private void ApplyPosition()
		{
			//IL_0049: Unknown result type (might be due to invalid IL or missing references)
			//IL_004e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0066: Unknown result type (might be due to invalid IL or missing references)
			//IL_006b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0071: Unknown result type (might be due to invalid IL or missing references)
			//IL_0077: 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_0081: Unknown result type (might be due to invalid IL or missing references)
			//IL_0083: Unknown result type (might be due to invalid IL or missing references)
			//IL_0084: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a1: Expected O, but got Unknown
			//IL_00cc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e3: Expected O, but got Unknown
			//IL_00fe: Unknown result type (might be due to invalid IL or missing references)
			if (currentWrapper == null || ((EquipedWrapper)currentWrapper).propData == null)
			{
				return;
			}
			try
			{
				PropItemData propData = ((EquipedWrapper)currentWrapper).propData;
				EnsureSideTransforms(propData);
				SideTransforms sideTransforms = sideOverrides[propData];
				if (editTargetSide == 0 || editTargetSide == 1)
				{
					sideTransforms.leftPosition = positionOffset;
				}
				if (editTargetSide == 0 || editTargetSide == 2)
				{
					sideTransforms.rightPosition = positionOffset;
				}
				Vector3 val = EncodePositionOffset(sideTransforms.leftRotation, sideTransforms.leftPosition);
				propData.m_positionOffset = val;
				CharacterItem spawnedProp = ((EquipedWrapper)currentWrapper).spawnedProp;
				if ((Object)spawnedProp != (Object)null)
				{
					GameObject gameObject = ((Component)spawnedProp).gameObject;
					GameObject mirrorObject = GetMirrorObject(spawnedProp);
					if (editTargetSide == 0 || editTargetSide == 1)
					{
						gameObject.transform.localPosition = sideTransforms.leftPosition;
					}
					if ((Object)mirrorObject != (Object)null && (editTargetSide == 0 || editTargetSide == 2))
					{
						mirrorObject.transform.localPosition = sideTransforms.rightPosition;
					}
				}
			}
			catch (Exception ex)
			{
				Plugin.Log.LogError((object)("[EquipEditorUI] ApplyPosition error: " + ex.Message));
			}
		}

		private void ApplyScale()
		{
			//IL_0049: Unknown result type (might be due to invalid IL or missing references)
			//IL_004e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0066: Unknown result type (might be due to invalid IL or missing references)
			//IL_006b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0072: Unknown result type (might be due to invalid IL or missing references)
			//IL_0077: Unknown result type (might be due to invalid IL or missing references)
			//IL_0089: Unknown result type (might be due to invalid IL or missing references)
			//IL_0094: Expected O, but got Unknown
			//IL_00bd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d4: Expected O, but got Unknown
			//IL_00ef: Unknown result type (might be due to invalid IL or missing references)
			if (currentWrapper == null || ((EquipedWrapper)currentWrapper).propData == null)
			{
				return;
			}
			try
			{
				PropItemData propData = ((EquipedWrapper)currentWrapper).propData;
				EnsureSideTransforms(propData);
				SideTransforms sideTransforms = sideOverrides[propData];
				if (editTargetSide == 0 || editTargetSide == 1)
				{
					sideTransforms.leftScale = scale;
				}
				if (editTargetSide == 0 || editTargetSide == 2)
				{
					sideTransforms.rightScale = scale;
				}
				propData.m_scale = sideTransforms.leftScale;
				CharacterItem spawnedProp = ((EquipedWrapper)currentWrapper).spawnedProp;
				if ((Object)spawnedProp != (Object)null)
				{
					GameObject gameObject = ((Component)spawnedProp).gameObject;
					GameObject mirrorObject = GetMirrorObject(spawnedProp);
					if (editTargetSide == 0 || editTargetSide == 1)
					{
						gameObject.transform.localScale = sideTransforms.leftScale;
					}
					if ((Object)mirrorObject != (Object)null && (editTargetSide == 0 || editTargetSide == 2))
					{
						mirrorObject.transform.localScale = sideTransforms.rightScale;
					}
				}
			}
			catch (Exception ex)
			{
				Plugin.Log.LogError((object)("[EquipEditorUI] ApplyScale error: " + ex.Message));
			}
		}

		private void CorrectMirrorAfterReset()
		{
			//IL_0033: Unknown result type (might be due to invalid IL or missing references)
			//IL_003e: Expected O, but got Unknown
			//IL_0049: Unknown result type (might be due to invalid IL or missing references)
			//IL_0054: Expected O, but got Unknown
			//IL_0089: 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_0095: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a6: Unknown result type (might be due to invalid IL or missing references)
			if (currentWrapper == null)
			{
				return;
			}
			PropItemData propData = ((EquipedWrapper)currentWrapper).propData;
			if (propData == null || !sideOverrides.ContainsKey(propData))
			{
				return;
			}
			CharacterItem spawnedProp = ((EquipedWrapper)currentWrapper).spawnedProp;
			if ((Object)spawnedProp == (Object)null)
			{
				return;
			}
			GameObject mirrorObject = GetMirrorObject(spawnedProp);
			if (!((Object)mirrorObject == (Object)null))
			{
				Vector3 val = default(Vector3);
				((Vector3)(ref val))..ctor(-1f, 1f, 1f);
				if (editTargetSide == 0 || editTargetSide == 2)
				{
					sideOverrides[propData].rightScale = val;
					mirrorObject.transform.localScale = val;
				}
				if (editTargetSide == 2)
				{
					scale = val;
				}
			}
		}

		public static GameObject GetMirrorObject(CharacterItem sourceProp)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Expected O, but got Unknown
			//IL_0042: Unknown result type (might be due to invalid IL or missing references)
			//IL_004a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0054: Expected O, but got Unknown
			//IL_0054: Expected O, but got Unknown
			//IL_0062: Unknown result type (might be due to invalid IL or missing references)
			//IL_006a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0074: Expected O, but got Unknown
			//IL_0074: Expected O, but got Unknown
			if ((Object)sourceProp == (Object)null || f_gameObjects == null)
			{
				return null;
			}
			try
			{
				if (!(f_gameObjects.GetValue(sourceProp) is GameObject[] array) || array.Length < 2)
				{
					return null;
				}
				if ((Object)((Component)sourceProp).gameObject == (Object)array[0])
				{
					return array[1];
				}
				if ((Object)((Component)sourceProp).gameObject == (Object)array[1])
				{
					return array[0];
				}
				return array[1];
			}
			catch
			{
				return null;
			}
		}

		public void SetCurrentWeapon(EquipedWeaponWrapper weapon, bool isRight)
		{
			//IL_0046: Unknown result type (might be due to invalid IL or missing references)
			//IL_0051: Expected O, but got Unknown
			//IL_00f8: 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_0103: Unknown result type (might be due to invalid IL or missing references)
			//IL_0108: Unknown result type (might be due to invalid IL or missing references)
			//IL_010e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0113: Unknown result type (might be due to invalid IL or missing references)
			//IL_0132: Unknown result type (might be due to invalid IL or missing references)
			//IL_0137: Unknown result type (might be due to invalid IL or missing references)
			//IL_0148: Unknown result type (might be due to invalid IL or missing references)
			//IL_014d: Unknown result type (might be due to invalid IL or missing references)
			//IL_015e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0163: Unknown result type (might be due to invalid IL or missing references)
			//IL_008d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0092: Unknown result type (might be due to invalid IL or missing references)
			//IL_0097: Unknown result type (might be due to invalid IL or missing references)
			//IL_009c: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00af: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bf: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00db: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ec: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f1: Unknown result type (might be due to invalid IL or missing references)
			currentWeapon = weapon;
			currentWeaponIsRight = isRight;
			showWeaponUI = weapon != null && IsInUnitEditor;
			if (showWeaponUI)
			{
				showUI = false;
				currentWrapper = null;
			}
			currentWeaponHoldable = null;
			if (weapon != null && (Object)((EquipedWrapper)weapon).spawnedProp != (Object)null)
			{
				currentWeaponHoldable = ((Component)((EquipedWrapper)weapon).spawnedProp).GetComponent<Holdable>();
			}
			if (weapon != null && ((EquipedWrapper)weapon).propData != null)
			{
				LoadWeaponValues();
				if ((Object)(object)currentWeaponHoldable != (Object)null)
				{
					Quaternion val = Quaternion.Inverse(Quaternion.Euler(weaponRotation));
					baseRelativePosition = currentWeaponHoldable.holdableData.relativePosition - weaponPosition;
					baseForwardRotation = val * currentWeaponHoldable.holdableData.forwardRotation;
					baseUpRotation = val * currentWeaponHoldable.holdableData.upRotation;
				}
				return;
			}
			weaponRotation = Vector3.zero;
			weaponPosition = Vector3.zero;
			weaponScale = Vector3.one;
			if ((Object)(object)currentWeaponHoldable != (Object)null)
			{
				baseRelativePosition = currentWeaponHoldable.holdableData.relativePosition;
				baseForwardRotation = currentWeaponHoldable.holdableData.forwardRotation;
				baseUpRotation = currentWeaponHoldable.holdableData.upRotation;
			}
		}

		private void LoadWeaponValues()
		{
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_0032: Unknown result type (might be due to invalid IL or missing references)
			//IL_0033: Unknown result type (might be due to invalid IL or missing references)
			//IL_0039: Unknown result type (might be due to invalid IL or missing references)
			//IL_003a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0041: Unknown result type (might be due to invalid IL or missing references)
			//IL_0046: Unknown result type (might be due to invalid IL or missing references)
			if (currentWeapon != null && ((EquipedWrapper)currentWeapon).propData != null)
			{
				PropItemData propData = ((EquipedWrapper)currentWeapon).propData;
				DecodePositionOffset(propData.m_positionOffset, out var rot, out var pos);
				weaponRotation = rot;
				weaponPosition = pos;
				weaponScale = propData.m_scale;
			}
		}

		private string GetWeaponName(EquipedWeaponWrapper weapon)
		{
			//IL_0009: Unknown result type (might be due to invalid IL or missing references)
			//IL_0014: Expected O, but got Unknown
			if (weapon == null || (Object)((EquipedWrapper)weapon).prop == (Object)null)
			{
				return T(W_NO_WEAPON);
			}
			string displayName = ((EquipedWrapper)weapon).prop.DisplayName;
			try
			{
				string singlePhrase = Localizer.GetSinglePhrase(displayName, Array.Empty<string>());
				if (!string.IsNullOrEmpty(singlePhrase) && singlePhrase != displayName)
				{
					return singlePhrase;
				}
			}
			catch
			{
			}
			return displayName;
		}

		private void ApplyWeaponRotation()
		{
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0033: Unknown result type (might be due to invalid IL or missing references)
			//IL_0034: 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_009b: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a6: Expected O, but got Unknown
			//IL_0049: Unknown result type (might be due to invalid IL or missing references)
			//IL_004e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0053: Unknown result type (might be due to invalid IL or missing references)
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0061: Unknown result type (might be due to invalid IL or missing references)
			//IL_0066: Unknown result type (might be due to invalid IL or missing references)
			//IL_006b: Unknown result type (might be due to invalid IL or missing references)
			//IL_007b: Unknown result type (might be due to invalid IL or missing references)
			//IL_007d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0082: Unknown result type (might be due to invalid IL or missing references)
			//IL_0087: Unknown result type (might be due to invalid IL or missing references)
			//IL_00af: Unknown result type (might be due to invalid IL or missing references)
			if (currentWeapon == null || ((EquipedWrapper)currentWeapon).propData == null)
			{
				return;
			}
			try
			{
				PropItemData propData = ((EquipedWrapper)currentWeapon).propData;
				Vector3 val = EncodePositionOffset(weaponRotation, weaponPosition);
				propData.m_positionOffset = val;
				if ((Object)(object)currentWeaponHoldable != (Object)null)
				{
					Quaternion val2 = Quaternion.Euler(weaponRotation);
					currentWeaponHoldable.holdableData.forwardRotation = val2 * baseForwardRotation;
					currentWeaponHoldable.holdableData.upRotation = val2 * baseUpRotation;
					return;
				}
				CharacterItem spawnedProp = ((EquipedWrapper)currentWeapon).spawnedProp;
				if ((Object)spawnedProp != (Object)null)
				{
					((Component)spawnedProp).transform.localEulerAngles = weaponRotation;
				}
			}
			catch (Exception ex)
			{
				Plugin.Log.LogError((object)("[EquipEditorUI] ApplyWeaponRotation error: " + ex.Message));
			}
		}

		private void ApplyWeaponPosition()
		{
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0033: Unknown result type (might be due to invalid IL or missing references)
			//IL_0034: 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_0078: Unknown result type (might be due to invalid IL or missing references)
			//IL_0083: Expected O, but got Unknown
			//IL_0054: Unknown result type (might be due to invalid IL or missing references)
			//IL_005a: Unknown result type (might be due to invalid IL or missing references)
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0064: Unknown result type (might be due to invalid IL or missing references)
			//IL_008c: Unknown result type (might be due to invalid IL or missing references)
			if (currentWeapon == null || ((EquipedWrapper)currentWeapon).propData == null)
			{
				return;
			}
			try
			{
				PropItemData propData = ((EquipedWrapper)currentWeapon).propData;
				Vector3 val = EncodePositionOffset(weaponRotation, weaponPosition);
				propData.m_positionOffset = val;
				if ((Object)(object)currentWeaponHoldable != (Object)null)
				{
					currentWeaponHoldable.holdableData.relativePosition = baseRelativePosition + weaponPosition;
					return;
				}
				CharacterItem spawnedProp = ((EquipedWrapper)currentWeapon).spawnedProp;
				if ((Object)spawnedProp != (Object)null)
				{
					((Component)spawnedProp).transform.localPosition = weaponPosition;
				}
			}
			catch (Exception ex)
			{
				Plugin.Log.LogError((object)("[EquipEditorUI] ApplyWeaponPosition error: " + ex.Message));
			}
		}

		private void ApplyWeaponScale()
		{
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_0028: Unknown result type (might be due to invalid IL or missing references)
			//IL_003a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0045: Expected O, but got Unknown
			//IL_004e: Unknown result type (might be due to invalid IL or missing references)
			if (currentWeapon == null || ((EquipedWrapper)currentWeapon).propData == null)
			{
				return;
			}
			try
			{
				((EquipedWrapper)currentWeapon).propData.m_scale = weaponScale;
				CharacterItem spawnedProp = ((EquipedWrapper)currentWeapon).spawnedProp;
				if ((Object)spawnedProp != (Object)null)
				{
					((Component)spawnedProp).transform.localScale = weaponScale;
				}
			}
			catch (Exception ex)
			{
				Plugin.Log.LogError((object)("[EquipEditorUI] ApplyWeaponScale error: " + ex.Message));
			}
		}

		private void RefreshWeaponSelection()
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: Expected O, but got Unknown
			try
			{
				UnitEditorManager val = Object.FindObjectOfType<UnitEditorManager>();
				if ((Object)val == (Object)null)
				{
					currentWeapon = null;
					return;
				}
				EquipedWeaponWrapper val2 = (currentWeaponIsRight ? val.RightHandedWeapon : val.LeftHandedWeapon);
				if (val2 != currentWeapon)
				{
					SetCurrentWeapon(val2, currentWeaponIsRight);
				}
			}
			catch (Exception ex)
			{
				Plugin.Log.LogError((object)("[EquipEditorUI] RefreshWeaponSelection error: " + ex.Message));
			}
		}

		private void SelectWeaponHand(bool isRight)
		{
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0019: Expected O, but got Unknown
			currentWeaponIsRight = isRight;
			try
			{
				UnitEditorManager val = Object.FindObjectOfType<UnitEditorManager>();
				if ((Object)val != (Object)null)
				{
					EquipedWeaponWrapper weapon = (isRight ? val.RightHandedWeapon : val.LeftHandedWeapon);
					SetCurrentWeapon(weapon, isRight);
				}
			}
			catch (Exception ex)
			{
				Plugin.Log.LogError((object)("[EquipEditorUI] SelectWeaponHand error: " + ex.Message));
			}
		}

		private void DrawWeaponWindow(int windowID)
		{
			//IL_019e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0223: 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: Unknown result type (might be due to invalid IL or missing references)
			//IL_031b: Unknown result type (might be due to invalid IL or missing references)
			//IL_032f: 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_0291: Unknown result type (might be due to invalid IL or missing references)
			//IL_0296: Unknown result type (might be due to invalid IL or missing references)
			//IL_0413: 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_043b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0389: Unknown result type (might be due to invalid IL or missing references)
			//IL_038e: Unknown result type (might be due to invalid IL or missing references)
			//IL_04c8: Unknown result type (might be due to invalid IL or missing references)
			//IL_04cd: Unknown result type (might be due to invalid IL or missing references)
			//IL_04d3: Unknown result type (might be due to invalid IL or missing references)
			//IL_04d8: Unknown result type (might be due to invalid IL or missing references)
			//IL_04de: Unknown result type (might be due to invalid IL or missing references)
			//IL_04e3: Unknown result type (might be due to invalid IL or missing references)
			//IL_0481: Unknown result type (might be due to invalid IL or missing references)
			//IL_0486: 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_0560: Unknown result type (might be due to invalid IL or missing references)
			//IL_0568: Unknown result type (might be due to invalid IL or missing references)
			//IL_056e: Invalid comparison between Unknown and I4
			//IL_0571: Unknown result type (might be due to invalid IL or missing references)
			//IL_0577: Invalid comparison between Unknown and I4
			//IL_057a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0580: Invalid comparison between Unknown and I4
			GUILayout.Space(4f);
			GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
			GUIStyle val = (currentWeaponIsRight ? styleEquipBtnSel : styleEquipBtn);
			GUIStyle val2 = ((!currentWeaponIsRight) ? styleEquipBtnSel : styleEquipBtn);
			if (GUILayout.Button(T(W_RIGHT_HAND), val, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(30f) }))
			{
				SelectWeaponHand(isRight: true);
			}
			if (GUILayout.Button(T(W_LEFT_HAND), val2, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(30f) }))
			{
				SelectWeaponHand(isRight: false);
			}
			GUILayout.EndHorizontal();
			DrawSep();
			GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
			GUILayout.Label(T(W_CURR_WEAPON), styleHeaderLabel, Array.Empty<GUILayoutOption>());
			GUILayout.Label(GetWeaponName(currentWeapon), styleClothingName, Array.Empty<GUILayoutOption>());
			GUILayout.FlexibleSpace();
			GUILayout.EndHorizontal();
			if (currentWeapon == null || (Object)(object)((EquipedWrapper)currentWeapon).spawnedProp == (Object)null)
			{
				GUILayout.Space(8f);
				GUILayout.Label("  " + T(W_NO_WEAPON), styleItemLabel, Array.Empty<GUILayoutOption>());
				GUILayout.Space(8f);
				if (GUILayout.Button(T(L_CLOSE), styleActionBtn, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(30f) }))
				{
					showWeaponUI = false;
				}
				GUI.DragWindow(new Rect(0f, 0f, 10000f, 30f));
				return;
			}
			DrawSep();
			showWeaponRotationSection = GUILayout.Toggle(showWeaponRotationSection, "  ▼ " + T(L_SEC_ROTATION), styleSectionToggle, Array.Empty<GUILayoutOption>());
			if (showWeaponRotationSection)
			{
				GUILayout.Space(4f);
				DrawVector3Control(ref weaponRotation, -180f, 180f, ApplyWeaponRotation, 9, new Color(0.95f, 0.4f, 0.4f), new Color(0.4f, 0.9f, 0.4f), new Color(0.4f, 0.6f, 0.95f));
				GUILayout.Space(2f);
				if (GUILayout.Button(T(L_RESET_ROT), styleActionBtn, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(26f) }))
				{
					weaponRotation = Vector3.zero;
					ApplyWeaponRotation();
				}
			}
			DrawSep();
			showWeaponPositionSection = GUILayout.Toggle(showWeaponPositionSection, "  ▼ " + T(L_SEC_POSITION), styleSectionToggle, Array.Empty<GUILayoutOption>());
			if (showWeaponPositionSection)
			{
				GUILayout.Space(4f);
				DrawVector3Control(ref weaponPosition, -10f, 10f, ApplyWeaponPosition, 12, new Color(0.95f, 0.4f, 0.4f), new Color(0.4f, 0.9f, 0.4f), new Color(0.4f, 0.6f, 0.95f), useDynamicRange: true);
				GUILayout.Space(2f);
				if (GUILayout.Button(T(L_RESET_POS), styleActionBtn, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(26f) }))
				{
					weaponPosition = Vector3.zero;
					ApplyWeaponPosition();
				}
			}
			DrawSep();
			showWeaponScaleSection = GUILayout.Toggle(showWeaponScaleSection, "  ▼ " + T(L_SEC_SCALE), styleSectionToggle, Array.Empty<GUILayoutOption>());
			if (showWeaponScaleSection)
			{
				GUILayout.Space(4f);
				DrawVector3Control(ref weaponScale, 0.1f, 10f, ApplyWeaponScale, 15, new Color(0.95f, 0.4f, 0.4f), new Color(0.4f, 0.9f, 0.4f), new Color(0.4f, 0.6f, 0.95f), useDynamicRange: true);
				GUILayout.Space(2f);
				if (GUILayout.Button(T(L_RESET_SCALE), styleActionBtn, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(26f) }))
				{
					weaponScale = Vector3.one;
					ApplyWeaponScale();
				}
			}
			DrawSep();
			if (GUILayout.Button(T(L_RESET_ALL), styleCloseBtn, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(30f) }))
			{
				weaponRotation = Vector3.zero;
				weaponPosition = Vector3.zero;
				weaponScale = Vector3.one;
				ApplyWeaponRotation();
				ApplyWeaponPosition();
				ApplyWeaponScale();
			}
			GUILayout.Space(8f);
			if (GUILayout.Button(T(L_CLOSE), styleActionBtn, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(30f) }))
			{
				showWeaponUI = false;
			}
			GUI.DragWindow(new Rect(0f, 0f, 10000f, 30f));
			Event val3 = Event.current;
			if ((int)val3.type == 0 || (int)val3.type == 3 || (int)val3.type == 1 || (int)val3.type == 6)
			{
				val3.Use();
			}
		}

		private int GetEquipTypeIndex(EquipType equipType)
		{
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_000d: Invalid comparison between I4 and Unknown
			for (int i = 0; i < equipTypes.Length; i++)
			{
				if ((int)equipTypes[i] == (int)equipType)
				{
					return i;
				}
			}
			return 0;
		}

		private Texture2D MakeTex(int width, int height, Color color)
		{
			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_0026: Unknown result type (might be due to invalid IL or missing references)
			//I