Decompiled source of UniversalModularSkinSystem v1.0.0

plugins/UniversalModularSkinSystem.dll

Decompiled 7 months ago
using System;
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using FistVR;
using Microsoft.CodeAnalysis;
using ModularWorkshop;
using On.FistVR;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: AssemblyTitle("UniversalModularSkinSystem")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("UniversalModularSkinSystem")]
[assembly: AssemblyCopyright("Copyright ©  2021")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("9dd00c5c-da95-4c5d-be9f-9eb454c282bc")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[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 Cityrobo
{
	[BepInPlugin("h3vr.cityrobo.UniversalModularSkinSystem", "Universal Modular Skin System", "1.0.0")]
	internal class UniversalModularSkinSystem : BaseUnityPlugin
	{
		private const string ASSET_BUNDLE_NAME = "workshop_ui";

		private const string PREFAB_NAME = "WorkshopUI";

		private GameObject _UIPrefab;

		public void Awake()
		{
			//IL_0038: Unknown result type (might be due to invalid IL or missing references)
			//IL_0042: Expected O, but got Unknown
			AssetBundle val = AssetBundle.LoadFromFile(Path.Combine(Path.GetDirectoryName(((BaseUnityPlugin)this).Info.Location), "workshop_ui"));
			_UIPrefab = val.LoadAsset<GameObject>("WorkshopUI");
			FVRPhysicalObject.Awake += new hook_Awake(FVRPhysicalObject_Awake);
		}

		public void OnDestroy()
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Expected O, but got Unknown
			FVRPhysicalObject.Awake -= new hook_Awake(FVRPhysicalObject_Awake);
		}

		private void FVRPhysicalObject_Awake(orig_Awake orig, FVRPhysicalObject self)
		{
			ReceiverSkinSystem component = ((Component)self).GetComponent<ReceiverSkinSystem>();
			ModularFVRPhysicalObject component2 = ((Component)self).GetComponent<ModularFVRPhysicalObject>();
			if (((Component)self).GetComponent<IModularWeapon>() == null && (Object)(object)component == (Object)null && (Object)(object)component2 == (Object)null)
			{
				((Component)self).gameObject.SetActive(false);
				component = ((Component)self).gameObject.AddComponent<ReceiverSkinSystem>();
				component.MainObject = self;
				component.UIPrefab = _UIPrefab;
				((Component)self).gameObject.SetActive(true);
			}
			orig.Invoke(self);
		}
	}
}