Decompiled source of MoreCustomValues v0.0.1

moreCustomValues.dll

Decompiled a day ago
using System;
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.Logging;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using TMPro;
using UnityEngine;
using UnityEngine.Events;
using UnityEngine.UI;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: AssemblyCompany("moreCustomValues")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("moreCustomValues")]
[assembly: AssemblyTitle("moreCustomValues")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.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.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace moreCustomValues
{
	[BepInPlugin("moreCustomValues", "moreCustomValues", "1.0.0")]
	public class Plugin : BaseUnityPlugin
	{
		[HarmonyPatch(typeof(SliderOption), "Initialize")]
		private class SliderPatch
		{
			private static void Prefix(SliderOption __instance)
			{
				__instance.SetLimits(float.MinValue, float.MaxValue);
			}

			private static void Postfix(SliderOption __instance)
			{
				CreateInput(__instance);
			}
		}

		internal static ManualLogSource Logger;

		private Harmony _harmony;

		private void Awake()
		{
			//IL_0020: Unknown result type (might be due to invalid IL or missing references)
			//IL_002a: Expected O, but got Unknown
			Logger = ((BaseUnityPlugin)this).Logger;
			Logger.LogInfo((object)"Plugin moreCustomValues is loaded!");
			_harmony = new Harmony("moreCustomValues");
			_harmony.PatchAll(typeof(Plugin).Assembly);
		}

		private static void CreateInput(SliderOption sliderOption)
		{
			//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_0081: 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)
			Slider slider = sliderOption.slider;
			ModdedSliderMarker component = ((Component)slider).GetComponent<ModdedSliderMarker>();
			if ((Object)(object)component != (Object)null)
			{
				component.i.text = sliderOption.value.ToString();
				return;
			}
			component = ((Component)slider).gameObject.AddComponent<ModdedSliderMarker>();
			GameObject val = new GameObject("ModInput - " + ((Object)slider).name);
			val.transform.SetParent(((Component)slider).transform.parent, false);
			TMP_InputField val2 = val.AddComponent<TMP_InputField>();
			TextMeshProUGUI val3 = val.AddComponent<TextMeshProUGUI>();
			component.i = val2;
			((Graphic)val3).color = Color.black;
			val2.textComponent = (TMP_Text)(object)val3;
			val2.text = slider.value.ToString();
			((UnityEvent<string>)(object)val2.onEndEdit).AddListener((UnityAction<string>)delegate(string v)
			{
				if (float.TryParse(v, out var result))
				{
					sliderOption.SetLimits(result, result);
					sliderOption.SetValue(result);
				}
			});
			((Component)slider).gameObject.SetActive(false);
		}
	}
	internal class ModdedSliderMarker : MonoBehaviour
	{
		public TMP_InputField i;
	}
	public static class MyPluginInfo
	{
		public const string PLUGIN_GUID = "moreCustomValues";

		public const string PLUGIN_NAME = "moreCustomValues";

		public const string PLUGIN_VERSION = "1.0.0";
	}
}