Decompiled source of dvd logo mod v1.0.0

DVD LOGO MOD.dll

Decompiled 18 hours ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Logging;
using UnityEngine;
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: AssemblyTitle("DVD LOGO MOD")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("DVD LOGO MOD")]
[assembly: AssemblyCopyright("Copyright ©  2026")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("be40aa48-716c-4f72-87ba-b336c1582076")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace DVDLogoMod;

[BepInPlugin("com.lazurut.dvdlogomod", "DVD_Logo_Mod", "1.0.0")]
public class DVDLogoPlugin : BaseUnityPlugin
{
	[CompilerGenerated]
	private sealed class <InitUI>d__2 : IEnumerator<object>, IDisposable, IEnumerator
	{
		private int <>1__state;

		private object <>2__current;

		public DVDLogoPlugin <>4__this;

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

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

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

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

		private bool MoveNext()
		{
			switch (<>1__state)
			{
			default:
				return false;
			case 0:
				<>1__state = -1;
				<>2__current = null;
				<>1__state = 1;
				return true;
			case 1:
				<>1__state = -1;
				<>4__this.CreateDVDCanvas();
				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();
		}
	}

	internal static ManualLogSource Log;

	private void Awake()
	{
		Log = ((BaseUnityPlugin)this).Logger;
		((BaseUnityPlugin)this).Logger.LogInfo((object)"DVD Logo Mod loaded!");
		((MonoBehaviour)this).StartCoroutine(InitUI());
	}

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

	private void CreateDVDCanvas()
	{
		//IL_0006: Unknown result type (might be due to invalid IL or missing references)
		//IL_000c: Expected O, but got Unknown
		//IL_0048: Unknown result type (might be due to invalid IL or missing references)
		//IL_005f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0065: Expected O, but got Unknown
		//IL_00c9: Unknown result type (might be due to invalid IL or missing references)
		//IL_00f9: Unknown result type (might be due to invalid IL or missing references)
		//IL_0106: Unknown result type (might be due to invalid IL or missing references)
		//IL_0113: Unknown result type (might be due to invalid IL or missing references)
		//IL_012a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0141: Unknown result type (might be due to invalid IL or missing references)
		GameObject val = new GameObject("DVDLogoCanvas");
		Object.DontDestroyOnLoad((Object)(object)val);
		Canvas val2 = val.AddComponent<Canvas>();
		val2.renderMode = (RenderMode)0;
		val2.sortingOrder = 9999;
		CanvasScaler val3 = val.AddComponent<CanvasScaler>();
		val3.uiScaleMode = (ScaleMode)1;
		val3.referenceResolution = new Vector2(1920f, 1080f);
		val.AddComponent<GraphicRaycaster>();
		GameObject val4 = new GameObject("DVDLogo");
		val4.transform.SetParent(val.transform, false);
		Image val5 = val4.AddComponent<Image>();
		((Graphic)val5).raycastTarget = false;
		Sprite val6 = LoadSprite();
		if ((Object)(object)val6 != (Object)null)
		{
			val5.sprite = val6;
			val5.preserveAspect = true;
			Log.LogInfo((object)"DVD_VIDEO_logo.png LOAD.");
		}
		else
		{
			((Graphic)val5).color = Color.white;
			Log.LogWarning((object)"DVD_VIDEO_logo.png NOT FOUND.");
		}
		RectTransform component = val4.GetComponent<RectTransform>();
		component.sizeDelta = new Vector2(200f, 120f);
		component.anchorMin = Vector2.zero;
		component.anchorMax = Vector2.zero;
		component.pivot = new Vector2(0.5f, 0.5f);
		component.anchoredPosition = new Vector2(200f, 120f);
		DVDBounce dVDBounce = val4.AddComponent<DVDBounce>();
		dVDBounce.speed = 250f;
	}

	private Sprite LoadSprite()
	{
		//IL_0053: Unknown result type (might be due to invalid IL or missing references)
		//IL_0059: Expected O, but got Unknown
		//IL_0087: Unknown result type (might be due to invalid IL or missing references)
		//IL_0096: Unknown result type (might be due to invalid IL or missing references)
		string directoryName = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
		string text = Path.Combine(directoryName, "DVD_VIDEO_logo.png");
		if (!File.Exists(text))
		{
			Log.LogWarning((object)("FILE NOT FOUND: " + text));
			return null;
		}
		byte[] array = File.ReadAllBytes(text);
		Texture2D val = new Texture2D(2, 2, (TextureFormat)4, false);
		if (!ImageConversion.LoadImage(val, array))
		{
			return null;
		}
		return Sprite.Create(val, new Rect(0f, 0f, (float)((Texture)val).width, (float)((Texture)val).height), new Vector2(0.5f, 0.5f), 100f);
	}
}
public class DVDBounce : MonoBehaviour
{
	public float speed = 250f;

	private Vector2 _velocity;

	private RectTransform _rt;

	private readonly Color[] _colors = (Color[])(object)new Color[8]
	{
		Color.red,
		Color.green,
		Color.blue,
		Color.yellow,
		Color.cyan,
		Color.magenta,
		new Color(1f, 0.5f, 0f),
		new Color(0.5f, 0f, 1f)
	};

	private int _colorIndex = 0;

	private Image _image;

	private void Start()
	{
		//IL_0042: Unknown result type (might be due to invalid IL or missing references)
		//IL_004d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0052: Unknown result type (might be due to invalid IL or missing references)
		_rt = ((Component)this).GetComponent<RectTransform>();
		_image = ((Component)this).GetComponent<Image>();
		float num = Random.Range(25f, 65f);
		_velocity = new Vector2(Mathf.Cos(num * ((float)Math.PI / 180f)), Mathf.Sin(num * ((float)Math.PI / 180f))) * speed;
		ApplyColor();
	}

	private void Update()
	{
		//IL_0007: Unknown result type (might be due to invalid IL or missing references)
		//IL_000c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0013: Unknown result type (might be due to invalid IL or missing references)
		//IL_0018: Unknown result type (might be due to invalid IL or missing references)
		//IL_0027: Unknown result type (might be due to invalid IL or missing references)
		//IL_0035: Unknown result type (might be due to invalid IL or missing references)
		//IL_0046: Unknown result type (might be due to invalid IL or missing references)
		//IL_008a: Unknown result type (might be due to invalid IL or missing references)
		//IL_00cb: Unknown result type (might be due to invalid IL or missing references)
		//IL_010f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0161: Unknown result type (might be due to invalid IL or missing references)
		//IL_0163: Unknown result type (might be due to invalid IL or missing references)
		//IL_016d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0172: Unknown result type (might be due to invalid IL or missing references)
		//IL_0177: Unknown result type (might be due to invalid IL or missing references)
		//IL_017e: Unknown result type (might be due to invalid IL or missing references)
		Vector2 anchoredPosition = _rt.anchoredPosition;
		Vector2 sizeDelta = _rt.sizeDelta;
		float num = Screen.width;
		float num2 = Screen.height;
		float num3 = sizeDelta.x * 0.5f;
		float num4 = sizeDelta.y * 0.5f;
		bool flag = false;
		if (anchoredPosition.x - num3 <= 0f)
		{
			anchoredPosition.x = num3;
			_velocity.x = Mathf.Abs(_velocity.x);
			flag = true;
		}
		else if (anchoredPosition.x + num3 >= num)
		{
			anchoredPosition.x = num - num3;
			_velocity.x = 0f - Mathf.Abs(_velocity.x);
			flag = true;
		}
		if (anchoredPosition.y - num4 <= 0f)
		{
			anchoredPosition.y = num4;
			_velocity.y = Mathf.Abs(_velocity.y);
			flag = true;
		}
		else if (anchoredPosition.y + num4 >= num2)
		{
			anchoredPosition.y = num2 - num4;
			_velocity.y = 0f - Mathf.Abs(_velocity.y);
			flag = true;
		}
		if (flag)
		{
			NextColor();
		}
		anchoredPosition += _velocity * Time.deltaTime;
		_rt.anchoredPosition = anchoredPosition;
	}

	private void NextColor()
	{
		_colorIndex = (_colorIndex + 1) % _colors.Length;
		ApplyColor();
	}

	private void ApplyColor()
	{
		//IL_0023: Unknown result type (might be due to invalid IL or missing references)
		if ((Object)(object)_image != (Object)null)
		{
			((Graphic)_image).color = _colors[_colorIndex];
		}
	}
}