Decompiled source of Case Board WASD Controls v1.0.1

CaseBoardScroll.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.Configuration;
using BepInEx.Core.Logging.Interpolation;
using BepInEx.Logging;
using BepInEx.Unity.IL2CPP;
using HarmonyLib;
using Il2CppInterop.Runtime.Injection;
using Microsoft.CodeAnalysis;
using TMPro;
using UnityEngine;
using UnityEngine.EventSystems;
using UnityEngine.UI;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETCoreApp,Version=v6.0", FrameworkDisplayName = ".NET 6.0")]
[assembly: AssemblyCompany("CaseBoardScroll")]
[assembly: AssemblyConfiguration("IL2CPP")]
[assembly: AssemblyDescription("Adds WASD controlls to the case board")]
[assembly: AssemblyFileVersion("1.0.1.0")]
[assembly: AssemblyInformationalVersion("1.0.1+da3c1a13a7789b11f679e2917bef0ef93141085e")]
[assembly: AssemblyProduct("CaseBoardScroll")]
[assembly: AssemblyTitle("CaseBoardScroll")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.1.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 CaseBoardScroll
{
	[BepInPlugin("CaseBoardScroll", "CaseBoardScroll", "1.0.1")]
	public class CaseBoardScroll : BasePlugin
	{
		public static ManualLogSource Logger;

		public static ConfigEntry<float> xScrollSpeed;

		public static ConfigEntry<float> yScrollSpeed;

		public static ConfigEntry<float> minZoomModifier;

		public static ConfigEntry<float> maxZoomModifier;

		public override void Load()
		{
			//IL_0098: Unknown result type (might be due to invalid IL or missing references)
			//IL_009e: Expected O, but got Unknown
			//IL_00d2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d8: Expected O, but got Unknown
			//IL_00f2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f8: Expected O, but got Unknown
			xScrollSpeed = ((BasePlugin)this).Config.Bind<float>("General", "Horizontal scroll speed", 0.15f, (ConfigDescription)null);
			yScrollSpeed = ((BasePlugin)this).Config.Bind<float>("General", "Vertical scroll speed", 0.15f, (ConfigDescription)null);
			minZoomModifier = ((BasePlugin)this).Config.Bind<float>("General", "Scroll modifier at min zoom", 5f, (ConfigDescription)null);
			maxZoomModifier = ((BasePlugin)this).Config.Bind<float>("General", "Scroll modifier at max zoom", 1f, (ConfigDescription)null);
			Logger = ((BasePlugin)this).Log;
			ManualLogSource log = ((BasePlugin)this).Log;
			bool flag = default(bool);
			BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(18, 1, ref flag);
			if (flag)
			{
				((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Plugin ");
				((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>("CaseBoardScroll");
				((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" is loaded!");
			}
			log.LogInfo(val);
			Harmony val2 = new Harmony("CaseBoardScroll");
			val2.PatchAll();
			ClassInjector.RegisterTypeInIl2Cpp<CaseBoardScrollRectWASD>();
			ManualLogSource log2 = ((BasePlugin)this).Log;
			val = new BepInExInfoLogInterpolatedStringHandler(42, 1, ref flag);
			if (flag)
			{
				((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Plugin ");
				((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>("CaseBoardScroll");
				((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" is patched and has injected types!");
			}
			log2.LogInfo(val);
		}
	}
	[HarmonyPatch(typeof(ScrollRect), "OnEnable")]
	public class CustomScrollRect_Awake
	{
		public static void Postfix(ScrollRect __instance)
		{
			if (((Object)__instance).name == "CorkBoard" && (Object)(object)((Component)__instance).GetComponent<CaseBoardScrollRectWASD>() == (Object)null)
			{
				((Component)__instance).gameObject.AddComponent<CaseBoardScrollRectWASD>();
			}
		}
	}
	public class CaseBoardScrollRectWASD : MonoBehaviour
	{
		private CustomScrollRect scrollRect;

		private ZoomContent zoomContent;

		private void Start()
		{
			scrollRect = ((Component)this).GetComponent<CustomScrollRect>();
			zoomContent = ((Component)this).GetComponentInChildren<ZoomContent>();
		}

		private void LateUpdate()
		{
			GameObject currentSelectedGameObject = EventSystem.current.currentSelectedGameObject;
			if ((Object)(object)currentSelectedGameObject == (Object)null || (Object)(object)currentSelectedGameObject.GetComponent<TMP_InputField>() == (Object)null)
			{
				float num = Mathf.Lerp(CaseBoardScroll.minZoomModifier.Value, CaseBoardScroll.maxZoomModifier.Value, zoomContent.normalizedZoom);
				float num2 = CaseBoardScroll.xScrollSpeed.Value * num * Time.deltaTime;
				float num3 = CaseBoardScroll.yScrollSpeed.Value * num * Time.deltaTime;
				if (Input.GetKey((KeyCode)119))
				{
					((ScrollRect)scrollRect).SetVerticalNormalizedPosition(((ScrollRect)scrollRect).verticalNormalizedPosition + num3);
				}
				else if (Input.GetKey((KeyCode)115))
				{
					((ScrollRect)scrollRect).SetVerticalNormalizedPosition(((ScrollRect)scrollRect).verticalNormalizedPosition - num3);
				}
				if (Input.GetKey((KeyCode)97))
				{
					((ScrollRect)scrollRect).SetHorizontalNormalizedPosition(((ScrollRect)scrollRect).horizontalNormalizedPosition - num2);
				}
				else if (Input.GetKey((KeyCode)100))
				{
					((ScrollRect)scrollRect).SetHorizontalNormalizedPosition(((ScrollRect)scrollRect).horizontalNormalizedPosition + num2);
				}
			}
		}
	}
	public static class MyPluginInfo
	{
		public const string PLUGIN_GUID = "CaseBoardScroll";

		public const string PLUGIN_NAME = "CaseBoardScroll";

		public const string PLUGIN_VERSION = "1.0.1";
	}
}