CGVD.dll

Decompiled a year ago
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Configuration;
using UnityEngine;
using UnityEngine.SceneManagement;
using UnityEngine.UI;
using UnityEngine.Video;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTitle("CGVD")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("CGVD")]
[assembly: AssemblyCopyright("Copyright ©  2024")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("3d1fe22d-aa74-4c1a-8651-fa068c83704f")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.7.1", FrameworkDisplayName = ".NET Framework 4.7.1")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace CGVD;

[BepInPlugin("CGVD", "CGVD", "1.0.0")]
public class Display : BaseUnityPlugin
{
	private ConfigEntry<string> Video_Path;

	private ConfigEntry<int> Video_Width;

	private ConfigEntry<int> Video_Height;

	public void Play_Video()
	{
		//IL_001a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0020: Expected O, but got Unknown
		RenderTexture val = new RenderTexture(Video_Width.Value, Video_Height.Value, 16, (RenderTextureFormat)0);
		val.Create();
		GameObject gameObject = ((Component)GameObject.Find("Everything/Cube/Canvas").transform.GetChild(1)).gameObject;
		Object.DestroyImmediate((Object)(object)((Component)gameObject.transform).GetComponent<Image>());
		RawImage val2 = gameObject.AddComponent<RawImage>();
		val2.texture = (Texture)(object)val;
		VideoPlayer val3 = gameObject.AddComponent<VideoPlayer>();
		val3.url = Video_Path.Value;
		val3.isLooping = true;
		val3.targetTexture = val;
		val3.Play();
	}

	public void OnSceneLoaded(Scene scene, LoadSceneMode mode)
	{
		//IL_005a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0060: Expected O, but got Unknown
		if (!(SceneHelper.CurrentScene == "Endless") || !(Video_Path.Value != ""))
		{
			return;
		}
		Transform child = GameObject.Find("Everything/Cube/Canvas").transform.GetChild(1);
		foreach (Transform item in ((Component)child).transform)
		{
			Transform val = item;
			((Component)val).gameObject.SetActive(false);
		}
		Play_Video();
		((BaseUnityPlugin)this).Logger.LogInfo((object)"Video Display Loaded.");
	}

	private void Awake()
	{
		Video_Path = ((BaseUnityPlugin)this).Config.Bind<string>("Video Config", "Video Path", "", "Full path to the video file without quotation marks. (Leave blank to disable)");
		Video_Width = ((BaseUnityPlugin)this).Config.Bind<int>("Video Config", "Video Width", 0, "Width of the video.");
		Video_Height = ((BaseUnityPlugin)this).Config.Bind<int>("Video Config", "Video Height", 0, "Height of the video.");
		SceneManager.sceneLoaded += OnSceneLoaded;
	}
}