Please disclose if any significant portion of your mod was created using AI tools by adding the 'AI Generated' category. Failing to do so may result in the mod being removed from Thunderstore.
Decompiled source of JeanNZoom v1.0.0
BepInEx/plugins/JeanNZoom.dll
Decompiled 2 hours agousing System.Collections.Generic; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using BepInEx; using BepInEx.Configuration; using JeanNZoom.Controllers; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: AssemblyTitle("JeanNZoom")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("JeanNZoom")] [assembly: AssemblyCopyright("Copyright © 2026")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("d315dd77-f692-4607-81d2-3bd1ea21dd92")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")] [assembly: AssemblyVersion("1.0.0.0")] namespace JeanNZoom.Plugin { [BepInPlugin("com.jeann.zoom", "JeanN Zoom", "1.0.0")] public class JeanNZoomPlugin : BaseUnityPlugin { private ZoomController zoomController; private ConfigEntry<float> zoomFov; private ConfigEntry<float> minZoomFov; private ConfigEntry<float> zoomSpeed; private ConfigEntry<float> scrollStep; private ConfigEntry<KeyCode> zoomKey; private ConfigEntry<KeyCode> debugCamerasKey; private void Awake() { ((BaseUnityPlugin)this).Logger.LogInfo((object)"JeanN Zoom cargado correctamente!"); zoomFov = ((BaseUnityPlugin)this).Config.Bind<float>("Zoom", "ZoomFov", 35f, "FOV actual del zoom. Se puede modificar con la rueda del mouse mientras mantienes la tecla de zoom."); minZoomFov = ((BaseUnityPlugin)this).Config.Bind<float>("Zoom", "MinZoomFov", 15f, "Límite máximo de acercamiento. Mientras más bajo, más zoom."); zoomSpeed = ((BaseUnityPlugin)this).Config.Bind<float>("Zoom", "ZoomSpeed", 8f, "Velocidad de transición del zoom. Actualmente reservado para futuras mejoras."); scrollStep = ((BaseUnityPlugin)this).Config.Bind<float>("Zoom", "ScrollStep", 3f, "Cantidad de FOV que cambia por cada movimiento de la rueda del mouse."); zoomKey = ((BaseUnityPlugin)this).Config.Bind<KeyCode>("Controls", "ZoomKey", (KeyCode)122, "Tecla que debes mantener presionada para hacer zoom."); debugCamerasKey = ((BaseUnityPlugin)this).Config.Bind<KeyCode>("Controls", "DebugCamerasKey", (KeyCode)291, "Tecla para mostrar las cámaras encontradas en el log."); zoomController = new ZoomController(((BaseUnityPlugin)this).Config, zoomFov, minZoomFov, zoomSpeed, scrollStep, zoomKey, debugCamerasKey); } private void LateUpdate() { zoomController.LateUpdate(); } } } namespace JeanNZoom.Controllers { public class ZoomController { private readonly ConfigFile configFile; private readonly ConfigEntry<float> zoomFov; private readonly ConfigEntry<float> minZoomFov; private readonly ConfigEntry<float> zoomSpeed; private readonly ConfigEntry<float> scrollStep; private readonly ConfigEntry<KeyCode> zoomKey; private readonly ConfigEntry<KeyCode> debugCamerasKey; private readonly Dictionary<Camera, float> originalFovs = new Dictionary<Camera, float>(); private bool wasZooming = false; public ZoomController(ConfigFile configFile, ConfigEntry<float> zoomFov, ConfigEntry<float> minZoomFov, ConfigEntry<float> zoomSpeed, ConfigEntry<float> scrollStep, ConfigEntry<KeyCode> zoomKey, ConfigEntry<KeyCode> debugCamerasKey) { this.configFile = configFile; this.zoomFov = zoomFov; this.minZoomFov = minZoomFov; this.zoomSpeed = zoomSpeed; this.scrollStep = scrollStep; this.zoomKey = zoomKey; this.debugCamerasKey = debugCamerasKey; } public void LateUpdate() { //IL_0007: 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) if (Input.GetKeyDown(debugCamerasKey.Value)) { MostrarCamaras(); } Camera[] allCameras = Camera.allCameras; if (allCameras == null || allCameras.Length == 0) { return; } bool key = Input.GetKey(zoomKey.Value); GuardarFovOriginal(allCameras); if (key) { AjustarZoomConRueda(allCameras); } Camera[] array = allCameras; foreach (Camera val in array) { if (!((Object)(object)val == (Object)null) && ((Behaviour)val).enabled && originalFovs.ContainsKey(val)) { float num = originalFovs[val]; if (key) { float fieldOfView = Mathf.Clamp(zoomFov.Value, minZoomFov.Value, num); val.fieldOfView = fieldOfView; } else { val.fieldOfView = num; } } } if (key && !wasZooming) { Debug.Log((object)"Zoom activado"); } if (!key && wasZooming) { Debug.Log((object)"Zoom desactivado"); } wasZooming = key; } private void GuardarFovOriginal(Camera[] cameras) { foreach (Camera val in cameras) { if (!((Object)(object)val == (Object)null) && ((Behaviour)val).enabled && !originalFovs.ContainsKey(val)) { originalFovs.Add(val, val.fieldOfView); Debug.Log((object)$"FOV original guardado para cámara: {((Object)val).name} | FOV: {val.fieldOfView}"); } } } private void AjustarZoomConRueda(Camera[] cameras) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) float y = Input.mouseScrollDelta.y; if (!(Mathf.Abs(y) <= 0.01f)) { float num = ObtenerMayorFovOriginal(cameras); float num2 = zoomFov.Value; if (y > 0f) { num2 -= scrollStep.Value; } else if (y < 0f) { num2 += scrollStep.Value; } num2 = Mathf.Clamp(num2, minZoomFov.Value, num); zoomFov.Value = num2; configFile.Save(); Debug.Log((object)$"Zoom ajustado con rueda | ZoomFov: {zoomFov.Value}"); } } private float ObtenerMayorFovOriginal(Camera[] cameras) { float num = 45f; foreach (Camera val in cameras) { if (!((Object)(object)val == (Object)null) && ((Behaviour)val).enabled && originalFovs.ContainsKey(val) && originalFovs[val] > num) { num = originalFovs[val]; } } return num; } private void MostrarCamaras() { Camera[] allCameras = Camera.allCameras; Debug.Log((object)$"Cantidad de cámaras encontradas: {allCameras.Length}"); Camera[] array = allCameras; foreach (Camera val in array) { if (!((Object)(object)val == (Object)null)) { Debug.Log((object)("Cámara: " + ((Object)val).name + " | " + $"Enabled: {((Behaviour)val).enabled} | " + $"FOV: {val.fieldOfView} | " + "Tag: " + ((Component)val).tag + " | " + $"Depth: {val.depth}")); } } } } }