using System;
using System.Collections;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using BepInEx;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using PluginConfig.API;
using PluginConfig.API.Fields;
using UnityEngine;
using UnityEngine.SceneManagement;
using UnityEngine.Video;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("CustomIntro")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("CustomIntro")]
[assembly: AssemblyTitle("CustomIntro")]
[assembly: AssemblyVersion("1.0.0.0")]
[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 CustomIntro
{
[BepInPlugin("triggeredidiot.customintro", "Ultrakill Custom Intro", "1.0.0")]
public class Plugin : BaseUnityPlugin
{
public static bool IsActive;
public const string Guid = "triggeredidiot.customintro";
public const string Name = "Ultrakill Custom Intro";
public const string Version = "1.0.0";
private static PluginConfigurator config;
private StringMultilineField stringListField;
private BoolField boolField;
public void Awake()
{
//IL_003e: Unknown result type (might be due to invalid IL or missing references)
//IL_0048: Expected O, but got Unknown
//IL_005e: Unknown result type (might be due to invalid IL or missing references)
//IL_0068: Expected O, but got Unknown
config = PluginConfigurator.Create("Ultrakill Custom Intro", "triggeredidiot.customintro");
config.SetIconWithURL("https://file.garden/Z9BrE5QDFXkNPYaw/super-epic-intro-changer.png");
stringListField = new StringMultilineField(config.rootPanel, "Video paths (url or file)", "triggeredidiot.customintro.videoPaths", "https://file.garden/Z9BrE5QDFXkNPYaw/v1spin.mp4", false);
boolField = new BoolField(config.rootPanel, "Play in sequence", "triggeredidiot.customintro.notRandom", false);
IsActive = false;
SceneManager.sceneLoaded += delegate
{
IsActive = false;
if (SceneHelper.CurrentScene == "Intro")
{
((MonoBehaviour)this).Invoke("DoIt", 0.0125f);
}
};
}
private void DoIt()
{
VideoPlayer val = Object.FindObjectOfType<VideoPlayer>();
Debug.Log((object)val);
string[] array = stringListField.value.Split('\n');
if (array.Length == 0)
{
Debug.LogWarning((object)"No video paths for triggeredidiot.customintro");
return;
}
IsActive = true;
if (boolField.value)
{
((MonoBehaviour)this).StartCoroutine(LoadVideoInSequence(val, array));
return;
}
val.url = array[Random.Range(0, array.Length)];
((MonoBehaviour)this).StartCoroutine(LoadMainMenuAfterVideo(val));
}
private static IEnumerator LoadMainMenuAfterVideo(VideoPlayer vp)
{
while (!vp.isPlaying)
{
yield return null;
}
while (vp.isPlaying)
{
yield return null;
}
IntroViolenceScreen obj = Object.FindObjectOfType<IntroViolenceScreen>();
SceneHelper.LoadScene((typeof(IntroViolenceScreen).GetMethod("GetTargetScene")?.Invoke(obj, Array.Empty<object>()) as string) ?? "Main Menu", false);
}
private static IEnumerator LoadVideoInSequence(VideoPlayer vp, string[] paths)
{
IntroViolenceScreen ivs = Object.FindObjectOfType<IntroViolenceScreen>();
((Behaviour)ivs).enabled = false;
for (int i = 0; i < paths.Length; i++)
{
string text = paths[i];
if (!string.IsNullOrWhiteSpace(text))
{
vp.url = text;
Debug.Log((object)("Playing '" + text + "' which is " + i + " of " + paths.Length));
int c = 175;
while (!vp.isPlaying && c > 0)
{
yield return (object)new WaitForSecondsRealtime(0.01f);
c--;
}
while (vp.time <= vp.length * 0.9900000095367432 && vp.isPlaying && !Input.GetKeyDown((KeyCode)27) && !Input.GetKeyDown((KeyCode)32) && !Input.GetKeyDown((KeyCode)13))
{
yield return null;
}
}
}
((Behaviour)ivs).enabled = true;
SceneHelper.LoadScene((typeof(IntroViolenceScreen).GetMethod("GetTargetScene")?.Invoke(ivs, Array.Empty<object>()) as string) ?? "Main Menu", false);
}
}
[HarmonyPatch(typeof(IntroViolenceScreen), "Update")]
public static class IntroViolenceScreenPatch
{
public static bool Prefix(IntroViolenceScreen __instance)
{
_ = Plugin.IsActive;
return true;
}
}
}