Decompiled source of NoTutorial v1.0.0

NoTutorial.dll

Decompiled 4 months ago
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 UnityEngine;
using UnityEngine.AddressableAssets;
using UnityEngine.Events;
using UnityEngine.SceneManagement;
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(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: AssemblyCompany("NoTutorial")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyDescription("No tutorials when starting new save files in ULTRAKILL.")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("NoTutorial")]
[assembly: AssemblyTitle("NoTutorial")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
namespace NoTutorial;

[BepInPlugin("trpg.uk.notutorial", "NoTutorial", "1.0.0")]
public class Core : BaseUnityPlugin
{
	public const string PluginGUID = "trpg.uk.notutorial";

	public const string PluginName = "NoTutorial";

	public const string PluginVersion = "1.0.0";

	public static ManualLogSource Logger = Logger.CreateLogSource("NoTutorial");

	private void Awake()
	{
		//IL_0006: Unknown result type (might be due to invalid IL or missing references)
		//IL_000c: Expected O, but got Unknown
		Harmony val = new Harmony("NoTutorial");
		val.PatchAll();
		Logger.LogInfo((object)"NoTutorial is loaded.");
		SceneManager.sceneLoaded += OnSceneLoaded;
	}

	private void OnSceneLoaded(Scene scene, LoadSceneMode mode)
	{
		FindIntroButtons();
	}

	private void FindIntroButtons()
	{
		//IL_00a8: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b2: Expected O, but got Unknown
		if (SceneHelper.CurrentScene != "Main Menu")
		{
			return;
		}
		GameObject val = GameObject.Find("/Canvas");
		GameObject val2 = null;
		LayerSelect[] componentsInChildren = val.GetComponentsInChildren<LayerSelect>(true);
		foreach (LayerSelect val3 in componentsInChildren)
		{
			if (val3.layerNumber == 0)
			{
				val2 = ((Component)((Component)val3).transform.parent).gameObject;
				break;
			}
		}
		Button component = ((Component)val2.transform.Find("FullIntroPopup").Find("Panel").Find("Button")).GetComponent<Button>();
		((UnityEvent)component.onClick).AddListener((UnityAction)delegate
		{
			SetTutorial();
		});
	}

	private void SetTutorial()
	{
		if (!GameProgressSaver.GetTutorial())
		{
			GameProgressSaver.SetTutorial(true);
		}
	}
}
[HarmonyPatch(typeof(OptionsMenuToManager), "CheckIfTutorialBeaten")]
public class OptionsMenuToManager_CheckIfTutorialBeaten_Patch
{
	public static bool Prefix()
	{
		if (!GameProgressSaver.GetTutorial())
		{
			Core.Logger.LogInfo((object)"No tutorial!");
		}
		return false;
	}
}
[HarmonyPatch(typeof(Bootstrap), "Start")]
public class Bootstrap_Start_Patch
{
	public static bool Prefix()
	{
		Debug.Log((object)Addressables.RuntimePath);
		if (!GameProgressSaver.GetTutorial())
		{
			Core.Logger.LogInfo((object)"No tutorial!");
		}
		SceneHelper.LoadScene("Intro", true);
		return false;
	}
}
[HarmonyPatch(typeof(IntroViolenceScreen), "GetTargetScene")]
public class IntroViolenceScreen_GetTargetScene_Patch
{
	public static void Postfix(ref string __result)
	{
		__result = "Main Menu";
	}
}
public static class PluginInfo
{
	public const string PLUGIN_GUID = "NoTutorial";

	public const string PLUGIN_NAME = "NoTutorial";

	public const string PLUGIN_VERSION = "1.0.0";
}