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.Logging;
using CG;
using CG.Input;
using Gameplay.Helm;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using UnityEngine;
using VoidManager;
using VoidManager.CustomGUI;
using VoidManager.MPModChecks;
using VoidManager.Utilities;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: AssemblyCompany("ExternalCameraDistance")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("0.0.1.0")]
[assembly: AssemblyInformationalVersion("0.0.1+2b6a2833acfc9512fcb8f3df7224bacc6cb6fe66")]
[assembly: AssemblyProduct("ExternalCameraDistance")]
[assembly: AssemblyTitle("Allows the player to change the external camera distance by scrolling. Client side.")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("0.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 ExternalCameraDistance
{
[BepInPlugin("18107.ExternalCameraDistance", "External Camera Distance", "0.0.1")]
[BepInProcess("Void Crew.exe")]
[BepInDependency(/*Could not decode attribute arguments.*/)]
public class BepinPlugin : BaseUnityPlugin
{
internal static ManualLogSource Log;
private void Awake()
{
Log = ((BaseUnityPlugin)this).Logger;
Harmony.CreateAndPatchAll(Assembly.GetExecutingAssembly(), "18107.ExternalCameraDistance");
Configs.Load(this);
((BaseUnityPlugin)this).Logger.LogInfo((object)"Plugin 18107.ExternalCameraDistance is loaded!");
}
}
internal class Configs
{
internal static ConfigEntry<float> ShipZoomConfig;
internal static ConfigEntry<float> ZoomSpeedConfig;
internal static void Load(BepinPlugin plugin)
{
ShipZoomConfig = ((BaseUnityPlugin)plugin).Config.Bind<float>("ExternalCameraDistance", "ZoomLevel", 20f, (ConfigDescription)null);
ZoomSpeedConfig = ((BaseUnityPlugin)plugin).Config.Bind<float>("ExternalCameraDistance", "ZoomRate", 0.05f, (ConfigDescription)null);
}
}
internal class GUI : ModSettingsMenu
{
private static string zoomDistance = Configs.ShipZoomConfig.Value.ToString();
private static string zoomSpeed = Configs.ZoomSpeedConfig.Value.ToString();
public override string Name()
{
return "External Camera Distance";
}
public override void OnOpen()
{
zoomDistance = Configs.ShipZoomConfig.Value.ToString();
}
public override void Draw()
{
if (GUITools.DrawTextField("Zoom Distance", ref zoomDistance, ((ConfigEntryBase)Configs.ShipZoomConfig).DefaultValue.ToString(), 80f))
{
if (float.TryParse(zoomDistance, out var result))
{
Configs.ShipZoomConfig.Value = result;
}
zoomDistance = Configs.ShipZoomConfig.Value.ToString();
}
if (GUITools.DrawTextField("Zoom Rate", ref zoomSpeed, ((ConfigEntryBase)Configs.ZoomSpeedConfig).DefaultValue.ToString(), 80f))
{
if (float.TryParse(zoomSpeed, out var result2))
{
Configs.ZoomSpeedConfig.Value = result2;
}
zoomSpeed = Configs.ZoomSpeedConfig.Value.ToString();
}
}
}
public class MyPluginInfo
{
public const string PLUGIN_GUID = "18107.ExternalCameraDistance";
public const string PLUGIN_NAME = "ExternalCameraDistance";
public const string USERS_PLUGIN_NAME = "External Camera Distance";
public const string PLUGIN_VERSION = "0.0.1";
public const string PLUGIN_DESCRIPTION = "Allows the player to change the external camera distance by scrolling. Client side.";
public const string PLUGIN_ORIGINAL_AUTHOR = "18107";
public const string PLUGIN_AUTHORS = "18107";
public const string PLUGIN_THUNDERSTORE_ID = "VoidCrewModdingTeam/External_Camera_Distance";
}
[HarmonyPatch(typeof(ShipExternalCamera))]
internal class ShipExternalCameraPatch
{
[HarmonyPatch("Move")]
private static void Postfix(ShipExternalCamera __instance)
{
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
//IL_0072: Unknown result type (might be due to invalid IL or missing references)
//IL_0082: Unknown result type (might be due to invalid IL or missing references)
//IL_0087: Unknown result type (might be due to invalid IL or missing references)
//IL_0096: Unknown result type (might be due to invalid IL or missing references)
//IL_009b: Unknown result type (might be due to invalid IL or missing references)
float num = 0f - UnityInput.Current.mouseScrollDelta.y;
if (num != 0f && !ServiceBase<InputService>.Instance.CursorVisibilityControl.IsCursorShown)
{
Configs.ShipZoomConfig.Value = Mathf.Clamp(Configs.ShipZoomConfig.Value + num * Configs.ZoomSpeedConfig.Value, -85f, 265f);
}
Transform transform = ((Component)__instance.Anchor).transform;
transform.position += -((Component)__instance.Anchor).transform.forward * Configs.ShipZoomConfig.Value;
}
}
public class VoidManagerPlugin : VoidPlugin
{
public override MultiplayerType MPType => (MultiplayerType)8;
public override string Author => "18107";
public override string Description => "Allows the player to change the external camera distance by scrolling. Client side.";
public override string ThunderstoreID => "VoidCrewModdingTeam/External_Camera_Distance";
}
}