Decompiled source of LaunchyPlatforms v1.0.0

LaunchyPlatforms.dll

Decompiled 5 months 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 System.Text.RegularExpressions;
using BepInEx;
using BepInEx.Configuration;
using BoplFixedMath;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using PlatformApi;
using UnityEngine;
using UnityEngine.SceneManagement;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: AssemblyCompany("LaunchyPlatforms")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyDescription("My first plugin")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("LaunchyPlatforms")]
[assembly: AssemblyTitle("LaunchyPlatforms")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.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.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace LaunchyPlatforms
{
	[BepInPlugin("com.David_Loves_JellyCar_Worlds.LaunchyPlatforms", "LaunchyPlatforms", "1.0.0")]
	public class Plugin : BaseUnityPlugin, IUpdatable
	{
		public static ConfigEntry<double> TimeBetweenLaunches;

		public static ConfigEntry<double> LaunchForce;

		public static ConfigFile config;

		private Fix TimeLastFrame = (Fix)0L;

		private int hierarchyNumber;

		public bool IsDestroyed { get; set; }

		public int HierarchyNumber
		{
			get
			{
				return hierarchyNumber;
			}
			set
			{
				hierarchyNumber = value;
			}
		}

		private void Awake()
		{
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_001d: Expected O, but got Unknown
			((BaseUnityPlugin)this).Logger.LogInfo((object)"Plugin LaunchyPlatforms is loaded!");
			Harmony val = new Harmony("com.David_Loves_JellyCar_Worlds.LaunchyPlatforms");
			((BaseUnityPlugin)this).Logger.LogInfo((object)"harmany created");
			val.PatchAll();
			((BaseUnityPlugin)this).Logger.LogInfo((object)"LaunchyPlatforms Patch Compleate!");
			config = ((BaseUnityPlugin)this).Config;
			TimeBetweenLaunches = config.Bind<double>("Settings", "TimeBetweenLaunches", 5.0, "the number of seconds between the launches");
			LaunchForce = config.Bind<double>("Settings", "LaunchForce", 100.0, "the force of the launch");
			GameObject[] array = Resources.FindObjectsOfTypeAll(typeof(GameObject)) as GameObject[];
			SceneManager.sceneLoaded += OnSceneLoaded;
		}

		public void OnSceneLoaded(Scene scene, LoadSceneMode mode)
		{
			if (IsLevelName(((Scene)(ref scene)).name))
			{
				Updater.RegisterUpdatable((IUpdatable)(object)this);
			}
		}

		public void Init()
		{
		}

		public bool IsEnabled()
		{
			return ((Behaviour)this).isActiveAndEnabled;
		}

		public void LateUpdateSim(Fix SimDeltaTime)
		{
		}

		public void OnDestroyUpdatable()
		{
		}

		public void UpdateSim(Fix SimDeltaTime)
		{
			//IL_000a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: 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_0038: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c1: 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)
			if (PlatformApi.gameInProgress && Fix.SlowMod(Updater.SimTimeSinceLevelLoaded, (Fix)TimeBetweenLaunches.Value) < Fix.SlowMod(TimeLastFrame, (Fix)TimeBetweenLaunches.Value) && !GameTime.IsTimeStopped())
			{
				List<GameObject> platformList = PlatformApi.PlatformList;
				foreach (GameObject item in platformList)
				{
					if ((Object)(object)item != (Object)null)
					{
						item.GetComponent<StickyRoundedRectangle>().DropAllAttachedPlayers(255, (Fix)LaunchForce.Value);
					}
				}
			}
			TimeLastFrame = Updater.SimTimeSinceLevelLoaded;
		}

		public static bool IsLevelName(string input)
		{
			Regex regex = new Regex("Level[0-9]+", RegexOptions.IgnoreCase);
			return regex.IsMatch(input);
		}
	}
	public static class PluginInfo
	{
		public const string PLUGIN_GUID = "LaunchyPlatforms";

		public const string PLUGIN_NAME = "LaunchyPlatforms";

		public const string PLUGIN_VERSION = "1.0.0";
	}
}