Decompiled source of VRCGameCompany v0.0.3

BepInEx/plugins/VRC-Game-Company.dll

Decompiled 2 years ago
using System;
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 BepInEx.Configuration;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using ModelReplacement;
using UnityEngine;
using UnityEngine.UI;
using VRC_Game_Company.Replacements;

[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.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: IgnoresAccessChecksTo("Assembly-CSharp")]
[assembly: AssemblyCompany("VRC-Game-Company")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+572dfe9eeafb0180a782361837460cdb688ac60b")]
[assembly: AssemblyProduct("VRC-Game-Company")]
[assembly: AssemblyTitle("VRC-Game-Company")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
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;
		}
	}
}
namespace VRC_Game_Company
{
	[HarmonyPatch(typeof(MenuManager), "Awake")]
	public static class MenuManagerLogoOverridePatch
	{
		public static Texture2D mainLogo;

		public static void Postfix(MenuManager __instance)
		{
			//IL_008d: Unknown result type (might be due to invalid IL or missing references)
			//IL_009c: Unknown result type (might be due to invalid IL or missing references)
			try
			{
				GameObject gameObject = ((Component)((Component)__instance).transform.parent).gameObject;
				GameObject gameObject2 = ((Component)gameObject.transform.Find("MenuContainer").Find("MainButtons").Find("HeaderImage")).gameObject;
				Image component = gameObject2.GetComponent<Image>();
				mainLogo = Assets.MainAssetBundle.LoadAsset<Texture2D>("VRCGameCompanyLogo");
				if (Plugin.enableVRCGameCompanyLogo.Value)
				{
					component.sprite = Sprite.Create(mainLogo, new Rect(0f, 0f, (float)((Texture)mainLogo).width, (float)((Texture)mainLogo).height), new Vector2(0.5f, 0.5f));
				}
			}
			catch (Exception ex)
			{
				Debug.Log((object)("VRC Game Company: Failed to replace logo: " + ex));
			}
		}
	}
	public static class PluginInformation
	{
		public const string PLUGIN_NAME = "VRC-Game-Company";

		public const string PLUGIN_VERSION = "0.0.3";

		public const string PLUGIN_GUID = "null-base.VRC-Game-Company";
	}
	[BepInPlugin("null-base.VRC-Game-Company", "VRC-Game-Company", "0.0.3")]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	public class Plugin : BaseUnityPlugin
	{
		public static ConfigFile config;

		public static ConfigEntry<bool> enableAnomeaSuit { get; private set; }

		public static ConfigEntry<bool> enableAnomeaPinkSuit { get; private set; }

		public static ConfigEntry<bool> enableAnomeaPurpleSuit { get; private set; }

		public static ConfigEntry<bool> enableAnomeaBlackSuit { get; private set; }

		public static ConfigEntry<bool> enableBlazeSuit { get; private set; }

		public static ConfigEntry<bool> enableNagiSuit { get; private set; }

		public static ConfigEntry<bool> enableSenbyoSuit { get; private set; }

		public static ConfigEntry<bool> enableZomeSuit { get; private set; }

		public static ConfigEntry<bool> enableVRCGameCompanyLogo { get; private set; }

		private static void InitConfig()
		{
			enableAnomeaSuit = config.Bind<bool>("Suits to Add Settings", "Suits to enable Anomea for", true, "Enable Anomea Suit");
			enableAnomeaPinkSuit = config.Bind<bool>("Suits to Add Settings", "Suits to enable Anomea (Pink) for", true, "Enable Anomea (Pink) Suit");
			enableAnomeaPurpleSuit = config.Bind<bool>("Suits to Add Settings", "Suits to enable Anomea (Purple) for", true, "Enable Anomea (Purple) Suit");
			enableAnomeaBlackSuit = config.Bind<bool>("Suits to Add Settings", "Suits to enable Anomea (Black) for", true, "Enable Anomea (Black) Suit");
			enableBlazeSuit = config.Bind<bool>("Suits to Add Settings", "Suits to enable Blaze for", true, "Enable Blaze Suit");
			enableNagiSuit = config.Bind<bool>("Suits to Add Settings", "Suits to enable Nagi for", true, "Enable Nagi Suit");
			enableSenbyoSuit = config.Bind<bool>("Suits to Add Settings", "Suits to enable Senbyo for", true, "Enable Senbyo Suit");
			enableZomeSuit = config.Bind<bool>("Suits to Add Settings", "Suits to enable Zome for", true, "Enable Zome Suit");
			enableVRCGameCompanyLogo = config.Bind<bool>("Logo Settings", "Enable VRC Game Company Logo", true, "Enable VRC Game Company Logo");
		}

		private void Awake()
		{
			//IL_014f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0155: Expected O, but got Unknown
			config = ((BaseUnityPlugin)this).Config;
			InitConfig();
			Assets.PopulateAssets();
			if (enableAnomeaSuit.Value)
			{
				ModelReplacementAPI.RegisterSuitModelReplacement("Anomea", typeof(AnomeaReplacement));
			}
			if (enableAnomeaPinkSuit.Value)
			{
				ModelReplacementAPI.RegisterSuitModelReplacement("Anomea (Pink)", typeof(AnomeaPinkReplacement));
			}
			if (enableAnomeaPurpleSuit.Value)
			{
				ModelReplacementAPI.RegisterSuitModelReplacement("Anomea (Purple)", typeof(AnomeaPurpleReplacement));
			}
			if (enableAnomeaBlackSuit.Value)
			{
				ModelReplacementAPI.RegisterSuitModelReplacement("Anomea (Black)", typeof(AnomeaBlackReplacement));
			}
			if (enableBlazeSuit.Value)
			{
				ModelReplacementAPI.RegisterSuitModelReplacement("Blaze", typeof(BlazeReplacement));
			}
			if (enableNagiSuit.Value)
			{
				ModelReplacementAPI.RegisterSuitModelReplacement("Nagi", typeof(NagiReplacement));
			}
			if (enableSenbyoSuit.Value)
			{
				ModelReplacementAPI.RegisterSuitModelReplacement("Senbyo", typeof(SenbyoReplacement));
			}
			if (enableZomeSuit.Value)
			{
				ModelReplacementAPI.RegisterSuitModelReplacement("Zome", typeof(ZomeReplacement));
			}
			Harmony val = new Harmony("null-base.VRC-Game-Company");
			val.PatchAll();
			((BaseUnityPlugin)this).Logger.LogInfo((object)"\n____   _______________________     ________                        _________                                           \n\\   \\ /   /\\______   \\_   ___ \\   /  _____/_____    _____   ____   \\_   ___ \\  ____   _____ ___________    ____ ___.__.\n \\   Y   /  |       _/    \\  \\/  /   \\  ___\\__  \\  /     \\_/ __ \\  /    \\  \\/ /  _ \\ /     \\\\____ \\__  \\  /    <   |  |\n  \\     /   |    |   \\     \\____ \\    \\_\\  \\/ __ \\|  Y Y  \\  ___/  \\     \\___(  <_> )  Y Y  \\  |_> > __ \\|   |  \\___  |\n   \\___/    |____|_  /\\______  /  \\______  (____  /__|_|  /\\___  >  \\______  /\\____/|__|_|  /   __(____  /___|  / ____|\n                   \\/        \\/          \\/     \\/      \\/     \\/          \\/             \\/|__|       \\/     \\/\\/     ");
			((BaseUnityPlugin)this).Logger.LogInfo((object)"Plugin null-base.VRC-Game-Company is loaded!");
		}
	}
	public static class Assets
	{
		public static string MainAssetBundleName = "vrc-game-company";

