Decompiled source of Camera Zoom v1.0.1

Patty_CameraZoom_MOD.dll

Decompiled a month ago
using System;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using HarmonyLib;
using ShinyShoe.Loading;
using UnityEngine;
using UnityEngine.SceneManagement;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTitle("Patty_CameraZoom_MOD")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Patty_CameraZoom_MOD")]
[assembly: AssemblyCopyright("Copyright ©  2025")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("91cced6b-6a05-4399-aab1-2d6a15154d75")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace Patty_CameraZoom_MOD;

internal class PatchList
{
	[Serializable]
	[CompilerGenerated]
	private sealed class <>c
	{
		public static readonly <>c <>9 = new <>c();

		public static ScreenActiveCallback <>9__0_0;

		internal void <StartLoadingScreen>b__0_0(IScreen _)
		{
			Plugin.ChangeZoom();
		}
	}

	[HarmonyPostfix]
	[HarmonyPatch(typeof(LoadScreen), "StartLoadingScreen")]
	public static void StartLoadingScreen(LoadScreen __instance, ref ScreenActiveCallback ___screenActiveCallback)
	{
		//IL_0002: Unknown result type (might be due to invalid IL or missing references)
		//IL_0008: Invalid comparison between Unknown and I4
		//IL_0036: Unknown result type (might be due to invalid IL or missing references)
		//IL_003c: Expected O, but got Unknown
		//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_0031: Expected O, but got Unknown
		if ((int)__instance.name != 1)
		{
			return;
		}
		ScreenActiveCallback a = ___screenActiveCallback;
		object obj = <>c.<>9__0_0;
		if (obj == null)
		{
			ScreenActiveCallback val = delegate
			{
				Plugin.ChangeZoom();
			};
			<>c.<>9__0_0 = val;
			obj = (object)val;
		}
		___screenActiveCallback = (ScreenActiveCallback)Delegate.Combine((Delegate?)(object)a, (Delegate?)obj);
	}
}
[BepInPlugin("Patty_CameraZoom_MOD", "Camera Zoom", "1.0.0")]
public class Plugin : BaseUnityPlugin
{
	public const string TARGET_SCENE = "Main";

	public static ConfigEntry<float> CameraZoom;

	internal static ManualLogSource LogSource { get; private set; }

	internal static Harmony PluginHarmony { get; private set; }

	private void Awake()
	{
		//IL_002c: Expected O, but got Unknown
		//IL_006b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0075: Expected O, but got Unknown
		LogSource = ((BaseUnityPlugin)this).Logger;
		try
		{
			PluginHarmony = Harmony.CreateAndPatchAll(typeof(PatchList), "Patty_CameraZoom_MOD");
		}
		catch (HarmonyException val)
		{
			HarmonyException val2 = val;
			LogSource.LogError((object)((Exception)(((object)((Exception)(object)val2).InnerException) ?? ((object)val2))).Message);
		}
		CameraZoom = ((BaseUnityPlugin)this).Config.Bind<float>("Camera", "Zoom", 0f, new ConfigDescription("Change the camera zoom in battle", (AcceptableValueBase)null, Array.Empty<object>()));
		CameraZoom.SettingChanged += CameraZoom_SettingChanged;
	}

	private void CameraZoom_SettingChanged(object sender, EventArgs e)
	{
		//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)
		Scene activeScene = SceneManager.GetActiveScene();
		if (((Scene)(ref activeScene)).IsValid() && ((Scene)(ref activeScene)).name.ToUpperInvariant().Contains("Main".ToUpperInvariant()))
		{
			ChangeZoom();
		}
	}

	public static void ChangeZoom()
	{
		//IL_0010: 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_002f: Unknown result type (might be due to invalid IL or missing references)
		Camera main = Camera.main;
		Transform transform = ((Component)main).transform;
		transform.localPosition = new Vector3(transform.localPosition.x, transform.localPosition.y, CameraZoom.Value);
	}
}
public static class PluginInfo
{
	public const string GUID = "Patty_CameraZoom_MOD";

	public const string Name = "Camera Zoom";

	public const string Version = "1.0.0";
}