using System;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using HarmonyLib;
using InControl;
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("LookingAroundKBM")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyDescription("Looking around")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+017cd72bd229784c8aa5526cecea422297d6f03b")]
[assembly: AssemblyProduct("LookingAroundKBM")]
[assembly: AssemblyTitle("LookingAroundKBM")]
[assembly: AssemblyVersion("1.0.0.0")]
[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;
}
}
}
namespace LookingAroundKBM
{
internal static class Log
{
private static ManualLogSource? logSource;
internal static void Init(ManualLogSource logSource)
{
Log.logSource = logSource;
}
internal static void Debug(object data)
{
ManualLogSource? obj = logSource;
if (obj != null)
{
obj.LogDebug(data);
}
}
internal static void Error(object data)
{
ManualLogSource? obj = logSource;
if (obj != null)
{
obj.LogError(data);
}
}
internal static void Fatal(object data)
{
ManualLogSource? obj = logSource;
if (obj != null)
{
obj.LogFatal(data);
}
}
internal static void Info(object data)
{
ManualLogSource? obj = logSource;
if (obj != null)
{
obj.LogInfo(data);
}
}
internal static void Message(object data)
{
ManualLogSource? obj = logSource;
if (obj != null)
{
obj.LogMessage(data);
}
}
internal static void Warning(object data)
{
ManualLogSource? obj = logSource;
if (obj != null)
{
obj.LogWarning(data);
}
}
}
[BepInPlugin("LookingAroundKBM", "LookingAroundKBM", "1.0.0")]
public class LookingAroundKBM : BaseUnityPlugin
{
internal static ConfigEntry<KeyboardShortcut> cameraControllKeybind;
private Harmony harmony;
private void Awake()
{
//IL_0051: Unknown result type (might be due to invalid IL or missing references)
Log.Init(((BaseUnityPlugin)this).Logger);
RCGLifeCycle.DontDestroyForever(((Component)this).gameObject);
harmony = Harmony.CreateAndPatchAll(typeof(LookingAroundKBM).Assembly, (string)null);
cameraControllKeybind = ((BaseUnityPlugin)this).Config.Bind<KeyboardShortcut>("General", "Look around", new KeyboardShortcut((KeyCode)115, (KeyCode[])(object)new KeyCode[1] { (KeyCode)306 }), "Press to look around");
((BaseUnityPlugin)this).Logger.LogInfo((object)"Plugin LookingAroundKBM is loaded!");
}
private void OnDestroy()
{
harmony.UnpatchSelf();
}
}
public static class MyPluginInfo
{
public const string PLUGIN_GUID = "LookingAroundKBM";
public const string PLUGIN_NAME = "LookingAroundKBM";
public const string PLUGIN_VERSION = "1.0.0";
}
}
namespace LookingAroundKBM.HarmonyPatches
{
[HarmonyPatch(typeof(PlayerCameraPanController))]
internal static class PlayerCameraPanControllerPatches
{
private static FieldInfo f_lastLookDirection = AccessTools.Field(typeof(PlayerCameraPanController), "lastLookDirection");
private static FieldInfo f_lookFurtherDirection = AccessTools.Field(typeof(PlayerCameraPanController), "lookFurtherDirection");
private static bool isLooking = false;
private static Vector2 anchorMousePosition = Vector2.zero;
private static float maxOffset = 96f;
private static float horizontalModifier = 1f;
private static float verticalModifier = 1f;
[HarmonyPatch("LookFurtherCheck")]
[HarmonyPrefix]
internal static bool LookFurtherCheck_Prefix(PlayerCameraPanController __instance, ref Vector2 __result, ref PlayerGamePlayActionSet actions)
{
//IL_0059: Unknown result type (might be due to invalid IL or missing references)
//IL_005e: Unknown result type (might be due to invalid IL or missing references)
//IL_0065: Unknown result type (might be due to invalid IL or missing references)
//IL_0070: Unknown result type (might be due to invalid IL or missing references)
//IL_0075: Unknown result type (might be due to invalid IL or missing references)
//IL_007b: Unknown result type (might be due to invalid IL or missing references)
//IL_0080: Unknown result type (might be due to invalid IL or missing references)
//IL_0148: Unknown result type (might be due to invalid IL or missing references)
//IL_0154: Unknown result type (might be due to invalid IL or missing references)
//IL_015b: Unknown result type (might be due to invalid IL or missing references)
//IL_015c: Unknown result type (might be due to invalid IL or missing references)
//IL_00c5: Unknown result type (might be due to invalid IL or missing references)
//IL_00dd: Unknown result type (might be due to invalid IL or missing references)
//IL_00f3: Unknown result type (might be due to invalid IL or missing references)
//IL_00f8: Unknown result type (might be due to invalid IL or missing references)
//IL_00fd: Unknown result type (might be due to invalid IL or missing references)
//IL_0102: Unknown result type (might be due to invalid IL or missing references)
//IL_0108: Unknown result type (might be due to invalid IL or missing references)
//IL_012a: Unknown result type (might be due to invalid IL or missing references)
//IL_012f: Unknown result type (might be due to invalid IL or missing references)
//IL_0134: Unknown result type (might be due to invalid IL or missing references)
//IL_0139: Unknown result type (might be due to invalid IL or missing references)
//IL_00a9: Unknown result type (might be due to invalid IL or missing references)
//IL_00ae: Unknown result type (might be due to invalid IL or missing references)
//IL_00b3: Unknown result type (might be due to invalid IL or missing references)
if (((OneAxisInputControl)actions.CameraUp).Value != 0f || ((OneAxisInputControl)actions.CameraRight).Value != 0f || ((OneAxisInputControl)actions.CameraLeft).Value != 0f || ((OneAxisInputControl)actions.CameraDown).Value != 0f)
{
return true;
}
Vector2 val = (Vector2)f_lookFurtherDirection.GetValue(__instance);
f_lastLookDirection.SetValue(__instance, val);
Vector2 val2 = Vector2.zero;
KeyboardShortcut value = LookingAroundKBM.cameraControllKeybind.Value;
if (((KeyboardShortcut)(ref value)).IsPressed() && Player.i.CanPanCamera)
{
if (!isLooking)
{
isLooking = true;
anchorMousePosition = Vector2.op_Implicit(Input.mousePosition);
}
int width = Screen.width;
int height = Screen.height;
float num = (Input.mousePosition.y - (float)(height / 2)) / (float)(height / 2);
float num2 = (Input.mousePosition.x - (float)(width / 2)) / (float)(width / 2);
_ = anchorMousePosition - Vector2.op_Implicit(Input.mousePosition);
val2 += 1f * new Vector2(num2 * maxOffset * horizontalModifier, num * maxOffset * verticalModifier);
}
else
{
isLooking = false;
}
f_lookFurtherDirection.SetValue(__instance, val2);
__instance.Pan(val2);
__result = val2;
return false;
}
}
}