Decompiled source of SemibotSliders v0.5.0

SemibotSliders.dll

Decompiled a month ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using HarmonyLib;
using MenuLib;
using MenuLib.MonoBehaviors;
using Microsoft.CodeAnalysis;
using Photon.Pun;
using Sirenix.Utilities;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: IgnoresAccessChecksTo("Assembly-CSharp-firstpass")]
[assembly: IgnoresAccessChecksTo("Assembly-CSharp")]
[assembly: IgnoresAccessChecksTo("Autodesk.Fbx")]
[assembly: IgnoresAccessChecksTo("Facepunch.Steamworks.Win64")]
[assembly: IgnoresAccessChecksTo("FbxBuildTestAssets")]
[assembly: IgnoresAccessChecksTo("Klattersynth")]
[assembly: IgnoresAccessChecksTo("Photon3Unity3D")]
[assembly: IgnoresAccessChecksTo("PhotonChat")]
[assembly: IgnoresAccessChecksTo("PhotonRealtime")]
[assembly: IgnoresAccessChecksTo("PhotonUnityNetworking")]
[assembly: IgnoresAccessChecksTo("PhotonUnityNetworking.Utilities")]
[assembly: IgnoresAccessChecksTo("PhotonVoice.API")]
[assembly: IgnoresAccessChecksTo("PhotonVoice")]
[assembly: IgnoresAccessChecksTo("PhotonVoice.PUN")]
[assembly: IgnoresAccessChecksTo("SingularityGroup.HotReload.Runtime")]
[assembly: IgnoresAccessChecksTo("SingularityGroup.HotReload.Runtime.Public")]
[assembly: IgnoresAccessChecksTo("Sirenix.OdinInspector.Attributes")]
[assembly: IgnoresAccessChecksTo("Sirenix.Serialization.Config")]
[assembly: IgnoresAccessChecksTo("Sirenix.Serialization")]
[assembly: IgnoresAccessChecksTo("Sirenix.Utilities")]
[assembly: IgnoresAccessChecksTo("Unity.AI.Navigation")]
[assembly: IgnoresAccessChecksTo("Unity.Formats.Fbx.Runtime")]
[assembly: IgnoresAccessChecksTo("Unity.InputSystem")]
[assembly: IgnoresAccessChecksTo("Unity.InputSystem.ForUI")]
[assembly: IgnoresAccessChecksTo("Unity.Postprocessing.Runtime")]
[assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.Core.Runtime")]
[assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.Core.ShaderLibrary")]
[assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.ShaderGraph.ShaderGraphLibrary")]
[assembly: IgnoresAccessChecksTo("Unity.TextMeshPro")]
[assembly: IgnoresAccessChecksTo("Unity.Timeline")]
[assembly: IgnoresAccessChecksTo("Unity.VisualScripting.Antlr3.Runtime")]
[assembly: IgnoresAccessChecksTo("Unity.VisualScripting.Core")]
[assembly: IgnoresAccessChecksTo("Unity.VisualScripting.Flow")]
[assembly: IgnoresAccessChecksTo("Unity.VisualScripting.State")]
[assembly: IgnoresAccessChecksTo("UnityEngine.ARModule")]
[assembly: IgnoresAccessChecksTo("UnityEngine.NVIDIAModule")]
[assembly: IgnoresAccessChecksTo("UnityEngine.UI")]
[assembly: IgnoresAccessChecksTo("websocket-sharp")]
[assembly: AssemblyCompany("linkoid")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("0.5.0.0")]
[assembly: AssemblyInformationalVersion("0.5.0+265984c488e47ca0fd95a9072afd54a665842786")]
[assembly: AssemblyProduct("SemibotSliders")]
[assembly: AssemblyTitle("SemibotSliders")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("0.5.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableAttribute : Attribute
	{
		public readonly byte[] NullableFlags;

		public NullableAttribute(byte P_0)
		{
			NullableFlags = new byte[1] { P_0 };
		}

		public NullableAttribute(byte[] P_0)
		{
			NullableFlags = P_0;
		}
	}
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableContextAttribute : Attribute
	{
		public readonly byte Flag;

		public NullableContextAttribute(byte P_0)
		{
			Flag = P_0;
		}
	}
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.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;
		}
	}
	internal static class IsExternalInit
	{
	}
}
namespace Linkoid.Repo.SemibotSliders
{
	internal class BodySliderMenu
	{
		public REPOPopupPage? page;

		private FieldInfo[] fields;

		private ScaleSettings scaleSettings = ScaleSettings.Default;

		private REPOAvatarPreview? avatarPreview;

		private Dictionary<FieldInfo, REPOVector3SliderModel> currentSliders;

		public BodySliderMenu()
		{
			fields = typeof(ScaleSettings).GetFields(BindingFlags.Instance | BindingFlags.Public);
		}

		public void Open()
		{
			//IL_004e: Unknown result type (might be due to invalid IL or missing references)
			//IL_007f: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ae: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d3: Unknown result type (might be due to invalid IL or missing references)
			//IL_0115: Unknown result type (might be due to invalid IL or missing references)
			//IL_0129: Unknown result type (might be due to invalid IL or missing references)
			//IL_012e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0130: Unknown result type (might be due to invalid IL or missing references)
			//IL_0144: Unknown result type (might be due to invalid IL or missing references)
			//IL_0149: Unknown result type (might be due to invalid IL or missing references)
			//IL_0174: Unknown result type (might be due to invalid IL or missing references)
			//IL_0176: Unknown result type (might be due to invalid IL or missing references)
			//IL_0195: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d8: Unknown result type (might be due to invalid IL or missing references)
			scaleSettings = UserConfigModel.Instance.GetScaleSettings();
			page = MenuAPI.CreateREPOPopupPage("Semibot Sliders", (PresetSide)0, false, true, 0f);
			MenuAPI.CreateREPOButton("Confirm", (Action)Close, ((Component)page).transform, new Vector2(66f, 18f));
			MenuAPI.CreateREPOButton("Revert", (Action)Revert, ((Component)page).transform, new Vector2(260f, 18f));
			REPOButton val = MenuAPI.CreateREPOButton("Reset to Defaults", (Action)Reset, ((Component)page).transform, default(Vector2));
			page.scrollView.popupPage.AddElementToScrollView(((REPOElement)val).rectTransform, default(Vector2), 0f, 0f);
			currentSliders = new Dictionary<FieldInfo, REPOVector3SliderModel>();
			FieldInfo[] array = fields;
			foreach (FieldInfo field in array)
			{
				Vector3 min = Vector3.one * SemibotSliders.ConfigModel.ScaleMinimum.Value;
				Vector3 value2 = Vector3.one * SemibotSliders.ConfigModel.ScaleMaximum.Value;
				REPOVector3SliderModel value3 = new REPOVector3SliderModel(field.Name, "", delegate(Vector3 value)
				{
					//IL_000c: Unknown result type (might be due to invalid IL or missing references)
					OnValueChanged(field, value);
				}, page.scrollView, min, value2, 2, (Vector3)field.GetValue(scaleSettings));
				currentSliders.Add(field, value3);
			}
			avatarPreview = MenuAPI.CreateREPOAvatarPreview(((Component)page).transform, new Vector2(476f, 36f), false, (Color?)null);
			page.OpenPage(false);
		}

		public void Revert()
		{
			scaleSettings = UserConfigModel.Instance.GetScaleSettings();
			ApplyScaleSettingsToSliders();
			ApplyScaleSettingsToMenuCharacter();
		}

		public void Reset()
		{
			scaleSettings = ScaleSettings.Default;
			ApplyScaleSettingsToSliders();
			ApplyScaleSettingsToMenuCharacter();
		}

		public void Close()
		{
			UserConfigModel.Instance.SaveScaleSettings(scaleSettings);
			PlayerController instance = PlayerController.instance;
			bool? obj;
			PlayerAvatarSlidersSync playerAvatarSlidersSync = default(PlayerAvatarSlidersSync);
			if (instance == null)
			{
				obj = null;
			}
			else
			{
				GameObject playerAvatar = instance.playerAvatar;
				obj = ((playerAvatar != null) ? new bool?(playerAvatar.TryGetComponent<PlayerAvatarSlidersSync>(ref playerAvatarSlidersSync)) : null);
			}
			bool? flag = obj;
			if (flag.GetValueOrDefault())
			{
				playerAvatarSlidersSync.SetScaleSettings(scaleSettings);
			}
			REPOPopupPage? obj2 = page;
			if (obj2 != null)
			{
				obj2.ClosePage(true);
			}
		}

		private void OnValueChanged(FieldInfo field, Vector3 value)
		{
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			object obj = scaleSettings;
			field.SetValue(obj, value);
			scaleSettings = (ScaleSettings)obj;
			ApplyScaleSettingsToMenuCharacter();
		}

		private void ApplyScaleSettingsToSliders()
		{
			//IL_0039: Unknown result type (might be due to invalid IL or missing references)
			foreach (var (fieldInfo2, rEPOVector3SliderModel2) in currentSliders)
			{
				rEPOVector3SliderModel2.SetValue((Vector3)fieldInfo2.GetValue(scaleSettings), invokeCallback: false);
			}
		}

		private void ApplyScaleSettingsToMenuCharacter()
		{
			PlayerAvatarSliders component = ((Component)avatarPreview.playerAvatarVisuals).GetComponent<PlayerAvatarSliders>();
			component.ScaleSettings = scaleSettings;
		}
	}
	internal static class GameObjectExtensions
	{
		public static GameObject? Find(this GameObject parent, string name)
		{
			Transform obj = parent.transform.Find(name);
			if (obj == null)
			{
				return null;
			}
			return ((Component)obj).gameObject;
		}

		public static GameObject? FindFirstChild(this GameObject parent, string name)
		{
			Transform? obj = parent.transform.FindFirstChild(name);
			if (obj == null)
			{
				return null;
			}
			return ((Component)obj).gameObject;
		}

		public static Transform? FindFirstChild(this Transform parent, string name)
		{
			Queue<Transform> queue = new Queue<Transform>();
			queue.Enqueue(parent);
			while (queue.Count > 0)
			{
				parent = queue.Dequeue();
				Transform val = parent.Find(name);
				if ((Object)(object)val != (Object)null)
				{
					return val;
				}
				int childCount = parent.childCount;
				for (int i = 0; i < childCount; i++)
				{
					queue.Enqueue(parent.GetChild(i));
				}
			}
			return null;
		}
	}
	internal record ModConfigModel(ConfigFile ConfigFile)
	{
		public const string GeneralSliderConstraintsSection = "GeneralSliderConstraints";

		public readonly ConfigEntry<float> ScaleMinimum = ConfigFile.Bind<float>("GeneralSliderConstraints", "ScaleMinimum", 0f, new ConfigDescription("Smallest applyable scale factor for body sliders", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 0.99f), Array.Empty<object>()));

		public readonly ConfigEntry<float> ScaleMaximum = ConfigFile.Bind<float>("GeneralSliderConstraints", "ScaleMaximum", 3f, new ConfigDescription("Largest applyable scale factor for body sliders", (AcceptableValueBase)(object)new AcceptableValueRange<float>(1.01f, 3f), Array.Empty<object>()));

		[CompilerGenerated]
		protected ModConfigModel(ModConfigModel original)
		{
			ConfigFile = original.ConfigFile;
			ScaleMinimum = original.ScaleMinimum;
			ScaleMaximum = original.ScaleMaximum;
		}
	}
	[HarmonyPatch]
	internal class PlayerAvatarSliders : MonoBehaviour
	{
		private PlayerAvatarVisuals playerAvatarVisuals;

		private Transform? legLBot;

		private Transform? legLTop;

		private Transform? legRBot;

		private Transform? legRTop;

		private Transform? bodyBot;

		private Transform? bodyBotScale;

		private Transform? bodyTop;

		private Transform? bodyTopScale;

		private Transform? armL;

		private Transform? armR;

		private Transform? headBot;

		private Transform? headTop;

		private Transform? eyeL;

		private Transform? eyeR;

		private ScaleSettings _scaleSettings = ScaleSettings.Default;

		private bool isDirty = true;

		private ScaleSettings appliedScaleSettings = ScaleSettings.Default;

		public ScaleSettings ScaleSettings
		{
			get
			{
				return _scaleSettings;
			}
			set
			{
				_scaleSettings = value;
				isDirty = true;
			}
		}

		[HarmonyPostfix]
		[HarmonyPatch(typeof(PlayerAvatarVisuals), "Start")]
		private static void Start_Postfix(PlayerAvatarVisuals __instance)
		{
			((Component)__instance).gameObject.AddComponent<PlayerAvatarSliders>();
		}

		private void Awake()
		{
			playerAvatarVisuals = ((Component)this).GetComponent<PlayerAvatarVisuals>();
			FindAvatarTransforms();
		}

		private void Start()
		{
			if (playerAvatarVisuals.isMenuAvatar)
			{
				MenuAvatarGetSliderSettingsFromRealAvatar();
			}
		}

		private void Update()
		{
			if (isDirty)
			{
				ApplyAbsoluteScales();
				isDirty = false;
			}
		}

		private void LateUpdate()
		{
			ApplyRelativeScales();
		}

		internal void SetDirty()
		{
			isDirty = true;
		}

		private void FindAvatarTransforms()
		{
			GameObject? obj = ((Component)this).gameObject.FindFirstChild("ANIM LEG L BOT");
			legLBot = ((obj != null) ? obj.transform : null);
			GameObject? obj2 = ((Component)this).gameObject.FindFirstChild("ANIM LEG L TOP");
			legLTop = ((obj2 != null) ? obj2.transform : null);
			GameObject? obj3 = ((Component)this).gameObject.FindFirstChild("ANIM LEG R BOT");
			legRBot = ((obj3 != null) ? obj3.transform : null);
			GameObject? obj4 = ((Component)this).gameObject.FindFirstChild("ANIM LEG R TOP");
			legRTop = ((obj4 != null) ? obj4.transform : null);
			GameObject? obj5 = ((Component)this).gameObject.FindFirstChild("ANIM BODY BOT");
			bodyBot = ((obj5 != null) ? obj5.transform : null);
			GameObject? obj6 = ((Component)this).gameObject.FindFirstChild("ANIM BODY BOT SCALE");
			bodyBotScale = ((obj6 != null) ? obj6.transform : null);
			GameObject? obj7 = ((Component)this).gameObject.FindFirstChild("ANIM BODY TOP");
			bodyTop = ((obj7 != null) ? obj7.transform : null);
			GameObject? obj8 = ((Component)this).gameObject.FindFirstChild("ANIM BODY TOP SCALE");
			bodyTopScale = ((obj8 != null) ? obj8.transform : null);
			GameObject? obj9 = ((Component)this).gameObject.FindFirstChild("ANIM ARM L");
			armL = ((obj9 != null) ? obj9.transform : null);
			GameObject? obj10 = ((Component)this).gameObject.FindFirstChild("ANIM ARM R");
			armR = ((obj10 != null) ? obj10.transform : null);
			GameObject? obj11 = ((Component)this).gameObject.FindFirstChild("ANIM HEAD BOT");
			headBot = ((obj11 != null) ? obj11.transform : null);
			GameObject? obj12 = ((Component)this).gameObject.FindFirstChild("ANIM HEAD TOP");
			headTop = ((obj12 != null) ? obj12.transform : null);
			GameObject? obj13 = ((Component)this).gameObject.FindFirstChild("ANIM EYE LEFT");
			eyeL = ((obj13 != null) ? obj13.transform : null);
			GameObject? obj14 = ((Component)this).gameObject.FindFirstChild("ANIM EYE RIGHT");
			eyeR = ((obj14 != null) ? obj14.transform : null);
		}

		private void MenuAvatarGetSliderSettingsFromRealAvatar()
		{
			PlayerAvatar val = playerAvatarVisuals.playerAvatar ?? PlayerAvatar.instance;
			bool? obj;
			PlayerAvatarSliders playerAvatarSliders = default(PlayerAvatarSliders);
			if (val == null)
			{
				obj = null;
			}
			else
			{
				PlayerAvatarVisuals obj2 = val.playerAvatarVisuals;
				obj = ((obj2 != null) ? new bool?(((Component)obj2).TryGetComponent<PlayerAvatarSliders>(ref playerAvatarSliders)) : null);
			}
			bool? flag = obj;
			if (flag.GetValueOrDefault())
			{
				ScaleSettings = playerAvatarSliders.ScaleSettings;
			}
			else
			{
				ScaleSettings = UserConfigModel.Instance.GetScaleSettings();
			}
		}

		private void ApplyAbsoluteScales()
		{
			//IL_003e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0054: Unknown result type (might be due to invalid IL or missing references)
			//IL_006a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0080: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ac: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c2: 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)
			appliedScaleSettings = ScaleSettings.Clamp(SemibotSliders.ConfigModel.ScaleMinimum.Value, SemibotSliders.ConfigModel.ScaleMaximum.Value);
			Set(bodyBot, appliedScaleSettings.BodyBot);
			Set(bodyTop, appliedScaleSettings.BodyTop);
			Set(headBot, appliedScaleSettings.HeadBot);
			Set(headTop, appliedScaleSettings.HeadTop);
			Set(eyeL, appliedScaleSettings.EyeL);
			Set(eyeR, appliedScaleSettings.EyeR);
			Set(armL, appliedScaleSettings.ArmL);
			Set(armR, appliedScaleSettings.ArmR);
			static void Set(Transform? transform, Vector3 scale)
			{
				//IL_000b: Unknown result type (might be due to invalid IL or missing references)
				if (!((Object)(object)transform == (Object)null))
				{
					transform.localScale = scale;
				}
			}
		}

		private void ApplyRelativeScales()
		{
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			//IL_0038: 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_0064: Unknown result type (might be due to invalid IL or missing references)
			//IL_007a: Unknown result type (might be due to invalid IL or missing references)
			Set(legLBot, appliedScaleSettings.LegLBot);
			Set(legLTop, appliedScaleSettings.LegLTop);
			Set(legRBot, appliedScaleSettings.LegRBot);
			Set(legRTop, appliedScaleSettings.LegRTop);
			Set(bodyBotScale, appliedScaleSettings.BodyBotScale);
			Set(bodyTopScale, appliedScaleSettings.BodyTopScale);
			static void Set(Transform? transform, Vector3 scale)
			{
				//IL_000b: Unknown result type (might be due to invalid IL or missing references)
				//IL_0010: Unknown result type (might be due to invalid IL or missing references)
				//IL_0013: Unknown result type (might be due to invalid IL or missing references)
				//IL_001a: Unknown result type (might be due to invalid IL or missing references)
				if (!((Object)(object)transform == (Object)null))
				{
					Vector3 localScale = transform.localScale;
					((Vector3)(ref localScale)).Scale(scale);
					transform.localScale = localScale;
				}
			}
		}
	}
	[HarmonyPatch]
	internal class PlayerAvatarSlidersSync : MonoBehaviour
	{
		private PhotonView photonView;

		private PlayerAvatar playerAvatar;

		private PlayerAvatarSliders playerAvatarSliders;

		private bool isDirty;

		private ScaleSettings scaleSettings = ScaleSettings.Default;

		[HarmonyPostfix]
		[HarmonyPatch(typeof(PlayerAvatar), "Awake")]
		private static void Awake_Postfix(PlayerAvatar __instance)
		{
			((Component)__instance).gameObject.AddComponent<PlayerAvatarSlidersSync>();
		}

		private void Awake()
		{
			photonView = ((Component)this).GetComponent<PhotonView>();
			playerAvatar = ((Component)this).GetComponent<PlayerAvatar>();
		}

		private void Start()
		{
			playerAvatarSliders = ((Component)playerAvatar.playerAvatarVisuals).GetComponent<PlayerAvatarSliders>();
			if (!SemiFunc.IsMultiplayer() || photonView.IsMine)
			{
				((MonoBehaviour)this).StartCoroutine(WaitForSteamID());
			}
		}

		private void Update()
		{
			ApplyScaleSettingsIfDirty();
		}

		private IEnumerator WaitForSteamID()
		{
			while (playerAvatar.steamID == null)
			{
				yield return null;
			}
			if (SemiFunc.IsMultiplayer() || !SemiFunc.IsMainMenu())
			{
				ScaleSettings scaleSettings = UserConfigModel.Instance.GetScaleSettings();
				SemibotSliders.Logger.LogDebug((object)scaleSettings);
				SetScaleSettings(scaleSettings);
			}
		}

		public void SetScaleSettings(ScaleSettings scaleSettings)
		{
			if (!GameManager.Multiplayer())
			{
				SemibotSliders_SetScaleSettingsRPC(scaleSettings.ToArray());
				return;
			}
			photonView.RPC("SemibotSliders_SetScaleSettingsRPC", (RpcTarget)3, new object[1] { scaleSettings.ToArray() });
		}

		[MethodImpl(MethodImplOptions.NoInlining)]
		[PunRPC]
		public void SemibotSliders_SetScaleSettingsRPC(Vector3[] scaleSettingsArray)
		{
			scaleSettings = ScaleSettings.FromArray(scaleSettingsArray);
			isDirty = true;
		}

		private void ApplyScaleSettingsIfDirty()
		{
			if (isDirty && !((Object)(object)playerAvatarSliders == (Object)null))
			{
				playerAvatarSliders.ScaleSettings = scaleSettings;
				isDirty = false;
			}
		}
	}
	internal class REPOVector3SliderModel
	{
		public Action<Vector3>? onValueChanged;

		private Vector3 defaultValue;

		private REPOLabel label;

		private REPOSlider xSlider;

		private REPOSlider ySlider;

		private REPOSlider zSlider;

		private Vector3 _min = Vector3.zero;

		private Vector3 _max = Vector3.one;

		private int _precision = 2;

		private float _precisionDecimal = 0.01f;

		public Vector3 min
		{
			get
			{
				//IL_0001: Unknown result type (might be due to invalid IL or missing references)
				return _min;
			}
			set
			{
				//IL_0001: Unknown result type (might be due to invalid IL or missing references)
				//IL_0002: Unknown result type (might be due to invalid IL or missing references)
				_min = value;
				xSlider.min = _min.x;
				ySlider.min = _min.y;
				zSlider.min = _min.z;
			}
		}

		public Vector3 max
		{
			get
			{
				//IL_0001: Unknown result type (might be due to invalid IL or missing references)
				return _max;
			}
			set
			{
				//IL_0001: Unknown result type (might be due to invalid IL or missing references)
				//IL_0002: Unknown result type (might be due to invalid IL or missing references)
				_max = value;
				xSlider.max = _max.x;
				ySlider.max = _max.y;
				zSlider.max = _max.z;
			}
		}

		public int precision
		{
			get
			{
				return _precision;
			}
			set
			{
				_precision = value;
				xSlider.precision = _precision;
				ySlider.precision = _precision;
				zSlider.precision = _precision;
			}
		}

		public float precisionDecimal
		{
			get
			{
				return _precisionDecimal;
			}
			set
			{
				_precisionDecimal = value;
				xSlider.precisionDecimal = _precisionDecimal;
				ySlider.precisionDecimal = _precisionDecimal;
				zSlider.precisionDecimal = _precisionDecimal;
			}
		}

		public Vector3 value
		{
			get
			{
				//IL_0021: Unknown result type (might be due to invalid IL or missing references)
				return new Vector3(xSlider.value, ySlider.value, zSlider.value);
			}
			set
			{
				//IL_0006: Unknown result type (might be due to invalid IL or missing references)
				//IL_0017: Unknown result type (might be due to invalid IL or missing references)
				//IL_0028: Unknown result type (might be due to invalid IL or missing references)
				xSlider.value = value.x;
				ySlider.value = value.y;
				zSlider.value = value.z;
			}
		}

		public REPOVector3SliderModel(string text, string description, Action<Vector3> onValueChanged, Transform parent, Vector3 min = default(Vector3), Vector3? max = null, int precision = 2, Vector3 defaultValue = default(Vector3))
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_0030: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_0053: Unknown result type (might be due to invalid IL or missing references)
			//IL_0059: Unknown result type (might be due to invalid IL or missing references)
			//IL_007f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0085: Unknown result type (might be due to invalid IL or missing references)
			//IL_0086: Unknown result type (might be due to invalid IL or missing references)
			//IL_008f: Unknown result type (might be due to invalid IL or missing references)
			//IL_009b: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d2: 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_00d9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ee: 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_0127: Unknown result type (might be due to invalid IL or missing references)
			//IL_0128: Unknown result type (might be due to invalid IL or missing references)
			//IL_0131: Unknown result type (might be due to invalid IL or missing references)
			//IL_013d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0161: Unknown result type (might be due to invalid IL or missing references)
			//IL_016b: Unknown result type (might be due to invalid IL or missing references)
			//IL_017e: Unknown result type (might be due to invalid IL or missing references)
			//IL_003f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0044: Unknown result type (might be due to invalid IL or missing references)
			//IL_0047: Unknown result type (might be due to invalid IL or missing references)
			Vector3 valueOrDefault = max.GetValueOrDefault();
			if (!max.HasValue)
			{
				valueOrDefault = Vector3.one;
				max = valueOrDefault;
			}
			label = MenuAPI.CreateREPOLabel(text, parent, default(Vector2));
			xSlider = MenuAPI.CreateREPOSlider("x", "", (Action<float>)OnInternalValueChanged, parent, default(Vector2), min.x, max.Value.x, precision, defaultValue.x, "", "", (BarBehavior)0);
			ySlider = MenuAPI.CreateREPOSlider("y", "", (Action<float>)OnInternalValueChanged, parent, default(Vector2), min.y, max.Value.y, precision, defaultValue.y, "", "", (BarBehavior)0);
			zSlider = MenuAPI.CreateREPOSlider("z", description, (Action<float>)OnInternalValueChanged, parent, default(Vector2), min.z, max.Value.z, precision, defaultValue.z, "", "", (BarBehavior)0);
			this.onValueChanged = onValueChanged;
			this.min = min;
			this.max = max.Value;
			this.precision = precision;
			SetValue(defaultValue, invokeCallback: false);
		}

		public REPOVector3SliderModel(string text, string description, Action<Vector3> onValueChanged, REPOScrollView scrollView, Vector3 min = default(Vector3), Vector3? max = null, int precision = 2, Vector3 defaultValue = default(Vector3))
			: this(text, description, onValueChanged, (Transform)(object)scrollView.popupPage.menuScrollBox.scroller, min, max, precision, defaultValue)
		{
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			//IL_003f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0044: Unknown result type (might be due to invalid IL or missing references)
			//IL_0075: Unknown result type (might be due to invalid IL or missing references)
			//IL_007a: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ab: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e6: Unknown result type (might be due to invalid IL or missing references)
			scrollView.popupPage.AddElementToScrollView(((REPOElement)label).rectTransform, Vector2.op_Implicit(((Transform)((REPOElement)label).rectTransform).localPosition), 0f, 0f);
			scrollView.popupPage.AddElementToScrollView(((REPOElement)xSlider).rectTransform, Vector2.op_Implicit(((Transform)((REPOElement)xSlider).rectTransform).localPosition), 0f, 0f);
			scrollView.popupPage.AddElementToScrollView(((REPOElement)ySlider).rectTransform, Vector2.op_Implicit(((Transform)((REPOElement)ySlider).rectTransform).localPosition), 0f, 0f);
			scrollView.popupPage.AddElementToScrollView(((REPOElement)zSlider).rectTransform, Vector2.op_Implicit(((Transform)((REPOElement)zSlider).rectTransform).localPosition), 0f, 0f);
		}

		public void SetValue(Vector3 newValue, bool invokeCallback)
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_002a: Unknown result type (might be due to invalid IL or missing references)
			xSlider.SetValue(newValue.x, invokeCallback);
			ySlider.SetValue(newValue.y, invokeCallback);
			zSlider.SetValue(newValue.z, invokeCallback);
		}

		private void OnInternalValueChanged(float _)
		{
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			onValueChanged?.Invoke(value);
		}
	}
	[Serializable]
	internal struct ScaleSettings
	{
		public static readonly ScaleSettings Default = new ScaleSettings
		{
			LegLBot = Vector3.one,
			LegLTop = Vector3.one,
			LegRBot = Vector3.one,
			LegRTop = Vector3.one,
			BodyBot = Vector3.one,
			BodyBotScale = Vector3.one,
			BodyTop = Vector3.one,
			BodyTopScale = Vector3.one,
			ArmL = Vector3.one,
			ArmR = Vector3.one,
			HeadBot = Vector3.one,
			HeadTop = Vector3.one,
			EyeL = Vector3.one,
			EyeR = Vector3.one
		};

		public Vector3 LegLBot;

		public Vector3 LegLTop;

		public Vector3 LegRBot;

		public Vector3 LegRTop;

		public Vector3 BodyBot;

		public Vector3 BodyBotScale;

		public Vector3 BodyTop;

		public Vector3 BodyTopScale;

		public Vector3 ArmL;

		public Vector3 ArmR;

		public Vector3 HeadBot;

		public Vector3 HeadTop;

		public Vector3 EyeL;

		public Vector3 EyeR;

		public ScaleSettings Clamp(float min, float max)
		{
			//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_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			return Clamp(Vector3.one * min, Vector3.one * max);
		}

		public ScaleSettings Clamp(Vector3 min, Vector3 max)
		{
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			//IL_0026: Unknown result type (might be due to invalid IL or missing references)
			//IL_002b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0033: Unknown result type (might be due to invalid IL or missing references)
			//IL_0038: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_003f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0047: Unknown result type (might be due to invalid IL or missing references)
			//IL_004c: Unknown result type (might be due to invalid IL or missing references)
			//IL_004d: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_005b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0060: Unknown result type (might be due to invalid IL or missing references)
			//IL_0061: Unknown result type (might be due to invalid IL or missing references)
			//IL_0062: Unknown result type (might be due to invalid IL or missing references)
			//IL_0067: Unknown result type (might be due to invalid IL or missing references)
			//IL_006f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0074: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_007b: 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_0088: 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_008a: Unknown result type (might be due to invalid IL or missing references)
			//IL_008f: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_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_00a3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ab: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bf: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d3: 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_00d9: 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_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_00ed: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ee: 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_00fb: Unknown result type (might be due to invalid IL or missing references)
			//IL_0100: Unknown result type (might be due to invalid IL or missing references)
			//IL_0101: 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_0107: Unknown result type (might be due to invalid IL or missing references)
			//IL_010f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0114: Unknown result type (might be due to invalid IL or missing references)
			//IL_0115: Unknown result type (might be due to invalid IL or missing references)
			//IL_0116: Unknown result type (might be due to invalid IL or missing references)
			//IL_011b: Unknown result type (might be due to invalid IL or missing references)
			ScaleSettings result = default(ScaleSettings);
			result.LegLBot = MathUtilities.Clamp(LegLBot, min, max);
			result.LegLTop = MathUtilities.Clamp(LegLTop, min, max);
			result.LegRBot = MathUtilities.Clamp(LegRBot, min, max);
			result.LegRTop = MathUtilities.Clamp(LegRTop, min, max);
			result.BodyBot = MathUtilities.Clamp(BodyBot, min, max);
			result.BodyBotScale = MathUtilities.Clamp(BodyBotScale, min, max);
			result.BodyTop = MathUtilities.Clamp(BodyTop, min, max);
			result.BodyTopScale = MathUtilities.Clamp(BodyTopScale, min, max);
			result.ArmL = MathUtilities.Clamp(ArmL, min, max);
			result.ArmR = MathUtilities.Clamp(ArmR, min, max);
			result.HeadBot = MathUtilities.Clamp(HeadBot, min, max);
			result.HeadTop = MathUtilities.Clamp(HeadTop, min, max);
			result.EyeL = MathUtilities.Clamp(EyeL, min, max);
			result.EyeR = MathUtilities.Clamp(EyeR, min, max);
			return result;
		}

		public Vector3[] ToArray()
		{
			//IL_000a: Unknown result type (might be due to invalid IL or missing references)
			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_0031: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Unknown result type (might be due to invalid IL or missing references)
			//IL_003e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0043: Unknown result type (might be due to invalid IL or missing references)
			//IL_004b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0050: Unknown result type (might be due to invalid IL or missing references)
			//IL_0058: Unknown result type (might be due to invalid IL or missing references)
			//IL_005d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0065: 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_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_0080: Unknown result type (might be due to invalid IL or missing references)
			//IL_0085: Unknown result type (might be due to invalid IL or missing references)
			//IL_008e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0093: Unknown result type (might be due to invalid IL or missing references)
			//IL_009c: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00aa: Unknown result type (might be due to invalid IL or missing references)
			//IL_00af: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bd: Unknown result type (might be due to invalid IL or missing references)
			return (Vector3[])(object)new Vector3[14]
			{
				LegLBot, LegLTop, LegRBot, LegRTop, BodyBot, BodyBotScale, BodyTop, BodyTopScale, ArmL, ArmR,
				HeadBot, HeadTop, EyeL, EyeR
			};
		}

		public static ScaleSettings FromArray(Vector3[] array)
		{
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: 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_0048: Unknown result type (might be due to invalid IL or missing references)
			//IL_004d: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_006c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0071: Unknown result type (might be due to invalid IL or missing references)
			//IL_007e: 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_0090: Unknown result type (might be due to invalid IL or missing references)
			//IL_0095: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_00c6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00dd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ea: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ef: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fc: Unknown result type (might be due to invalid IL or missing references)
			//IL_0101: Unknown result type (might be due to invalid IL or missing references)
			int num = 0;
			ScaleSettings result = default(ScaleSettings);
			result.LegLBot = array[num++];
			result.LegLTop = array[num++];
			result.LegRBot = array[num++];
			result.LegRTop = array[num++];
			result.BodyBot = array[num++];
			result.BodyBotScale = array[num++];
			result.BodyTop = array[num++];
			result.BodyTopScale = array[num++];
			result.ArmL = array[num++];
			result.ArmR = array[num++];
			result.HeadBot = array[num++];
			result.HeadTop = array[num++];
			result.EyeL = array[num++];
			result.EyeR = array[num++];
			return result;
		}
	}
	[BepInPlugin("Linkoid.Repo.SemibotSliders", "Semibot Sliders", "0.5")]
	[BepInDependency("nickklmao.menulib", "2.2")]
	public class SemibotSliders : BaseUnityPlugin
	{
		private BodySliderMenu bodySliderMenu = new BodySliderMenu();

		internal static SemibotSliders Instance { get; private set; }

		internal static ManualLogSource Logger => Instance._logger;

		private ManualLogSource _logger => ((BaseUnityPlugin)this).Logger;

		internal Harmony? Harmony { get; set; }

		internal static ModConfigModel ConfigModel { get; private set; }

		private void Awake()
		{
			Instance = this;
			((Component)this).gameObject.transform.parent = null;
			((Object)((Component)this).gameObject).hideFlags = (HideFlags)61;
			ConfigModel = new ModConfigModel(((BaseUnityPlugin)this).Config);
			((BaseUnityPlugin)this).Config.SettingChanged += OnConfigSettingChanged;
			UserConfigModel.InitGlobalUserConfig();
			Patch();
			Logger.LogInfo((object)$"{((BaseUnityPlugin)this).Info.Metadata.GUID} v{((BaseUnityPlugin)this).Info.Metadata.Version} has loaded!");
		}

		private void Start()
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Expected O, but got Unknown
			MenuAPI.AddElementToColorMenu((BuilderDelegate)delegate(Transform parent)
			{
				//IL_003a: Unknown result type (might be due to invalid IL or missing references)
				//IL_003f: Unknown result type (might be due to invalid IL or missing references)
				//IL_0050: Unknown result type (might be due to invalid IL or missing references)
				//IL_0055: Unknown result type (might be due to invalid IL or missing references)
				//IL_0074: Unknown result type (might be due to invalid IL or missing references)
				//IL_0079: Unknown result type (might be due to invalid IL or missing references)
				//IL_0098: 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)
				MenuPageColor menuPageColor = ((Component)parent).GetComponent<MenuPageColor>();
				REPOButton val = MenuAPI.CreateREPOButton("Semibot Sliders", (Action)delegate
				{
					menuPageColor.ConfirmButton();
					bodySliderMenu.Open();
				}, parent, Vector2.op_Implicit(new Vector3(495f, 45f, 0f)));
				val.menuButton.colorClick = Color.white;
				val.menuButton.colorHover = new Color(1f, 0.9022f, 0f, 1f);
				val.menuButton.colorNormal = new Color(1f, 0.594f, 0f, 1f);
				val.menuButton.customColors = true;
			});
		}

		internal void Patch()
		{
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0020: Expected O, but got Unknown
			//IL_0025: Expected O, but got Unknown
			if (Harmony == null)
			{
				Harmony val = new Harmony(((BaseUnityPlugin)this).Info.Metadata.GUID);
				Harmony val2 = val;
				Harmony = val;
			}
			Harmony.PatchAll();
		}

		internal void Unpatch()
		{
			Harmony? harmony = Harmony;
			if (harmony != null)
			{
				harmony.UnpatchSelf();
			}
		}

		private void OnConfigSettingChanged(object sender, SettingChangedEventArgs e)
		{
			PlayerAvatarSliders[] array = Object.FindObjectsOfType<PlayerAvatarSliders>();
			foreach (PlayerAvatarSliders playerAvatarSliders in array)
			{
				playerAvatarSliders.SetDirty();
			}
		}
	}
	internal class UserConfigModel
	{
		public readonly ConfigFile ConfigFile;

		public const string ScaleSettingsSection = "ScaleSettings";

		private readonly IReadOnlyDictionary<FieldInfo, ConfigEntryBase> ScaleSettingsEntries;

		public static UserConfigModel Instance { get; private set; }

		internal static void InitGlobalUserConfig()
		{
			//IL_0021: Unknown result type (might be due to invalid IL or missing references)
			//IL_0027: Expected O, but got Unknown
			string text = Application.persistentDataPath + "/REPOModData/Linkoid.Repo.SemibotSliders.User.cfg";
			ConfigFile configFile = new ConfigFile(text, true, ((BaseUnityPlugin)SemibotSliders.Instance).Info.Metadata);
			Instance = new UserConfigModel(configFile);
		}

		private UserConfigModel(ConfigFile configFile)
		{
			//IL_004e: Unknown result type (might be due to invalid IL or missing references)
			ConfigFile = configFile;
			Dictionary<FieldInfo, ConfigEntryBase> dictionary = new Dictionary<FieldInfo, ConfigEntryBase>();
			FieldInfo[] fields = typeof(ScaleSettings).GetFields(BindingFlags.Instance | BindingFlags.Public);
			foreach (FieldInfo fieldInfo in fields)
			{
				ConfigEntry<Vector3> value = ConfigFile.Bind<Vector3>("ScaleSettings", fieldInfo.Name, (Vector3)fieldInfo.GetValue(ScaleSettings.Default), (ConfigDescription)null);
				dictionary.Add(fieldInfo, (ConfigEntryBase)(object)value);
			}
			ScaleSettingsEntries = dictionary;
		}

		public ScaleSettings GetScaleSettings()
		{
			object obj = default(ScaleSettings);
			foreach (var (fieldInfo2, val2) in ScaleSettingsEntries)
			{
				fieldInfo2.SetValue(obj, val2.BoxedValue);
			}
			return (ScaleSettings)obj;
		}

		public void SaveScaleSettings(ScaleSettings scaleSettings)
		{
			ConfigFile.SaveOnConfigSet = false;
			try
			{
				foreach (var (fieldInfo2, val2) in ScaleSettingsEntries)
				{
					val2.BoxedValue = fieldInfo2.GetValue(scaleSettings);
				}
			}
			finally
			{
				ConfigFile.SaveOnConfigSet = true;
			}
			ConfigFile.Save();
		}
	}
}