Decompiled source of SmoothPlayer v1.0.3

plugins/SmoothPlayer.dll

Decompiled 9 hours ago
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.Logging;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETStandard,Version=v2.0", FrameworkDisplayName = ".NET Standard 2.0")]
[assembly: AssemblyCompany("SmoothPlayer")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.3.0")]
[assembly: AssemblyInformationalVersion("1.0.3+ff589572d28fc84a3d2b1b1c63f21b373e9321d3")]
[assembly: AssemblyProduct("SmoothPlayer")]
[assembly: AssemblyTitle("SmoothPlayer")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.3.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.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 SmoothPlayer
{
	[HarmonyPatch]
	internal static class Patch
	{
		private const float RotateSpeed = 40f;

		private const float FollowSpeed = 10f;

		private const float EdgeSpeed = 25f;

		[HarmonyPatch(typeof(VGPlayerData), "SpawnPlayerObject")]
		[HarmonyPostfix]
		private static void VGPlayerData_SpawnPlayerObject_Postfix(VGPlayer __result)
		{
			if (!Object.op_Implicit((Object)(object)__result))
			{
				return;
			}
			Transform val = ((Component)__result).transform.Find("Player");
			if (Object.op_Implicit((Object)(object)val))
			{
				DelayTracker component = ((Component)val).GetComponent<DelayTracker>();
				if (Object.op_Implicit((Object)(object)component))
				{
					Object.Destroy((Object)(object)component);
				}
			}
		}

		[HarmonyPatch(typeof(VGPlayer), "Update")]
		[HarmonyPostfix]
		private static void VGPlayer_Update_Postfix(VGPlayer __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)
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0031: Unknown result type (might be due to invalid IL or missing references)
			//IL_003b: 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)
			//IL_0043: Unknown result type (might be due to invalid IL or missing references)
			//IL_0048: Unknown result type (might be due to invalid IL or missing references)
			//IL_004e: 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)
			//IL_005e: 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)
			//IL_006f: Unknown result type (might be due to invalid IL or missing references)
			Transform obj = ((Component)__instance).transform.Find("Player");
			Vector3 val = Vector2.op_Implicit(__instance.internalVelocity);
			Quaternion val2 = Quaternion.Euler(0f, 0f, ((Component)__instance.Player_Rigidbody).transform.eulerAngles.z);
			obj.position += val * Time.deltaTime;
			obj.rotation = Quaternion.Lerp(obj.rotation, val2, Time.deltaTime * 40f);
		}

		[HarmonyPatch(typeof(VGPlayer), "LateUpdate")]
		[HarmonyPostfix]
		private static void VGPlayer_LateUpdate_Postfix(VGPlayer __instance)
		{
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_0033: 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_004e: 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_0097: 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_00cb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e7: Unknown result type (might be due to invalid IL or missing references)
			//IL_006e: Unknown result type (might be due to invalid IL or missing references)
			//IL_007d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0086: Unknown result type (might be due to invalid IL or missing references)
			Transform val = ((Component)__instance).transform.Find("Player");
			val.position = Vector3.Lerp(val.position, ((Component)__instance.Player_Rigidbody).transform.position, Time.deltaTime * 10f);
			Vector3 val2 = __instance.ObjectCamera.WorldToViewportPoint(val.position);
			float eDGE_OFFSET = VGPlayer.EDGE_OFFSET;
			float num = (float)Screen.height / (float)Screen.width * eDGE_OFFSET;
			if (val2.x < num || val2.x > 1f - num || val2.y < eDGE_OFFSET || val2.y > 1f - eDGE_OFFSET)
			{
				val2.x = Mathf.Clamp(val2.x, num, 1f - num);
				val2.y = Mathf.Clamp(val2.y, eDGE_OFFSET, 1f - eDGE_OFFSET);
				val.position = Vector3.Lerp(val.position, __instance.ObjectCamera.ViewportToWorldPoint(val2), Time.deltaTime * 25f);
			}
		}
	}
	[BepInPlugin("enchart.SmoothPlayer", "SmoothPlayer", "1.0.3")]
	public class Plugin : BaseUnityPlugin
	{
		public const string Guid = "enchart.SmoothPlayer";

		public const string Author = "enchart";

		public const string Name = "SmoothPlayer";

		internal static ManualLogSource Logger;

		private void Awake()
		{
			Logger = ((BaseUnityPlugin)this).Logger;
			Logger.LogInfo((object)"Plugin SmoothPlayer is loaded!");
			Logger.LogInfo((object)"Applying Harmony patches");
			Harmony.CreateAndPatchAll(Assembly.GetExecutingAssembly(), (string)null);
		}
	}
	public static class MyPluginInfo
	{
		public const string PLUGIN_GUID = "SmoothPlayer";

		public const string PLUGIN_NAME = "SmoothPlayer";

		public const string PLUGIN_VERSION = "1.0.3";
	}
}