Decompiled source of FixIntroSkip v1.0.0

FixIntroSkip.dll

Decompiled 2 weeks ago
using System;
using System.Collections;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using HG.Reflection;
using Microsoft.CodeAnalysis;
using On;
using On.RoR2;
using RoR2;
using UnityEngine;
using UnityEngine.Networking;
using UnityEngine.ResourceManagement.AsyncOperations;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: OptIn]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("FixIntroSkip")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+c9d2ebcc5ac5c7b1d7344b7e5633c4bf34de088c")]
[assembly: AssemblyProduct("FixIntroSkip")]
[assembly: AssemblyTitle("FixIntroSkip")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: RefSafetyRules(11)]
[module: UnverifiableCode]
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 FixIntroSkip
{
	[BepInPlugin("groovesalad.FixIntroSkip", "FixIntroSkip", "1.0.0")]
	public class FixIntroSkipPlugin : BaseUnityPlugin
	{
		public const string GUID = "groovesalad.FixIntroSkip";

		public const string NAME = "FixIntroSkip";

		public const string VERSION = "1.0.0";

		private const string SPLASH_SCENE_GUID = "fe13e00695117284fb0d1b25422a0529";

		private const string INTRO_SCENE_GUID = "330d792ae1727574e969e68ce8e966d2";

		public void Awake()
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Expected O, but got Unknown
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_0022: Expected O, but got Unknown
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_0033: Expected O, but got Unknown
			SplashScreenController.Finish += new hook_Finish(SplashScreenController_Finish);
			LoadHelper.LoadSceneAdditivelyAsync += new hook_LoadSceneAdditivelyAsync(LoadHelper_LoadSceneAdditivelyAsync);
			LoadHelper.StartLoadSceneAdditiveAsync += new hook_StartLoadSceneAdditiveAsync(LoadHelper_StartLoadSceneAdditiveAsync);
		}

		private void SplashScreenController_Finish(orig_Finish orig, SplashScreenController self)
		{
			if (IntroCutsceneController.shouldSkip && RoR2Application.isLoading)
			{
				RoR2Application.onLoad = (Action)Delegate.Combine(RoR2Application.onLoad, (Action)delegate
				{
					((NetworkManager)PlatformSystems.networkManager).ServerChangeScene("title");
				});
			}
			else
			{
				orig.Invoke(self);
			}
		}

		private IEnumerator LoadHelper_LoadSceneAdditivelyAsync(orig_LoadSceneAdditivelyAsync orig, string _sceneGuid)
		{
			if (_sceneGuid == "fe13e00695117284fb0d1b25422a0529" && SplashScreenController.cvSplashSkip.value)
			{
				return FinishSplashScreen();
			}
			return orig.Invoke(_sceneGuid);
			static IEnumerator FinishSplashScreen()
			{
				GameObject val = new GameObject("Splash");
				val.SetActive(false);
				SplashScreenController val2 = val.AddComponent<SplashScreenController>();
				val.AddComponent<TriggerIntroMusicStart>();
				val.SetActive(true);
				val2.Finish();
				yield break;
			}
		}

		private AsyncOperationHandle LoadHelper_StartLoadSceneAdditiveAsync(orig_StartLoadSceneAdditiveAsync orig, string _sceneGuid)
		{
			//IL_0020: 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_001c: Unknown result type (might be due to invalid IL or missing references)
			if (_sceneGuid == "330d792ae1727574e969e68ce8e966d2" && RoR2Application.isLoading)
			{
				return default(AsyncOperationHandle);
			}
			return orig.Invoke(_sceneGuid);
		}
	}
}