Decompiled source of PeakFilter v1.1.4

plugins/PeakFilter.dll

Decompiled 2 weeks ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Threading;
using BepInEx;
using BepInEx.Configuration;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using UnityEngine;
using UnityEngine.Rendering;
using UnityEngine.Rendering.RenderGraphModule;
using UnityEngine.Rendering.RenderGraphModule.Util;
using UnityEngine.Rendering.Universal;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: AssemblyCompany("PeakFilter")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.1.4.0")]
[assembly: AssemblyInformationalVersion("1.1.4")]
[assembly: AssemblyProduct("PeakFilter")]
[assembly: AssemblyTitle("PeakFilter")]
[assembly: AssemblyVersion("1.1.4.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 PeakFilter
{
	[HarmonyPatch]
	public static class CursorPatch
	{
		private static bool shouldUnlock;

		public static void SetUnlock(bool unlock)
		{
			shouldUnlock = unlock;
		}

		[HarmonyPatch(/*Could not decode attribute arguments.*/)]
		[HarmonyPrefix]
		private static bool PrefixLockState(ref CursorLockMode value)
		{
			if (shouldUnlock)
			{
				value = (CursorLockMode)0;
			}
			return true;
		}

		[HarmonyPatch(/*Could not decode attribute arguments.*/)]
		[HarmonyPrefix]
		private static bool PrefixVisible(ref bool value)
		{
			if (shouldUnlock)
			{
				value = true;
			}
			return true;
		}
	}
	public static class FilterConfig
	{
		private static bool savePending;

		private static DateTime nextSaveTimeUtc;

		private static readonly TimeSpan SaveDelay = TimeSpan.FromMilliseconds(500.0);

		public static ConfigEntry<bool> ModEnabled;

		public static ConfigEntry<FilterType> ActiveFilter;

		public static ConfigEntry<float> Intensity;

		public static ConfigEntry<float> SketchEdgeStrength;

		public static ConfigEntry<float> SketchLineWidth;

		public static ConfigEntry<float> SketchPaperTexture;

		public static ConfigEntry<float> PencilDensity;

		public static ConfigEntry<float> PencilDarkness;

		public static ConfigEntry<float> PencilPaperGrain;

		public static ConfigEntry<float> CelOutlineStrength;

		public static ConfigEntry<float> CelColorSharpness;

		public static ConfigEntry<float> CelTintAmount;

		public static ConfigEntry<float> ToonRampSteps;

		public static ConfigEntry<float> ToonShadowCutoff;

		public static ConfigEntry<float> ToonInkStrength;

		public static ConfigEntry<float> HorrorFearTint;

		public static ConfigEntry<float> HorrorDarkness;

		public static ConfigEntry<float> HorrorGrain;

		public static ConfigEntry<float> PixelSize;

		public static ConfigEntry<float> PixelOutlineStrength;

		public static ConfigEntry<float> PixelDitherAmount;

		public static ConfigEntry<float> AdventureVibrance;

		public static ConfigEntry<float> AdventureSkyLift;

		public static ConfigEntry<float> AdventureClarity;

		public static ConfigEntry<float> CyberpunkNeon;

		public static ConfigEntry<float> CyberpunkSplit;

		public static ConfigEntry<float> CyberpunkGlitch;

		public static ConfigEntry<float> EmberHeat;

		public static ConfigEntry<float> EmberContrast;

		public static ConfigEntry<float> EmberVignette;

		public static ConfigEntry<float> RetroCRTScanlines;

		public static ConfigEntry<float> RetroCRTColorBleed;

		public static ConfigEntry<float> RetroCRTCurve;

		public static ConfigEntry<float> ThermalHeat;

		public static ConfigEntry<float> ThermalEdge;

		public static ConfigEntry<float> ThermalNoise;

		public static ConfigEntry<float> StorybookPaper;

		public static ConfigEntry<float> StorybookInk;

		public static ConfigEntry<float> StorybookWarmth;

		public static ConfigEntry<float> WatercolorToonWash;

		public static ConfigEntry<float> WatercolorToonBleed;

		public static ConfigEntry<float> WatercolorToonPaper;

		public static ConfigEntry<float> ComicFrameInk;

		public static ConfigEntry<float> ComicFrameHalftone;

		public static ConfigEntry<float> ComicFramePanels;

		public static ConfigEntry<float> PaperCutoutLayers;

		public static ConfigEntry<float> PaperCutoutShadow;

		public static ConfigEntry<float> PaperCutoutTexture;

		public static ConfigEntry<float> PaperComicPaper;

		public static ConfigEntry<float> PaperComicInk;

		public static ConfigEntry<float> PaperComicTone;

		public static ConfigEntry<float> WastelandComicInk;

		public static ConfigEntry<float> WastelandComicContrast;

		public static ConfigEntry<float> WastelandComicGrunge;

		public static ConfigEntry<float> PainterlyArtBrush;

		public static ConfigEntry<float> PainterlyArtPalette;

		public static ConfigEntry<float> PainterlyArtCanvas;

		public static ConfigEntry<float> UIPanelX;

		public static ConfigEntry<float> UIPanelY;

		public static ConfigEntry<PanelThemeMode> UIPanelTheme;

		public static ConfigFile ConfigFile { get; private set; }

		public static long Version { get; private set; }

		public static void Initialize(ConfigFile config)
		{
			ConfigFile = config;
			ModEnabled = config.Bind<bool>("General", "Enabled", true, "Enable/disable the filter mod");
			ActiveFilter = config.Bind<FilterType>("General", "ActiveFilter", FilterType.Sketch, "Active filter type");
			Intensity = config.Bind<float>("General", "Intensity", 0.84f, "Filter intensity (0-1)");
			if (!IsAvailableFilter(ActiveFilter.Value))
			{
				ActiveFilter.Value = FilterType.Sketch;
			}
			SketchEdgeStrength = config.Bind<float>("Sketch", "EdgeStrength", 2.6f, "Edge detection strength (0-5)");
			SketchLineWidth = config.Bind<float>("Sketch", "LineWidth", 2.4f, "Line width (0.5-8)");
			SketchPaperTexture = config.Bind<float>("Sketch", "PaperTexture", 0.36f, "Paper texture intensity (0-1)");
			PencilDensity = config.Bind<float>("PencilSketch", "Density", 2.5f, "Pencil hatching density (0.5-8)");
			PencilDarkness = config.Bind<float>("PencilSketch", "Darkness", 1.45f, "Pencil darkness (0-3)");
			PencilPaperGrain = config.Bind<float>("PencilSketch", "PaperGrain", 0.36f, "Paper grain intensity (0-1)");
			CelOutlineStrength = config.Bind<float>("CelShade", "OutlineStrength", 2.5f, "Outline strength (0-5)");
			CelColorSharpness = config.Bind<float>("CelShade", "ColorSharpness", 8.5f, "Color quantization sharpness (2-20)");
			CelTintAmount = config.Bind<float>("CelShade", "TintAmount", 0.42f, "Cel shading tint amount (0-1)");
			ToonRampSteps = config.Bind<float>("ToonRamp", "RampSteps", 5f, "Cel ramp steps (2-8)");
			ToonShadowCutoff = config.Bind<float>("ToonRamp", "ShadowCutoff", 0.38f, "Shadow separation threshold (0.1-0.9)");
			ToonInkStrength = config.Bind<float>("ToonRamp", "InkStrength", 0.95f, "Ink outline strength (0-3)");
			HorrorFearTint = config.Bind<float>("Horror", "FearTint", 0.78f, "Cold green-red horror tint (0-1)");
			HorrorDarkness = config.Bind<float>("Horror", "Darkness", 0.58f, "Dark vignette and contrast (0-1)");
			HorrorGrain = config.Bind<float>("Horror", "Grain", 0.46f, "Dirty film grain amount (0-1)");
			PixelSize = config.Bind<float>("Pixelate", "PixelSize", 6f, "Pixel block size (1-30)");
			PixelOutlineStrength = config.Bind<float>("Pixelate", "OutlineStrength", 0.65f, "Pixel outline strength (0-3)");
			PixelDitherAmount = config.Bind<float>("Pixelate", "DitherAmount", 0.05f, "Pixel dithering amount (0-1)");
			AdventureVibrance = config.Bind<float>("Adventure", "Vibrance", 0.62f, "Natural color lift for traversal and exploration (0-1)");
			AdventureSkyLift = config.Bind<float>("Adventure", "SkyLift", 0.34f, "Cool highlight lift without crushing terrain detail (0-1)");
			AdventureClarity = config.Bind<float>("Adventure", "Clarity", 0.55f, "Local clarity and contrast (0-1)");
			CyberpunkNeon = config.Bind<float>("Cyberpunk", "Neon", 0.76f, "Magenta-cyan neon grading strength (0-1)");
			CyberpunkSplit = config.Bind<float>("Cyberpunk", "ColorSplit", 0.42f, "Chromatic channel split (0-1)");
			CyberpunkGlitch = config.Bind<float>("Cyberpunk", "Glitch", 0.22f, "Subtle animated scan glitches (0-1)");
			EmberHeat = config.Bind<float>("Ember", "Heat", 0.62f, "Amber-red heat tint (0-1)");
			EmberContrast = config.Bind<float>("Ember", "Contrast", 0.54f, "Cinematic contrast lift (0-1)");
			EmberVignette = config.Bind<float>("Ember", "Vignette", 0.42f, "Warm edge falloff (0-1)");
			RetroCRTScanlines = config.Bind<float>("RetroCRT", "Scanlines", 0.64f, "CRT scanline visibility (0-1)");
			RetroCRTColorBleed = config.Bind<float>("RetroCRT", "ColorBleed", 0.34f, "Color bleed and channel separation (0-1)");
			RetroCRTCurve = config.Bind<float>("RetroCRT", "Curve", 0.3f, "Screen curve vignette strength (0-1)");
			ThermalHeat = config.Bind<float>("ThermalVision", "Heat", 0.82f, "False-color heat map strength (0-1)");
			ThermalEdge = config.Bind<float>("ThermalVision", "Edge", 0.55f, "Thermal edge readability (0-1)");
			ThermalNoise = config.Bind<float>("ThermalVision", "Noise", 0.26f, "Sensor noise amount (0-1)");
			StorybookPaper = config.Bind<float>("Storybook", "Paper", 0.42f, "Illustrated paper texture amount (0-1)");
			StorybookInk = config.Bind<float>("Storybook", "Ink", 0.3f, "Storybook ink outline amount (0-1)");
			StorybookWarmth = config.Bind<float>("Storybook", "Warmth", 0.48f, "Warm hand-painted palette amount (0-1)");
			WatercolorToonWash = config.Bind<float>("WatercolorToon", "Wash", 0.52f, "Watercolor wash strength (0-1)");
			WatercolorToonBleed = config.Bind<float>("WatercolorToon", "Bleed", 0.3f, "Pigment bleed and edge pooling (0-1)");
			WatercolorToonPaper = config.Bind<float>("WatercolorToon", "Paper", 0.34f, "Paper grain visibility (0-1)");
			ComicFrameInk = config.Bind<float>("ComicFrame", "Ink", 0.62f, "Comic ink line strength (0-1)");
			ComicFrameHalftone = config.Bind<float>("ComicFrame", "Halftone", 0.26f, "Halftone shading visibility (0-1)");
			ComicFramePanels = config.Bind<float>("ComicFrame", "Panels", 0.16f, "Subtle panel-frame treatment (0-1)");
			PaperCutoutLayers = config.Bind<float>("PaperCutout", "Layers", 0.48f, "Layered cutout posterization (0-1)");
			PaperCutoutShadow = config.Bind<float>("PaperCutout", "Shadow", 0.28f, "Paper layer shadow amount (0-1)");
			PaperCutoutTexture = config.Bind<float>("PaperCutout", "Texture", 0.22f, "Fiber texture and handmade roughness (0-1)");
			PaperComicPaper = config.Bind<float>("PaperComic", "Paper", 0.58f, "Aged paper surface and print fade (0-1)");
			PaperComicInk = config.Bind<float>("PaperComic", "Ink", 0.66f, "Printed comic ink line strength (0-1)");
			PaperComicTone = config.Bind<float>("PaperComic", "Tone", 0.42f, "Halftone dot shading amount (0-1)");
			WastelandComicInk = config.Bind<float>("WastelandComic", "Ink", 0.72f, "Bold American comic ink outline strength (0-1)");
			WastelandComicContrast = config.Bind<float>("WastelandComic", "Contrast", 0.62f, "High-contrast desert comic grading (0-1)");
			WastelandComicGrunge = config.Bind<float>("WastelandComic", "Grunge", 0.46f, "Rough printed grit and hatch amount (0-1)");
			PainterlyArtBrush = config.Bind<float>("PainterlyArt", "Brush", 0.56f, "Painterly brush blending amount (0-1)");
			PainterlyArtPalette = config.Bind<float>("PainterlyArt", "Palette", 0.52f, "Gallery-style color palette shift (0-1)");
			PainterlyArtCanvas = config.Bind<float>("PainterlyArt", "Canvas", 0.38f, "Canvas grain and paint texture (0-1)");
			UIPanelX = config.Bind<float>("UI", "PanelX", 20f, "UI panel X position");
			UIPanelY = config.Bind<float>("UI", "PanelY", 20f, "UI panel Y position");
			UIPanelTheme = config.Bind<PanelThemeMode>("UI", "PanelTheme", PanelThemeMode.Colorful, "UI panel theme");
			if (ApplyLegacyDefaultUpgrade())
			{
				RequestSave();
			}
			config.SettingChanged += delegate
			{
				Version++;
				RequestSave();
			};
		}

		public static void FlushPendingSave(bool force = false)
		{
			if (savePending && ConfigFile != null && (force || !(DateTime.UtcNow < nextSaveTimeUtc)))
			{
				ConfigFile.Save();
				savePending = false;
			}
		}

		public static void ResetDefaults()
		{
			ModEnabled.Value = true;
			ActiveFilter.Value = FilterType.Sketch;
			Intensity.Value = 0.84f;
			SketchEdgeStrength.Value = 2.6f;
			SketchLineWidth.Value = 2.4f;
			SketchPaperTexture.Value = 0.36f;
			PencilDensity.Value = 2.5f;
			PencilDarkness.Value = 1.45f;
			PencilPaperGrain.Value = 0.36f;
			CelOutlineStrength.Value = 2.5f;
			CelColorSharpness.Value = 8.5f;
			CelTintAmount.Value = 0.42f;
			ToonRampSteps.Value = 5f;
			ToonShadowCutoff.Value = 0.38f;
			ToonInkStrength.Value = 0.95f;
			HorrorFearTint.Value = 0.78f;
			HorrorDarkness.Value = 0.58f;
			HorrorGrain.Value = 0.46f;
			PixelSize.Value = 6f;
			PixelOutlineStrength.Value = 0.65f;
			PixelDitherAmount.Value = 0.05f;
			AdventureVibrance.Value = 0.62f;
			AdventureSkyLift.Value = 0.34f;
			AdventureClarity.Value = 0.55f;
			CyberpunkNeon.Value = 0.76f;
			CyberpunkSplit.Value = 0.42f;
			CyberpunkGlitch.Value = 0.22f;
			EmberHeat.Value = 0.62f;
			EmberContrast.Value = 0.54f;
			EmberVignette.Value = 0.42f;
			RetroCRTScanlines.Value = 0.64f;
			RetroCRTColorBleed.Value = 0.34f;
			RetroCRTCurve.Value = 0.3f;
			ThermalHeat.Value = 0.82f;
			ThermalEdge.Value = 0.55f;
			ThermalNoise.Value = 0.26f;
			StorybookPaper.Value = 0.42f;
			StorybookInk.Value = 0.3f;
			StorybookWarmth.Value = 0.48f;
			WatercolorToonWash.Value = 0.52f;
			WatercolorToonBleed.Value = 0.3f;
			WatercolorToonPaper.Value = 0.34f;
			ComicFrameInk.Value = 0.62f;
			ComicFrameHalftone.Value = 0.26f;
			ComicFramePanels.Value = 0.16f;
			PaperCutoutLayers.Value = 0.48f;
			PaperCutoutShadow.Value = 0.28f;
			PaperCutoutTexture.Value = 0.22f;
			PaperComicPaper.Value = 0.58f;
			PaperComicInk.Value = 0.66f;
			PaperComicTone.Value = 0.42f;
			WastelandComicInk.Value = 0.72f;
			WastelandComicContrast.Value = 0.62f;
			WastelandComicGrunge.Value = 0.46f;
			PainterlyArtBrush.Value = 0.56f;
			PainterlyArtPalette.Value = 0.52f;
			PainterlyArtCanvas.Value = 0.38f;
			UIPanelTheme.Value = PanelThemeMode.Colorful;
		}

		public static void SavePanelPosition(float x, float y)
		{
			UIPanelX.Value = x;
			UIPanelY.Value = y;
		}

		private static void RequestSave()
		{
			savePending = true;
			nextSaveTimeUtc = DateTime.UtcNow + SaveDelay;
		}

		private static bool ApplyLegacyDefaultUpgrade()
		{
			return false | UpgradeIfDefault(Intensity, 0.86f, 0.84f) | UpgradeIfDefault(SketchEdgeStrength, 2.8f, 2.6f) | UpgradeIfDefault(SketchLineWidth, 3f, 2.4f) | UpgradeIfDefault(SketchPaperTexture, 0.45f, 0.36f) | UpgradeIfDefault(PencilDensity, 3.2f, 2.5f) | UpgradeIfDefault(PencilDarkness, 1.8f, 1.45f) | UpgradeIfDefault(PencilPaperGrain, 0.5f, 0.36f) | UpgradeIfDefault(CelOutlineStrength, 3.2f, 2.5f) | UpgradeIfDefault(CelColorSharpness, 10f, 8.5f) | UpgradeIfDefault(CelTintAmount, 0.55f, 0.42f) | UpgradeIfDefault(ToonRampSteps, 4f, 5f) | UpgradeIfDefault(ToonShadowCutoff, 0.44f, 0.38f) | UpgradeIfDefault(ToonInkStrength, 1.4f, 0.95f) | UpgradeIfDefault(HorrorFearTint, 0.92f, 0.78f) | UpgradeIfDefault(HorrorDarkness, 0.78f, 0.58f) | UpgradeIfDefault(HorrorGrain, 0.7f, 0.46f) | UpgradeIfDefault(PixelSize, 7f, 6f) | UpgradeIfDefault(PixelOutlineStrength, 0.8f, 0.65f) | UpgradeIfDefault(PixelDitherAmount, 0.08f, 0.05f) | UpgradeIfDefault(StorybookPaper, 0.48f, 0.42f) | UpgradeIfDefault(StorybookInk, 0.42f, 0.3f) | UpgradeIfDefault(StorybookWarmth, 0.54f, 0.48f) | UpgradeIfDefault(WatercolorToonWash, 0.6f, 0.52f) | UpgradeIfDefault(WatercolorToonBleed, 0.44f, 0.3f) | UpgradeIfDefault(WatercolorToonPaper, 0.46f, 0.34f) | UpgradeIfDefault(ComicFrameInk, 0.7f, 0.62f) | UpgradeIfDefault(ComicFrameHalftone, 0.38f, 0.26f) | UpgradeIfDefault(ComicFramePanels, 0.28f, 0.16f) | UpgradeIfDefault(PaperCutoutLayers, 0.6f, 0.48f) | UpgradeIfDefault(PaperCutoutShadow, 0.44f, 0.28f) | UpgradeIfDefault(PaperCutoutTexture, 0.38f, 0.22f);
		}

		private static bool UpgradeIfDefault(ConfigEntry<float> entry, float oldValue, float newValue)
		{
			if (Math.Abs(entry.Value - oldValue) > 0.001f)
			{
				return false;
			}
			entry.Value = newValue;
			return true;
		}

		private static bool IsAvailableFilter(FilterType type)
		{
			switch (type)
			{
			case FilterType.None:
			case FilterType.Sketch:
			case FilterType.PencilSketch:
			case FilterType.CelShade:
			case FilterType.ToonRamp:
			case FilterType.Pixelate:
			case FilterType.Horror:
			case FilterType.Adventure:
			case FilterType.Ember:
			case FilterType.RetroCRT:
			case FilterType.ThermalVision:
			case FilterType.Storybook:
			case FilterType.WatercolorToon:
			case FilterType.ComicFrame:
			case FilterType.PaperCutout:
			case FilterType.PaperComic:
			case FilterType.WastelandComic:
			case FilterType.PainterlyArt:
			case FilterType.Cyberpunk:
				return true;
			default:
				return false;
			}
		}
	}
	public class FilterManager : MonoBehaviour
	{
		private PeakFilterFeature filterFeature;

		private Dictionary<FilterType, Material> materials = new Dictionary<FilterType, Material>();

		private AssetBundle shaderBundle;

		private bool isInitialized;

		private long lastAppliedConfigVersion = -1L;

		private static readonly Dictionary<FilterType, string> ShaderInternalNames = new Dictionary<FilterType, string>
		{
			{
				FilterType.Sketch,
				"Hidden/PeakFilter/Sketch"
			},
			{
				FilterType.PencilSketch,
				"Hidden/PeakFilter/PencilSketch"
			},
			{
				FilterType.CelShade,
				"Hidden/PeakFilter/CelShade"
			},
			{
				FilterType.ToonRamp,
				"Hidden/PeakFilter/ToonRamp"
			},
			{
				FilterType.Horror,
				"Hidden/PeakFilter/Horror"
			},
			{
				FilterType.Pixelate,
				"Hidden/PeakFilter/Pixelate"
			},
			{
				FilterType.Adventure,
				"Hidden/PeakFilter/GameGrade"
			},
			{
				FilterType.Cyberpunk,
				"Hidden/PeakFilter/GameGrade"
			},
			{
				FilterType.Ember,
				"Hidden/PeakFilter/GameGrade"
			},
			{
				FilterType.RetroCRT,
				"Hidden/PeakFilter/GameGrade"
			},
			{
				FilterType.ThermalVision,
				"Hidden/PeakFilter/GameGrade"
			},
			{
				FilterType.Storybook,
				"Hidden/PeakFilter/AnimationGrade"
			},
			{
				FilterType.WatercolorToon,
				"Hidden/PeakFilter/AnimationGrade"
			},
			{
				FilterType.ComicFrame,
				"Hidden/PeakFilter/AnimationGrade"
			},
			{
				FilterType.PaperCutout,
				"Hidden/PeakFilter/AnimationGrade"
			},
			{
				FilterType.PaperComic,
				"Hidden/PeakFilter/AnimationGrade"
			},
			{
				FilterType.WastelandComic,
				"Hidden/PeakFilter/AnimationGrade"
			},
			{
				FilterType.PainterlyArt,
				"Hidden/PeakFilter/AnimationGrade"
			}
		};

		public bool IsInitialized => isInitialized;

		public void Initialize()
		{
			LoadShaders();
			InjectFeature();
			isInitialized = true;
		}

		private void LoadShaders()
		{
			LoadFromAssetBundle();
			int num = 0;
			foreach (KeyValuePair<FilterType, string> shaderInternalName in ShaderInternalNames)
			{
				if (materials.ContainsKey(shaderInternalName.Key) && (Object)(object)materials[shaderInternalName.Key] != (Object)null && (Object)(object)materials[shaderInternalName.Key].shader != (Object)null && ((Object)materials[shaderInternalName.Key].shader).name == shaderInternalName.Value)
				{
					num++;
				}
			}
			if (num < ShaderInternalNames.Count)
			{
				Debug.LogWarning((object)$"[PeakFilter] AssetBundle loaded {num}/{ShaderInternalNames.Count} shaders, trying Shader.Find fallback...");
				LoadFromShaderFind();
			}
			num = 0;
			foreach (KeyValuePair<FilterType, string> shaderInternalName2 in ShaderInternalNames)
			{
				if (materials.ContainsKey(shaderInternalName2.Key) && (Object)(object)materials[shaderInternalName2.Key] != (Object)null && (Object)(object)materials[shaderInternalName2.Key].shader != (Object)null && ((Object)materials[shaderInternalName2.Key].shader).name == shaderInternalName2.Value)
				{
					num++;
				}
			}
			if (num < ShaderInternalNames.Count)
			{
				CreateFallbackMaterials();
			}
			LogMissingShaders();
			Debug.Log((object)$"[PeakFilter] Shader loading complete: {num}/{ShaderInternalNames.Count} shaders ready.");
		}

		private void LogMissingShaders()
		{
			foreach (KeyValuePair<FilterType, string> shaderInternalName in ShaderInternalNames)
			{
				if (!materials.ContainsKey(shaderInternalName.Key) || (Object)(object)materials[shaderInternalName.Key] == (Object)null || (Object)(object)materials[shaderInternalName.Key].shader == (Object)null || ((Object)materials[shaderInternalName.Key].shader).name != shaderInternalName.Value)
				{
					Debug.LogWarning((object)$"[PeakFilter] Shader not ready: {shaderInternalName.Key} -> '{shaderInternalName.Value}'");
				}
			}
		}

		private void LoadFromAssetBundle()
		{
			//IL_01d4: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d9: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e6: Expected O, but got Unknown
			try
			{
				string directoryName = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
				string text = Path.Combine(directoryName, "peakfilter_shaders");
				if (!File.Exists(text))
				{
					text = Path.Combine(directoryName, "Shaders", "peakfilter_shaders");
				}
				if (!File.Exists(text))
				{
					Debug.LogWarning((object)"[PeakFilter] AssetBundle file not found.");
					return;
				}
				shaderBundle = AssetBundle.LoadFromFile(text);
				if ((Object)(object)shaderBundle == (Object)null)
				{
					Debug.LogError((object)"[PeakFilter] Failed to load AssetBundle.");
					return;
				}
				Debug.Log((object)("[PeakFilter] AssetBundle loaded: '" + ((Object)shaderBundle).name + "'"));
				Shader[] array = shaderBundle.LoadAllAssets<Shader>();
				if (array == null || array.Length == 0)
				{
					Debug.LogError((object)"[PeakFilter] No shaders found in AssetBundle.");
					return;
				}
				Debug.Log((object)$"[PeakFilter] Found {array.Length} shaders in bundle:");
				Shader[] array2 = array;
				foreach (Shader val in array2)
				{
					Debug.Log((object)$"[PeakFilter]   - name='{((Object)val).name}' supported={val.isSupported}");
				}
				foreach (KeyValuePair<FilterType, string> shaderInternalName in ShaderInternalNames)
				{
					if (materials.ContainsKey(shaderInternalName.Key) && (Object)(object)materials[shaderInternalName.Key] != (Object)null && (Object)(object)materials[shaderInternalName.Key].shader != (Object)null && ((Object)materials[shaderInternalName.Key].shader).name == shaderInternalName.Value)
					{
						continue;
					}
					array2 = array;
					foreach (Shader val2 in array2)
					{
						if (((Object)val2).name == shaderInternalName.Value && val2.isSupported)
						{
							materials[shaderInternalName.Key] = new Material(val2)
							{
								hideFlags = (HideFlags)61
							};
							Debug.Log((object)$"[PeakFilter] Material from bundle: {shaderInternalName.Key} -> '{shaderInternalName.Value}'");
							break;
						}
					}
				}
			}
			catch (Exception ex)
			{
				Debug.LogError((object)("[PeakFilter] AssetBundle error: " + ex.Message));
			}
		}

		private void LoadFromShaderFind()
		{
			//IL_00bf: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d1: Expected O, but got Unknown
			foreach (KeyValuePair<FilterType, string> shaderInternalName in ShaderInternalNames)
			{
				if (materials.ContainsKey(shaderInternalName.Key) && (Object)(object)materials[shaderInternalName.Key] != (Object)null && (Object)(object)materials[shaderInternalName.Key].shader != (Object)null && ((Object)materials[shaderInternalName.Key].shader).name == shaderInternalName.Value)
				{
					continue;
				}
				try
				{
					Shader val = Shader.Find(shaderInternalName.Value);
					if ((Object)(object)val != (Object)null && val.isSupported)
					{
						materials[shaderInternalName.Key] = new Material(val)
						{
							hideFlags = (HideFlags)61
						};
						Debug.Log((object)$"[PeakFilter] Material from Shader.Find: {shaderInternalName.Key} -> '{shaderInternalName.Value}'");
					}
				}
				catch (Exception ex)
				{
					Debug.LogWarning((object)("[PeakFilter] Shader.Find failed for '" + shaderInternalName.Value + "': " + ex.Message));
				}
			}
		}

		private void CreateFallbackMaterials()
		{
			//IL_0066: Unknown result type (might be due to invalid IL or missing references)
			//IL_006b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0074: Expected O, but got Unknown
			try
			{
				Shader val = Shader.Find("Hidden/Universal Render Pipeline/Blit") ?? Shader.Find("Hidden/UniversalRenderPipeline/Blit") ?? Shader.Find("PostProcessing/Blit") ?? Shader.Find("Hidden/PostProcessing/Blit") ?? Shader.Find("Hidden/Blit") ?? Shader.Find("Blit");
				if ((Object)(object)val != (Object)null && val.isSupported)
				{
					Material value = new Material(val)
					{
						hideFlags = (HideFlags)61
					};
					foreach (FilterType key in ShaderInternalNames.Keys)
					{
						if (!materials.ContainsKey(key) || (Object)(object)materials[key] == (Object)null)
						{
							materials[key] = value;
						}
					}
					Debug.LogWarning((object)"[PeakFilter] Fallback materials created for missing shaders.");
				}
				else
				{
					Debug.LogWarning((object)"[PeakFilter] Some shaders are missing and no fallback Blit shader was found.");
				}
			}
			catch (Exception ex)
			{
				Debug.LogError((object)("[PeakFilter] Error creating fallback materials: " + ex.Message));
			}
		}

		private void InjectFeature()
		{
			try
			{
				RenderPipelineAsset currentRenderPipeline = GraphicsSettings.currentRenderPipeline;
				UniversalRenderPipelineAsset val = (UniversalRenderPipelineAsset)(object)((currentRenderPipeline is UniversalRenderPipelineAsset) ? currentRenderPipeline : null);
				if ((Object)(object)val == (Object)null)
				{
					Debug.LogError((object)"[PeakFilter] UniversalRenderPipelineAsset not found.");
					return;
				}
				ScriptableRendererData rendererData = GetRendererData(val);
				if ((Object)(object)rendererData == (Object)null)
				{
					Debug.LogError((object)"[PeakFilter] Could not access UniversalRendererData.");
					return;
				}
				for (int i = 0; i < rendererData.rendererFeatures.Count; i++)
				{
					if (rendererData.rendererFeatures[i] is PeakFilterFeature peakFilterFeature)
					{
						filterFeature = peakFilterFeature;
						Debug.Log((object)"[PeakFilter] Found existing PeakFilterFeature.");
						return;
					}
				}
				filterFeature = ScriptableObject.CreateInstance<PeakFilterFeature>();
				((Object)filterFeature).name = "PeakFilter";
				((ScriptableRendererFeature)filterFeature).Create();
				rendererData.rendererFeatures.Add((ScriptableRendererFeature)(object)filterFeature);
				try
				{
					typeof(ScriptableRendererData).GetMethod("SetDirty", BindingFlags.Instance | BindingFlags.NonPublic)?.Invoke(rendererData, null);
				}
				catch
				{
				}
				Debug.Log((object)"[PeakFilter] Injected PeakFilterFeature into URP pipeline.");
			}
			catch (Exception ex)
			{
				Debug.LogError((object)("[PeakFilter] Error injecting renderer feature: " + ex.Message));
			}
		}

		private ScriptableRendererData GetRendererData(UniversalRenderPipelineAsset pipelineAsset)
		{
			Type type = ((object)pipelineAsset).GetType();
			FieldInfo field = type.GetField("m_RendererDataList", BindingFlags.Instance | BindingFlags.NonPublic);
			if (field != null && field.GetValue(pipelineAsset) is ScriptableRendererData[] array && array.Length != 0)
			{
				return array[0];
			}
			PropertyInfo property = type.GetProperty("rendererDataList", BindingFlags.Instance | BindingFlags.NonPublic);
			if (property != null && property.GetValue(pipelineAsset) is ScriptableRendererData[] array2 && array2.Length != 0)
			{
				return array2[0];
			}
			return null;
		}

		private void SetFloat(Material mat, string property, float value)
		{
			if (mat.HasProperty(property))
			{
				mat.SetFloat(property, value);
			}
		}

		private void SetGameGrade(Material mat, float mode, float styleStrength, float colorShift, float detailAmount)
		{
			SetFloat(mat, "_Mode", mode);
			SetFloat(mat, "_StyleStrength", styleStrength);
			SetFloat(mat, "_ColorShift", colorShift);
			SetFloat(mat, "_DetailAmount", detailAmount);
		}

		public void UpdateFilter()
		{
			if ((Object)(object)filterFeature == (Object)null)
			{
				return;
			}
			long version = FilterConfig.Version;
			if (version == lastAppliedConfigVersion)
			{
				return;
			}
			FilterType value = FilterConfig.ActiveFilter.Value;
			bool value2 = FilterConfig.ModEnabled.Value;
			float value3 = FilterConfig.Intensity.Value;
			if (value == FilterType.None || !materials.ContainsKey(value) || !value2)
			{
				filterFeature.IsActive = false;
				filterFeature.CurrentMaterial = null;
				lastAppliedConfigVersion = version;
				return;
			}
			Material val = materials[value];
			SetFloat(val, "_Intensity", value3);
			switch (value)
			{
			case FilterType.Sketch:
				SetFloat(val, "_EdgeStrength", FilterConfig.SketchEdgeStrength.Value);
				SetFloat(val, "_LineWidth", FilterConfig.SketchLineWidth.Value);
				SetFloat(val, "_PaperTexture", FilterConfig.SketchPaperTexture.Value);
				break;
			case FilterType.PencilSketch:
				SetFloat(val, "_PencilDensity", FilterConfig.PencilDensity.Value);
				SetFloat(val, "_PencilDarkness", FilterConfig.PencilDarkness.Value);
				SetFloat(val, "_PaperGrain", FilterConfig.PencilPaperGrain.Value);
				break;
			case FilterType.CelShade:
				SetFloat(val, "_OutlineStrength", FilterConfig.CelOutlineStrength.Value);
				SetFloat(val, "_ColorSharpness", FilterConfig.CelColorSharpness.Value);
				SetFloat(val, "_TintAmount", FilterConfig.CelTintAmount.Value);
				break;
			case FilterType.ToonRamp:
				SetFloat(val, "_RampSteps", FilterConfig.ToonRampSteps.Value);
				SetFloat(val, "_ShadowCutoff", FilterConfig.ToonShadowCutoff.Value);
				SetFloat(val, "_InkStrength", FilterConfig.ToonInkStrength.Value);
				break;
			case FilterType.Horror:
				SetFloat(val, "_FearTint", FilterConfig.HorrorFearTint.Value);
				SetFloat(val, "_Darkness", FilterConfig.HorrorDarkness.Value);
				SetFloat(val, "_Grain", FilterConfig.HorrorGrain.Value);
				break;
			case FilterType.Pixelate:
				SetFloat(val, "_PixelSize", FilterConfig.PixelSize.Value);
				SetFloat(val, "_OutlineStrength", FilterConfig.PixelOutlineStrength.Value);
				SetFloat(val, "_DitherAmount", FilterConfig.PixelDitherAmount.Value);
				break;
			case FilterType.Adventure:
				SetGameGrade(val, 1f, FilterConfig.AdventureVibrance.Value, FilterConfig.AdventureSkyLift.Value, FilterConfig.AdventureClarity.Value);
				break;
			case FilterType.Cyberpunk:
				SetGameGrade(val, 3f, FilterConfig.CyberpunkNeon.Value, FilterConfig.CyberpunkSplit.Value, FilterConfig.CyberpunkGlitch.Value);
				break;
			case FilterType.Ember:
				SetGameGrade(val, 4f, FilterConfig.EmberHeat.Value, FilterConfig.EmberContrast.Value, FilterConfig.EmberVignette.Value);
				break;
			case FilterType.RetroCRT:
				SetGameGrade(val, 5f, FilterConfig.RetroCRTScanlines.Value, FilterConfig.RetroCRTColorBleed.Value, FilterConfig.RetroCRTCurve.Value);
				break;
			case FilterType.ThermalVision:
				SetGameGrade(val, 6f, FilterConfig.ThermalHeat.Value, FilterConfig.ThermalEdge.Value, FilterConfig.ThermalNoise.Value);
				break;
			case FilterType.Storybook:
				SetGameGrade(val, 2f, FilterConfig.StorybookPaper.Value, FilterConfig.StorybookInk.Value, FilterConfig.StorybookWarmth.Value);
				break;
			case FilterType.WatercolorToon:
				SetGameGrade(val, 3f, FilterConfig.WatercolorToonWash.Value, FilterConfig.WatercolorToonBleed.Value, FilterConfig.WatercolorToonPaper.Value);
				break;
			case FilterType.ComicFrame:
				SetGameGrade(val, 4f, FilterConfig.ComicFrameInk.Value, FilterConfig.ComicFrameHalftone.Value, FilterConfig.ComicFramePanels.Value);
				break;
			case FilterType.PaperCutout:
				SetGameGrade(val, 6f, FilterConfig.PaperCutoutLayers.Value, FilterConfig.PaperCutoutShadow.Value, FilterConfig.PaperCutoutTexture.Value);
				break;
			case FilterType.PaperComic:
				SetGameGrade(val, 7f, FilterConfig.PaperComicPaper.Value, FilterConfig.PaperComicInk.Value, FilterConfig.PaperComicTone.Value);
				break;
			case FilterType.WastelandComic:
				SetGameGrade(val, 8f, FilterConfig.WastelandComicInk.Value, FilterConfig.WastelandComicContrast.Value, FilterConfig.WastelandComicGrunge.Value);
				break;
			case FilterType.PainterlyArt:
				SetGameGrade(val, 10f, FilterConfig.PainterlyArtBrush.Value, FilterConfig.PainterlyArtPalette.Value, FilterConfig.PainterlyArtCanvas.Value);
				break;
			}
			filterFeature.CurrentMaterial = val;
			filterFeature.IsActive = value2;
			lastAppliedConfigVersion = version;
		}

		public void SetEnabled(bool enabled)
		{
			if ((Object)(object)filterFeature != (Object)null)
			{
				filterFeature.IsActive = enabled;
			}
		}

		public void ForceUpdate()
		{
			lastAppliedConfigVersion = -1L;
			UpdateFilter();
		}

		private void OnDestroy()
		{
			if ((Object)(object)filterFeature != (Object)null)
			{
				filterFeature.IsActive = false;
				filterFeature.CurrentMaterial = null;
			}
			HashSet<Material> hashSet = new HashSet<Material>();
			foreach (Material value in materials.Values)
			{
				if ((Object)(object)value != (Object)null && hashSet.Add(value))
				{
					Object.DestroyImmediate((Object)(object)value);
				}
			}
			materials.Clear();
			if ((Object)(object)shaderBundle != (Object)null)
			{
				shaderBundle.Unload(true);
				shaderBundle = null;
			}
		}
	}
	public class PeakFilterFeature : ScriptableRendererFeature
	{
		public bool IsActive;

		public Material CurrentMaterial;

		public override void Create()
		{
		}

		public override void AddRenderPasses(ScriptableRenderer renderer, ref RenderingData renderingData)
		{
			if (IsActive && !((Object)(object)CurrentMaterial == (Object)null))
			{
				PeakFilterPass peakFilterPass = new PeakFilterPass(CurrentMaterial);
				renderer.EnqueuePass((ScriptableRenderPass)(object)peakFilterPass);
			}
		}
	}
	public class PeakFilterPass : ScriptableRenderPass
	{
		private Material material;

		public PeakFilterPass(Material mat)
		{
			material = mat;
			((ScriptableRenderPass)this).renderPassEvent = (RenderPassEvent)550;
		}

		public override void RecordRenderGraph(RenderGraph renderGraph, ContextContainer frameData)
		{
			//IL_0045: Unknown result type (might be due to invalid IL or missing references)
			//IL_004a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0056: Unknown result type (might be due to invalid IL or missing references)
			//IL_005d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0062: Unknown result type (might be due to invalid IL or missing references)
			//IL_0065: Unknown result type (might be due to invalid IL or missing references)
			//IL_0066: Unknown result type (might be due to invalid IL or missing references)
			//IL_0074: Unknown result type (might be due to invalid IL or missing references)
			//IL_0087: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)material == (Object)null || (Object)(object)material.shader == (Object)null || !material.shader.isSupported)
			{
				return;
			}
			UniversalResourceData val = frameData.Get<UniversalResourceData>();
			if (!val.isActiveTargetBackBuffer)
			{
				TextureHandle activeColorTexture = val.activeColorTexture;
				if (((TextureHandle)(ref activeColorTexture)).IsValid())
				{
					TextureHandle val2 = renderGraph.CreateTexture(activeColorTexture, "_PeakFilterDest", false);
					BlitMaterialParameters val3 = default(BlitMaterialParameters);
					((BlitMaterialParameters)(ref val3))..ctor(activeColorTexture, val2, material, 0);
					RenderGraphUtils.AddBlitPass(renderGraph, val3, "PeakFilter", "D:\\Mod Projects\\PeakFilter\\FilterRenderer.cs", 52);
					val.cameraColor = val2;
				}
			}
		}

		public override void OnCameraSetup(CommandBuffer cmd, ref RenderingData renderingData)
		{
		}

		public override void Execute(ScriptableRenderContext context, ref RenderingData renderingData)
		{
		}

		public override void OnCameraCleanup(CommandBuffer cmd)
		{
		}
	}
	public enum FilterType
	{
		None = 0,
		Sketch = 1,
		PencilSketch = 2,
		CelShade = 3,
		ToonRamp = 4,
		Pixelate = 5,
		Horror = 9,
		Adventure = 13,
		Ember = 14,
		RetroCRT = 15,
		ThermalVision = 16,
		Storybook = 18,
		WatercolorToon = 19,
		ComicFrame = 20,
		PaperCutout = 22,
		PaperComic = 23,
		WastelandComic = 24,
		PainterlyArt = 26,
		Cyberpunk = 103,
		[Obsolete("Removed from the active filter set.")]
		Watercolor = 6,
		[Obsolete("Removed from the active filter set.")]
		OilPaint = 7,
		[Obsolete("Removed from the active filter set.")]
		ShadowBalance = 8,
		[Obsolete("Removed from the active filter set.")]
		PosterizePop = 11,
		[Obsolete("Removed from the active filter set.")]
		FrostedGlass = 12,
		[Obsolete("Removed from the active filter set.")]
		DreamBloom = 10,
		[Obsolete("Removed from the active filter set.")]
		AnimationFilm = 17,
		[Obsolete("Removed from the active filter set.")]
		PastelIllustration = 21,
		[Obsolete("Removed from the active filter set.")]
		TwoDIllustration = 25,
		[Obsolete("Removed from the active filter set.")]
		BlackWhite = 100,
		[Obsolete("Removed from the active filter set.")]
		Sepia = 101,
		[Obsolete("Removed from the active filter set.")]
		Silhouette = 102,
		[Obsolete("Removed from the active filter set.")]
		Vintage = 104,
		[Obsolete("Removed from the active filter set.")]
		NeonGlow = 105
	}
	public class FilterUI : MonoBehaviour
	{
		private struct ThemePalette
		{
			public Color panelBg;

			public Color titleBg;

			public Color text;

			public Color textDim;

			public Color accentA;

			public Color accentB;

			public Color accentC;

			public Color buttonA;

			public Color buttonB;

			public Color selectedA;

			public Color selectedB;

			public Color buttonHover;

			public Color selectedBorder;

			public Color border;

			public Color separator;

			public Color sliderTrack;

			public Color thumb;

			public Color titleButtonBg;

			public Color titleButtonIcon;

			public Color selectedText;
		}

		private class FilterGroup
		{
			public string label;

			public FilterType[] filters;
		}

		private class FilterParam
		{
			public string labelKey;

			public Func<float> getValue;

			public Action<float> setValue;

			public float min;

			public float max;

			public FilterParam(string labelKey, Func<float> getValue, Action<float> setValue, float min, float max)
			{
				this.labelKey = labelKey;
				this.getValue = getValue;
				this.setValue = setValue;
				this.min = min;
				this.max = max;
			}
		}

		private bool showPanel;

		private Rect panelRect = new Rect(20f, 20f, 660f, 560f);

		private bool isDragging;

		private Vector2 dragOffset;

		private float scale = 0.68f;

		private Vector2 scrollPos;

		private const string version = "v1.1.4";

		private const float PanelWidth = 660f;

		private const float MaxPanelHeight = 900f;

		private const float TitleHeight = 42f;

		private const float ContentPad = 16f;

		private const float ButtonGap = 8f;

		private const float RowGap = 8f;

		private const float GroupHeaderHeight = 22f;

		private const float GroupGap = 12f;

		private const float ButtonHeight = 36f;

		private const float SliderBlockHeight = 58f;

		private const int MaxFilterColumns = 4;

		private static readonly FilterGroup[] Groups = new FilterGroup[5]
		{
			new FilterGroup
			{
				label = "lineart",
				filters = new FilterType[4]
				{
					FilterType.Sketch,
					FilterType.PencilSketch,
					FilterType.Storybook,
					FilterType.WatercolorToon
				}
			},
			new FilterGroup
			{
				label = "tooncomic",
				filters = new FilterType[5]
				{
					FilterType.CelShade,
					FilterType.ToonRamp,
					FilterType.ComicFrame,
					FilterType.PaperComic,
					FilterType.WastelandComic
				}
			},
			new FilterGroup
			{
				label = "illustration",
				filters = new FilterType[2]
				{
					FilterType.PaperCutout,
					FilterType.PainterlyArt
				}
			},
			new FilterGroup
			{
				label = "cinematic",
				filters = new FilterType[3]
				{
					FilterType.Adventure,
					FilterType.Ember,
					FilterType.Cyberpunk
				}
			},
			new FilterGroup
			{
				label = "fxvision",
				filters = new FilterType[4]
				{
					FilterType.Pixelate,
					FilterType.RetroCRT,
					FilterType.Horror,
					FilterType.ThermalVision
				}
			}
		};

		private static readonly Dictionary<FilterType, string> FilterKeys = new Dictionary<FilterType, string>
		{
			{
				FilterType.None,
				"none"
			},
			{
				FilterType.Sketch,
				"sketch"
			},
			{
				FilterType.PencilSketch,
				"pencilsketch"
			},
			{
				FilterType.CelShade,
				"celshade"
			},
			{
				FilterType.ToonRamp,
				"toonramp"
			},
			{
				FilterType.Horror,
				"horror"
			},
			{
				FilterType.Pixelate,
				"pixelate"
			},
			{
				FilterType.Adventure,
				"adventure"
			},
			{
				FilterType.Cyberpunk,
				"cyberpunk"
			},
			{
				FilterType.Ember,
				"ember"
			},
			{
				FilterType.RetroCRT,
				"retrocrt"
			},
			{
				FilterType.ThermalVision,
				"thermalvision"
			},
			{
				FilterType.Storybook,
				"storybook"
			},
			{
				FilterType.WatercolorToon,
				"watercolortoon"
			},
			{
				FilterType.ComicFrame,
				"comicframe"
			},
			{
				FilterType.PaperCutout,
				"papercutout"
			},
			{
				FilterType.PaperComic,
				"papercomic"
			},
			{
				FilterType.WastelandComic,
				"wastelandcomic"
			},
			{
				FilterType.PainterlyArt,
				"painterlyart"
			}
		};

		private static readonly Dictionary<FilterType, FilterParam[]> FilterParams = new Dictionary<FilterType, FilterParam[]>
		{
			{
				FilterType.Sketch,
				new FilterParam[3]
				{
					Param("edgeStrength", () => FilterConfig.SketchEdgeStrength.Value, delegate(float v)
					{
						FilterConfig.SketchEdgeStrength.Value = v;
					}, 0f, 5f),
					Param("lineWidth", () => FilterConfig.SketchLineWidth.Value, delegate(float v)
					{
						FilterConfig.SketchLineWidth.Value = v;
					}, 0.5f, 8f),
					Param("paperTexture", () => FilterConfig.SketchPaperTexture.Value, delegate(float v)
					{
						FilterConfig.SketchPaperTexture.Value = v;
					}, 0f, 1f)
				}
			},
			{
				FilterType.PencilSketch,
				new FilterParam[3]
				{
					Param("pencilDensity", () => FilterConfig.PencilDensity.Value, delegate(float v)
					{
						FilterConfig.PencilDensity.Value = v;
					}, 0.5f, 8f),
					Param("pencilDarkness", () => FilterConfig.PencilDarkness.Value, delegate(float v)
					{
						FilterConfig.PencilDarkness.Value = v;
					}, 0f, 3f),
					Param("paperGrain", () => FilterConfig.PencilPaperGrain.Value, delegate(float v)
					{
						FilterConfig.PencilPaperGrain.Value = v;
					}, 0f, 1f)
				}
			},
			{
				FilterType.CelShade,
				new FilterParam[3]
				{
					Param("outlineStrength", () => FilterConfig.CelOutlineStrength.Value, delegate(float v)
					{
						FilterConfig.CelOutlineStrength.Value = v;
					}, 0f, 5f),
					Param("colorSharpness", () => FilterConfig.CelColorSharpness.Value, delegate(float v)
					{
						FilterConfig.CelColorSharpness.Value = v;
					}, 2f, 20f),
					Param("celTint", () => FilterConfig.CelTintAmount.Value, delegate(float v)
					{
						FilterConfig.CelTintAmount.Value = v;
					}, 0f, 1f)
				}
			},
			{
				FilterType.ToonRamp,
				new FilterParam[3]
				{
					Param("rampSteps", () => FilterConfig.ToonRampSteps.Value, delegate(float v)
					{
						FilterConfig.ToonRampSteps.Value = v;
					}, 2f, 8f),
					Param("shadowCutoff", () => FilterConfig.ToonShadowCutoff.Value, delegate(float v)
					{
						FilterConfig.ToonShadowCutoff.Value = v;
					}, 0.1f, 0.9f),
					Param("inkStrength", () => FilterConfig.ToonInkStrength.Value, delegate(float v)
					{
						FilterConfig.ToonInkStrength.Value = v;
					}, 0f, 3f)
				}
			},
			{
				FilterType.Horror,
				new FilterParam[3]
				{
					Param("fearTint", () => FilterConfig.HorrorFearTint.Value, delegate(float v)
					{
						FilterConfig.HorrorFearTint.Value = v;
					}, 0f, 1f),
					Param("darkness", () => FilterConfig.HorrorDarkness.Value, delegate(float v)
					{
						FilterConfig.HorrorDarkness.Value = v;
					}, 0f, 1f),
					Param("grain", () => FilterConfig.HorrorGrain.Value, delegate(float v)
					{
						FilterConfig.HorrorGrain.Value = v;
					}, 0f, 1f)
				}
			},
			{
				FilterType.Pixelate,
				new FilterParam[3]
				{
					Param("pixelSize", () => FilterConfig.PixelSize.Value, delegate(float v)
					{
						FilterConfig.PixelSize.Value = v;
					}, 1f, 30f),
					Param("pixelOutline", () => FilterConfig.PixelOutlineStrength.Value, delegate(float v)
					{
						FilterConfig.PixelOutlineStrength.Value = v;
					}, 0f, 3f),
					Param("ditherAmount", () => FilterConfig.PixelDitherAmount.Value, delegate(float v)
					{
						FilterConfig.PixelDitherAmount.Value = v;
					}, 0f, 1f)
				}
			},
			{
				FilterType.Adventure,
				new FilterParam[3]
				{
					Param("adventureVibrance", () => FilterConfig.AdventureVibrance.Value, delegate(float v)
					{
						FilterConfig.AdventureVibrance.Value = v;
					}, 0f, 1f),
					Param("adventureSkyLift", () => FilterConfig.AdventureSkyLift.Value, delegate(float v)
					{
						FilterConfig.AdventureSkyLift.Value = v;
					}, 0f, 1f),
					Param("adventureClarity", () => FilterConfig.AdventureClarity.Value, delegate(float v)
					{
						FilterConfig.AdventureClarity.Value = v;
					}, 0f, 1f)
				}
			},
			{
				FilterType.Cyberpunk,
				new FilterParam[3]
				{
					Param("neonColor", () => FilterConfig.CyberpunkNeon.Value, delegate(float v)
					{
						FilterConfig.CyberpunkNeon.Value = v;
					}, 0f, 1f),
					Param("colorSplit", () => FilterConfig.CyberpunkSplit.Value, delegate(float v)
					{
						FilterConfig.CyberpunkSplit.Value = v;
					}, 0f, 1f),
					Param("glitchPulse", () => FilterConfig.CyberpunkGlitch.Value, delegate(float v)
					{
						FilterConfig.CyberpunkGlitch.Value = v;
					}, 0f, 1f)
				}
			},
			{
				FilterType.Ember,
				new FilterParam[3]
				{
					Param("emberHeat", () => FilterConfig.EmberHeat.Value, delegate(float v)
					{
						FilterConfig.EmberHeat.Value = v;
					}, 0f, 1f),
					Param("emberContrast", () => FilterConfig.EmberContrast.Value, delegate(float v)
					{
						FilterConfig.EmberContrast.Value = v;
					}, 0f, 1f),
					Param("emberVignette", () => FilterConfig.EmberVignette.Value, delegate(float v)
					{
						FilterConfig.EmberVignette.Value = v;
					}, 0f, 1f)
				}
			},
			{
				FilterType.RetroCRT,
				new FilterParam[3]
				{
					Param("crtScanlines", () => FilterConfig.RetroCRTScanlines.Value, delegate(float v)
					{
						FilterConfig.RetroCRTScanlines.Value = v;
					}, 0f, 1f),
					Param("crtBleed", () => FilterConfig.RetroCRTColorBleed.Value, delegate(float v)
					{
						FilterConfig.RetroCRTColorBleed.Value = v;
					}, 0f, 1f),
					Param("crtCurve", () => FilterConfig.RetroCRTCurve.Value, delegate(float v)
					{
						FilterConfig.RetroCRTCurve.Value = v;
					}, 0f, 1f)
				}
			},
			{
				FilterType.ThermalVision,
				new FilterParam[3]
				{
					Param("thermalHeat", () => FilterConfig.ThermalHeat.Value, delegate(float v)
					{
						FilterConfig.ThermalHeat.Value = v;
					}, 0f, 1f),
					Param("thermalEdges", () => FilterConfig.ThermalEdge.Value, delegate(float v)
					{
						FilterConfig.ThermalEdge.Value = v;
					}, 0f, 1f),
					Param("thermalNoise", () => FilterConfig.ThermalNoise.Value, delegate(float v)
					{
						FilterConfig.ThermalNoise.Value = v;
					}, 0f, 1f)
				}
			},
			{
				FilterType.Storybook,
				new FilterParam[3]
				{
					Param("storyPaper", () => FilterConfig.StorybookPaper.Value, delegate(float v)
					{
						FilterConfig.StorybookPaper.Value = v;
					}, 0f, 1f),
					Param("storyInk", () => FilterConfig.StorybookInk.Value, delegate(float v)
					{
						FilterConfig.StorybookInk.Value = v;
					}, 0f, 1f),
					Param("storyWarmth", () => FilterConfig.StorybookWarmth.Value, delegate(float v)
					{
						FilterConfig.StorybookWarmth.Value = v;
					}, 0f, 1f)
				}
			},
			{
				FilterType.WatercolorToon,
				new FilterParam[3]
				{
					Param("waterWash", () => FilterConfig.WatercolorToonWash.Value, delegate(float v)
					{
						FilterConfig.WatercolorToonWash.Value = v;
					}, 0f, 1f),
					Param("waterBleed", () => FilterConfig.WatercolorToonBleed.Value, delegate(float v)
					{
						FilterConfig.WatercolorToonBleed.Value = v;
					}, 0f, 1f),
					Param("waterPaper", () => FilterConfig.WatercolorToonPaper.Value, delegate(float v)
					{
						FilterConfig.WatercolorToonPaper.Value = v;
					}, 0f, 1f)
				}
			},
			{
				FilterType.ComicFrame,
				new FilterParam[3]
				{
					Param("comicInk", () => FilterConfig.ComicFrameInk.Value, delegate(float v)
					{
						FilterConfig.ComicFrameInk.Value = v;
					}, 0f, 1f),
					Param("comicHalftone", () => FilterConfig.ComicFrameHalftone.Value, delegate(float v)
					{
						FilterConfig.ComicFrameHalftone.Value = v;
					}, 0f, 1f),
					Param("comicPanels", () => FilterConfig.ComicFramePanels.Value, delegate(float v)
					{
						FilterConfig.ComicFramePanels.Value = v;
					}, 0f, 1f)
				}
			},
			{
				FilterType.PaperCutout,
				new FilterParam[3]
				{
					Param("cutoutLayers", () => FilterConfig.PaperCutoutLayers.Value, delegate(float v)
					{
						FilterConfig.PaperCutoutLayers.Value = v;
					}, 0f, 1f),
					Param("cutoutShadow", () => FilterConfig.PaperCutoutShadow.Value, delegate(float v)
					{
						FilterConfig.PaperCutoutShadow.Value = v;
					}, 0f, 1f),
					Param("cutoutTexture", () => FilterConfig.PaperCutoutTexture.Value, delegate(float v)
					{
						FilterConfig.PaperCutoutTexture.Value = v;
					}, 0f, 1f)
				}
			},
			{
				FilterType.PaperComic,
				new FilterParam[3]
				{
					Param("paperComicPaper", () => FilterConfig.PaperComicPaper.Value, delegate(float v)
					{
						FilterConfig.PaperComicPaper.Value = v;
					}, 0f, 1f),
					Param("paperComicInk", () => FilterConfig.PaperComicInk.Value, delegate(float v)
					{
						FilterConfig.PaperComicInk.Value = v;
					}, 0f, 1f),
					Param("paperComicTone", () => FilterConfig.PaperComicTone.Value, delegate(float v)
					{
						FilterConfig.PaperComicTone.Value = v;
					}, 0f, 1f)
				}
			},
			{
				FilterType.WastelandComic,
				new FilterParam[3]
				{
					Param("wastelandInk", () => FilterConfig.WastelandComicInk.Value, delegate(float v)
					{
						FilterConfig.WastelandComicInk.Value = v;
					}, 0f, 1f),
					Param("wastelandContrast", () => FilterConfig.WastelandComicContrast.Value, delegate(float v)
					{
						FilterConfig.WastelandComicContrast.Value = v;
					}, 0f, 1f),
					Param("wastelandGrunge", () => FilterConfig.WastelandComicGrunge.Value, delegate(float v)
					{
						FilterConfig.WastelandComicGrunge.Value = v;
					}, 0f, 1f)
				}
			},
			{
				FilterType.PainterlyArt,
				new FilterParam[3]
				{
					Param("artBrush", () => FilterConfig.PainterlyArtBrush.Value, delegate(float v)
					{
						FilterConfig.PainterlyArtBrush.Value = v;
					}, 0f, 1f),
					Param("artPalette", () => FilterConfig.PainterlyArtPalette.Value, delegate(float v)
					{
						FilterConfig.PainterlyArtPalette.Value = v;
					}, 0f, 1f),
					Param("artCanvas", () => FilterConfig.PainterlyArtCanvas.Value, delegate(float v)
					{
						FilterConfig.PainterlyArtCanvas.Value = v;
					}, 0f, 1f)
				}
			}
		};

		private GUIStyle titleStyle;

		private GUIStyle sectionStyle;

		private GUIStyle groupLabelStyle;

		private GUIStyle btnStyle;

		private GUIStyle selectedBtnStyle;

		private GUIStyle closeBtnStyle;

		private GUIStyle iconBtnStyle;

		private GUIStyle labelStyle;

		private GUIStyle valueStyle;

		private bool stylesInit;

		private PanelThemeMode activeTheme = (PanelThemeMode)(-1);

		private ThemePalette activePalette;

		private Texture2D panelBgTex;

		private Texture2D titleBgTex;

		private Texture2D gradSliderBg;

		private Texture2D sliderTrackTex;

		private Texture2D buttonGradTex;

		private Texture2D buttonSelectedTex;

		private Texture2D buttonHoverTex;

		private Texture2D themeIconTex;

		private Texture2D whiteTex;

		private bool texInit;

		private static FilterParam Param(string labelKey, Func<float> getValue, Action<float> setValue, float min, float max)
		{
			return new FilterParam(labelKey, getValue, setValue, min, max);
		}

		private void InitStyles()
		{
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0020: Unknown result type (might be due to invalid IL or missing references)
			//IL_0028: Unknown result type (might be due to invalid IL or missing references)
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Unknown result type (might be due to invalid IL or missing references)
			//IL_003c: Unknown result type (might be due to invalid IL or missing references)
			//IL_004b: Expected O, but got Unknown
			//IL_0056: Unknown result type (might be due to invalid IL or missing references)
			//IL_005b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0063: Unknown result type (might be due to invalid IL or missing references)
			//IL_006a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0071: Unknown result type (might be due to invalid IL or missing references)
			//IL_0077: Unknown result type (might be due to invalid IL or missing references)
			//IL_0086: Expected O, but got Unknown
			//IL_0091: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: Unknown result type (might be due to invalid IL or missing references)
			//IL_009e: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ac: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ba: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cf: Expected O, but got Unknown
			//IL_00da: Unknown result type (might be due to invalid IL or missing references)
			//IL_00df: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ee: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fc: Unknown result type (might be due to invalid IL or missing references)
			//IL_0103: Unknown result type (might be due to invalid IL or missing references)
			//IL_0109: Unknown result type (might be due to invalid IL or missing references)
			//IL_0113: Unknown result type (might be due to invalid IL or missing references)
			//IL_011f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0125: Unknown result type (might be due to invalid IL or missing references)
			//IL_012f: Unknown result type (might be due to invalid IL or missing references)
			//IL_013b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0141: Unknown result type (might be due to invalid IL or missing references)
			//IL_014b: Unknown result type (might be due to invalid IL or missing references)
			//IL_015c: Expected O, but got Unknown
			//IL_0163: Unknown result type (might be due to invalid IL or missing references)
			//IL_0168: Unknown result type (might be due to invalid IL or missing references)
			//IL_016e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0178: Unknown result type (might be due to invalid IL or missing references)
			//IL_0184: Unknown result type (might be due to invalid IL or missing references)
			//IL_018a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0194: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a0: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b0: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c1: Expected O, but got Unknown
			//IL_01c7: Unknown result type (might be due to invalid IL or missing references)
			//IL_01cc: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d4: Unknown result type (might be due to invalid IL or missing references)
			//IL_01db: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e2: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e8: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f2: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f8: Unknown result type (might be due to invalid IL or missing references)
			//IL_0202: Unknown result type (might be due to invalid IL or missing references)
			//IL_0208: Unknown result type (might be due to invalid IL or missing references)
			//IL_0217: Expected O, but got Unknown
			//IL_021d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0222: Unknown result type (might be due to invalid IL or missing references)
			//IL_0229: Unknown result type (might be due to invalid IL or missing references)
			//IL_0230: Unknown result type (might be due to invalid IL or missing references)
			//IL_023c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0248: Unknown result type (might be due to invalid IL or missing references)
			//IL_0259: Expected O, but got Unknown
			//IL_0264: Unknown result type (might be due to invalid IL or missing references)
			//IL_0269: Unknown result type (might be due to invalid IL or missing references)
			//IL_0271: Unknown result type (might be due to invalid IL or missing references)
			//IL_0278: Unknown result type (might be due to invalid IL or missing references)
			//IL_027f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0286: Unknown result type (might be due to invalid IL or missing references)
			//IL_028c: Unknown result type (might be due to invalid IL or missing references)
			//IL_029b: Expected O, but got Unknown
			//IL_02a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ab: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ba: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c0: Unknown result type (might be due to invalid IL or missing references)
			//IL_02cf: Expected O, but got Unknown
			if (!stylesInit)
			{
				stylesInit = true;
				GUIStyle val = new GUIStyle(GUI.skin.label)
				{
					fontSize = 24,
					fontStyle = (FontStyle)1,
					alignment = (TextAnchor)3
				};
				val.normal.textColor = Color.white;
				titleStyle = val;
				GUIStyle val2 = new GUIStyle(GUI.skin.label)
				{
					fontSize = 16,
					fontStyle = (FontStyle)1,
					alignment = (TextAnchor)3
				};
				val2.normal.textColor = Color.white;
				sectionStyle = val2;
				GUIStyle val3 = new GUIStyle(GUI.skin.label)
				{
					fontSize = 14,
					fontStyle = (FontStyle)1,
					alignment = (TextAnchor)3,
					wordWrap = false,
					clipping = (TextClipping)1
				};
				val3.normal.textColor = Color.white;
				groupLabelStyle = val3;
				GUIStyle val4 = new GUIStyle(GUI.skin.button)
				{
					fontSize = 14,
					fontStyle = (FontStyle)1,
					alignment = (TextAnchor)4,
					wordWrap = false,
					clipping = (TextClipping)1
				};
				val4.normal.textColor = Color.white;
				val4.normal.background = null;
				val4.hover.textColor = Color.white;
				val4.hover.background = null;
				val4.active.textColor = Color.white;
				val4.active.background = null;
				btnStyle = val4;
				GUIStyle val5 = new GUIStyle(btnStyle);
				val5.normal.textColor = Color.white;
				val5.normal.background = null;
				val5.hover.textColor = Color.white;
				val5.hover.background = null;
				val5.active.textColor = Color.white;
				val5.active.background = null;
				selectedBtnStyle = val5;
				GUIStyle val6 = new GUIStyle(GUIStyle.none)
				{
					fontSize = 18,
					fontStyle = (FontStyle)1,
					alignment = (TextAnchor)4
				};
				val6.normal.textColor = Color.white;
				val6.hover.textColor = Color.white;
				val6.active.textColor = Color.white;
				closeBtnStyle = val6;
				GUIStyle val7 = new GUIStyle(GUIStyle.none)
				{
					alignment = (TextAnchor)4,
					imagePosition = (ImagePosition)2
				};
				val7.normal.background = null;
				val7.hover.background = null;
				val7.active.background = null;
				iconBtnStyle = val7;
				GUIStyle val8 = new GUIStyle(GUI.skin.label)
				{
					fontSize = 14,
					alignment = (TextAnchor)3,
					wordWrap = false,
					clipping = (TextClipping)1
				};
				val8.normal.textColor = Color.white;
				labelStyle = val8;
				GUIStyle val9 = new GUIStyle(GUI.skin.label)
				{
					fontSize = 14,
					alignment = (TextAnchor)5
				};
				val9.normal.textColor = Color.white;
				valueStyle = val9;
			}
		}

		private Texture2D MakeTex(int w, int h, Color c)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Expected O, but got Unknown
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			Texture2D val = new Texture2D(w, h);
			for (int i = 0; i < w; i++)
			{
				for (int j = 0; j < h; j++)
				{
					val.SetPixel(i, j, c);
				}
			}
			val.Apply();
			return val;
		}

		private Texture2D MakeGradTex(int w, int h, Color from, Color to)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Expected O, but got Unknown
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_002d: Unknown result type (might be due to invalid IL or missing references)
			Texture2D val = new Texture2D(w, h);
			for (int i = 0; i < w; i++)
			{
				float num = (float)i / (float)Mathf.Max(w - 1, 1);
				Color val2 = Color.Lerp(from, to, num);
				for (int j = 0; j < h; j++)
				{
					val.SetPixel(i, j, val2);
				}
			}
			val.Apply();
			return val;
		}

		private Texture2D MakeSliderGradTex(int w, int h)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Expected O, but got Unknown
			//IL_0055: Unknown result type (might be due to invalid IL or missing references)
			//IL_0060: Unknown result type (might be due to invalid IL or missing references)
			//IL_006c: Unknown result type (might be due to invalid IL or missing references)
			//IL_002b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Unknown result type (might be due to invalid IL or missing references)
			//IL_0048: Unknown result type (might be due to invalid IL or missing references)
			//IL_0071: Unknown result type (might be due to invalid IL or missing references)
			//IL_007b: Unknown result type (might be due to invalid IL or missing references)
			Texture2D val = new Texture2D(w, h);
			for (int i = 0; i < w; i++)
			{
				float num = (float)i / (float)Mathf.Max(w - 1, 1);
				Color val2 = ((num < 0.55f) ? Color.Lerp(activePalette.accentA, activePalette.accentB, num / 0.55f) : Color.Lerp(activePalette.accentB, activePalette.accentC, (num - 0.55f) / 0.45f));
				for (int j = 0; j < h; j++)
				{
					val.SetPixel(i, j, val2);
				}
			}
			val.Apply();
			return val;
		}

		private void InitTextures()
		{
			//IL_0054: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0098: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00dd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e8: Unknown result type (might be due to invalid IL or missing references)
			//IL_0101: Unknown result type (might be due to invalid IL or missing references)
			//IL_0127: Unknown result type (might be due to invalid IL or missing references)
			PanelThemeMode value = FilterConfig.UIPanelTheme.Value;
			if (!texInit || value != activeTheme)
			{
				DestroyThemeTextures();
				texInit = true;
				activeTheme = value;
				activePalette = GetPalette(value);
				ApplyThemeToStyles(activePalette);
				panelBgTex = MakeTex(1, 1, activePalette.panelBg);
				titleBgTex = MakeTex(1, 1, activePalette.titleBg);
				gradSliderBg = MakeSliderGradTex(256, 1);
				sliderTrackTex = MakeTex(1, 1, activePalette.sliderTrack);
				buttonGradTex = MakeGradTex(128, 1, activePalette.buttonA, activePalette.buttonB);
				buttonSelectedTex = MakeGradTex(128, 1, activePalette.selectedA, activePalette.selectedB);
				buttonHoverTex = MakeTex(1, 1, activePalette.buttonHover);
				themeIconTex = MakeThemeIcon(value, activePalette);
				whiteTex = MakeTex(1, 1, Color.white);
			}
		}

		private ThemePalette GetPalette(PanelThemeMode theme)
		{
			//IL_0037: Unknown result type (might be due to invalid IL or missing references)
			//IL_003c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0057: Unknown result type (might be due to invalid IL or missing references)
			//IL_005c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0077: Unknown result type (might be due to invalid IL or missing references)
			//IL_007c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0097: 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)
			//IL_00b7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00dc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fc: Unknown result type (might be due to invalid IL or missing references)
			//IL_0117: Unknown result type (might be due to invalid IL or missing references)
			//IL_011c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0137: Unknown result type (might be due to invalid IL or missing references)
			//IL_013c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0157: Unknown result type (might be due to invalid IL or missing references)
			//IL_015c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0177: Unknown result type (might be due to invalid IL or missing references)
			//IL_017c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0197: Unknown result type (might be due to invalid IL or missing references)
			//IL_019c: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b7: Unknown result type (might be due to invalid IL or missing references)
			//IL_01bc: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d7: Unknown result type (might be due to invalid IL or missing references)
			//IL_01dc: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f7: Unknown result type (might be due to invalid IL or missing references)
			//IL_01fc: Unknown result type (might be due to invalid IL or missing references)
			//IL_0217: Unknown result type (might be due to invalid IL or missing references)
			//IL_021c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0237: Unknown result type (might be due to invalid IL or missing references)
			//IL_023c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0257: Unknown result type (might be due to invalid IL or missing references)
			//IL_025c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0277: Unknown result type (might be due to invalid IL or missing references)
			//IL_027c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0283: Unknown result type (might be due to invalid IL or missing references)
			//IL_0288: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ad: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b2: Unknown result type (might be due to invalid IL or missing references)
			//IL_02cd: Unknown result type (might be due to invalid IL or missing references)
			//IL_02d2: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ed: Unknown result type (might be due to invalid IL or missing references)
			//IL_02f2: Unknown result type (might be due to invalid IL or missing references)
			//IL_030d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0312: Unknown result type (might be due to invalid IL or missing references)
			//IL_032d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0332: Unknown result type (might be due to invalid IL or missing references)
			//IL_034d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0352: Unknown result type (might be due to invalid IL or missing references)
			//IL_036d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0372: Unknown result type (might be due to invalid IL or missing references)
			//IL_038d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0392: Unknown result type (might be due to invalid IL or missing references)
			//IL_03ad: Unknown result type (might be due to invalid IL or missing references)
			//IL_03b2: Unknown result type (might be due to invalid IL or missing references)
			//IL_03cd: Unknown result type (might be due to invalid IL or missing references)
			//IL_03d2: Unknown result type (might be due to invalid IL or missing references)
			//IL_03ed: Unknown result type (might be due to invalid IL or missing references)
			//IL_03f2: Unknown result type (might be due to invalid IL or missing references)
			//IL_040d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0412: Unknown result type (might be due to invalid IL or missing references)
			//IL_042d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0432: Unknown result type (might be due to invalid IL or missing references)
			//IL_044d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0452: Unknown result type (might be due to invalid IL or missing references)
			//IL_046d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0472: Unknown result type (might be due to invalid IL or missing references)
			//IL_048d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0492: Unknown result type (might be due to invalid IL or missing references)
			//IL_04ad: Unknown result type (might be due to invalid IL or missing references)
			//IL_04b2: Unknown result type (might be due to invalid IL or missing references)
			//IL_04cd: Unknown result type (might be due to invalid IL or missing references)
			//IL_04d2: Unknown result type (might be due to invalid IL or missing references)
			//IL_04ed: Unknown result type (might be due to invalid IL or missing references)
			//IL_04f2: Unknown result type (might be due to invalid IL or missing references)
			//IL_04f9: Unknown result type (might be due to invalid IL or missing references)
			//IL_04fe: Unknown result type (might be due to invalid IL or missing references)
			//IL_0523: Unknown result type (might be due to invalid IL or missing references)
			//IL_0528: Unknown result type (might be due to invalid IL or missing references)
			//IL_0543: Unknown result type (might be due to invalid IL or missing references)
			//IL_0548: Unknown result type (might be due to invalid IL or missing references)
			//IL_0563: Unknown result type (might be due to invalid IL or missing references)
			//IL_0568: Unknown result type (might be due to invalid IL or missing references)
			//IL_0583: Unknown result type (might be due to invalid IL or missing references)
			//IL_0588: Unknown result type (might be due to invalid IL or missing references)
			//IL_05a3: Unknown result type (might be due to invalid IL or missing references)
			//IL_05a8: Unknown result type (might be due to invalid IL or missing references)
			//IL_05c3: Unknown result type (might be due to invalid IL or missing references)
			//IL_05c8: Unknown result type (might be due to invalid IL or missing references)
			//IL_05e3: Unknown result type (might be due to invalid IL or missing references)
			//IL_05e8: Unknown result type (might be due to invalid IL or missing references)
			//IL_0603: Unknown result type (might be due to invalid IL or missing references)
			//IL_0608: Unknown result type (might be due to invalid IL or missing references)
			//IL_0623: Unknown result type (might be due to invalid IL or missing references)
			//IL_0628: Unknown result type (might be due to invalid IL or missing references)
			//IL_0643: Unknown result type (might be due to invalid IL or missing references)
			//IL_0648: Unknown result type (might be due to invalid IL or missing references)
			//IL_0663: Unknown result type (might be due to invalid IL or missing references)
			//IL_0668: Unknown result type (might be due to invalid IL or missing references)
			//IL_0683: Unknown result type (might be due to invalid IL or missing references)
			//IL_0688: Unknown result type (might be due to invalid IL or missing references)
			//IL_06a3: Unknown result type (might be due to invalid IL or missing references)
			//IL_06a8: Unknown result type (might be due to invalid IL or missing references)
			//IL_06c3: Unknown result type (might be due to invalid IL or missing references)
			//IL_06c8: Unknown result type (might be due to invalid IL or missing references)
			//IL_06e3: Unknown result type (might be due to invalid IL or missing references)
			//IL_06e8: Unknown result type (might be due to invalid IL or missing references)
			//IL_0703: Unknown result type (might be due to invalid IL or missing references)
			//IL_0708: Unknown result type (might be due to invalid IL or missing references)
			//IL_0723: Unknown result type (might be due to invalid IL or missing references)
			//IL_0728: Unknown result type (might be due to invalid IL or missing references)
			//IL_0743: Unknown result type (might be due to invalid IL or missing references)
			//IL_0748: Unknown result type (might be due to invalid IL or missing references)
			//IL_0763: Unknown result type (might be due to invalid IL or missing references)
			//IL_0768: Unknown result type (might be due to invalid IL or missing references)
			//IL_076f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0774: Unknown result type (might be due to invalid IL or missing references)
			//IL_0799: Unknown result type (might be due to invalid IL or missing references)
			//IL_079e: Unknown result type (might be due to invalid IL or missing references)
			//IL_07b9: Unknown result type (might be due to invalid IL or missing references)
			//IL_07be: Unknown result type (might be due to invalid IL or missing references)
			//IL_07d9: Unknown result type (might be due to invalid IL or missing references)
			//IL_07de: Unknown result type (might be due to invalid IL or missing references)
			//IL_07f9: Unknown result type (might be due to invalid IL or missing references)
			//IL_07fe: Unknown result type (might be due to invalid IL or missing references)
			//IL_0819: Unknown result type (might be due to invalid IL or missing references)
			//IL_081e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0839: Unknown result type (might be due to invalid IL or missing references)
			//IL_083e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0859: Unknown result type (might be due to invalid IL or missing references)
			//IL_085e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0879: Unknown result type (might be due to invalid IL or missing references)
			//IL_087e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0899: Unknown result type (might be due to invalid IL or missing references)
			//IL_089e: Unknown result type (might be due to invalid IL or missing references)
			//IL_08b9: Unknown result type (might be due to invalid IL or missing references)
			//IL_08be: Unknown result type (might be due to invalid IL or missing references)
			//IL_08d9: Unknown result type (might be due to invalid IL or missing references)
			//IL_08de: Unknown result type (might be due to invalid IL or missing references)
			//IL_08f9: Unknown result type (might be due to invalid IL or missing references)
			//IL_08fe: Unknown result type (might be due to invalid IL or missing references)
			//IL_0919: Unknown result type (might be due to invalid IL or missing references)
			//IL_091e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0939: Unknown result type (might be due to invalid IL or missing references)
			//IL_093e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0959: Unknown result type (might be due to invalid IL or missing references)
			//IL_095e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0979: Unknown result type (might be due to invalid IL or missing references)
			//IL_097e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0999: Unknown result type (might be due to invalid IL or missing references)
			//IL_099e: Unknown result type (might be due to invalid IL or missing references)
			//IL_09b9: Unknown result type (might be due to invalid IL or missing references)
			//IL_09be: Unknown result type (might be due to invalid IL or missing references)
			//IL_09d9: Unknown result type (might be due to invalid IL or missing references)
			//IL_09de: Unknown result type (might be due to invalid IL or missing references)
			//IL_09e5: Unknown result type (might be due to invalid IL or missing references)
			//IL_09ea: Unknown result type (might be due to invalid IL or missing references)
			switch (theme)
			{
			case PanelThemeMode.Black:
			{
				ThemePalette result = default(ThemePalette);
				result.panelBg = new Color(0.055f, 0.06f, 0.075f, 0.95f);
				result.titleBg = new Color(0.09f, 0.1f, 0.13f, 0.96f);
				result.text = new Color(0.94f, 0.96f, 1f, 1f);
				result.textDim = new Color(0.64f, 0.69f, 0.78f, 1f);
				result.accentA = new Color(0.12f, 0.55f, 0.88f, 1f);
				result.accentB = new Color(0.55f, 0.34f, 0.92f, 1f);
				result.accentC = new Color(0.96f, 0.62f, 0.35f, 1f);
				result.buttonA = new Color(0.13f, 0.15f, 0.2f, 0.98f);
				result.buttonB = new Color(0.18f, 0.2f, 0.27f, 0.98f);
				result.selectedA = new Color(0.06f, 0.33f, 0.68f, 1f);
				result.selectedB = new Color(0.36f, 0.16f, 0.62f, 1f);
				result.buttonHover = new Color(1f, 1f, 1f, 0.12f);
				result.selectedBorder = new Color(0.28f, 0.64f, 1f, 0.95f);
				result.border = new Color(0.58f, 0.66f, 0.82f, 0.44f);
				result.separator = new Color(0.48f, 0.55f, 0.7f, 0.48f);
				result.sliderTrack = new Color(0.12f, 0.13f, 0.17f, 1f);
				result.thumb = new Color(0.9f, 0.93f, 0.98f, 1f);
				result.titleButtonBg = new Color(0.07f, 0.08f, 0.11f, 0.98f);
				result.titleButtonIcon = new Color(0.84f, 0.89f, 1f, 1f);
				result.selectedText = Color.white;
				return result;
			}
			case PanelThemeMode.White:
			{
				ThemePalette result = default(ThemePalette);
				result.panelBg = new Color(0.97f, 0.98f, 1f, 0.96f);
				result.titleBg = new Color(0.9f, 0.93f, 0.98f, 0.96f);
				result.text = new Color(0.1f, 0.12f, 0.18f, 1f);
				result.textDim = new Color(0.32f, 0.36f, 0.46f, 1f);
				result.accentA = new Color(0.1f, 0.48f, 0.92f, 1f);
				result.accentB = new Color(0.46f, 0.32f, 0.88f, 1f);
				result.accentC = new Color(0.95f, 0.58f, 0.32f, 1f);
				result.buttonA = new Color(0.82f, 0.88f, 0.96f, 0.98f);
				result.buttonB = new Color(0.74f, 0.78f, 0.9f, 0.98f);
				result.selectedA = new Color(0.08f, 0.38f, 0.82f, 1f);
				result.selectedB = new Color(0.36f, 0.22f, 0.72f, 1f);
				result.buttonHover = new Color(1f, 1f, 1f, 0.34f);
				result.selectedBorder = new Color(0.16f, 0.42f, 0.92f, 0.95f);
				result.border = new Color(0.25f, 0.32f, 0.45f, 0.38f);
				result.separator = new Color(0.36f, 0.42f, 0.54f, 0.45f);
				result.sliderTrack = new Color(0.78f, 0.82f, 0.89f, 1f);
				result.thumb = new Color(0.98f, 0.99f, 1f, 1f);
				result.titleButtonBg = new Color(0.18f, 0.22f, 0.32f, 0.96f);
				result.titleButtonIcon = new Color(0.94f, 0.97f, 1f, 1f);
				result.selectedText = Color.white;
				return result;
			}
			case PanelThemeMode.Transparent:
			{
				ThemePalette result = default(ThemePalette);
				result.panelBg = new Color(0.04f, 0.06f, 0.1f, 0.54f);
				result.titleBg = new Color(0.04f, 0.06f, 0.1f, 0.4f);
				result.text = new Color(0.94f, 0.97f, 1f, 1f);
				result.textDim = new Color(0.76f, 0.82f, 0.92f, 1f);
				result.accentA = new Color(0.1f, 0.68f, 0.95f, 0.92f);
				result.accentB = new Color(0.68f, 0.38f, 0.96f, 0.92f);
				result.accentC = new Color(1f, 0.7f, 0.4f, 0.92f);
				result.buttonA = new Color(0.18f, 0.28f, 0.42f, 0.5f);
				result.buttonB = new Color(0.34f, 0.24f, 0.5f, 0.5f);
				result.selectedA = new Color(0.08f, 0.4f, 0.86f, 0.78f);
				result.selectedB = new Color(0.48f, 0.24f, 0.82f, 0.78f);
				result.buttonHover = new Color(1f, 1f, 1f, 0.16f);
				result.selectedBorder = new Color(0.7f, 0.86f, 1f, 0.88f);
				result.border = new Color(0.9f, 0.95f, 1f, 0.34f);
				result.separator = new Color(0.8f, 0.88f, 1f, 0.3f);
				result.sliderTrack = new Color(0.08f, 0.1f, 0.16f, 0.62f);
				result.thumb = new Color(0.92f, 0.96f, 1f, 0.94f);
				result.titleButtonBg = new Color(0.06f, 0.08f, 0.12f, 0.62f);
				result.titleButtonIcon = new Color(0.9f, 0.95f, 1f, 0.96f);
				result.selectedText = Color.white;
				return result;
			}
			default:
			{
				ThemePalette result = default(ThemePalette);
				result.panelBg = new Color(0.9f, 0.96f, 1f, 0.94f);
				result.titleBg = new Color(0.82f, 0.91f, 1f, 0.78f);
				result.text = new Color(0.12f, 0.14f, 0.26f, 1f);
				result.textDim = new Color(0.22f, 0.25f, 0.39f, 1f);
				result.accentA = new Color(0.13f, 0.55f, 0.98f, 1f);
				result.accentB = new Color(0.67f, 0.34f, 0.95f, 1f);
				result.accentC = new Color(1f, 0.72f, 0.48f, 1f);
				result.buttonA = new Color(0.19f, 0.55f, 0.98f, 0.95f);
				result.buttonB = new Color(0.55f, 0.32f, 0.88f, 0.95f);
				result.selectedA = new Color(0.1f, 0.35f, 0.82f, 1f);
				result.selectedB = new Color(0.35f, 0.2f, 0.7f, 1f);
				result.buttonHover = new Color(1f, 1f, 1f, 0.18f);
				result.selectedBorder = new Color(0.18f, 0.45f, 0.95f, 0.95f);
				result.border = new Color(1f, 1f, 1f, 0.95f);
				result.separator = new Color(0.34f, 0.42f, 0.58f, 0.55f);
				result.sliderTrack = new Color(0.8f, 0.84f, 0.9f, 1f);
				result.thumb = new Color(0.92f, 0.95f, 1f, 1f);
				result.titleButtonBg = new Color(0.12f, 0.14f, 0.28f, 0.96f);
				result.titleButtonIcon = new Color(0.78f, 0.84f, 0.96f, 1f);
				result.selectedText = Color.white;
				return result;
			}
			}
		}

		private void ApplyThemeToStyles(ThemePalette palette)
		{
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			//IL_0038: Unknown result type (might be due to invalid IL or missing references)
			//IL_004e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0064: Unknown result type (might be due to invalid IL or missing references)
			//IL_007a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0090: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fc: Unknown result type (might be due to invalid IL or missing references)
			//IL_0112: Unknown result type (might be due to invalid IL or missing references)
			//IL_0128: Unknown result type (might be due to invalid IL or missing references)
			titleStyle.normal.textColor = palette.text;
			sectionStyle.normal.textColor = palette.text;
			groupLabelStyle.normal.textColor = palette.textDim;
			btnStyle.normal.textColor = palette.text;
			btnStyle.hover.textColor = palette.text;
			btnStyle.active.textColor = palette.text;
			selectedBtnStyle.normal.textColor = palette.selectedText;
			selectedBtnStyle.hover.textColor = palette.selectedText;
			selectedBtnStyle.active.textColor = palette.selectedText;
			closeBtnStyle.normal.textColor = palette.titleButtonIcon;
			closeBtnStyle.hover.textColor = Color.white;
			closeBtnStyle.active.textColor = Color.white;
			labelStyle.normal.textColor = palette.textDim;
			valueStyle.normal.textColor = palette.text;
		}

		private Texture2D MakeThemeIcon(PanelThemeMode theme, ThemePalette palette)
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Expected O, but got Unknown
			//IL_0028: Unknown result type (might be due to invalid IL or missing references)
			//IL_002d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0074: Unknown result type (might be due to invalid IL or missing references)
			//IL_0084: Unknown result type (might be due to invalid IL or missing references)
			//IL_008e: Unknown result type (might be due to invalid IL or missing references)
			//IL_003b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0099: Unknown result type (might be due to invalid IL or missing references)
			//IL_009f: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
			Texture2D val = new Texture2D(18, 18, (TextureFormat)4, false);
			Color val2 = default(Color);
			((Color)(ref val2))..ctor(0f, 0f, 0f, 0f);
			Color titleButtonIcon = palette.titleButtonIcon;
			for (int i = 0; i < 18; i++)
			{
				for (int j = 0; j < 18; j++)
				{
					val.SetPixel(j, i, val2);
				}
			}
			switch (theme)
			{
			case PanelThemeMode.Black:
				FillRect(val, 4, 4, 10, 10, titleButtonIcon);
				break;
			case PanelThemeMode.White:
				DrawRect(val, 4, 4, 10, 10, titleButtonIcon);
				break;
			case PanelThemeMode.Transparent:
				DrawCheckerIcon(val, titleButtonIcon);
				break;
			default:
				DrawSunIcon(val, palette.accentA, palette.accentB, palette.accentC);
				break;
			}
			val.Apply();
			((Object)val).hideFlags = (HideFlags)61;
			return val;
		}

		private void DrawSunIcon(Texture2D tex, Color a, Color b, Color c)
		{
			//IL_00b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ac: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c6: Unknown result type (might be due to invalid IL or missing references)
			int width = ((Texture)tex).width;
			float num = (float)(width - 1) * 0.5f;
			for (int i = 0; i < width; i++)
			{
				for (int j = 0; j < width; j++)
				{
					float num2 = (float)j - num;
					float num3 = (float)i - num;
					float num4 = Mathf.Sqrt(num2 * num2 + num3 * num3);
					bool flag = (Mathf.Abs(num2) < 0.75f || Mathf.Abs(num3) < 0.75f || Mathf.Abs(Mathf.Abs(num2) - Mathf.Abs(num3)) < 0.75f) && num4 > 6f && num4 < 8.6f;
					if (num4 <= 4.2f || flag)
					{
						Color val = (((float)j < num) ? Color.Lerp(a, b, (float)i / (float)(width - 1)) : Color.Lerp(b, c, (float)i / (float)(width - 1)));
						tex.SetPixel(j, i, val);
					}
				}
			}
		}

		private void DrawCheckerIcon(Texture2D tex, Color color)
		{
			//IL_0054: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Unknown result type (might be due to invalid IL or missing references)
			//IL_003c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0042: Unknown result type (might be due to invalid IL or missing references)
			//IL_004d: Unknown result type (might be due to invalid IL or missing references)
			for (int i = 3; i < 15; i++)
			{
				for (int j = 3; j < 15; j++)
				{
					bool flag = j == 3 || j == 14 || i == 3 || i == 14;
					bool flag2 = (j / 3 + i / 3) % 2 == 0;
					if (flag || flag2)
					{
						tex.SetPixel(j, i, (Color)(flag ? color : new Color(color.r, color.g, color.b, 0.45f)));
					}
				}
			}
		}

		private void FillRect(Texture2D tex, int x, int y, int w, int h, Color color)
		{
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			for (int i = y; i < y + h; i++)
			{
				for (int j = x; j < x + w; j++)
				{
					tex.SetPixel(j, i, color);
				}
			}
		}

		private void DrawRect(Texture2D tex, int x, int y, int w, int h, Color color)
		{
			//IL_0009: Unknown result type (might be due to invalid IL or missing references)
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0033: Unknown result type (might be due to invalid IL or missing references)
			//IL_0044: Unknown result type (might be due to invalid IL or missing references)
			for (int i = 0; i < w; i++)
			{
				tex.SetPixel(x + i, y, color);
				tex.SetPixel(x + i, y + h - 1, color);
			}
			for (int j = 0; j < h; j++)
			{
				tex.SetPixel(x, y + j, color);
				tex.SetPixel(x + w - 1, y + j, color);
			}
		}

		private PanelThemeMode GetNextTheme(PanelThemeMode theme)
		{
			return theme switch
			{
				PanelThemeMode.Colorful => PanelThemeMode.Black, 
				PanelThemeMode.Black => PanelThemeMode.White, 
				PanelThemeMode.White => PanelThemeMode.Transparent, 
				_ => PanelThemeMode.Colorful, 
			};
		}

		private void DestroyThemeTextures()
		{
			DestroyTexture(panelBgTex);
			DestroyTexture(titleBgTex);
			DestroyTexture(gradSliderBg);
			DestroyTexture(sliderTrackTex);
			DestroyTexture(buttonGradTex);
			DestroyTexture(buttonSelectedTex);
			DestroyTexture(buttonHoverTex);
			DestroyTexture(themeIconTex);
			DestroyTexture(whiteTex);
			panelBgTex = null;
			titleBgTex = null;
			gradSliderBg = null;
			sliderTrackTex = null;
			buttonGradTex = null;
			buttonSelectedTex = null;
			buttonHoverTex = null;
			themeIconTex = null;
			whiteTex = null;
		}

		private void Awake()
		{
			Localization.Initialize();
			((Rect)(ref panelRect)).x = FilterConfig.UIPanelX.Value;
			((Rect)(ref panelRect)).y = FilterConfig.UIPanelY.Value;
		}

		private void Update()
		{
			if (Input.GetKeyDown((KeyCode)284))
			{
				showPanel = !showPanel;
				CursorPatch.SetUnlock(showPanel);
			}
		}

		private void OnGUI()
		{
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			//IL_002a: Unknown result type (might be due to invalid IL or missing references)
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d8: Unknown result type (might be due to invalid IL or missing references)
			//IL_0134: Unknown result type (might be due to invalid IL or missing references)
			//IL_0142: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f2: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ae: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b4: Invalid comparison between Unknown and I4
			//IL_0155: Unknown result type (might be due to invalid IL or missing references)
			//IL_0115: Unknown result type (might be due to invalid IL or missing references)
			//IL_0234: Unknown result type (might be due to invalid IL or missing references)
			//IL_0250: Unknown result type (might be due to invalid IL or missing references)
			//IL_0262: Unknown result type (might be due to invalid IL or missing references)
			//IL_028c: Unknown result type (might be due to invalid IL or missing references)
			//IL_02d1: Unknown result type (might be due to invalid IL or missing references)
			//IL_02dc: Unknown result type (might be due to invalid IL or missing references)
			//IL_02e7: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ef: Unknown result type (might be due to invalid IL or missing references)
			//IL_02f9: Unknown result type (might be due to invalid IL or missing references)
			//IL_030b: Unknown result type (might be due to invalid IL or missing references)
			//IL_031b: Expected O, but got Unknown
			//IL_0216: Unknown result type (might be due to invalid IL or missing references)
			//IL_021c: Invalid comparison between Unknown and I4
			//IL_01bb: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c1: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c6: Unknown result type (might be due to invalid IL or missing references)
			//IL_01cb: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d3: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ec: Unknown result type (might be due to invalid IL or missing references)
			//IL_0168: Unknown result type (might be due to invalid IL or missing references)
			//IL_033e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0346: Unknown result type (might be due to invalid IL or missing references)
			//IL_0350: Unknown result type (might be due to invalid IL or missing references)
			//IL_0181: Unknown result type (might be due to invalid IL or missing references)
			//IL_0188: Unknown result type (might be due to invalid IL or missing references)
			//IL_018d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0192: Unknown result type (might be due to invalid IL or missing references)
			//IL_039f: Unknown result type (might be due to invalid IL or missing references)
			//IL_03a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_03bc: Unknown result type (might be due to invalid IL or missing references)
			//IL_03c1: Unknown result type (might be due to invalid IL or missing references)
			//IL_03c6: Unknown result type (might be due to invalid IL or missing references)
			//IL_0407: Unknown result type (might be due to invalid IL or missing references)
			//IL_043e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0488: Unknown result type (might be due to invalid IL or missing references)
			//IL_0525: Unknown result type (might be due to invalid IL or missing references)
			//IL_06f1: Unknown result type (might be due to invalid IL or missing references)
			//IL_063d: Unknown result type (might be due to invalid IL or missing references)
			if (!showPanel)
			{
				return;
			}
			InitStyles();
			InitTextures();
			GUI.matrix = Matrix4x4.TRS(Vector3.zero, Quaternion.identity, Vector3.one * scale);
			float num = ((Rect)(ref panelRect)).x / scale;
			float num2 = ((Rect)(ref panelRect)).y / scale;
			float num3 = 660f;
			float contentHeight = GetContentHeight();
			float num4 = Mathf.Min(contentHeight + 42f + 8f, 900f);
			Rect val = default(Rect);
			((Rect)(ref val))..ctor(num, num2, num3, num4);
			Rect val2 = default(Rect);
			((Rect)(ref val2))..ctor(num + num3 - 76f, num2 + 6f, 30f, 30f);
			Rect val3 = default(Rect);
			((Rect)(ref val3))..ctor(num + num3 - 40f, num2 + 6f, 30f, 30f);
			if ((int)Event.current.type == 0 && Event.current.button == 0 && !((Rect)(ref val)).Contains(Event.current.mousePosition))
			{
				showPanel = false;
				CursorPatch.SetUnlock(unlock: false);
				Event.current.Use();
				GUI.matrix = Matrix4x4.identity;
				return;
			}
			Rect val4 = default(Rect);
			((Rect)(ref val4))..ctor(num, num2, num3, 42f);
			if ((int)Event.current.type == 0 && ((Rect)(ref val4)).Contains(Event.current.mousePosition) && !((Rect)(ref val2)).Contains(Event.current.mousePosition) && !((Rect)(ref val3)).Contains(Event.current.mousePosition))
			{
				isDragging = true;
				dragOffset = Event.current.mousePosition - new Vector2(num, num2);
				Event.current.Use();
			}
			if (isDragging && (int)Event.current.type == 3)
			{
				Vector2 val5 = Event.current.mousePosition - dragOffset;
				((Rect)(ref panelRect)).x = val5.x * scale;
				((Rect)(ref panelRect)).y = val5.y * scale;
				Event.current.Use();
			}
			if (isDragging && (int)Event.current.type == 1)
			{
				isDragging = false;
				Event.current.Use();
			}
			GUI.DrawTexture(new Rect(num, num2, num3, num4), (Texture)(object)panelBgTex);
			DrawBorder(num, num2, num3, num4, activePalette.border);
			GUI.DrawTexture(new Rect(num, num2, num3, 42f), (Texture)(object)titleBgTex);
			GUI.Label(new Rect(num + 16f, num2 + 2f, num3 - 112f, 38f), Localization.Get("title") + " v1.1.4", titleStyle);
			DrawSolidRect(new Rect(num + 16f, num2 + 42f - 1f, num3 - 32f, 1f), activePalette.separator);
			DrawSolidRect(val2, activePalette.titleButtonBg);
			if (GUI.Button(val2, new GUIContent((Texture)(object)themeIconTex, Localization.Get("theme")), iconBtnStyle))
			{
				FilterConfig.UIPanelTheme.Value = GetNextTheme(FilterConfig.UIPanelTheme.Value);
				InitTextures();
			}
			DrawSolidRect(val3, activePalette.titleButtonBg);
			if (GUI.Button(val3, "X", closeBtnStyle))
			{
				showPanel = false;
				CursorPatch.SetUnlock(unlock: false);
			}
			float num5 = num;
			float num6 = num2 + 42f + 2f;
			float num7 = num3;
			float num8 = num4 - 42f - 6f;
			scrollPos = GUI.BeginScrollView(new Rect(num5, num6, num7, num8), scrollPos, new Rect(0f, 0f, num3 - 18f, contentHeight));
			float num9 = 16f;
			float num10 = 12f;
			float num11 = num3 - 32f - 18f;
			float num12 = num9;
			float num13 = num11;
			FilterType value = FilterConfig.ActiveFilter.Value;
			GUI.Label(new Rect(num9, num10, num11, 22f), Localization.Get("filterSelection"), sectionStyle);
			num10 += 30f;
			bool selected = value == FilterType.None;
			if (DrawFilterButton(new Rect(num12, num10, num13, 36f), Localization.Get("none"), selected))
			{
				FilterConfig.ActiveFilter.Value = FilterType.None;
			}
			num10 += 48f;
			for (int i = 0; i < Groups.Length; i++)
			{
				FilterGroup filterGroup = Groups[i];
				GUI.Label(new Rect(num9, num10, num11, 22f), Localization.Get(filterGroup.label), groupLabelStyle);
				num10 += 22f;
				int columnCount = GetColumnCount(filterGroup.filters.Length);
				float num14 = (num13 - 8f * (float)(columnCount - 1)) / (float)columnCount;
				for (int j = 0; j < filterGroup.filters.Length; j++)
				{
					FilterType filterType = filterGroup.filters[j];
					bool selected2 = value == filterType;
					int num15 = j % columnCount;
					int num16 = j / columnCount;
					float num17 = num12 + (float)num15 * (num14 + 8f);
					float num18 = num10 + (float)num16 * 44f;
					if (DrawFilterButton(new Rect(num17, num18, num14, 36f), Localization.Get(FilterKeys[filterType]), selected2))
					{
						FilterConfig.ActiveFilter.Value = filterType;
					}
				}
				num10 += GetGroupHeight(filterGroup) + 12f;
			}
			num10 += 8f;
			DrawSeparator(num9, num10, num11);
			num10 += 14f;
			float value2 = FilterConfig.Intensity.Value;
			DrawSliderBlock(num9, num10, num11, Localization.Get("intensity"), ref value2, 0f, 1f);
			if (!Mathf.Approximately(FilterConfig.I