Decompiled source of Cutscene Skipper v1.0.1

Mods/CutsceneSkipperBBS.dll

Decompiled 3 weeks ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection;
using System.Resources;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using CutsceneSkipperBBS;
using Il2Cpp;
using MelonLoader;
using Microsoft.CodeAnalysis;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: MelonInfo(typeof(Core), "CutsceneSkipperBBS", "1.0.0", "Caleb Orchard", null)]
[assembly: MelonGame("DefaultCompany", "BabySteps")]
[assembly: TargetFramework(".NETCoreApp,Version=v6.0", FrameworkDisplayName = ".NET 6.0")]
[assembly: AssemblyCompany("CutsceneSkipperBBS")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+27248c38185312078d4e34dba34d9fe5bcbc540d")]
[assembly: AssemblyProduct("CutsceneSkipperBBS")]
[assembly: AssemblyTitle("CutsceneSkipperBBS")]
[assembly: NeutralResourcesLanguage("en-US")]
[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 CutsceneSkipperBBS
{
	public class Core : MelonMod
	{
		[CompilerGenerated]
		private sealed class <HandleCutscene>d__8 : IEnumerator<object>, IEnumerator, IDisposable
		{
			private int <>1__state;

			private object <>2__current;

			public Core <>4__this;

			object IEnumerator<object>.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			object IEnumerator.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			[DebuggerHidden]
			public <HandleCutscene>d__8(int <>1__state)
			{
				this.<>1__state = <>1__state;
			}

			[DebuggerHidden]
			void IDisposable.Dispose()
			{
				<>1__state = -2;
			}

			private bool MoveNext()
			{
				//IL_003a: Unknown result type (might be due to invalid IL or missing references)
				//IL_0044: Expected O, but got Unknown
				switch (<>1__state)
				{
				default:
					return false;
				case 0:
					<>1__state = -1;
					break;
				case 1:
					<>1__state = -1;
					break;
				}
				if (<>4__this.playerMovement.inCutscene)
				{
					<>4__this.skipper.IncrementLevel();
					<>2__current = (object)new WaitForSeconds(0.25f);
					<>1__state = 1;
					return true;
				}
				return false;
			}

			bool IEnumerator.MoveNext()
			{
				//ILSpy generated this explicit interface implementation from .override directive in MoveNext
				return this.MoveNext();
			}

			[DebuggerHidden]
			void IEnumerator.Reset()
			{
				throw new NotSupportedException();
			}
		}

		public bool gameHasLoaded = false;

		public PlayerMovement playerMovement;

		public SkipGame skipper;

		public GameObject bitsyBoss;

		private bool wasInCutscene = false;

		private object cutsceneCoroutine;

		public override void OnSceneWasLoaded(int buildIndex, string sceneName)
		{
			((MelonMod)this).OnSceneWasLoaded(buildIndex, sceneName);
			if (!gameHasLoaded && sceneName == "SampleScene_player")
			{
				gameHasLoaded = true;
			}
		}

		public override void OnLateUpdate()
		{
			((MelonBase)this).OnLateUpdate();
			if (!gameHasLoaded)
			{
				return;
			}
			if ((Object)(object)playerMovement == (Object)null)
			{
				GameObject obj = GameObject.Find("Dudest");
				playerMovement = ((obj != null) ? obj.GetComponent<PlayerMovement>() : null);
			}
			if ((Object)(object)playerMovement == (Object)null)
			{
				return;
			}
			if ((Object)(object)skipper == (Object)null)
			{
				GameObject obj2 = GameObject.Find("BigManagerPrefab/Camera/Skipper");
				skipper = ((obj2 != null) ? obj2.GetComponent<SkipGame>() : null);
			}
			if ((Object)(object)skipper == (Object)null)
			{
				return;
			}
			if ((Object)(object)bitsyBoss == (Object)null)
			{
				bitsyBoss = GameObject.Find("BigManagerPrefab/Menu/BBitsyBoss");
			}
			if ((Object)(object)bitsyBoss == (Object)null)
			{
				return;
			}
			if (!bitsyBoss.active && playerMovement.inCutscene && !wasInCutscene)
			{
				wasInCutscene = true;
				if (cutsceneCoroutine != null)
				{
					MelonCoroutines.Stop(cutsceneCoroutine);
				}
				cutsceneCoroutine = MelonCoroutines.Start(HandleCutscene());
			}
			else if (!playerMovement.inCutscene && wasInCutscene)
			{
				wasInCutscene = false;
				if (cutsceneCoroutine != null)
				{
					MelonCoroutines.Stop(cutsceneCoroutine);
					cutsceneCoroutine = null;
				}
			}
		}

		[IteratorStateMachine(typeof(<HandleCutscene>d__8))]
		private IEnumerator HandleCutscene()
		{
			//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
			return new <HandleCutscene>d__8(0)
			{
				<>4__this = this
			};
		}
	}
}