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 Microsoft.CodeAnalysis; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("CameraExtras")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0+da1940063b34dff09dbccb7e5c4a2759ab242193")] [assembly: AssemblyProduct("CameraExtras")] [assembly: AssemblyTitle("CameraExtras")] [assembly: AssemblyMetadata("RepositoryUrl", "https://github.com/jnmcallister/CameraExtras")] [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.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)] internal sealed class NullableAttribute : Attribute { public readonly byte[] NullableFlags; public NullableAttribute(byte P_0) { NullableFlags = new byte[1] { P_0 }; } public NullableAttribute(byte[] P_0) { NullableFlags = P_0; } } [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] internal sealed class NullableContextAttribute : Attribute { public readonly byte Flag; public NullableContextAttribute(byte P_0) { Flag = P_0; } } [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; } } } internal static class Configuration { private static ConfigEntry? _freezeCamera; private static ConfigEntry? _hideUI; public static KeyCode FreezeCamera => (KeyCode)(((??)_freezeCamera?.Value) ?? 0); public static KeyCode HideUI => (KeyCode)(((??)_hideUI?.Value) ?? 0); public static void Init(ConfigFile config) { _freezeCamera = config.Bind("Keybinds", "Freeze Camera", (KeyCode)98, (ConfigDescription)null); _hideUI = config.Bind("Keybinds", "Hide UI", (KeyCode)108, (ConfigDescription)null); } } internal static class InputHelper { public static bool FreezeCameraDown => Input.GetKeyDown(Configuration.FreezeCamera); public static bool HideUIDown => Input.GetKeyDown(Configuration.HideUI); } namespace BepInEx { [AttributeUsage(AttributeTargets.Class, Inherited = false, AllowMultiple = false)] [Conditional("CodeGeneration")] internal sealed class BepInAutoPluginAttribute : Attribute { public BepInAutoPluginAttribute(string? id = null, string? name = null, string? version = null) { } } } namespace BepInEx.Preloader.Core.Patching { [AttributeUsage(AttributeTargets.Class, Inherited = false, AllowMultiple = false)] [Conditional("CodeGeneration")] internal sealed class PatcherAutoPluginAttribute : Attribute { public PatcherAutoPluginAttribute(string? id = null, string? name = null, string? version = null) { } } } namespace CameraExtras { [BepInPlugin("io.github.foxyrobo.cameraextras", "CameraExtras", "1.0.0")] public class CameraExtrasPlugin : BaseUnityPlugin { private CameraController cameraController; private HUDCamera hudCamera; private Camera uiCamera; public const string Id = "io.github.foxyrobo.cameraextras"; public static string Name => "CameraExtras"; public static string Version => "1.0.0"; private void Awake() { ((BaseUnityPlugin)this).Logger.LogInfo((object)("Plugin " + Name + " (io.github.foxyrobo.cameraextras) has loaded!")); Configuration.Init(((BaseUnityPlugin)this).Config); } private void Start() { cameraController = Object.FindFirstObjectByType(); hudCamera = Object.FindFirstObjectByType(); if ((Object)(object)hudCamera != (Object)null) { uiCamera = ((Component)hudCamera).GetComponent(); } } private void Update() { HandleInput(); } private void HandleInput() { if (InputHelper.FreezeCameraDown) { ((BaseUnityPlugin)this).Logger.LogInfo((object)"Freeze camera button pressed"); ToggleFreezeCamera(); } if (InputHelper.HideUIDown) { ((BaseUnityPlugin)this).Logger.LogInfo((object)"Hide UI button pressed"); ToggleHideUI(); } } public void ToggleFreezeCamera() { //IL_005e: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)cameraController == (Object)null) { ((BaseUnityPlugin)this).Logger.LogWarning((object)"No camera controller found! Trying again"); cameraController = Object.FindFirstObjectByType(); if ((Object)(object)cameraController == (Object)null) { ((BaseUnityPlugin)this).Logger.LogError((object)"No camera controller found!"); return; } ((BaseUnityPlugin)this).Logger.LogInfo((object)"Camera controller found!"); } if ((int)cameraController.mode == 0) { cameraController.StopFreeze(false); } else { cameraController.FreezeInPlace(false); } } public void ToggleHideUI() { if ((Object)(object)hudCamera == (Object)null) { ((BaseUnityPlugin)this).Logger.LogWarning((object)"No HUDCamera found! Trying again"); hudCamera = Object.FindFirstObjectByType(); if ((Object)(object)hudCamera == (Object)null) { ((BaseUnityPlugin)this).Logger.LogError((object)"No HUDCamera found!"); return; } ((BaseUnityPlugin)this).Logger.LogInfo((object)"HUDCamera found!"); } if ((Object)(object)uiCamera == (Object)null) { ((BaseUnityPlugin)this).Logger.LogWarning((object)"No UI camera found! Trying again"); uiCamera = ((Component)hudCamera).GetComponent(); if ((Object)(object)uiCamera == (Object)null) { ((BaseUnityPlugin)this).Logger.LogError((object)"No UI camera found!"); return; } ((BaseUnityPlugin)this).Logger.LogInfo((object)"UI camera found!"); } ((Behaviour)uiCamera).enabled = !((Behaviour)uiCamera).enabled; } } }