Decompiled source of No Posterization Shader v1.0.0

LCNoPosterization.dll

Decompiled 2 months ago
using System;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using Microsoft.CodeAnalysis;
using On;
using UnityEngine;
using UnityEngine.Rendering.HighDefinition;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("LCNoPosterization")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+bc92552bc9ebbc87ba69123ae86b0b09dd229925")]
[assembly: AssemblyProduct("LCNoPosterization")]
[assembly: AssemblyTitle("LCNoPosterization")]
[assembly: AssemblyVersion("1.0.0.0")]
[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 LCNoPosterization
{
	[BepInPlugin("au.sparronator.lc.noposterization", "No Posterization Shader", "1.0.0")]
	public class Plugin : BaseUnityPlugin
	{
		internal static ManualLogSource Logger;

		private readonly ConfigEntry<bool> RemoveShader;

		private CustomPass Shader;

		public Plugin()
		{
			RemoveShader = ((BaseUnityPlugin)this).Config.Bind<bool>("Config", "RemoveShader", true, "Should Lethal Company's posterization/cel-shading (\"outline\") effect be removed?\n\nA restart is NOT required if changing this setting in-game.");
			RemoveShader.SettingChanged += ShaderEnabled_SettingChanged;
		}

		public void Awake()
		{
			//IL_0021: Unknown result type (might be due to invalid IL or missing references)
			//IL_002b: Expected O, but got Unknown
			Logger = ((BaseUnityPlugin)this).Logger;
			Logger.LogInfo((object)"Finished loading successfully!");
			StartOfRound.Awake += new hook_Awake(StartOfRound_Awake);
		}

		private void StartOfRound_Awake(orig_Awake orig, StartOfRound self)
		{
			orig.Invoke(self);
			Logger.LogInfo((object)"New game joined! Looking for its post-processing shader...");
			bool flag = false;
			GameObject val = GameObject.Find("CustomPass (1)");
			if ((Object)(object)val != (Object)null)
			{
				foreach (CustomPass customPass in val.GetComponent<CustomPassVolume>().customPasses)
				{
					if (customPass.name == "LethalSponge")
					{
						Logger.LogInfo((object)"Found post-processing shader successfully!");
						flag = true;
						Shader = customPass;
						customPass.enabled = !RemoveShader.Value;
						break;
					}
				}
			}
			if (!flag)
			{
				Logger.LogError((object)"Failed to find post-processing shader - it will not be disabled this game!");
			}
		}

		private void ShaderEnabled_SettingChanged(object sender, EventArgs e)
		{
			if (Shader != null)
			{
				Shader.enabled = !RemoveShader.Value;
			}
		}
	}
}