		public static AssetBundle MainAssetBundle = null;

		private static string GetAssemblyName()
		{
			return Assembly.GetExecutingAssembly().GetName().Name;
		}

		public static void PopulateAssets()
		{
			if ((Object)(object)MainAssetBundle == (Object)null)
			{
				using (Stream stream = Assembly.GetExecutingAssembly().GetManifestResourceStream(GetAssemblyName() + "." + MainAssetBundleName))
				{
					MainAssetBundle = AssetBundle.LoadFromStream(stream);
				}
			}
		}
	}
}
namespace VRC_Game_Company.Replacements
{
	public class AnomeaReplacement : BodyReplacementBase
	{
		protected override GameObject LoadAssetsAndReturnModel()
		{
			string text = "Anomea";
			return Assets.MainAssetBundle.LoadAsset<GameObject>(text);
		}
	}
	public class AnomeaPinkReplacement : BodyReplacementBase
	{
		protected override GameObject LoadAssetsAndReturnModel()
		{
			string text = "Anomea (Pink)";
			return Assets.MainAssetBundle.LoadAsset<GameObject>(text);
		}
	}
	public class AnomeaPurpleReplacement : BodyReplacementBase
	{
		protected override GameObject LoadAssetsAndReturnModel()
		{
			string text = "Anomea (Purple)";
			return Assets.MainAssetBundle.LoadAsset<GameObject>(text);
		}
	}
	public class AnomeaBlackReplacement : BodyReplacementBase
	{
		protected override GameObject LoadAssetsAndReturnModel()
		{
			string text = "Anomea (Black)";
			return Assets.MainAssetBundle.LoadAsset<GameObject>(text);
		}
	}
	public class BlazeReplacement : BodyReplacementBase
	{
		protected override GameObject LoadAssetsAndReturnModel()
		{
			string text = "Blaze";
			return Assets.MainAssetBundle.LoadAsset<GameObject>(text);
		}
	}
	public class NagiReplacement : BodyReplacementBase
	{
		protected override GameObject LoadAssetsAndReturnModel()
		{
			string text = "Nagi";
			return Assets.MainAssetBundle.LoadAsset<GameObject>(text);
		}
	}
	public class SenbyoReplacement : BodyReplacementBase
	{
		protected override GameObject LoadAssetsAndReturnModel()
		{
			string text = "Senbyo";
			return Assets.MainAssetBundle.LoadAsset<GameObject>(text);
		}
	}
	public class ZomeReplacement : BodyReplacementBase
	{
		protected override GameObject LoadAssetsAndReturnModel()
		{
			string text = "Zome";
			return Assets.MainAssetBundle.LoadAsset<GameObject>(text);
		}
	}
}
namespace System.Runtime.CompilerServices
{
	[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
	internal sealed class IgnoresAccessChecksToAttribute : Attribute
	{
		public IgnoresAccessChecksToAttribute(string assemblyName)
		{
		}
	}
}