Decompiled source of BigWalkPhotoMode v1.0.2

plugins/BigWalkPhotoMode.dll

Decompiled 2 weeks ago
using System;
using System.Collections.Generic;
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.Core.Logging.Interpolation;
using BepInEx.Logging;
using BepInEx.Unity.IL2CPP;
using HarmonyLib;
using Il2CppInterop.Runtime;
using Il2CppInterop.Runtime.Injection;
using Il2CppInterop.Runtime.InteropTypes;
using Il2CppInterop.Runtime.InteropTypes.Arrays;
using Il2CppSystem.Collections.Generic;
using Microsoft.CodeAnalysis;
using Mirror;
using UnityEngine;
using UnityEngine.Rendering;
using UnityEngine.Rendering.Universal;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETCoreApp,Version=v6.0", FrameworkDisplayName = ".NET 6.0")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("0.0.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[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 BigWalkPhotoMode
{
	public class PhotoModeBehaviour : MonoBehaviour
	{
		private struct CamBookmark
		{
			public bool Set;

			public Vector3 Pos;

			public float Yaw;

			public float Pitch;

			public float Roll;

			public float Fov;
		}

		public static bool Active;

		private static Transform _camT;

		private static Camera _cam;

		private static Vector3 _pos;

		private static float _yaw;

		private static float _pitch;

		private static float _roll;

		private static float _fov = 60f;

		private static PlayerCharacter _player;

		private static Transform _camParent;

		private static Vector3 _savedLocalPos;

		private static Quaternion _savedLocalRot;

		private static float _savedFov;

		private static bool _savedBypassUpdate;

		private static bool _savedBypassLateUpdate;

		private static bool _savedBypassFixedUpdate;

		private static Rigidbody _rb;

		private static bool _savedKinematic;

		private static int _savedCullingMask;

		private static Il2CppStructArray<float> _savedLayerCullDistances;

		private static readonly List<Canvas> _hiddenCanvases = new List<Canvas>();

		private static bool _uiHidden;

		private static bool _showOverlay = true;

		private static Light _flashlight;

		private static bool _flashlightOnPlayer;

		private static bool _showGrid;

		private static bool _showCinemaBars;

		private static Texture2D _flatTex;

		private static readonly CamBookmark[] _bookmarks = new CamBookmark[6];

		private static bool _transitioning;

		private static float _transitionT;

		private static Vector3 _transFromPos;

		private static Vector3 _transToPos;

		private static float _transFromYaw;

		private static float _transToYaw;

		private static float _transFromPitch;

		private static float _transToPitch;

		private static float _transFromRoll;

		private static float _transToRoll;

		private static float _transFromFov;

		private static float _transToFov;

		private static bool _touring;

		private static int _tourIndex;

		private static float _tourDwellTimer;

		private static bool _gestureForwardingBroken;

		private static Volume _dofVolume;

		private static DepthOfField _dof;

		private static UniversalAdditionalCameraData _camData;

		private static LayerMask _savedVolumeLayerMask;

		private static bool _savedRenderPostProcessing;

		private static bool _dofOn;

		private static float _fixedHour;

		private static string _toast = "";

		private static float _toastUntil;

		public PhotoModeBehaviour(IntPtr ptr)
			: base(ptr)
		{
		}

		private void Update()
		{
			try
			{
				Tick();
			}
			catch (Exception ex)
			{
				Plugin.Log2.Error("Error in photo mode Update: " + ex);
				if (Active)
				{
					Exit();
				}
			}
		}

		private void Tick()
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_0047: Unknown result type (might be due to invalid IL or missing references)
			//IL_0067: Unknown result type (might be due to invalid IL or missing references)
			//IL_0097: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f6: Unknown result type (might be due to invalid IL or missing references)
			//IL_0111: Unknown result type (might be due to invalid IL or missing references)
			//IL_012c: Unknown result type (might be due to invalid IL or missing references)
			if (Input.GetKeyDown(Plugin.KeyToggle.Value))
			{
				if (Active)
				{
					Exit();
				}
				else
				{
					Enter();
				}
			}
			else
			{
				if (!Active)
				{
					return;
				}
				if (Input.GetKeyDown(Plugin.KeyToggleOverlay.Value))
				{
					_showOverlay = !_showOverlay;
				}
				if (Input.GetKeyDown(Plugin.KeyToggleUI.Value))
				{
					if (_uiHidden)
					{
						ShowGameUI();
					}
					else
					{
						HideGameUI();
					}
				}
				if (Input.GetKeyDown(Plugin.KeyToggleFlashlight.Value))
				{
					ToggleFlashlight();
				}
				if (Input.GetKeyDown(Plugin.KeyToggleGrid.Value))
				{
					_showGrid = !_showGrid;
				}
				if (Input.GetKeyDown(Plugin.KeyToggleCinemaBars.Value))
				{
					_showCinemaBars = !_showCinemaBars;
				}
				if (Input.GetKeyDown(Plugin.KeyToggleDof.Value))
				{
					ToggleDof();
				}
				if (Input.GetKeyDown(Plugin.KeyToggleTour.Value))
				{
					ToggleTour();
				}
				if (Input.GetKeyDown(Plugin.KeyRecenter.Value))
				{
					RecenterCamera();
				}
				if (_touring && ManualMoveOrBookmarkKeyPressed())
				{
					StopTour();
				}
				HandleBookmarks();
				if (_transitioning)
				{
					UpdateTransition();
				}
				else
				{
					HandleLook();
					HandleMove();
				}
				if (_touring && !_transitioning)
				{
					AdvanceTourIfDue();
				}
				HandleWorld();
				UpdateDofFocus();
				if (Plugin.EnableGestures.Value)
				{
					ForwardGestures();
				}
				ApplyCameraPose();
			}
		}

		private static void Enter()
		{
			//IL_02de: Unknown result type (might be due to invalid IL or missing references)
			//IL_02e3: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ed: Unknown result type (might be due to invalid IL or missing references)
			//IL_02f2: Unknown result type (might be due to invalid IL or missing references)
			//IL_02f6: Unknown result type (might be due to invalid IL or missing references)
			//IL_02fb: Unknown result type (might be due to invalid IL or missing references)
			//IL_02fc: Unknown result type (might be due to invalid IL or missing references)
			//IL_030c: Unknown result type (might be due to invalid IL or missing references)
			//IL_038f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0092: Unknown result type (might be due to invalid IL or missing references)
			//IL_0097: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b7: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c7: Unknown result type (might be due to invalid IL or missing references)
			_player = FindLocalPlayer();
			if ((Object)(object)_player == (Object)null)
			{
				Plugin.Log2.Warn("Photo mode: no local player found. Join a session first.");
				Toast("Photo mode unavailable outside a session");
				return;
			}
			_camT = _player.cameraTransform;
			if ((Object)(object)_camT == (Object)null)
			{
				Plugin.Log2.Error("Photo mode: cameraTransform is null.");
				return;
			}
			_cam = ResolveCamera(_player);
			_camParent = _camT.parent;
			_savedLocalPos = _camT.localPosition;
			_savedLocalRot = _camT.localRotation;
			_savedFov = (((Object)(object)_cam != (Object)null) ? _cam.fieldOfView : 60f);
			try
			{
				_savedBypassUpdate = _player.bypassUpdate;
				_savedBypassLateUpdate = _player.bypassLateUpdate;
				_savedBypassFixedUpdate = _player.bypassFixedUpdate;
				_player.bypassUpdate = true;
				_player.bypassLateUpdate = true;
				_player.bypassFixedUpdate = true;
			}
			catch (Exception ex)
			{
				Plugin.Log2.Warn("Couldn't freeze the PlayerCharacter: " + ex.Message);
			}
			try
			{
				PlayerLooks looks = _player.looks;
				if (looks != null)
				{
					looks.SetBodyToRemoteMode();
				}
			}
			catch (Exception ex2)
			{
				Plugin.Log2.Warn("Couldn't switch to the full body (remote mode): " + ex2.Message);
			}
			try
			{
				_rb = _player.rb;
				if ((Object)(object)_rb != (Object)null)
				{
					_savedKinematic = _rb.isKinematic;
					_rb.linearVelocity = Vector3.zero;
					_rb.angularVelocity = Vector3.zero;
					_rb.isKinematic = true;
				}
			}
			catch (Exception ex3)
			{
				Plugin.Log2.Warn("Couldn't freeze the body's physics: " + ex3.Message);
			}
			try
			{
				if ((Object)(object)_cam != (Object)null)
				{
					_savedCullingMask = _cam.cullingMask;
					_savedLayerCullDistances = _cam.layerCullDistances;
					_cam.cullingMask = -1;
					_cam.layerCullDistances = new Il2CppStructArray<float>(32L);
				}
			}
			catch (Exception ex4)
			{
				Plugin.Log2.Warn("Couldn't adjust the camera's culling: " + ex4.Message);
			}
			try
			{
				_camData = (((Object)(object)_cam != (Object)null) ? CameraExtensions.GetUniversalAdditionalCameraData(_cam) : null);
			}
			catch (Exception ex5)
			{
				Plugin.Log2.Warn("No UniversalAdditionalCameraData (background blur unavailable): " + ex5.Message);
				_camData = null;
			}
			_dofOn = false;
			_transitioning = false;
			_touring = false;
			_pos = _camT.position;
			Quaternion rotation = _camT.rotation;
			Vector3 eulerAngles = ((Quaternion)(ref rotation)).eulerAngles;
			_pitch = NormalizeAngle(eulerAngles.x);
			_yaw = eulerAngles.y;
			_roll = 0f;
			_fov = _savedFov;
			try
			{
				_fixedHour = SkyManager.GetCurrentTime();
			}
			catch (Exception ex6)
			{
				Plugin.Log2.Warn("Couldn't read the current time: " + ex6.Message);
				_fixedHour = 12f;
			}
			Active = true;
			HideGameUI();
			Plugin.Log2.Info($"Photo mode ON — pos {_pos}, fov {_fov:F0}, time {_fixedHour:F1}");
			Toast("Photo mode active");
		}

		private static void Exit()
		{
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			//IL_002d: Unknown result type (might be due to invalid IL or missing references)
			//IL_00be: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ce: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a1: Unknown result type (might be due to invalid IL or missing references)
			Active = false;
			try
			{
				if ((Object)(object)_camT != (Object)null)
				{
					_camT.localPosition = _savedLocalPos;
					_camT.localRotation = _savedLocalRot;
				}
				if ((Object)(object)_cam != (Object)null)
				{
					_cam.fieldOfView = _savedFov;
				}
				if ((Object)(object)_player != (Object)null)
				{
					_player.bypassUpdate = _savedBypassUpdate;
					_player.bypassLateUpdate = _savedBypassLateUpdate;
					_player.bypassFixedUpdate = _savedBypassFixedUpdate;
				}
				if ((Object)(object)_rb != (Object)null)
				{
					_rb.isKinematic = _savedKinematic;
					_rb.linearVelocity = Vector3.zero;
					_rb.angularVelocity = Vector3.zero;
				}
				if ((Object)(object)_cam != (Object)null)
				{
					_cam.cullingMask = _savedCullingMask;
					_cam.layerCullDistances = _savedLayerCullDistances;
				}
				PlayerCharacter player = _player;
				if (player != null)
				{
					PlayerLooks looks = player.looks;
					if (looks != null)
					{
						looks.SetBodyToLocalMode();
					}
				}
			}
			catch (Exception ex)
			{
				Plugin.Log2.Error("Error restoring state: " + ex);
			}
			if ((Object)(object)_flashlight != (Object)null)
			{
				Object.Destroy((Object)(object)((Component)_flashlight).gameObject);
				_flashlight = null;
			}
			try
			{
				if (_dofOn && (Object)(object)_camData != (Object)null)
				{
					_camData.volumeLayerMask = _savedVolumeLayerMask;
					_camData.renderPostProcessing = _savedRenderPostProcessing;
				}
				if ((Object)(object)_dofVolume != (Object)null)
				{
					if ((Object)(object)_dofVolume.profile != (Object)null)
					{
						Object.Destroy((Object)(object)_dofVolume.profile);
					}
					Object.Destroy((Object)(object)((Component)_dofVolume).gameObject);
				}
			}
			catch (Exception ex2)
			{
				Plugin.Log2.Warn("Error cleaning up background blur: " + ex2.Message);
			}
			_dofVolume = null;
			_dof = null;
			_dofOn = false;
			_camData = null;
			try
			{
				SkyManager.ClearFixedTime();
			}
			catch (Exception ex3)
			{
				Plugin.Log2.Warn("Couldn't unlock the time: " + ex3.Message);
			}
			ShowGameUI();
			Plugin.Log2.Info("Photo mode OFF");
		}

		public static void ApplyCameraPose()
		{
			//IL_0021: Unknown result type (might be due to invalid IL or missing references)
			//IL_0040: Unknown result type (might be due to invalid IL or missing references)
			if (Active && !((Object)(object)_camT == (Object)null))
			{
				_camT.position = _pos;
				_camT.rotation = Quaternion.Euler(_pitch, _yaw, _roll);
				if ((Object)(object)_cam != (Object)null)
				{
					_cam.fieldOfView = _fov;
				}
			}
		}

		private static void HandleLook()
		{
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0105: Unknown result type (might be due to invalid IL or missing references)
			float num = 0f;
			float num2 = 0f;
			try
			{
				Vector3 mousePositionDelta = Input.mousePositionDelta;
				num = mousePositionDelta.x;
				num2 = mousePositionDelta.y;
			}
			catch
			{
				try
				{
					num = Input.GetAxisRaw("Mouse X") * 10f;
					num2 = Input.GetAxisRaw("Mouse Y") * 10f;
				}
				catch
				{
				}
			}
			float value = Plugin.MouseSensitivity.Value;
			_yaw += num * value;
			_pitch += (Plugin.InvertY.Value ? num2 : (0f - num2)) * value;
			_pitch = Mathf.Clamp(_pitch, -89.5f, 89.5f);
			if (Input.GetKey((KeyCode)122))
			{
				_roll -= 40f * Time.unscaledDeltaTime;
			}
			if (Input.GetKey((KeyCode)120))
			{
				_roll += 40f * Time.unscaledDeltaTime;
			}
			if (Input.GetKeyDown((KeyCode)114))
			{
				_roll = 0f;
			}
			float y = Input.mouseScrollDelta.y;
			if (Mathf.Abs(y) > 0.01f)
			{
				_fov = Mathf.Clamp(_fov - y * 3f, 5f, 120f);
			}
		}

		private static void HandleMove()
		{
			//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_0081: 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_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_008d: Unknown result type (might be due to invalid IL or missing references)
			//IL_008e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0093: Unknown result type (might be due to invalid IL or missing references)
			//IL_0098: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ab: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ad: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ce: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00da: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ec: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f1: 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_010f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0114: Unknown result type (might be due to invalid IL or missing references)
			//IL_0116: Unknown result type (might be due to invalid IL or missing references)
			//IL_011b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0120: Unknown result type (might be due to invalid IL or missing references)
			//IL_0132: Unknown result type (might be due to invalid IL or missing references)
			//IL_0137: Unknown result type (might be due to invalid IL or missing references)
			//IL_013d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0142: Unknown result type (might be due to invalid IL or missing references)
			//IL_0147: Unknown result type (might be due to invalid IL or missing references)
			//IL_0159: Unknown result type (might be due to invalid IL or missing references)
			//IL_015e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0164: Unknown result type (might be due to invalid IL or missing references)
			//IL_0169: Unknown result type (might be due to invalid IL or missing references)
			//IL_016e: Unknown result type (might be due to invalid IL or missing references)
			float num = Plugin.MoveSpeed.Value;
			if (Input.GetKey((KeyCode)304) || Input.GetKey((KeyCode)303))
			{
				num *= Plugin.FastMultiplier.Value;
			}
			if (Input.GetKey((KeyCode)306) || Input.GetKey((KeyCode)305))
			{
				num *= Plugin.SlowMultiplier.Value;
			}
			num *= Time.unscaledDeltaTime;
			Quaternion val = Quaternion.Euler(_pitch, _yaw, 0f);
			Vector3 val2 = val * Vector3.forward;
			Vector3 val3 = val * Vector3.right;
			if (Input.GetKey((KeyCode)119))
			{
				_pos += val2 * num;
			}
			if (Input.GetKey((KeyCode)115))
			{
				_pos -= val2 * num;
			}
			if (Input.GetKey((KeyCode)100))
			{
				_pos += val3 * num;
			}
			if (Input.GetKey((KeyCode)97))
			{
				_pos -= val3 * num;
			}
			if (Input.GetKey((KeyCode)101))
			{
				_pos += Vector3.up * num;
			}
			if (Input.GetKey((KeyCode)113))
			{
				_pos -= Vector3.up * num;
			}
		}

		private static void HandleWorld()
		{
			try
			{
				float num = 3f * Time.unscaledDeltaTime;
				if (Input.GetKey((KeyCode)91))
				{
					_fixedHour -= num;
				}
				if (Input.GetKey((KeyCode)93))
				{
					_fixedHour += num;
				}
				_fixedHour = (_fixedHour % 24f + 24f) % 24f;
				SkyManager.SetFixedTime(_fixedHour);
			}
			catch (Exception ex)
			{
				Plugin.Log2.Warn("SkyManager unavailable for time of day: " + ex.Message);
			}
		}

		private static void RecenterCamera()
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			//IL_0039: 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)
			//IL_0043: Unknown result type (might be due to invalid IL or missing references)
			//IL_0046: Unknown result type (might be due to invalid IL or missing references)
			//IL_004b: Unknown result type (might be due to invalid IL or missing references)
			//IL_004c: Unknown result type (might be due to invalid IL or missing references)
			//IL_004d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0053: Unknown result type (might be due to invalid IL or missing references)
			try
			{
				if ((Object)(object)_camParent == (Object)null)
				{
					Toast("No reference to recenter to");
					return;
				}
				Vector3 pos = _camParent.TransformPoint(_savedLocalPos);
				Quaternion val = _camParent.rotation * _savedLocalRot;
				Vector3 eulerAngles = ((Quaternion)(ref val)).eulerAngles;
				StartTransitionTo(pos, eulerAngles.y, NormalizeAngle(eulerAngles.x), 0f, _savedFov);
				Toast("Camera recentered");
			}
			catch (Exception ex)
			{
				Plugin.Log2.Warn("Failed to recenter: " + ex.Message);
			}
		}

		private static void HandleBookmarks()
		{
			//IL_0027: Unknown result type (might be due to invalid IL or missing references)
			//IL_0028: Unknown result type (might be due to invalid IL or missing references)
			//IL_005d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0062: Unknown result type (might be due to invalid IL or missing references)
			//IL_0104: Unknown result type (might be due to invalid IL or missing references)
			bool flag = Input.GetKey((KeyCode)306) || Input.GetKey((KeyCode)305);
			for (int i = 1; i <= 5; i++)
			{
				KeyCode val = (KeyCode)(48 + i);
				if (Input.GetKeyDown(val))
				{
					if (flag)
					{
						_bookmarks[i] = new CamBookmark
						{
							Set = true,
							Pos = _pos,
							Yaw = _yaw,
							Pitch = _pitch,
							Roll = _roll,
							Fov = _fov
						};
						Toast($"Bookmark {i} saved");
					}
					else if (_bookmarks[i].Set)
					{
						CamBookmark camBookmark = _bookmarks[i];
						StartTransitionTo(camBookmark.Pos, camBookmark.Yaw, camBookmark.Pitch, camBookmark.Roll, camBookmark.Fov);
						Toast($"Bookmark {i}");
					}
					else
					{
						Toast($"Bookmark {i} empty — Ctrl+{i} to save");
					}
				}
			}
		}

		private static void StartTransitionTo(Vector3 pos, float yaw, float pitch, float roll, float fov)
		{
			//IL_0041: Unknown result type (might be due to invalid IL or missing references)
			//IL_0046: Unknown result type (might be due to invalid IL or missing references)
			//IL_004b: Unknown result type (might be due to invalid IL or missing references)
			//IL_004c: Unknown result type (might be due to invalid IL or missing references)
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			if (Plugin.BookmarkTransitionSeconds.Value <= 0.01f)
			{
				_pos = pos;
				_yaw = yaw;
				_pitch = pitch;
				_roll = roll;
				_fov = fov;
				_transitioning = false;
				return;
			}
			_transFromPos = _pos;
			_transToPos = pos;
			_transFromYaw = _yaw;
			_transToYaw = yaw;
			_transFromPitch = _pitch;
			_transToPitch = pitch;
			_transFromRoll = _roll;
			_transToRoll = roll;
			_transFromFov = _fov;
			_transToFov = fov;
			_transitionT = 0f;
			_transitioning = true;
		}

		private static void UpdateTransition()
		{
			//IL_0040: Unknown result type (might be due to invalid IL or missing references)
			//IL_0045: Unknown result type (might be due to invalid IL or missing references)
			//IL_004b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0050: Unknown result type (might be due to invalid IL or missing references)
			_transitionT += Time.unscaledDeltaTime / Mathf.Max(0.01f, Plugin.BookmarkTransitionSeconds.Value);
			float num = Mathf.SmoothStep(0f, 1f, Mathf.Clamp01(_transitionT));
			_pos = Vector3.Lerp(_transFromPos, _transToPos, num);
			_yaw = Mathf.LerpAngle(_transFromYaw, _transToYaw, num);
			_pitch = Mathf.LerpAngle(_transFromPitch, _transToPitch, num);
			_roll = Mathf.LerpAngle(_transFromRoll, _transToRoll, num);
			_fov = Mathf.Lerp(_transFromFov, _transToFov, num);
			if (_transitionT >= 1f)
			{
				_transitioning = false;
			}
		}

		private static void ToggleTour()
		{
			//IL_0055: Unknown result type (might be due to invalid IL or missing references)
			if (_touring)
			{
				StopTour();
				return;
			}
			int num = FirstSetBookmark();
			if (num < 0)
			{
				Toast("No saved positions — Ctrl+1-5 to save some first");
				return;
			}
			_touring = true;
			_tourIndex = num;
			_tourDwellTimer = 0f;
			CamBookmark camBookmark = _bookmarks[num];
			StartTransitionTo(camBookmark.Pos, camBookmark.Yaw, camBookmark.Pitch, camBookmark.Roll, camBookmark.Fov);
			Toast($"Auto tour started — spot {num}");
		}

		private static void StopTour()
		{
			if (_touring)
			{
				_touring = false;
				Toast("Auto tour stopped");
			}
		}

		private static void AdvanceTourIfDue()
		{
			//IL_0048: Unknown result type (might be due to invalid IL or missing references)
			_tourDwellTimer += Time.unscaledDeltaTime;
			if (!(_tourDwellTimer < Plugin.TourDwellSeconds.Value))
			{
				_tourIndex = NextSetBookmark(_tourIndex);
				CamBookmark camBookmark = _bookmarks[_tourIndex];
				StartTransitionTo(camBookmark.Pos, camBookmark.Yaw, camBookmark.Pitch, camBookmark.Roll, camBookmark.Fov);
				_tourDwellTimer = 0f;
				Toast($"Spot {_tourIndex}");
			}
		}

		private static bool ManualMoveOrBookmarkKeyPressed()
		{
			if (Input.GetKeyDown((KeyCode)119) || Input.GetKeyDown((KeyCode)97) || Input.GetKeyDown((KeyCode)115) || Input.GetKeyDown((KeyCode)100) || Input.GetKeyDown((KeyCode)113) || Input.GetKeyDown((KeyCode)101))
			{
				return true;
			}
			for (int i = 1; i <= 5; i++)
			{
				if (Input.GetKeyDown((KeyCode)(48 + i)))
				{
					return true;
				}
			}
			return false;
		}

		private static int FirstSetBookmark()
		{
			for (int i = 1; i <= 5; i++)
			{
				if (_bookmarks[i].Set)
				{
					return i;
				}
			}
			return -1;
		}

		private static int NextSetBookmark(int from)
		{
			for (int i = 1; i <= 5; i++)
			{
				int num = (from - 1 + i) % 5 + 1;
				if (_bookmarks[num].Set)
				{
					return num;
				}
			}
			return from;
		}

		private static void ForwardGestures()
		{
			if (_gestureForwardingBroken || (Object)(object)_player == (Object)null)
			{
				return;
			}
			try
			{
				PlayerGestures gestures = _player.gestures;
				if (gestures != null)
				{
					gestures.Update();
				}
			}
			catch (Exception ex)
			{
				_gestureForwardingBroken = true;
				Plugin.Log2.Warn("Gestures errored in photo mode, disabling for the rest of the session: " + ex.Message);
			}
		}

		private static void EnsureDofVolume()
		{
			//IL_00d6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00dc: Expected O, but got Unknown
			if (!((Object)(object)_dofVolume != (Object)null))
			{
				VolumeProfile val = ScriptableObject.CreateInstance<VolumeProfile>();
				VolumeComponent val2 = val.Add(Il2CppType.Of<DepthOfField>(), true);
				_dof = ((Il2CppObjectBase)val2).TryCast<DepthOfField>();
				((VolumeParameter<DepthOfFieldMode>)(object)_dof.mode).value = (DepthOfFieldMode)2;
				((VolumeParameter)_dof.mode).overrideState = true;
				((VolumeParameter<float>)(object)_dof.aperture).value = Plugin.DofAperture.Value;
				((VolumeParameter)_dof.aperture).overrideState = true;
				((VolumeParameter<float>)(object)_dof.focalLength).value = Plugin.DofFocalLength.Value;
				((VolumeParameter)_dof.focalLength).overrideState = true;
				((VolumeParameter<float>)(object)_dof.focusDistance).value = 5f;
				((VolumeParameter)_dof.focusDistance).overrideState = true;
				GameObject val3 = new GameObject("BigWalkPhotoMode_DOF");
				_dofVolume = val3.AddComponent<Volume>();
				_dofVolume.isGlobal = true;
				_dofVolume.priority = 100f;
				_dofVolume.weight = 1f;
				_dofVolume.profile = val;
				((Behaviour)_dofVolume).enabled = false;
			}
		}

		private static void ToggleDof()
		{
			//IL_0083: Unknown result type (might be due to invalid IL or missing references)
			//IL_0044: Unknown result type (might be due to invalid IL or missing references)
			//IL_0049: Unknown result type (might be due to invalid IL or missing references)
			//IL_0063: Unknown result type (might be due to invalid IL or missing references)
			try
			{
				EnsureDofVolume();
				_dofOn = !_dofOn;
				((Behaviour)_dofVolume).enabled = _dofOn;
				if ((Object)(object)_camData != (Object)null)
				{
					if (_dofOn)
					{
						_savedVolumeLayerMask = _camData.volumeLayerMask;
						_savedRenderPostProcessing = _camData.renderPostProcessing;
						_camData.volumeLayerMask = LayerMask.op_Implicit(-1);
						_camData.renderPostProcessing = true;
					}
					else
					{
						_camData.volumeLayerMask = _savedVolumeLayerMask;
						_camData.renderPostProcessing = _savedRenderPostProcessing;
					}
				}
				else if (_dofOn)
				{
					Plugin.Log2.Warn("No UniversalAdditionalCameraData — the blur may not show up.");
				}
				Toast(_dofOn ? "Background blur on" : "Background blur off");
			}
			catch (Exception ex)
			{
				Plugin.Log2.Warn("Background blur failed: " + ex);
				Toast("Background blur unavailable");
			}
		}

		private static void UpdateDofFocus()
		{
			//IL_003a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0049: Unknown result type (might be due to invalid IL or missing references)
			if (!_dofOn || (Object)(object)_dof == (Object)null || (Object)(object)_player == (Object)null)
			{
				return;
			}
			try
			{
				((VolumeParameter<float>)(object)_dof.focusDistance).value = Mathf.Max(0.3f, Vector3.Distance(_pos, ((Component)_player).transform.position));
			}
			catch
			{
			}
		}

		private static void ToggleFlashlight()
		{
			//IL_002a: Unknown result type (might be due to invalid IL or missing references)
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b7: Expected O, but got Unknown
			//IL_00cb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00dc: Unknown result type (might be due to invalid IL or missing references)
			//IL_011d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0084: Unknown result type (might be due to invalid IL or missing references)
			//IL_0089: Unknown result type (might be due to invalid IL or missing references)
			try
			{
				if ((Object)(object)_flashlight == (Object)null)
				{
					_flashlightOnPlayer = Plugin.FlashlightOnPlayer.Value;
					Transform val = _camT;
					Quaternion localRotation = Quaternion.identity;
					if (_flashlightOnPlayer)
					{
						PlayerCharacter player = _player;
						Transform val2 = ((((player != null) ? player.head : null) != null) ? _player.head.cameraUprighter : null);
						if ((Object)(object)val2 != (Object)null)
						{
							val = val2;
							localRotation = Quaternion.Euler(-80f, 0f, 0f);
						}
						else
						{
							Plugin.Log2.Warn("No head reference for the flashlight — falling back to the camera.");
							_flashlightOnPlayer = false;
							val = _camT;
						}
					}
					GameObject val3 = new GameObject("BigWalkPhotoMode_Flashlight");
					val3.transform.SetParent(val, false);
					val3.transform.localPosition = Vector3.zero;
					val3.transform.localRotation = localRotation;
					_flashlight = val3.AddComponent<Light>();
					_flashlight.type = (LightType)0;
					_flashlight.color = new Color(Plugin.FlashlightColorR.Value, Plugin.FlashlightColorG.Value, Plugin.FlashlightColorB.Value);
					_flashlight.intensity = Plugin.FlashlightIntensity.Value;
					_flashlight.range = Plugin.FlashlightRange.Value;
					_flashlight.spotAngle = Plugin.FlashlightAngle.Value;
					_flashlight.shadows = (LightShadows)(Plugin.FlashlightShadows.Value ? 2 : 0);
					((Behaviour)_flashlight).enabled = true;
					Toast("Flashlight on");
				}
				else
				{
					((Behaviour)_flashlight).enabled = !((Behaviour)_flashlight).enabled;
					Toast(((Behaviour)_flashlight).enabled ? "Flashlight on" : "Flashlight off");
				}
			}
			catch (Exception ex)
			{
				Plugin.Log2.Warn("Flashlight failed: " + ex);
			}
		}

		private static void HideGameUI()
		{
			if (_uiHidden)
			{
				return;
			}
			try
			{
				Il2CppArrayBase<Canvas> val = Object.FindObjectsByType<Canvas>((FindObjectsInactive)0, (FindObjectsSortMode)0);
				_hiddenCanvases.Clear();
				foreach (Canvas item in val)
				{
					if (!((Object)(object)item == (Object)null) && ((Behaviour)item).enabled)
					{
						((Behaviour)item).enabled = false;
						_hiddenCanvases.Add(item);
					}
				}
				_uiHidden = true;
			}
			catch (Exception ex)
			{
				Plugin.Log2.Warn("Couldn't hide the UI: " + ex.Message);
			}
		}

		private static void ShowGameUI()
		{
			try
			{
				foreach (Canvas hiddenCanvase in _hiddenCanvases)
				{
					if ((Object)(object)hiddenCanvase != (Object)null)
					{
						((Behaviour)hiddenCanvase).enabled = true;
					}
				}
			}
			catch (Exception ex)
			{
				Plugin.Log2.Warn("Couldn't restore the UI: " + ex.Message);
			}
			_hiddenCanvases.Clear();
			_uiHidden = false;
		}

		private static PlayerCharacter FindLocalPlayer()
		{
			try
			{
				List<PlayerCharacter> allPlayerCharacters = PlayerCharacter.allPlayerCharacters;
				if (allPlayerCharacters == null)
				{
					return null;
				}
				for (int i = 0; i < allPlayerCharacters.Count; i++)
				{
					PlayerCharacter val = allPlayerCharacters[i];
					if (!((Object)(object)val == (Object)null) && ((NetworkBehaviour)val).isLocalPlayer)
					{
						return val;
					}
				}
				return (allPlayerCharacters.Count > 0) ? allPlayerCharacters[0] : null;
			}
			catch (Exception ex)
			{
				Plugin.Log2.Error("Error finding the local player: " + ex);
				return null;
			}
		}

		private static Camera ResolveCamera(PlayerCharacter p)
		{
			try
			{
				PlayerCameraReferences val = ((p.cameraMinder != null) ? p.cameraMinder.playerCameraReferences : null);
				if ((Object)(object)val != (Object)null && (Object)(object)val.playerCamera != (Object)null)
				{
					return val.playerCamera;
				}
			}
			catch
			{
			}
			try
			{
				return Camera.main;
			}
			catch
			{
				return null;
			}
		}

		private static float NormalizeAngle(float a)
		{
			return (a > 180f) ? (a - 360f) : a;
		}

		private static void Toast(string msg)
		{
			_toast = msg;
			_toastUntil = Time.unscaledTime + 3f;
		}

		private static Texture2D FlatTex()
		{
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			//IL_001d: Expected O, but got Unknown
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)_flatTex == (Object)null)
			{
				_flatTex = new Texture2D(1, 1);
				_flatTex.SetPixel(0, 0, Color.white);
				_flatTex.Apply();
			}
			return _flatTex;
		}

		private void OnGUI()
		{
			//IL_0022: 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)
			//IL_0062: 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_00a9: 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_014c: Unknown result type (might be due to invalid IL or missing references)
			//IL_016e: Unknown result type (might be due to invalid IL or missing references)
			//IL_017e: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d2: Unknown result type (might be due to invalid IL or missing references)
			//IL_01dd: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ea: Unknown result type (might be due to invalid IL or missing references)
			//IL_0229: Unknown result type (might be due to invalid IL or missing references)
			//IL_0298: Unknown result type (might be due to invalid IL or missing references)
			//IL_02db: Unknown result type (might be due to invalid IL or missing references)
			//IL_0312: Unknown result type (might be due to invalid IL or missing references)
			//IL_0349: Unknown result type (might be due to invalid IL or missing references)
			//IL_0380: Unknown result type (might be due to invalid IL or missing references)
			//IL_03b7: Unknown result type (might be due to invalid IL or missing references)
			//IL_03ee: Unknown result type (might be due to invalid IL or missing references)
			//IL_0425: Unknown result type (might be due to invalid IL or missing references)
			//IL_0467: Unknown result type (might be due to invalid IL or missing references)
			//IL_053d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0548: Unknown result type (might be due to invalid IL or missing references)
			//IL_0555: Unknown result type (might be due to invalid IL or missing references)
			//IL_058e: Unknown result type (might be due to invalid IL or missing references)
			if (Active && _showCinemaBars)
			{
				float num = (float)Screen.height * 0.11f;
				GUI.color = Color.black;
				GUI.DrawTexture(new Rect(0f, 0f, (float)Screen.width, num), (Texture)(object)FlatTex());
				GUI.DrawTexture(new Rect(0f, (float)Screen.height - num, (float)Screen.width, num), (Texture)(object)FlatTex());
				GUI.color = Color.white;
			}
			if (Active && _showGrid)
			{
				GUI.color = new Color(1f, 1f, 1f, 0.55f);
				float num2 = (float)Screen.width / 3f;
				float num3 = (float)Screen.width * 2f / 3f;
				float num4 = (float)Screen.height / 3f;
				float num5 = (float)Screen.height * 2f / 3f;
				GUI.DrawTexture(new Rect(num2, 0f, 1f, (float)Screen.height), (Texture)(object)FlatTex());
				GUI.DrawTexture(new Rect(num3, 0f, 1f, (float)Screen.height), (Texture)(object)FlatTex());
				GUI.DrawTexture(new Rect(0f, num4, (float)Screen.width, 1f), (Texture)(object)FlatTex());
				GUI.DrawTexture(new Rect(0f, num5, (float)Screen.width, 1f), (Texture)(object)FlatTex());
				GUI.color = Color.white;
			}
			if (Active && _showOverlay)
			{
				Rect val = default(Rect);
				((Rect)(ref val))..ctor(14f, 14f, 300f, 442f);
				GUI.color = new Color(0f, 0f, 0f, 0.72f);
				GUI.Box(val, "");
				GUI.color = Color.white;
				GUILayout.BeginArea(new Rect(((Rect)(ref val)).x + 12f, ((Rect)(ref val)).y + 8f, ((Rect)(ref val)).width - 24f, ((Rect)(ref val)).height - 16f));
				GUILayout.Label("<b>PHOTO MODE</b>", (Il2CppReferenceArray<GUILayoutOption>)null);
				GUILayout.Space(4f);
				GUILayout.Label("WASD  move        Q/E  down/up", (Il2CppReferenceArray<GUILayoutOption>)null);
				GUILayout.Label("Mouse  look        Scroll  zoom (FOV)", (Il2CppReferenceArray<GUILayoutOption>)null);
				GUILayout.Label("Shift  fast        Ctrl  slow", (Il2CppReferenceArray<GUILayoutOption>)null);
				GUILayout.Label("Z/X  tilt          R  level", (Il2CppReferenceArray<GUILayoutOption>)null);
				GUILayout.Label("[ ]  time of day", (Il2CppReferenceArray<GUILayoutOption>)null);
				GUILayout.Label($"{Plugin.KeyRecenter.Value}  recenter on head", (Il2CppReferenceArray<GUILayoutOption>)null);
				GUILayout.Label("1-5  go to spot     Ctrl+1-5  save", (Il2CppReferenceArray<GUILayoutOption>)null);
				GUILayout.Label($"{Plugin.KeyToggleTour.Value}  auto tour through spots", (Il2CppReferenceArray<GUILayoutOption>)null);
				GUILayout.Label($"{Plugin.KeyToggleGrid.Value}  composition grid", (Il2CppReferenceArray<GUILayoutOption>)null);
				GUILayout.Label($"{Plugin.KeyToggleCinemaBars.Value}  cinema bars", (Il2CppReferenceArray<GUILayoutOption>)null);
				GUILayout.Label($"{Plugin.KeyToggleDof.Value}  background blur", (Il2CppReferenceArray<GUILayoutOption>)null);
				GUILayout.Label($"{Plugin.KeyToggleFlashlight.Value}  flashlight (suspense)", (Il2CppReferenceArray<GUILayoutOption>)null);
				GUILayout.Label($"{Plugin.KeyToggleUI.Value}  game UI", (Il2CppReferenceArray<GUILayoutOption>)null);
				GUILayout.Label($"{Plugin.KeyToggleOverlay.Value}  hide this panel (for screenshots)", (Il2CppReferenceArray<GUILayoutOption>)null);
				GUILayout.Label("F12  capture (Steam)", (Il2CppReferenceArray<GUILayoutOption>)null);
				GUILayout.Label($"{Plugin.KeyToggle.Value}  exit", (Il2CppReferenceArray<GUILayoutOption>)null);
				GUILayout.Space(6f);
				GUILayout.Label($"FOV {_fov:F0}   {FormatHour(_fixedHour)}", (Il2CppReferenceArray<GUILayoutOption>)null);
				GUILayout.EndArea();
			}
			if (Time.unscaledTime < _toastUntil)
			{
				Rect val2 = default(Rect);
				((Rect)(ref val2))..ctor(14f, (float)(Screen.height - 60), 420f, 30f);
				GUI.color = new Color(0f, 0f, 0f, 0.72f);
				GUI.Box(val2, "");
				GUI.color = Color.white;
				GUI.Label(new Rect(((Rect)(ref val2)).x + 10f, ((Rect)(ref val2)).y + 6f, ((Rect)(ref val2)).width - 20f, ((Rect)(ref val2)).height), _toast);
			}
		}

		private static string FormatHour(float h)
		{
			int value = Mathf.FloorToInt(h) % 24;
			int value2 = Mathf.FloorToInt((h - Mathf.Floor(h)) * 60f);
			return $"{value:D2}:{value2:D2}";
		}
	}
	[BepInPlugin("com.valim.bigwalk.photomode", "Big Walk Photo Mode", "1.0.0")]
	public class Plugin : BasePlugin
	{
		public const string GUID = "com.valim.bigwalk.photomode";

		public static Plugin Instance;

		public static ManualLogSourceProxy Log2;

		public static ConfigEntry<KeyCode> KeyToggle;

		public static ConfigEntry<KeyCode> KeyToggleUI;

		public static ConfigEntry<KeyCode> KeyToggleOverlay;

		public static ConfigEntry<KeyCode> KeyToggleFlashlight;

		public static ConfigEntry<KeyCode> KeyToggleGrid;

		public static ConfigEntry<KeyCode> KeyToggleCinemaBars;

		public static ConfigEntry<KeyCode> KeyRecenter;

		public static ConfigEntry<KeyCode> KeyToggleDof;

		public static ConfigEntry<KeyCode> KeyToggleTour;

		public static ConfigEntry<float> MoveSpeed;

		public static ConfigEntry<float> FastMultiplier;

		public static ConfigEntry<float> SlowMultiplier;

		public static ConfigEntry<float> MouseSensitivity;

		public static ConfigEntry<bool> InvertY;

		public static ConfigEntry<float> FlashlightColorR;

		public static ConfigEntry<float> FlashlightColorG;

		public static ConfigEntry<float> FlashlightColorB;

		public static ConfigEntry<float> FlashlightIntensity;

		public static ConfigEntry<float> FlashlightRange;

		public static ConfigEntry<float> FlashlightAngle;

		public static ConfigEntry<bool> FlashlightShadows;

		public static ConfigEntry<bool> FlashlightOnPlayer;

		public static ConfigEntry<bool> EnableGestures;

		public static ConfigEntry<float> BookmarkTransitionSeconds;

		public static ConfigEntry<float> TourDwellSeconds;

		public static ConfigEntry<float> DofAperture;

		public static ConfigEntry<float> DofFocalLength;

		public override void Load()
		{
			//IL_0227: Unknown result type (might be due to invalid IL or missing references)
			//IL_0231: Expected O, but got Unknown
			//IL_0264: Unknown result type (might be due to invalid IL or missing references)
			//IL_026e: Expected O, but got Unknown
			//IL_02a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ab: Expected O, but got Unknown
			//IL_02de: Unknown result type (might be due to invalid IL or missing references)
			//IL_02e8: Expected O, but got Unknown
			//IL_031b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0325: Expected O, but got Unknown
			//IL_0358: Unknown result type (might be due to invalid IL or missing references)
			//IL_0362: Expected O, but got Unknown
			//IL_03f5: Unknown result type (might be due to invalid IL or missing references)
			//IL_03ff: Expected O, but got Unknown
			//IL_0432: Unknown result type (might be due to invalid IL or missing references)
			//IL_043c: Expected O, but got Unknown
			//IL_046f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0479: Expected O, but got Unknown
			//IL_04ac: Unknown result type (might be due to invalid IL or missing references)
			//IL_04b6: Expected O, but got Unknown
			//IL_0544: Unknown result type (might be due to invalid IL or missing references)
			//IL_054a: Expected O, but got Unknown
			//IL_055f: Unknown result type (might be due to invalid IL or missing references)
			Instance = this;
			Log2 = new ManualLogSourceProxy(((BasePlugin)this).Log);
			KeyToggle = ((BasePlugin)this).Config.Bind<KeyCode>("Keybinds", "Toggle photo mode", (KeyCode)287, "Enter/exit photo mode.");
			KeyToggleUI = ((BasePlugin)this).Config.Bind<KeyCode>("Keybinds", "Toggle game UI", (KeyCode)288, "Show/hide the game's own interface (Canvas).");
			KeyToggleOverlay = ((BasePlugin)this).Config.Bind<KeyCode>("Keybinds", "Toggle help panel", (KeyCode)104, "Show/hide the photo mode controls panel.");
			KeyToggleGrid = ((BasePlugin)this).Config.Bind<KeyCode>("Keybinds", "Toggle composition grid", (KeyCode)103, "Show/hide the rule-of-thirds grid.");
			KeyToggleCinemaBars = ((BasePlugin)this).Config.Bind<KeyCode>("Keybinds", "Toggle cinema bars", (KeyCode)99, "Show/hide black letterbox bars.");
			KeyRecenter = ((BasePlugin)this).Config.Bind<KeyCode>("Keybinds", "Recenter camera", (KeyCode)278, "Snaps the camera back to the character's head without leaving photo mode.");
			KeyToggleDof = ((BasePlugin)this).Config.Bind<KeyCode>("Keybinds", "Toggle background blur", (KeyCode)102, "Toggle depth-of-field blur (auto-focuses on the character).");
			KeyToggleTour = ((BasePlugin)this).Config.Bind<KeyCode>("Keybinds", "Toggle auto tour", (KeyCode)116, "Automatically glides through your saved bookmarks (1-5) on a loop, hands-free.");
			MoveSpeed = ((BasePlugin)this).Config.Bind<float>("Camera", "Speed", 6f, "Base free-camera speed, in units per second.");
			FastMultiplier = ((BasePlugin)this).Config.Bind<float>("Camera", "Fast multiplier", 4f, "Speed multiplier while holding Shift.");
			SlowMultiplier = ((BasePlugin)this).Config.Bind<float>("Camera", "Slow multiplier", 0.2f, "Speed multiplier while holding Ctrl.");
			MouseSensitivity = ((BasePlugin)this).Config.Bind<float>("Camera", "Mouse sensitivity", 0.15f, "Look sensitivity in photo mode.");
			InvertY = ((BasePlugin)this).Config.Bind<bool>("Camera", "Invert Y", false, "Inverts the vertical mouse axis.");
			KeyToggleFlashlight = ((BasePlugin)this).Config.Bind<KeyCode>("Flashlight", "Toggle flashlight", (KeyCode)108, "Turns on/off a spotlight attached to the camera, pointing where you look.");
			FlashlightColorR = ((BasePlugin)this).Config.Bind<float>("Flashlight", "Color R", 0.75f, new ConfigDescription("Red component of the light color (0-1). Default is a slightly cool white.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 1f), Array.Empty<object>()));
			FlashlightColorG = ((BasePlugin)this).Config.Bind<float>("Flashlight", "Color G", 0.9f, new ConfigDescription("Green component of the light color (0-1).", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 1f), Array.Empty<object>()));
			FlashlightColorB = ((BasePlugin)this).Config.Bind<float>("Flashlight", "Color B", 1f, new ConfigDescription("Blue component of the light color (0-1).", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 1f), Array.Empty<object>()));
			FlashlightIntensity = ((BasePlugin)this).Config.Bind<float>("Flashlight", "Intensity", 6f, new ConfigDescription("Light strength.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0.5f, 30f), Array.Empty<object>()));
			FlashlightRange = ((BasePlugin)this).Config.Bind<float>("Flashlight", "Range", 25f, new ConfigDescription("How far the light reaches.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(5f, 100f), Array.Empty<object>()));
			FlashlightAngle = ((BasePlugin)this).Config.Bind<float>("Flashlight", "Beam angle", 35f, new ConfigDescription("Cone angle of the light, in degrees.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(5f, 90f), Array.Empty<object>()));
			FlashlightShadows = ((BasePlugin)this).Config.Bind<bool>("Flashlight", "Shadows", true, "Whether the flashlight casts shadows (more dramatic, slightly heavier).");
			FlashlightOnPlayer = ((BasePlugin)this).Config.Bind<bool>("Flashlight", "Attach to character", false, "False (default) = attached to the camera, as if you're filming. True = attached to the character itself pointing upward, a 'flashlight under the chin' campfire-story effect.");
			EnableGestures = ((BasePlugin)this).Config.Bind<bool>("Gestures (experimental)", "Allow gestures in photo mode", false, "If enabled, the game's normal wave/gesture controls keep working while the character is frozen in photo mode. Off by default because this subsystem also ties into things like footstep audio, which can sound odd with the character standing still — try it and report back if anything feels wrong.");
			BookmarkTransitionSeconds = ((BasePlugin)this).Config.Bind<float>("Bookmarks", "Transition duration", 0.6f, new ConfigDescription("Time (seconds) the camera takes to glide to a saved position. 0 = instant cut.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 3f), Array.Empty<object>()));
			TourDwellSeconds = ((BasePlugin)this).Config.Bind<float>("Bookmarks", "Auto tour dwell time", 3f, new ConfigDescription("Seconds to hold at each saved bookmark during an auto tour before gliding to the next one.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0.5f, 15f), Array.Empty<object>()));
			DofAperture = ((BasePlugin)this).Config.Bind<float>("Background blur", "Aperture (f-stop)", 2.8f, new ConfigDescription("Simulated lens aperture. Lower = blurrier background.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(1f, 16f), Array.Empty<object>()));
			DofFocalLength = ((BasePlugin)this).Config.Bind<float>("Background blur", "Focal length (mm)", 85f, new ConfigDescription("Simulated lens focal length. 85mm is a classic portrait lens.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(20f, 300f), Array.Empty<object>()));
			((BasePlugin)this).Log.LogInfo((object)"Big Walk Photo Mode 1.0.0 loading...");
			try
			{
				Harmony.CreateAndPatchAll(typeof(CameraMinderUpdatePatch), (string)null);
				Harmony.CreateAndPatchAll(typeof(PlayerLateUpdatePatch), (string)null);
				((BasePlugin)this).Log.LogInfo((object)"Patches applied.");
			}
			catch (Exception ex)
			{
				((BasePlugin)this).Log.LogError((object)("Failed to apply patches: " + ex));
			}
			ClassInjector.RegisterTypeInIl2Cpp<PhotoModeBehaviour>();
			((BasePlugin)this).AddComponent<PhotoModeBehaviour>();
			ManualLogSource log = ((BasePlugin)this).Log;
			bool flag = default(bool);
			BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(49, 1, ref flag);
			if (flag)
			{
				((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Ready. ");
				((BepInExLogInterpolatedStringHandler)val).AppendFormatted<KeyCode>(KeyToggle.Value);
				((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" = photo mode. Use Steam's F12 to capture.");
			}
			log.LogInfo(val);
		}
	}
	public class ManualLogSourceProxy
	{
		private readonly ManualLogSource _src;

		public ManualLogSourceProxy(ManualLogSource src)
		{
			_src = src;
		}

		public void Info(string m)
		{
			_src.LogInfo((object)m);
		}

		public void Warn(string m)
		{
			_src.LogWarning((object)m);
		}

		public void Error(string m)
		{
			_src.LogError((object)m);
		}
	}
	[HarmonyPatch(typeof(PlayerCameraMinder), "Update")]
	internal static class CameraMinderUpdatePatch
	{
		private static bool Prefix()
		{
			return !PhotoModeBehaviour.Active;
		}
	}
	[HarmonyPatch(typeof(PlayerCharacter), "LateUpdate")]
	internal static class PlayerLateUpdatePatch
	{
		private static void Postfix()
		{
			if (PhotoModeBehaviour.Active)
			{
				PhotoModeBehaviour.ApplyCameraPose();
			}
		}
	}
}