Decompiled source of CameraFollow v1.0.0

CameraRoundsMod.dll

Decompiled an hour ago
using System;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using BepInEx;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using Photon.Pun;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("CameraRoundsMod")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("CameraRoundsMod")]
[assembly: AssemblyTitle("CameraRoundsMod")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[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]
	[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;
		}
	}
}
namespace RoundsMod
{
	[HarmonyPatch(typeof(CameraZoomHandler), "Update")]
	public static class CameraZoomHandlerUpdatePatch
	{
		public static float targetSize = 20f;

		public static float smoothSpeed = 2.5f;

		public static Vector3 oldPosition = new Vector3(0f, 0f, -100f);

		[HarmonyPostfix]
		private static void UpdatePostfix(CameraZoomHandler __instance)
		{
			//IL_00fc: Unknown result type (might be due to invalid IL or missing references)
			//IL_0101: Unknown result type (might be due to invalid IL or missing references)
			//IL_018a: Unknown result type (might be due to invalid IL or missing references)
			//IL_018f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0194: Unknown result type (might be due to invalid IL or missing references)
			//IL_0196: Unknown result type (might be due to invalid IL or missing references)
			//IL_019f: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a4: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ae: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b8: Unknown result type (might be due to invalid IL or missing references)
			//IL_01bd: Unknown result type (might be due to invalid IL or missing references)
			//IL_023f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0253: Unknown result type (might be due to invalid IL or missing references)
			//IL_0263: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d5: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e0: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f0: Unknown result type (might be due to invalid IL or missing references)
			//IL_0201: Unknown result type (might be due to invalid IL or missing references)
			//IL_020b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0210: Unknown result type (might be due to invalid IL or missing references)
			//IL_0212: Unknown result type (might be due to invalid IL or missing references)
			//IL_0222: Unknown result type (might be due to invalid IL or missing references)
			//IL_0144: Unknown result type (might be due to invalid IL or missing references)
			//IL_014d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0157: 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_0161: Unknown result type (might be due to invalid IL or missing references)
			try
			{
				Player val = null;
				foreach (Player player in PlayerManager.instance.players)
				{
					if ((Object)(object)player != (Object)null && (Object)(object)player.data != (Object)null && player.data.view.IsMine)
					{
						val = player;
						break;
					}
				}
				if ((Object)(object)val == (Object)null)
				{
					return;
				}
				Camera[] componentsInChildren = ((Component)__instance).GetComponentsInChildren<Camera>();
				bool flag = val.data.isPlaying && val.data.health > 0f && !Object.FindObjectOfType<CardChoice>().IsPicking && !val.data.dead;
				bool flag2 = val.data.currentCards.Any((CardInfo p) => p.cardName == "REMOTE");
				Vector3 val2 = Vector3.zero;
				RemoteControl[] array = Object.FindObjectsOfType<RemoteControl>();
				if (flag2)
				{
					RemoteControl[] array2 = array;
					foreach (RemoteControl val3 in array2)
					{
						PhotonView componentInParent = ((Component)val3).GetComponentInParent<PhotonView>();
						GameObject gameObject = ((Component)val3).gameObject;
						if (componentInParent.IsMine)
						{
							val2 += gameObject.transform.position / (float)array.Length;
						}
					}
				}
				Camera[] array3 = componentsInChildren;
				foreach (Camera val4 in array3)
				{
					Vector3 val5 = val4.ScreenToWorldPoint(Input.mousePosition);
					Vector3 val6 = Vector3.ClampMagnitude((val5 - ((Component)val4).transform.position) * 0.5f, 8f);
					if (flag)
					{
						((Component)val4).transform.position = Vector3.Lerp(((Component)val4).transform.position, new Vector3(((Component)val).transform.position.x, ((Component)val).transform.position.y, ((Component)val4).transform.position.z) + val6, Time.unscaledDeltaTime * smoothSpeed);
					}
					else
					{
						((Component)val4).transform.position = Vector3.Lerp(((Component)val4).transform.position, new Vector3(0f, 0f, -100f), Time.unscaledDeltaTime * smoothSpeed);
					}
					val4.orthographicSize = Mathf.Lerp(val4.orthographicSize, targetSize - (val.data.block.IsBlocking() ? 5.5f : 0f) - (flag ? (((Vector3)(ref val6)).magnitude / 1f) : 0f), Time.unscaledDeltaTime * smoothSpeed);
				}
			}
			catch (Exception ex)
			{
				MonoBehaviour.print((object)ex.Message);
			}
		}
	}
	[HarmonyPatch(typeof(CameraZoomHandler), "Start")]
	public static class CameraZoomHandlerStartPatch
	{
		[HarmonyPostfix]
		private static void StartPostfix(CameraZoomHandler __instance)
		{
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			CameraZoomHandlerUpdatePatch.oldPosition = ((Component)((Component)__instance).GetComponentsInChildren<Camera>().First()).transform.position;
		}
	}
}
namespace CameraRoundsMod
{
	[BepInPlugin("gamingaming", "CameraBlock", "1.0.0")]
	[BepInProcess("Rounds.exe")]
	public class CameraPlugin : BaseUnityPlugin
	{
		private void Awake()
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			new Harmony("gamingaming").PatchAll();
		}
	}
}