using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Configuration;
using CameraRoundsMod;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using TMPro;
using UnboundLib;
using UnboundLib.Utils.UI;
using UnityEngine;
using UnityEngine.Events;
using UnityEngine.UI;
[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 List<Vector3> oldPositions = new List<Vector3>();
[HarmonyPostfix]
[HarmonyPriority(0)]
private static void UpdatePostfix(CameraZoomHandler __instance)
{
//IL_010b: Unknown result type (might be due to invalid IL or missing references)
//IL_0110: 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_0119: Unknown result type (might be due to invalid IL or missing references)
//IL_011e: 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_0129: Unknown result type (might be due to invalid IL or missing references)
//IL_012e: Unknown result type (might be due to invalid IL or missing references)
//IL_0138: 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_01d0: Unknown result type (might be due to invalid IL or missing references)
//IL_01e1: Unknown result type (might be due to invalid IL or missing references)
//IL_01f1: Unknown result type (might be due to invalid IL or missing references)
//IL_0158: Unknown result type (might be due to invalid IL or missing references)
//IL_0160: Unknown result type (might be due to invalid IL or missing references)
//IL_0170: Unknown result type (might be due to invalid IL or missing references)
//IL_017a: Unknown result type (might be due to invalid IL or missing references)
//IL_0181: 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_0199: Unknown result type (might be due to invalid IL or missing references)
//IL_0192: Unknown result type (might be due to invalid IL or missing references)
//IL_019b: Unknown result type (might be due to invalid IL or missing references)
//IL_01ba: Unknown result type (might be due to invalid IL or missing references)
smoothSpeed = CameraPlugin.smoothSpeed.Value;
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>();
if (oldPositions == null)
{
oldPositions = new List<Vector3>(componentsInChildren.Length);
}
bool flag = val.data.isPlaying && val.data.health > 0f && !Object.FindObjectOfType<CardChoice>().IsPicking && !val.data.dead;
for (int i = 0; i < componentsInChildren.Length; i++)
{
Camera val2 = componentsInChildren[i];
Vector3 val3 = oldPositions[i];
Vector3 val4 = val2.ScreenToWorldPoint(Input.mousePosition);
Vector3 val5 = Vector3.ClampMagnitude((val4 - ((Component)val2).transform.position) * 0.5f, 5f);
if (flag)
{
((Component)val2).transform.position = Vector3.Lerp(val3, new Vector3(((Component)val).transform.position.x, ((Component)val).transform.position.y, val3.z) + (CameraPlugin.offsetToMouse.Value ? val5 : Vector3.zero), Mathf.Clamp(Time.unscaledDeltaTime * smoothSpeed, 0f, 1f));
}
else
{
((Component)val2).transform.position = Vector3.Lerp(val3, new Vector3(0f, 0f, -100f), Time.unscaledDeltaTime * smoothSpeed);
}
oldPositions[i] = ((Component)val2).transform.position;
val2.orthographicSize = Mathf.Lerp(val2.orthographicSize, targetSize - ((val.data.block.IsBlocking() && CameraPlugin.zoomInWhenBlocking.Value) ? 5.5f : 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_001f: Unknown result type (might be due to invalid IL or missing references)
Camera[] componentsInChildren = ((Component)__instance).GetComponentsInChildren<Camera>();
Camera[] array = componentsInChildren;
foreach (Camera val in array)
{
CameraZoomHandlerUpdatePatch.oldPositions.Add(((Component)val).transform.position);
}
}
}
}
namespace CameraRoundsMod
{
[BepInPlugin("Digli.CameraFollow", "CameraFollow", "1.0.1")]
[BepInProcess("Rounds.exe")]
public class CameraPlugin : BaseUnityPlugin
{
[Serializable]
[CompilerGenerated]
private sealed class <>c
{
public static readonly <>c <>9 = new <>c();
public static UnityAction <>9__5_0;
public static UnityAction<float> <>9__6_0;
public static UnityAction<bool> <>9__6_2;
public static UnityAction<bool> <>9__6_3;
internal void <Awake>b__5_0()
{
}
internal void <NewGUI>b__6_0(float value)
{
smoothSpeed.Value = value;
}
internal void <NewGUI>b__6_2(bool value)
{
offsetToMouse.Value = value;
}
internal void <NewGUI>b__6_3(bool value)
{
zoomInWhenBlocking.Value = value;
}
}
public static ConfigEntry<float> smoothSpeed;
public static ConfigEntry<bool> offsetToMouse;
public static ConfigEntry<bool> zoomInWhenBlocking;
public static Toggle offsetToMouseToggle;
public static Toggle zoomInWhenBlockingToggle;
private void Awake()
{
//IL_002f: Unknown result type (might be due to invalid IL or missing references)
//IL_0039: Expected O, but got Unknown
//IL_0083: Unknown result type (might be due to invalid IL or missing references)
//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
//IL_00ac: Unknown result type (might be due to invalid IL or missing references)
//IL_00b2: Expected O, but got Unknown
smoothSpeed = ((BaseUnityPlugin)this).Config.Bind<float>("Camera", "Smooth Speed", 2.5f, new ConfigDescription("Higher the value, the faster the camera moves to look at the player", (AcceptableValueBase)(object)new AcceptableValueRange<float>(1f, 100f), Array.Empty<object>()));
offsetToMouse = ((BaseUnityPlugin)this).Config.Bind<bool>("Camera", "Offset To Mouse", true, "");
zoomInWhenBlocking = ((BaseUnityPlugin)this).Config.Bind<bool>("Camera", "Zoom in when blocking", true, "");
new Harmony("Digli.CameraFollow").PatchAll();
object obj = <>c.<>9__5_0;
if (obj == null)
{
UnityAction val = delegate
{
};
<>c.<>9__5_0 = val;
obj = (object)val;
}
Unbound.RegisterMenu("Camera Follow", (UnityAction)obj, (Action<GameObject>)NewGUI, (GameObject)null, false);
}
private void NewGUI(GameObject menu)
{
//IL_00a9: Unknown result type (might be due to invalid IL or missing references)
//IL_00ca: Expected O, but got Unknown
TextMeshProUGUI val = null;
Slider slider = null;
MenuHandler.CreateText("Camera Follow Options", menu, ref val, 60, true, (Color?)null, (TMP_FontAsset)null, (Material)null, (TextAlignmentOptions?)null);
MenuHandler.CreateSlider("Smooth Speed", menu, 60, 1f, 100f, smoothSpeed.Value, (UnityAction<float>)delegate(float value)
{
smoothSpeed.Value = value;
}, ref slider, false, (Color?)null, (Direction)0, true, (Color?)null, (TMP_FontAsset)null, (Material)null, (TextAlignmentOptions?)null);
MenuHandler.CreateButton("Reset Smooth Speed", menu, (UnityAction)delegate
{
smoothSpeed.Value = 2.5f;
slider.value = 2.5f;
}, 30, true, (Color?)null, (TMP_FontAsset)null, (Material)null, (TextAlignmentOptions?)null);
offsetToMouseToggle = MenuHandler.CreateToggle(offsetToMouse.Value, "Offset To Mouse", menu, (UnityAction<bool>)delegate(bool value)
{
offsetToMouse.Value = value;
}, 30, true, (Color?)null, (TMP_FontAsset)null, (Material)null, (TextAlignmentOptions?)null).GetComponent<Toggle>();
zoomInWhenBlockingToggle = MenuHandler.CreateToggle(zoomInWhenBlocking.Value, "Zoom in when blocking", menu, (UnityAction<bool>)delegate(bool value)
{
zoomInWhenBlocking.Value = value;
}, 30, true, (Color?)null, (TMP_FontAsset)null, (Material)null, (TextAlignmentOptions?)null).GetComponent<Toggle>();
}
}
}