Decompiled source of GlassPanel v1.0.0

GlassPanel.dll

Decompiled a day ago
using System;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Core.Logging.Interpolation;
using BepInEx.Logging;
using BepInEx.Unity.IL2CPP;
using HarmonyLib;
using Il2CppSystem;
using Il2CppSystem.Collections.Generic;
using Microsoft.CodeAnalysis;
using UnityEngine;
using WildSkies.Gameplay.Building;
using WildSkies.Gameplay.ShipBuilding;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETCoreApp,Version=v6.0", FrameworkDisplayName = ".NET 6.0")]
[assembly: AssemblyCompany("GlassPanel")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyCopyright("Nines (Natives)")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("GlasssPanel")]
[assembly: AssemblyTitle("GlassPanel")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[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 GlassPanel
{
	[BepInPlugin("GlassPanel", "GlasssPanel", "1.0.0")]
	public class Plugin : BasePlugin
	{
		internal static ManualLogSource Log;

		internal static Harmony harmonyInstance;

		private static ConfigEntry<string> GlassPanel_BaseColor;

		private static readonly string[] Ids = new string[2] { "ship.part.panel.half.glass", "ship.part.panel.full.glass" };

		public override void Load()
		{
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Expected O, but got Unknown
			Log = ((BasePlugin)this).Log;
			ManualLogSource log = Log;
			bool flag = default(bool);
			BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(18, 1, ref flag);
			if (flag)
			{
				((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Plugin ");
				((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>("GlassPanel");
				((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" is loaded!");
			}
			log.LogInfo(val);
			GlassPanel_BaseColor = ((BasePlugin)this).Config.Bind<string>("GlassPanel", "BaseColor", "#333333", "GlassPanel.BaseColor");
			harmonyInstance = Harmony.CreateAndPatchAll(typeof(Plugin), (string)null);
		}

		public override bool Unload()
		{
			Harmony obj = harmonyInstance;
			if (obj != null)
			{
				obj.UnpatchSelf();
			}
			return true;
		}

		[HarmonyPatch(typeof(ShipFrameBuilder), "Awake")]
		[HarmonyPrefix]
		public static void ShipFrameBuilder_Awake(ShipFrameBuilder __instance)
		{
			//IL_0080: Unknown result type (might be due to invalid IL or missing references)
			Color val = default(Color);
			if (ColorUtility.TryParseHtmlString(GlassPanel_BaseColor.Value, ref val))
			{
				Enumerator<BuildableItemDefinition> enumerator = __instance.ShipMaterials.ShipPanelList.FindAll(Predicate<BuildableItemDefinition>.op_Implicit((Func<BuildableItemDefinition, bool>)((BuildableItemDefinition buildable) => Ids.Contains(buildable.Id)))).GetEnumerator();
				while (enumerator.MoveNext())
				{
					Material assetMaterial = enumerator.Current.AssetMaterial;
					assetMaterial.SetFloat("_Tiling", 0f);
					assetMaterial.SetFloat("_Damage_Tile", 0f);
					assetMaterial.SetColor("_Base_Color_BC", val);
				}
			}
		}
	}
	public static class MyPluginInfo
	{
		public const string PLUGIN_GUID = "GlassPanel";

		public const string PLUGIN_NAME = "GlasssPanel";

		public const string PLUGIN_VERSION = "1.0.0";
	}
}