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 UnityEngine;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTitle("ZoomCamera")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("ZoomCamera")]
[assembly: AssemblyCopyright("Copyright © 2025")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("26ad11e2-44cf-455e-a01f-857671257f4b")]
[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 ZoomCamera;
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInPlugin("kylethescientist.etg.zoomcamera", "Zoom Camera", "1.3.1")]
public class ZoomCameraMod : BaseUnityPlugin
{
public static ConfigEntry<float> ZoomScale { get; private set; }
public void Start()
{
//IL_002f: Unknown result type (might be due to invalid IL or missing references)
//IL_0039: Expected O, but got Unknown
ZoomScale = ((BaseUnityPlugin)this).Config.Bind<float>("Camera", "ZoomScale", 1f, new ConfigDescription("相机缩放(0.3-1.5)", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0.3f, 1.5f), new object[0]));
ETGModMainBehaviour.WaitForGameManagerStart((Action<GameManager>)GMStart);
}
private void GMStart(GameManager g)
{
((MonoBehaviour)((Component)ETGModMainBehaviour.Instance).gameObject.AddComponent<ZoomBehaviour>()).Invoke("Init", 2f);
ETGModConsole.Commands.AddUnit("zoom", (Action<string[]>)delegate(string[] args)
{
float result;
if (args.Length == 0)
{
ETGModConsole.Log((object)$"Zoom: {ZoomScale.Value:F2}", false);
}
else if (float.TryParse(args[0], out result))
{
ZoomScale.Value = Mathf.Clamp(result, 0.3f, 1.5f);
ETGModConsole.Log((object)$"Zoom: {ZoomScale.Value:F2}", false);
}
else if (args[0].ToLower() == "reset")
{
ZoomScale.Value = 1f;
ETGModConsole.Log((object)"Zoom reset to 1.0", false);
}
});
ETGModConsole.Log((object)"Zoom Camera v1.3.1: 加载安全+场景限!用 'zoom 0.6'。", false);
}
}
public class ZoomBehaviour : MonoBehaviour
{
private bool initialized;
public void Init()
{
initialized = true;
}
private void Update()
{
//IL_0028: Unknown result type (might be due to invalid IL or missing references)
//IL_002e: Invalid comparison between Unknown and I4
//IL_0035: Unknown result type (might be due to invalid IL or missing references)
if (!initialized || !GameManager.HasInstance || (Object)(object)GameManager.Instance.PrimaryPlayer == (Object)null || ((int)GameManager.Instance.CurrentGameType != 1 && (int)GameManager.Instance.CurrentGameType != 0))
{
return;
}
try
{
Camera main = Camera.main;
CameraController val = ((main != null) ? ((Component)main).GetComponent<CameraController>() : null);
if ((Object)(object)val != (Object)null)
{
val.OverrideZoomScale = ZoomCameraMod.ZoomScale.Value;
}
}
catch
{
}
}
}