using System;
using System.Diagnostics;
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.Logging;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using TMPro;
using UnityEngine;
using UnityEngine.Events;
using UnityEngine.Rendering.PostProcessing;
using UnityEngine.SceneManagement;
using UnityEngine.UI;
[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: AssemblyCompany("fxopt")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("fxopt")]
[assembly: AssemblyTitle("fxopt")]
[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 fxopt
{
[BepInPlugin("fxopt", "fxopt", "1.0.0")]
public class Plugin : BaseUnityPlugin
{
public static ManualLogSource Logger;
public static FX_CameraShaderController fxShader;
public static ConfigEntry<bool> postProcessEnable;
private void Awake()
{
Logger = ((BaseUnityPlugin)this).Logger;
postProcessEnable = ((BaseUnityPlugin)this).Config.Bind<bool>("SavedConfig", "postProcessEnable", false, "");
Harmony.CreateAndPatchAll(typeof(Patches), (string)null);
}
public static void SetFX(bool value)
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
Scene activeScene = SceneManager.GetActiveScene();
if (((Scene)(ref activeScene)).name == "Main-Menu")
{
((Behaviour)((Component)fxShader).GetComponent<PostProcessVolume>()).enabled = value;
((Behaviour)((Component)fxShader).GetComponent<PostProcessLayer>()).enabled = value;
}
else
{
GameObject gameObject = ((Component)((Component)ENT_Player.playerObject).transform.Find("FXCam")).gameObject;
gameObject.SetActive(value);
}
}
}
public class Patches
{
[HarmonyPatch(typeof(ENT_Player), "Start")]
[HarmonyPrefix]
[HarmonyWrapSafe]
public static void PlayerPatch(ENT_Player __instance)
{
GameObject gameObject = ((Component)((Component)__instance).transform.Find("FXCam")).gameObject;
gameObject.SetActive(Plugin.postProcessEnable.Value);
}
[HarmonyPatch(typeof(FX_CameraShaderController), "Start")]
[HarmonyPrefix]
[HarmonyWrapSafe]
public static void FXCamPatch(FX_CameraShaderController __instance)
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
Scene activeScene = SceneManager.GetActiveScene();
if (!(((Scene)(ref activeScene)).name != "Main-Menu"))
{
Plugin.fxShader = __instance;
((Behaviour)((Component)__instance).GetComponent<PostProcessVolume>()).enabled = Plugin.postProcessEnable.Value;
((Behaviour)((Component)__instance).GetComponent<PostProcessLayer>()).enabled = Plugin.postProcessEnable.Value;
}
}
[HarmonyPatch(typeof(UI_SettingsMenu), "Start")]
[HarmonyPostfix]
[HarmonyWrapSafe]
public static void AddOurShit(UI_SettingsMenu __instance)
{
Transform val = ((Component)__instance).transform.Find("SettingsParent/Settings Pane/Video Settings/Options Tab/Other");
Transform val2 = val.Find("Vertex Jitter");
Transform val3 = Object.Instantiate<Transform>(val2, val);
TextMeshProUGUI component = ((Component)val3.Find("Background/Label (1)")).GetComponent<TextMeshProUGUI>();
((TMP_Text)component).text = "Post-processing";
ToggleSettingsBinder binder = ((Component)val3).GetComponent<ToggleSettingsBinder>();
binder.settingName = "";
binder.toggle = ((Component)binder).GetComponent<Toggle>();
((UnityEventBase)binder.toggle.onValueChanged).RemoveAllListeners();
((UnityEvent<bool>)(object)binder.toggle.onValueChanged).AddListener((UnityAction<bool>)delegate
{
Plugin.postProcessEnable.Value = binder.toggle.isOn;
((ConfigEntryBase)Plugin.postProcessEnable).ConfigFile.Save();
Plugin.SetFX(binder.toggle.isOn);
});
binder.toggle.isOn = Plugin.postProcessEnable.Value;
Plugin.SetFX(binder.toggle.isOn);
}
}
public static class MyPluginInfo
{
public const string PLUGIN_GUID = "fxopt";
public const string PLUGIN_NAME = "fxopt";
public const string PLUGIN_VERSION = "1.0.0";
}
}
namespace System.Runtime.CompilerServices
{
[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
internal sealed class IgnoresAccessChecksToAttribute : Attribute
{
internal IgnoresAccessChecksToAttribute(string assemblyName)
{
}
}
}