Decompiled source of V3MinusV1 v1.0.0

doomahreal.ultrakill.v3minusv2/V3MinusV2.dll

Decompiled 8 months ago
using System;
using System.Collections;
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using Microsoft.CodeAnalysis;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETStandard,Version=v2.0", FrameworkDisplayName = ".NET Standard 2.0")]
[assembly: AssemblyCompany("V3MinusV2")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyDescription("My first plugin")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("V3MinusV2")]
[assembly: AssemblyTitle("V3MinusV2")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
[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.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace V3MinusV2
{
	[BepInPlugin("doomahreal.ultrakill.v3minusv1", "V3MinusV2", "1.0.0")]
	public class Plugin : BaseUnityPlugin
	{
		private static AssetBundle assetBundle;

		private Coroutine updateCoroutine;

		private void Awake()
		{
			using Stream stream = Assembly.GetExecutingAssembly().GetManifestResourceStream("V3MinusV2.redassets.bundle");
			assetBundle = AssetBundle.LoadFromStream(stream);
		}

		private void OnDestroy()
		{
			if ((Object)(object)assetBundle != (Object)null)
			{
				assetBundle.Unload(true);
			}
		}

		private void Start()
		{
			updateCoroutine = ((MonoBehaviour)this).StartCoroutine(UpdateEverySecond());
		}

		private void Stop()
		{
			if (updateCoroutine != null)
			{
				((MonoBehaviour)this).StopCoroutine(updateCoroutine);
			}
		}

		private IEnumerator UpdateEverySecond()
		{
			while (true)
			{
				UpdateMaterials();
				yield return (object)new WaitForSeconds(0.1f);
			}
		}

		private void UpdateMaterials()
		{
			Material[] array = Resources.FindObjectsOfTypeAll<Material>();
			Material[] array2 = array;
			foreach (Material val in array2)
			{
				if (((Object)val).name.StartsWith("V3-body"))
				{
					if (((Object)val.mainTexture).name != "v2butawesome")
					{
						Texture val2 = assetBundle.LoadAsset<Texture>("v2butawesome");
						if ((Object)(object)val2 != (Object)null)
						{
							val.mainTexture = val2;
						}
					}
				}
				else if (((Object)val).name.StartsWith("V3-wings"))
				{
					string text = ((Object)val.mainTexture).name.ToLower();
					Texture val3 = null;
					if (text.EndsWith("red"))
					{
						val3 = assetBundle.LoadAsset<Texture>("red");
					}
					else if (text.EndsWith("yellow"))
					{
						val3 = assetBundle.LoadAsset<Texture>("yellow");
					}
					else if (text.EndsWith("blue"))
					{
						val3 = assetBundle.LoadAsset<Texture>("bluee");
					}
					else if (text.EndsWith("green"))
					{
						val3 = assetBundle.LoadAsset<Texture>("green");
					}
					if ((Object)(object)val3 != (Object)null)
					{
						val.mainTexture = val3;
					}
				}
			}
		}
	}
	public static class PluginInfo
	{
		public const string PLUGIN_GUID = "V3MinusV2";

		public const string PLUGIN_NAME = "V3MinusV2";

		public const string PLUGIN_VERSION = "1.0.0";
	}
}