Decompiled source of PeakFilter v1.1.7
plugins/PeakFilter.dll
Decompiled 3 days ago
The result has been truncated due to the large size, download it to view full contents!
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.7.0")] [assembly: AssemblyInformationalVersion("1.1.7+47d33ea1233c9713bd28e1b3ccf4c4b116152eef")] [assembly: AssemblyProduct("PeakFilter")] [assembly: AssemblyTitle("PeakFilter")] [assembly: AssemblyVersion("1.1.7.0")] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace 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<float> UIPanelScale; 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) { //IL_0768: Unknown result type (might be due to invalid IL or missing references) //IL_0772: Expected O, but got Unknown 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", 4f, "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.24f, "Chromatic channel split (0-1)"); CyberpunkGlitch = config.Bind<float>("Cyberpunk", "Glitch", 0.14f, "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.2f, "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.52f, "Illustrated paper texture amount (0-1)"); StorybookInk = config.Bind<float>("Storybook", "Ink", 0.22f, "Storybook ink outline amount (0-1)"); StorybookWarmth = config.Bind<float>("Storybook", "Warmth", 0.62f, "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.46f, "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.62f, "Layered cutout posterization (0-1)"); PaperCutoutShadow = config.Bind<float>("PaperCutout", "Shadow", 0.42f, "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.56f, "Halftone dot shading amount (0-1)"); WastelandComicInk = config.Bind<float>("WastelandComic", "Ink", 0.8f, "Bold American comic ink outline strength (0-1)"); WastelandComicContrast = config.Bind<float>("WastelandComic", "Contrast", 0.68f, "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.68f, "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.24f, "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"); UIPanelScale = config.Bind<float>("UI", "PanelScale", 1f, new ConfigDescription("Panel scale multiplier (0.5-1.5); fitted to the screen when necessary", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0.5f, 1.5f), Array.Empty<object>())); UIPanelScale.Value = (float)Math.Round(UIPanelScale.Value, 1, MidpointRounding.AwayFromZero); RequestSave(); 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 = 4f; 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.24f; CyberpunkGlitch.Value = 0.14f; EmberHeat.Value = 0.62f; EmberContrast.Value = 0.54f; EmberVignette.Value = 0.42f; RetroCRTScanlines.Value = 0.64f; RetroCRTColorBleed.Value = 0.2f; RetroCRTCurve.Value = 0.3f; ThermalHeat.Value = 0.82f; ThermalEdge.Value = 0.55f; ThermalNoise.Value = 0.26f; StorybookPaper.Value = 0.52f; StorybookInk.Value = 0.22f; StorybookWarmth.Value = 0.62f; WatercolorToonWash.Value = 0.52f; WatercolorToonBleed.Value = 0.46f; WatercolorToonPaper.Value = 0.34f; ComicFrameInk.Value = 0.62f; ComicFrameHalftone.Value = 0.26f; ComicFramePanels.Value = 0.16f; PaperCutoutLayers.Value = 0.62f; PaperCutoutShadow.Value = 0.42f; PaperCutoutTexture.Value = 0.22f; PaperComicPaper.Value = 0.58f; PaperComicInk.Value = 0.66f; PaperComicTone.Value = 0.56f; WastelandComicInk.Value = 0.8f; WastelandComicContrast.Value = 0.68f; WastelandComicGrunge.Value = 0.46f; PainterlyArtBrush.Value = 0.68f; PainterlyArtPalette.Value = 0.52f; PainterlyArtCanvas.Value = 0.24f; UIPanelTheme.Value = PanelThemeMode.Colorful; UIPanelScale.Value = 1f; } 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 (byte)(0u | (UpgradeIfDefault(Intensity, 0.86f, 0.84f) ? 1u : 0u) | (UpgradeIfDefault(SketchEdgeStrength, 2.8f, 2.6f) ? 1u : 0u) | (UpgradeIfDefault(SketchLineWidth, 3f, 2.4f) ? 1u : 0u) | (UpgradeIfDefault(SketchPaperTexture, 0.45f, 0.36f) ? 1u : 0u) | (UpgradeIfDefault(PencilDensity, 3.2f, 2.5f) ? 1u : 0u) | (UpgradeIfDefault(PencilDarkness, 1.8f, 1.45f) ? 1u : 0u) | (UpgradeIfDefault(PencilPaperGrain, 0.5f, 0.36f) ? 1u : 0u) | (UpgradeIfDefault(CelOutlineStrength, 3.2f, 2.5f) ? 1u : 0u) | (UpgradeIfDefault(CelColorSharpness, 10f, 8.5f) ? 1u : 0u) | (UpgradeIfDefault(CelTintAmount, 0.55f, 0.42f) ? 1u : 0u) | (UpgradeIfDefault(ToonRampSteps, 4f, 5f) ? 1u : 0u) | (UpgradeIfDefault(ToonShadowCutoff, 0.44f, 0.38f) ? 1u : 0u) | (UpgradeIfDefault(ToonInkStrength, 1.4f, 0.95f) ? 1u : 0u) | (UpgradeIfDefault(HorrorFearTint, 0.92f, 0.78f) ? 1u : 0u) | (UpgradeIfDefault(HorrorFearTint, 0.86f, 0.78f) ? 1u : 0u) | (UpgradeIfDefault(HorrorDarkness, 0.78f, 0.58f) ? 1u : 0u) | (UpgradeIfDefault(HorrorDarkness, 0.62f, 0.58f) ? 1u : 0u) | (UpgradeIfDefault(HorrorDarkness, 0.42f, 0.58f) ? 1u : 0u) | (UpgradeIfDefault(HorrorGrain, 0.7f, 0.46f) ? 1u : 0u) | (UpgradeIfDefault(PixelSize, 7f, 4f) ? 1u : 0u) | (UpgradeIfDefault(PixelSize, 6f, 4f) ? 1u : 0u) | (UpgradeIfDefault(PixelOutlineStrength, 0.8f, 0.65f) ? 1u : 0u) | (UpgradeIfDefault(PixelDitherAmount, 0.08f, 0.05f) ? 1u : 0u) | (UpgradeIfDefault(StorybookPaper, 0.48f, 0.52f) ? 1u : 0u) | (UpgradeIfDefault(StorybookPaper, 0.42f, 0.52f) ? 1u : 0u) | (UpgradeIfDefault(StorybookInk, 0.42f, 0.22f) ? 1u : 0u) | (UpgradeIfDefault(StorybookInk, 0.3f, 0.22f) ? 1u : 0u) | (UpgradeIfDefault(StorybookWarmth, 0.54f, 0.62f) ? 1u : 0u) | (UpgradeIfDefault(StorybookWarmth, 0.48f, 0.62f) ? 1u : 0u) | (UpgradeIfDefault(WatercolorToonWash, 0.6f, 0.52f) ? 1u : 0u) | (UpgradeIfDefault(WatercolorToonBleed, 0.44f, 0.46f) ? 1u : 0u) | (UpgradeIfDefault(WatercolorToonBleed, 0.3f, 0.46f) ? 1u : 0u) | (UpgradeIfDefault(WatercolorToonPaper, 0.46f, 0.34f) ? 1u : 0u) | (UpgradeIfDefault(ComicFrameInk, 0.7f, 0.62f) ? 1u : 0u) | (UpgradeIfDefault(ComicFrameHalftone, 0.38f, 0.26f) ? 1u : 0u) | (UpgradeIfDefault(ComicFramePanels, 0.28f, 0.16f) ? 1u : 0u) | (UpgradeIfDefault(PaperCutoutLayers, 0.6f, 0.62f) ? 1u : 0u) | (UpgradeIfDefault(PaperCutoutLayers, 0.48f, 0.62f) ? 1u : 0u) | (UpgradeIfDefault(PaperCutoutShadow, 0.44f, 0.42f) ? 1u : 0u) | (UpgradeIfDefault(PaperCutoutShadow, 0.28f, 0.42f) ? 1u : 0u) | (UpgradeIfDefault(PaperCutoutTexture, 0.38f, 0.22f) ? 1u : 0u) | (UpgradeIfDefault(CyberpunkSplit, 0.42f, 0.24f) ? 1u : 0u) | (UpgradeIfDefault(CyberpunkGlitch, 0.22f, 0.14f) ? 1u : 0u) | (UpgradeIfDefault(RetroCRTColorBleed, 0.34f, 0.2f) ? 1u : 0u) | (UpgradeIfDefault(PaperComicTone, 0.42f, 0.56f) ? 1u : 0u) | (UpgradeIfDefault(WastelandComicInk, 0.72f, 0.8f) ? 1u : 0u) | (UpgradeIfDefault(WastelandComicContrast, 0.62f, 0.68f) ? 1u : 0u) | (UpgradeIfDefault(PainterlyArtBrush, 0.56f, 0.68f) ? 1u : 0u) | (UpgradeIfDefault(PainterlyArtCanvas, 0.38f, 0.24f) ? 1u : 0u)) != 0; } 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 UniversalRenderPipelineAsset attachedPipeline; private ScriptableRendererData attachedRenderer; private bool ownsFeature; private float nextPipelineCheck; 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++; } } 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 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; attachedPipeline = val; attachedRenderer = rendererData; ownsFeature = false; 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); attachedPipeline = val; attachedRenderer = rendererData; ownsFeature = true; try { MethodInfo method = typeof(ScriptableRendererData).GetMethod("SetDirty", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic, null, Type.EmptyTypes, null); if (method != null) { method.Invoke(rendererData, null); } else { Debug.LogWarning((object)"[PeakFilter] ScriptableRendererData.SetDirty not found; renderer may not pick up the feature."); } } catch (Exception ex) { Debug.LogWarning((object)("[PeakFilter] SetDirty failed: " + ex)); } Debug.Log((object)"[PeakFilter] Injected PeakFilterFeature into URP pipeline."); } catch (Exception ex2) { Debug.LogError((object)("[PeakFilter] Error injecting renderer feature: " + ex2)); } } private ScriptableRendererData GetRendererData(UniversalRenderPipelineAsset pipelineAsset) { Type type = ((object)pipelineAsset).GetType(); FieldInfo field = type.GetField("m_RendererDataList", BindingFlags.Instance | BindingFlags.NonPublic); if (field != null) { try { if (field.GetValue(pipelineAsset) is ScriptableRendererData[] array && array.Length != 0) { FieldInfo field2 = type.GetField("m_DefaultRendererIndex", BindingFlags.Instance | BindingFlags.NonPublic); int num = ((field2 != null) ? ((int)field2.GetValue(pipelineAsset)) : 0); if (num >= 0 && num < array.Length && (Object)(object)array[num] != (Object)null) { return array[num]; } } } catch { } } try { PropertyInfo property = type.GetProperty("rendererDataList", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); if (property != null && property.PropertyType == typeof(ScriptableRendererData[]) && property.GetValue(pipelineAsset) is ScriptableRendererData[] array2 && array2.Length != 0 && (Object)(object)array2[0] != (Object)null) { return array2[0]; } } catch { } 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 (Time.unscaledTime >= nextPipelineCheck) { nextPipelineCheck = Time.unscaledTime + 2f; RenderPipelineAsset currentRenderPipeline = GraphicsSettings.currentRenderPipeline; UniversalRenderPipelineAsset val = (UniversalRenderPipelineAsset)(object)((currentRenderPipeline is UniversalRenderPipelineAsset) ? currentRenderPipeline : null); if ((Object)(object)val != (Object)null && ((Object)(object)filterFeature == (Object)null || (Object)(object)val != (Object)(object)attachedPipeline)) { DetachFeature(); InjectFeature(); lastAppliedConfigVersion = -1L; } } 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.TryGetValue(value, out var value4) || (Object)(object)value4 == (Object)null || (Object)(object)value4.shader == (Object)null || !value4.shader.isSupported || !value2 || !ShaderInternalNames.TryGetValue(value, out var value5) || ((Object)value4.shader).name != value5 || FilterConfig.Intensity.Value <= 0f) { filterFeature.IsActive = false; filterFeature.CurrentMaterial = null; lastAppliedConfigVersion = version; return; } SetFloat(value4, "_Intensity", Mathf.Clamp01(value3)); switch (value) { case FilterType.Sketch: SetFloat(value4, "_EdgeStrength", FilterConfig.SketchEdgeStrength.Value); SetFloat(value4, "_LineWidth", FilterConfig.SketchLineWidth.Value); SetFloat(value4, "_PaperTexture", FilterConfig.SketchPaperTexture.Value); break; case FilterType.PencilSketch: SetFloat(value4, "_PencilDensity", FilterConfig.PencilDensity.Value); SetFloat(value4, "_PencilDarkness", FilterConfig.PencilDarkness.Value); SetFloat(value4, "_PaperGrain", FilterConfig.PencilPaperGrain.Value); break; case FilterType.CelShade: SetFloat(value4, "_OutlineStrength", FilterConfig.CelOutlineStrength.Value); SetFloat(value4, "_ColorSharpness", FilterConfig.CelColorSharpness.Value); SetFloat(value4, "_TintAmount", FilterConfig.CelTintAmount.Value); break; case FilterType.ToonRamp: SetFloat(value4, "_RampSteps", FilterConfig.ToonRampSteps.Value); SetFloat(value4, "_ShadowCutoff", FilterConfig.ToonShadowCutoff.Value); SetFloat(value4, "_InkStrength", FilterConfig.ToonInkStrength.Value); break; case FilterType.Horror: SetFloat(value4, "_FearTint", FilterConfig.HorrorFearTint.Value); SetFloat(value4, "_Darkness", FilterConfig.HorrorDarkness.Value); SetFloat(value4, "_Grain", FilterConfig.HorrorGrain.Value); break; case FilterType.Pixelate: SetFloat(value4, "_PixelSize", FilterConfig.PixelSize.Value); SetFloat(value4, "_OutlineStrength", FilterConfig.PixelOutlineStrength.Value); SetFloat(value4, "_DitherAmount", FilterConfig.PixelDitherAmount.Value); break; case FilterType.Adventure: SetGameGrade(value4, 1f, FilterConfig.AdventureVibrance.Value, FilterConfig.AdventureSkyLift.Value, FilterConfig.AdventureClarity.Value); break; case FilterType.Cyberpunk: SetGameGrade(value4, 3f, FilterConfig.CyberpunkNeon.Value, FilterConfig.CyberpunkSplit.Value, FilterConfig.CyberpunkGlitch.Value); break; case FilterType.Ember: SetGameGrade(value4, 4f, FilterConfig.EmberHeat.Value, FilterConfig.EmberContrast.Value, FilterConfig.EmberVignette.Value); break; case FilterType.RetroCRT: SetGameGrade(value4, 5f, FilterConfig.RetroCRTScanlines.Value, FilterConfig.RetroCRTColorBleed.Value, FilterConfig.RetroCRTCurve.Value); break; case FilterType.ThermalVision: SetGameGrade(value4, 6f, FilterConfig.ThermalHeat.Value, FilterConfig.ThermalEdge.Value, FilterConfig.ThermalNoise.Value); break; case FilterType.Storybook: SetGameGrade(value4, 2f, FilterConfig.StorybookPaper.Value, FilterConfig.StorybookInk.Value, FilterConfig.StorybookWarmth.Value); break; case FilterType.WatercolorToon: SetGameGrade(value4, 3f, FilterConfig.WatercolorToonWash.Value, FilterConfig.WatercolorToonBleed.Value, FilterConfig.WatercolorToonPaper.Value); break; case FilterType.ComicFrame: SetGameGrade(value4, 4f, FilterConfig.ComicFrameInk.Value, FilterConfig.ComicFrameHalftone.Value, FilterConfig.ComicFramePanels.Value); break; case FilterType.PaperCutout: SetGameGrade(value4, 6f, FilterConfig.PaperCutoutLayers.Value, FilterConfig.PaperCutoutShadow.Value, FilterConfig.PaperCutoutTexture.Value); break; case FilterType.PaperComic: SetGameGrade(value4, 7f, FilterConfig.PaperComicPaper.Value, FilterConfig.PaperComicInk.Value, FilterConfig.PaperComicTone.Value); break; case FilterType.WastelandComic: SetGameGrade(value4, 8f, FilterConfig.WastelandComicInk.Value, FilterConfig.WastelandComicContrast.Value, FilterConfig.WastelandComicGrunge.Value); break; case FilterType.PainterlyArt: SetGameGrade(value4, 10f, FilterConfig.PainterlyArtBrush.Value, FilterConfig.PainterlyArtPalette.Value, FilterConfig.PainterlyArtCanvas.Value); break; } filterFeature.CurrentMaterial = value4; 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 DetachFeature() { if ((Object)(object)filterFeature != (Object)null) { filterFeature.IsActive = false; filterFeature.CurrentMaterial = null; if (ownsFeature) { if ((Object)(object)attachedRenderer != (Object)null) { attachedRenderer.rendererFeatures.Remove((ScriptableRendererFeature)(object)filterFeature); attachedRenderer.SetDirty(); } Object.Destroy((Object)(object)filterFeature); } } filterFeature = null; attachedPipeline = null; attachedRenderer = null; ownsFeature = false; } private void OnDestroy() { DetachFeature(); 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; private PeakFilterPass pass; public override void Create() { pass?.Dispose(); PeakFilterPass peakFilterPass = new PeakFilterPass(); ((ScriptableRenderPass)peakFilterPass).renderPassEvent = (RenderPassEvent)600; ((ScriptableRenderPass)peakFilterPass).requiresIntermediateTexture = true; pass = peakFilterPass; ((ScriptableRenderPass)pass).ConfigureInput((ScriptableRenderPassInput)4); } protected override void Dispose(bool disposing) { pass?.Dispose(); pass = null; } public override void AddRenderPasses(ScriptableRenderer renderer, ref RenderingData renderingData) { //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Invalid comparison between Unknown and I4 if (IsActive && !((Object)(object)CurrentMaterial == (Object)null) && (int)((CameraData)(ref renderingData.cameraData)).cameraType == 1 && (int)((CameraData)(ref renderingData.cameraData)).camera.cameraType != 4) { if (pass == null) { ((ScriptableRendererFeature)this).Create(); } pass.Material = CurrentMaterial; renderer.EnqueuePass((ScriptableRenderPass)(object)pass); } } } public class PeakFilterPass : ScriptableRenderPass { private RTHandle compatibilityTarget; public Material Material { get; set; } public void Dispose() { RTHandle obj = compatibilityTarget; if (obj != null) { obj.Release(); } compatibilityTarget = null; } 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_0089: 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", false, "D:\\Mod Projects\\PeakFilter\\FilterRenderer.cs", 80); val.cameraColor = val2; } } } public override void OnCameraSetup(CommandBuffer cmd, ref RenderingData renderingData) { //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references) RenderTextureDescriptor cameraTargetDescriptor = ((CameraData)(ref renderingData.cameraData)).cameraTargetDescriptor; ((RenderTextureDescriptor)(ref cameraTargetDescriptor)).depthBufferBits = 0; ((RenderTextureDescriptor)(ref cameraTargetDescriptor)).msaaSamples = 1; RenderingUtils.ReAllocateHandleIfNeeded(ref compatibilityTarget, ref cameraTargetDescriptor, (FilterMode)1, (TextureWrapMode)1, 1, 0f, "_PeakFilterCompatibility"); } public override void Execute(ScriptableRenderContext context, ref RenderingData renderingData) { if ((Object)(object)Material == (Object)null || !Material.shader.isSupported || compatibilityTarget == null) { return; } RTHandle cameraColorTargetHandle = ((CameraData)(ref renderingData.cameraData)).renderer.cameraColorTargetHandle; if (cameraColorTargetHandle == null) { return; } CommandBuffer val = CommandBufferPool.Get("PeakFilter"); try { Blitter.BlitCameraTexture(val, cameraColorTargetHandle, compatibilityTarget, Material, 0); Blitter.BlitCameraTexture(val, compatibilityTarget, cameraColorTargetHandle, 0f, false); ((ScriptableRenderContext)(ref context)).ExecuteCommandBuffer(val); } finally { CommandBufferPool.Release(val); } } 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 } 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 panelOutline; 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 Action reset; public float min; public float max; public FilterParam(string labelKey, Func<ConfigEntry<float>> entry, float min, float max) { this.labelKey = labelKey; getValue = () => entry().Value; setValue = delegate(float value) { entry().Value = value; }; reset = delegate { entry().Value = (float)((ConfigEntryBase)entry()).DefaultValue; }; this.min = min; this.max = max; } } private bool showPanel; private Rect panelRect = new Rect(20f, 20f, 860f, 700f); private bool isDragging; private Vector2 dragOffset; private const float BaseScale = 1f; private const float ReferenceScreenHeight = 1080f; private float scale = 1f; private int lastScreenWidth; private int lastScreenHeight; private int scaleSliderControl; private Vector2 scrollPos; private const float PanelWidth = 860f; private const float MaxPanelHeight = 700f; private const float TitleHeight = 56f; private const float ContentPad = 20f; private const float SelectionWidth = 466f; private const float ButtonGap = 8f; private const float RowGap = 6f; private const float GroupHeaderHeight = 26f; private const float GroupGap = 14f; private const float ButtonHeight = 32f; private const float SliderBlockHeight = 70f; private const int MaxFilterColumns = 2; 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, 0f, 5f), Param("lineWidth", () => FilterConfig.SketchLineWidth, 0.5f, 8f), Param("paperTexture", () => FilterConfig.SketchPaperTexture, 0f, 1f) } }, { FilterType.PencilSketch, new FilterParam[3] { Param("pencilDensity", () => FilterConfig.PencilDensity, 0.5f, 8f), Param("pencilDarkness", () => FilterConfig.PencilDarkness, 0f, 3f), Param("paperGrain", () => FilterConfig.PencilPaperGrain, 0f, 1f) } }, { FilterType.CelShade, new FilterParam[3] { Param("outlineStrength", () => FilterConfig.CelOutlineStrength, 0f, 5f), Param("colorSharpness", () => FilterConfig.CelColorSharpness, 2f, 20f), Param("celTint", () => FilterConfig.CelTintAmount, 0f, 1f) } }, { FilterType.ToonRamp, new FilterParam[3] { Param("rampSteps", () => FilterConfig.ToonRampSteps, 2f, 8f), Param("shadowCutoff", () => FilterConfig.ToonShadowCutoff, 0.1f, 0.9f), Param("inkStrength", () => FilterConfig.ToonInkStrength, 0f, 3f) } }, { FilterType.Horror, new FilterParam[3] { Param("fearTint", () => FilterConfig.HorrorFearTint, 0f, 1f), Param("darkness", () => FilterConfig.HorrorDarkness, 0f, 1f), Param("grain", () => FilterConfig.HorrorGrain, 0f, 1f) } }, { FilterType.Pixelate, new FilterParam[3] { Param("pixelSize", () => FilterConfig.PixelSize, 1f, 30f), Param("pixelOutline", () => FilterConfig.PixelOutlineStrength, 0f, 3f), Param("ditherAmount", () => FilterConfig.PixelDitherAmount, 0f, 1f) } }, { FilterType.Adventure, new FilterParam[3] { Param("adventureVibrance", () => FilterConfig.AdventureVibrance, 0f, 1f), Param("adventureSkyLift", () => FilterConfig.AdventureSkyLift, 0f, 1f), Param("adventureClarity", () => FilterConfig.AdventureClarity, 0f, 1f) } }, { FilterType.Cyberpunk, new FilterParam[3] { Param("neonColor", () => FilterConfig.CyberpunkNeon, 0f, 1f), Param("colorSplit", () => FilterConfig.CyberpunkSplit, 0f, 1f), Param("glitchPulse", () => FilterConfig.CyberpunkGlitch, 0f, 1f) } }, { FilterType.Ember, new FilterParam[3] { Param("emberHeat", () => FilterConfig.EmberHeat, 0f, 1f), Param("emberContrast", () => FilterConfig.EmberContrast, 0f, 1f), Param("emberVignette", () => FilterConfig.EmberVignette, 0f, 1f) } }, { FilterType.RetroCRT, new FilterParam[3] { Param("crtScanlines", () => FilterConfig.RetroCRTScanlines, 0f, 1f), Param("crtBleed", () => FilterConfig.RetroCRTColorBleed, 0f, 1f), Param("crtCurve", () => FilterConfig.RetroCRTCurve, 0f, 1f) } }, { FilterType.ThermalVision, new FilterParam[3] { Param("thermalHeat", () => FilterConfig.ThermalHeat, 0f, 1f), Param("thermalEdges", () => FilterConfig.ThermalEdge, 0f, 1f), Param("thermalNoise", () => FilterConfig.ThermalNoise, 0f, 1f) } }, { FilterType.Storybook, new FilterParam[3] { Param("storyPaper", () => FilterConfig.StorybookPaper, 0f, 1f), Param("storyInk", () => FilterConfig.StorybookInk, 0f, 1f), Param("storyWarmth", () => FilterConfig.StorybookWarmth, 0f, 1f) } }, { FilterType.WatercolorToon, new FilterParam[3] { Param("waterWash", () => FilterConfig.WatercolorToonWash, 0f, 1f), Param("waterBleed", () => FilterConfig.WatercolorToonBleed, 0f, 1f), Param("waterPaper", () => FilterConfig.WatercolorToonPaper, 0f, 1f) } }, { FilterType.ComicFrame, new FilterParam[3] { Param("comicInk", () => FilterConfig.ComicFrameInk, 0f, 1f), Param("comicHalftone", () => FilterConfig.ComicFrameHalftone, 0f, 1f), Param("comicPanels", () => FilterConfig.ComicFramePanels, 0f, 1f) } }, { FilterType.PaperCutout, new FilterParam[3] { Param("cutoutLayers", () => FilterConfig.PaperCutoutLayers, 0f, 1f), Param("cutoutShadow", () => FilterConfig.PaperCutoutShadow, 0f, 1f), Param("cutoutTexture", () => FilterConfig.PaperCutoutTexture, 0f, 1f) } }, { FilterType.PaperComic, new FilterParam[3] { Param("paperComicPaper", () => FilterConfig.PaperComicPaper, 0f, 1f), Param("paperComicInk", () => FilterConfig.PaperComicInk, 0f, 1f), Param("paperComicTone", () => FilterConfig.PaperComicTone, 0f, 1f) } }, { FilterType.WastelandComic, new FilterParam[3] { Param("wastelandInk", () => FilterConfig.WastelandComicInk, 0f, 1f), Param("wastelandContrast", () => FilterConfig.WastelandComicContrast, 0f, 1f), Param("wastelandGrunge", () => FilterConfig.WastelandComicGrunge, 0f, 1f) } }, { FilterType.PainterlyArt, new FilterParam[3] { Param("artBrush", () => FilterConfig.PainterlyArtBrush, 0f, 1f), Param("artPalette", () => FilterConfig.PainterlyArtPalette, 0f, 1f), Param("artCanvas", () => FilterConfig.PainterlyArtCanvas, 0f, 1f) } } }; private GUIStyle titleStyle; private GUIStyle versionStyle; private GUIStyle sectionStyle; private GUIStyle currentFilterStyle; private GUIStyle groupLabelStyle; private GUIStyle btnStyle; private GUIStyle selectedBtnStyle; private GUIStyle iconBtnStyle; private GUIStyle labelStyle; private GUIStyle valueStyle; private GUIStyle settingsLabelStyle; 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 resetIconTex; private Texture2D closeIconTex; private Texture2D themeIconTex; private Texture2D thumbTex; private Texture2D whiteTex; private bool texInit; private static FilterParam Param(string labelKey, Func<ConfigEntry<float>> entry, float min, float max) { return new FilterParam(labelKey, entry, 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_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Expected O, but got Unknown //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_005e: 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_006d: 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_0080: Expected O, but got Unknown //IL_008b: 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_0098: 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_00a6: 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_00bb: Expected O, but got Unknown //IL_00c2: Unknown result type (might be due to invalid IL or missing references) //IL_00c7: Unknown result type (might be due to invalid IL or missing references) //IL_00cf: Unknown result type (might be due to invalid IL or missing references) //IL_00d6: Unknown result type (might be due to invalid IL or missing references) //IL_00e2: Expected O, but got Unknown //IL_00ed: 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_00fa: 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_0108: Unknown result type (might be due to invalid IL or missing references) //IL_010f: Unknown result type (might be due to invalid IL or missing references) //IL_0116: 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_012b: Expected O, but got Unknown //IL_0136: 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_0143: Unknown result type (might be due to invalid IL or missing references) //IL_014a: Unknown result type (might be due to invalid IL or missing references) //IL_0151: Unknown result type (might be due to invalid IL or missing references) //IL_0158: Unknown result type (might be due to invalid IL or missing references) //IL_015f: Unknown result type (might be due to invalid IL or missing references) //IL_0165: Unknown result type (might be due to invalid IL or missing references) //IL_016f: Unknown result type (might be due to invalid IL or missing references) //IL_017b: 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_018b: 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_019d: Unknown result type (might be due to invalid IL or missing references) //IL_01a7: Unknown result type (might be due to invalid IL or missing references) //IL_01b8: Expected O, but got Unknown //IL_01bf: Unknown result type (might be due to invalid IL or missing references) //IL_01c4: Unknown result type (might be due to invalid IL or missing references) //IL_01ca: 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_01e0: Unknown result type (might be due to invalid IL or missing references) //IL_01e6: Unknown result type (might be due to invalid IL or missing references) //IL_01f0: 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_0202: Unknown result type (might be due to invalid IL or missing references) //IL_020c: Unknown result type (might be due to invalid IL or missing references) //IL_021d: Expected O, but got Unknown //IL_0223: Unknown result type (might be due to invalid IL or missing references) //IL_0228: Unknown result type (might be due to invalid IL or missing references) //IL_022f: Unknown result type (might be due to invalid IL or missing references) //IL_0236: Unknown result type (might be due to invalid IL or missing references) //IL_0242: Unknown result type (might be due to invalid IL or missing references) //IL_024e: Unknown result type (might be due to invalid IL or missing references) //IL_025f: Expected O, but got Unknown //IL_026a: Unknown result type (might be due to invalid IL or missing references) //IL_026f: 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_027e: Unknown result type (might be due to invalid IL or missing references) //IL_0285: 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_0292: Unknown result type (might be due to invalid IL or missing references) //IL_02a1: Expected O, but got Unknown //IL_02ac: Unknown result type (might be due to invalid IL or missing references) //IL_02b1: Unknown result type (might be due to invalid IL or missing references) //IL_02b9: 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_02c6: Unknown result type (might be due to invalid IL or missing references) //IL_02d5: Expected O, but got Unknown //IL_02dc: Unknown result type (might be due to invalid IL or missing references) //IL_02e1: Unknown result type (might be due to invalid IL or missing references) //IL_02ee: Expected O, but got Unknown if (!stylesInit) { stylesInit = true; GUIStyle val = new GUIStyle(GUI.skin.label) { fontSize = 20, fontStyle = (FontStyle)1, wordWrap = false, alignment = (TextAnchor)3 }; val.normal.textColor = Color.white; titleStyle = val; versionStyle = new GUIStyle(titleStyle) { fontSize = 10, fontStyle = (FontStyle)0, wordWrap = false, clipping = (TextClipping)1 }; GUIStyle val2 = new GUIStyle(GUI.skin.label) { fontSize = 16, fontStyle = (FontStyle)1, alignment = (TextAnchor)3 }; val2.normal.textColor = Color.white; sectionStyle = val2; currentFilterStyle = new GUIStyle(sectionStyle) { fontSize = 20, wordWrap = false, clipping = (TextClipping)1 }; GUIStyle val3 = new GUIStyle(GUI.skin.label) { fontSize = 14, fontStyle = (FontStyle)0, alignment = (TextAnchor)3, wordWrap = false, clipping = (TextClipping)1 }; val3.normal.textColor = Color.white; groupLabelStyle = val3; GUIStyle val4 = new GUIStyle(GUI.skin.label) { fontSize = 15, 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) { alignment = (TextAnchor)4, imagePosition = (ImagePosition)2 }; val6.normal.background = null; val6.hover.background = null; val6.active.background = null; iconBtnStyle = val6; GUIStyle val7 = new GUIStyle(GUI.skin.label) { fontSize = 15, alignment = (TextAnchor)3, wordWrap = false, clipping = (TextClipping)1 }; val7.normal.textColor = Color.white; labelStyle = val7; GUIStyle val8 = new GUIStyle(GUI.skin.label) { fontSize = 15, alignment = (TextAnchor)5 }; val8.normal.textColor = Color.white; valueStyle = val8; settingsLabelStyle = new GUIStyle(labelStyle) { fontSize = 13 }; } } 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 MakeThumbTex() { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0013: 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_0022: 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_0049: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_008b: 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_00ad: Unknown result type (might be due to invalid IL or missing references) Texture2D val = new Texture2D(64, 64, (TextureFormat)4, false) { hideFlags = (HideFlags)61, wrapMode = (TextureWrapMode)1, filterMode = (FilterMode)1 }; Color border = activePalette.border; border.a = 1f; for (int i = 0; i < 64; i++) { for (int j = 0; j < 64; j++) { float num = Vector2.Distance(new Vector2((float)j, (float)i), new Vector2(31.5f, 31.5f)); float num2 = Mathf.SmoothStep(0f, 1f, num - 27.3f); Color val2 = Color.Lerp(activePalette.thumb, border, num2); val2.a *= Mathf.Clamp01(31f - num); val.SetPixel(j, i, 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_0119: Unknown result type (might be due to invalid IL or missing references) //IL_0131: 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) 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); resetIconTex = MakeActionIcon(close: false, activePalette.text); closeIconTex = MakeActionIcon(close: true, activePalette.titleButtonIcon); themeIconTex = MakeThemeIcon(); thumbTex = MakeThumbTex(); whiteTex = MakeTex(1, 1, Color.white); } } private ThemePalette GetPalette(PanelThemeMode theme) { //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_008a: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_008f: Unknown result type (might be due to invalid IL or missing references) //IL_00be: Unknown result type (might be due to invalid IL or missing references) //IL_00a8: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_00c3: 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_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_0126: Unknown result type (might be due to invalid IL or missing references) //IL_0110: Unknown result type (might be due to invalid IL or missing references) //IL_012b: Unknown result type (might be due to invalid IL or missing references) //IL_015a: Unknown result type (might be due to invalid IL or missing references) //IL_015f: Unknown result type (might be due to invalid IL or missing references) //IL_018e: 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_0153: Unknown result type (might be due to invalid IL or missing references) //IL_0193: 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_01b1: Unknown result type (might be due to invalid IL or missing references) //IL_01d1: Unknown result type (might be due to invalid IL or missing references) //IL_01f1: 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_01f6: 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_0239: Unknown result type (might be due to invalid IL or missing references) //IL_0268: Unknown result type (might be due to invalid IL or missing references) //IL_0252: Unknown result type (might be due to invalid IL or missing references) //IL_021e: Unknown result type (might be due to invalid IL or missing references) //IL_026d: Unknown result type (might be due to invalid IL or missing references) //IL_029c: 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_02a1: Unknown result type (might be due to invalid IL or missing references) //IL_02df: Unknown result type (might be due to invalid IL or missing references) //IL_02e4: Unknown result type (might be due to invalid IL or missing references) //IL_0304: Unknown result type (might be due to invalid IL or missing references) //IL_02fd: Unknown result type (might be due to invalid IL or missing references) //IL_02c9: Unknown result type (might be due to invalid IL or missing references) //IL_0309: Unknown result type (might be due to invalid IL or missing references) //IL_0347: Unknown result type (might be due to invalid IL or missing references) //IL_034c: Unknown result type (might be due to invalid IL or missing references) //IL_037b: Unknown result type (might be due to invalid IL or missing references) //IL_0365: Unknown result type (might be due to invalid IL or missing references) //IL_0331: Unknown result type (might be due to invalid IL or missing references) //IL_0380: Unknown result type (might be due to invalid IL or missing references) //IL_03a0: Unknown result type (might be due to invalid IL or missing references) //IL_0399: 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_03af: Unknown result type (might be due to invalid IL or missing references) //IL_03b4: 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_03cb: Unknown result type (might be due to invalid IL or missing references) //IL_03d0: Unknown result type (might be due to invalid IL or missing references) //IL_03d1: Unknown result type (might be due to invalid IL or missing references) //IL_03d3: Unknown result type (might be due to invalid IL or missing references) //IL_03d8: Unknown result type (might be due to invalid IL or missing references) //IL_03da: Unknown result type (might be due to invalid IL or missing references) //IL_03f5: Unknown result type (might be due to invalid IL or missing references) //IL_03fa: Unknown result type (might be due to invalid IL or missing references) //IL_0410: Unknown result type (might be due to invalid IL or missing references) //IL_0415: Unknown result type (might be due to invalid IL or missing references) //IL_042b: Unknown result type (might be due to invalid IL or missing references) //IL_0430: Unknown result type (might be due to invalid IL or missing references) //IL_0446: Unknown result type (might be due to invalid IL or missing references) //IL_044b: Unknown result type (might be due to invalid IL or missing references) //IL_0461: Unknown result type (might be due to invalid IL or missing references) //IL_0466: Unknown result type (might be due to invalid IL or missing references) //IL_047c: Unknown result type (might be due to invalid IL or missing references) //IL_0481: Unknown result type (might be due to invalid IL or missing references) //IL_0489: Unknown result type (might be due to invalid IL or missing references) //IL_048e: Unknown result type (might be due to invalid IL or missing references) //IL_04a4: Unknown result type (might be due to invalid IL or missing references) //IL_04a9: Unknown result type (might be due to invalid IL or missing references) //IL_04bf: Unknown result type (might be due to invalid IL or missing references) //IL_04c4: Unknown result type (might be due to invalid IL or missing references) //IL_04da: Unknown result type (might be due to invalid IL or missing references) //IL_04df: Unknown result type (might be due to invalid IL or missing references) //IL_0507: Unknown result type (might be due to invalid IL or missing references) //IL_050c: Unknown result type (might be due to invalid IL or missing references) //IL_050d: Unknown result type (might be due to invalid IL or missing references) //IL_050f: Unknown result type (might be due to invalid IL or missing references) //IL_0514: Unknown result type (might be due to invalid IL or missing references) //IL_0516: Unknown result type (might be due to invalid IL or missing references) //IL_051d: Unknown result type (might be due to invalid IL or missing references) //IL_0522: Unknown result type (might be due to invalid IL or missing references) //IL_053c: Unknown result type (might be due to invalid IL or missing references) //IL_0541: Unknown result type (might be due to invalid IL or missing references) //IL_0542: Unknown result type (might be due to invalid IL or missing references) //IL_0544: Unknown result type (might be due to invalid IL or missing references) //IL_0549: Unknown result type (might be due to invalid IL or missing references) //IL_054b: Unknown result type (might be due to invalid IL or missing references) //IL_054c: Unknown result type (might be due to invalid IL or missing references) //IL_054e: Unknown result type (might be due to invalid IL or missing references) //IL_0553: Unknown result type (might be due to invalid IL or missing references) //IL_0555: Unknown result type (might be due to invalid IL or missing references) //IL_055d: Unknown result type (might be due to invalid IL or missing references) //IL_0562: Unknown result type (might be due to invalid IL or missing references) //IL_057d: Unknown result type (might be due to invalid IL or missing references) //IL_0582: Unknown result type (might be due to invalid IL or missing references) //IL_0598: Unknown result type (might be due to invalid IL or missing references) //IL_059d: Unknown result type (might be due to invalid IL or missing references) //IL_05b3: Unknown result type (might be due to invalid IL or missing references) //IL_05b8: Unknown result type (might be due to invalid IL or missing references) bool flag = theme == PanelThemeMode.White || theme == PanelThemeMode.Colorful; bool num = theme == PanelThemeMode.Colorful; bool flag2 = theme == PanelThemeMode.Transparent; ThemePalette result = new ThemePalette { panelBg = (flag ? new Color(0.965f, 0.965f, 0.97f) : new Color(0.075f, 0.075f, 0.08f, flag2 ? 0.64f : 1f)), titleBg = (Color)(flag ? Color.white : new Color(0.11f, 0.11f, 0.12f, flag2 ? 0.86f : 1f)), text = (flag ? new Color(0.12f, 0.13f, 0.15f) : new Color(0.96f, 0.96f, 0.97f)), textDim = (flag ? new Color(0.36f, 0.37f, 0.4f) : new Color(0.77f, 0.78f, 0.8f)), accentA = (flag ? new Color(0.24f, 0.26f, 0.3f) : new Color(0.8f, 0.81f, 0.84f)), buttonA = (Color)(flag ? Color.white : new Color(0.16f, 0.16f, 0.18f, flag2 ? 0.8f : 1f)), selectedA = (flag ? new Color(0.16f, 0.17f, 0.2f) : new Color(0.89f, 0.9f, 0.92f)), buttonHover = (flag ? new Color(0f, 0f, 0f, 0.055f) : new Color(1f, 1f, 1f, 0.09f)), selectedBorder = (Color)(flag ? new Color(0.16f, 0.17f, 0.2f) : Color.white), border = (flag ? new Color(0.78f, 0.79f, 0.81f) : new Color(0.4f, 0.41f, 0.44f, flag2 ? 0.9f : 0.8f)), panelOutline = (flag ? new Color(0.42f, 0.44f, 0.47f) : new Color(0.58f, 0.6f, 0.64f)), separator = (flag ? new Color(0.84f, 0.85f, 0.87f) : new Color(0.3f, 0.31f, 0.34f)), sliderTrack = (flag ? new Color(0.84f, 0.85f, 0.87f) : new Color(0.26f, 0.27f, 0.3f, flag2 ? 0.9f : 1f)), thumb = (Color)(flag ? Color.white : new Color(0.98f, 0.98f, 1f)), titleButtonBg = (flag ? new Color(0.94f, 0.94f, 0.96f) : new Color(0.2f, 0.2f, 0.23f, flag2 ? 0.9f : 1f)), titleButtonIcon = (flag ? new Color(0.27f, 0.28f, 0.31f) : new Color(0.94f, 0.95f, 0.97f)), selectedText = (Color)(flag ? Color.white : new Color(0.1f, 0.11f, 0.13f)) }; result.buttonB = result.buttonA; result.selectedB = result.selectedA; result.accentB = (result.accentC = result.accentA); if (num) { result.panelBg = new Color(0.95f, 0.97f, 0.98f); result.accentA = new Color(0.02f, 0.57f, 0.48f); result.accentB = new Color(0.16f, 0.47f, 0.84f); result.accentC = new Color(0.88f, 0.39f, 0.28f); result.selectedA = new Color(0.015f, 0.37f, 0.34f); result.selectedB = new Color(0.1f, 0.32f, 0.53f); result.selectedBorder = result.accentA; result.border = new Color(0.73f, 0.81f, 0.83f); result.panelOutline = new Color(0.08f, 0.49f, 0.52f); result.sliderTrack = new Color(0.82f, 0.88f, 0.9f); } else if (flag2) { result.selectedA = (result.selectedB = new Color(0.18f, 0.29f, 0.34f, 0.96f)); result.selectedText = Color.white; result.accentA = (result.accentB = (result.accentC = new Color(0.7f, 0.87f, 0.93f))); result.selectedBorder = result.accentA; result.separator = new Color(0.72f, 0.78f, 0.83f, 0.4f); result.panelOutline = new Color(0.7f, 0.87f, 0.93f); result.textDim = new Color(0.94f, 0.95f, 0.97f); } 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_00e8: Unknown result type (might be due to invalid IL or missing references) //IL_00fe: Unknown result type (might be due to invalid IL or missing references) //IL_0114: Unknown result type (might be due to invalid IL or missing references) //IL_012a: Unknown result type (might be due to invalid IL or missing references) titleStyle.normal.textColor = palette.text; versionStyle.normal.textColor = palette.textDim; 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; settingsLabelStyle.normal.textColor = palette.textDim; currentFilterStyle.normal.textColor = palette.text; labelStyle.normal.textColor = palette.text; valueStyle.normal.textColor = palette.text; } private Texture2D MakeActionIcon(bool close, Color color) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Expected O, but got Unknown //IL_00e3: 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) Texture2D val = new Texture2D(36, 36, (TextureFormat)4, false); ((Object)val).hideFlags = (HideFlags)61; for (int i = 0; i < 36; i++) { for (int j = 0; j < 36; j++) { float num = (float)j - 17.5f; float num2 = (float)i - 17.5f; float num3 = Mathf.Sqrt(num * num + num2 * num2); float num4 = Mathf.Atan2(num2, num); bool flag = (close ? (Mathf.Abs(Mathf.Abs(num) - Mathf.Abs(num2)) < 1.8f && Mathf.Abs(num) < 10f && Mathf.Abs(num2) < 10f) : ((num3 > 10f && num3 < 13f && (num4 < 2.1f || num4 > 3f)) || (j >= 4 && j <= 12 && i >= 23 && i <= 31 && j + i <= 36))); val.SetPixel(j, i, flag ? color : Color.clear); } } val.Apply(); return val; } private Texture2D MakeThemeIcon() { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0013: 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_0022: Expected O, but got Unknown //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0035: 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_0047: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0089: Unknown result type (might be due to invalid IL or missing references) //IL_009d: Unknown result type (might be due to invalid IL or missing references) //IL_00a9: Unknown result type (might be due to invalid IL or missing references) //IL_00c7: Unknown result type (might be due to invalid IL or missing references) //IL_00cc: Unknown result type (might be due to invalid IL or missing references) //IL_014f: Unknown result type (might be due to invalid IL or missing references) //IL_0108: Unknown result type (might be due to invalid IL or missing references) //IL_010d: Unknown result type (might be due to invalid IL or missing references) //IL_010f: Unknown result type (might be due to invalid IL or missing references) //IL_0114: Unknown result type (might be due to invalid IL or missing references) //IL_011e: Unknown result type (might be due to invalid IL or missing references) //IL_0120: Unknown result type (might be due to invalid IL or missing references) //IL_012d: Unknown result type (might be due to invalid IL or missing references) //IL_0132: 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_00e6: Unknown result type (might be due to invalid IL or missing references) Texture2D val = new Texture2D(48, 48, (TextureFormat)4, false) { hideFlags = (HideFlags)61, wrapMode = (TextureWrapMode)1, filterMode = (FilterMode)1 }; Color[] array = (Color[])(object)new Color[3] { activePalette.accentA, activePalette.accentB, activePalette.accentC }; Vector2 val2 = default(Vector2); for (int i = 0; i < 48; i++) { for (int j = 0; j < 48; j++) { ((Vector2)(ref val2))..ctor((float)j, (float)i); float num = Mathf.Clamp01(20f - Vector2.Distance(val2, new Vector2(23.5f, 23.5f))); num *= Mathf.Clamp01(Vector2.Distance(val2, new Vector2(34f, 12f)) - 8f); Color val3 = activePalette.titleButtonIcon; for (int k = 0; k < 3; k++) { Vector2 val4 = (Vector2)(k switch { 1 => new Vector2(21f, 34f), 0 => new Vector2(13f, 23f), _ => new Vector2(33f, 29f), }); val3 = Color.Lerp(val3, array[k], Mathf.Clamp01(4.5f - Vector2.Distance(val2, val4))); } val3.a *= num; val.SetPixel(j, i, val3); } } val.Apply(); return val; } private void DestroyThemeTextures() { DestroyTexture(panelBgTex); DestroyTexture(titleBgTex); DestroyTexture(gradSliderBg); DestroyTexture(sliderTrackTex); DestroyTexture(buttonGradTex); DestroyTexture(buttonSelectedTex); DestroyTexture(buttonHoverTex); DestroyTexture(resetIconTex); DestroyTexture(closeIconTex); DestroyTexture(themeIconTex); DestroyTexture(thumbTex); DestroyTexture(whiteTex); panelBgTex = null; titleBgTex = null; gradSliderBg = null; sliderTrackTex = null; buttonGradTex = null; buttonSelectedTex = null; buttonHoverTex = null; resetIconTex = null; closeIconTex = null; themeIconTex = null; thumbTex = 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)) { if (showPanel) { ClosePanel(); } else { showPanel = true; CursorPatch.SetUnlock(unlock: true); } } if (showPanel && Input.GetKeyDown((KeyCode)27)) { ClosePanel(); } } private void ClosePanel() { showPanel = false; isDragging = false; GUIUtility.hotControl = 0; CursorPatch.SetUnlock(unlock: false); FilterConfig.SavePanelPosition(((Rect)(ref panelRect)).x, ((Rect)(ref panelRect)).y); FilterConfig.FlushPendingSave(force: true); } private void UpdateScale(int width, int height) { int num; if (width == lastScreenWidth) { num = ((height != lastScreenHeight) ? 1 : 0); if (num == 0) { goto IL_0065; } } else { num = 1; } if (lastScreenWidth > 0 && lastScreenHeight > 0) { ref Rect reference = ref panelRect; ((Rect)(ref reference)).x = ((Rect)(ref reference)).x * ((float)width / (float)lastScreenWidth); ref Rect reference2 = ref panelRect; ((Rect)(ref reference2)).y = ((Rect)(ref reference2)).y * ((float)height / (float)lastScreenHeight); } goto IL_0065; IL_0065: lastScreenWidth = width; lastScreenHeight = height; float num2 = Mathf.Max(0.85f, 1f * (float)height / 1080f); float num3 = ((float)width - 24f) / 860f; if (num != 0 || scaleSliderControl == 0 || GUIUtility.hotControl != scaleSliderControl) { scale = Mathf.Max(0.01f, Mathf.Min(new float[3] { num2 * FilterConfig.UIPanelScale.Value, num3, ((float)height - 24f) / 700f })); } } private void OnGUI() { DrawPanel(Screen.width, Screen.height); } private void DrawPanel(int width, int height) { //IL_001d: 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_0023: 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_002d: 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_003d: Unknown result type (might be due to invalid IL or missing references) //IL_016f: Unknown result type (might be due to invalid IL or missing references) //IL_01c7: 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_01e0: 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_01f9: Expected I4, but got Unknown //IL_041e: Unknown result type (might be due to invalid IL or missing references) //IL_0437: Unknown result type (might be due to invalid IL or missing references) //IL_01f9: Unknown result type (might be due to invalid IL or missing references) //IL_01fd: Invalid comparison between Unknown and I4 //IL_0189: Unknown result type (might be due to invalid IL or missing references) //IL_0484: Unknown result type (might be due to invalid IL or missing references) //IL_048b: Expected O, but got Unknown //IL_0493: Unknown result type (might be due to invalid IL or missing references) //IL_0498: Unknown result type (might be due to invalid IL or missing references) //IL_04ab: Unknown result type (might be due to invalid IL or missing references) //IL_04bc: Unknown result type (might be due to invalid IL or missing references) //IL_04d0: Unknown result type (might be due to invalid IL or missing references) //IL_04d7: Expected O, but got Unknown //IL_04df: Unknown result type (might be due to invalid IL or missing references) //IL_04e4: 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_04f4: Unknown result type (might be due to invalid IL or missing references) //IL_0519: Unknown result type (might be due to invalid IL or missing references) //IL_0532: Unknown result type (might be due to invalid IL or missing references) //IL_0596: Unknown result type (might be due to invalid IL or missing references) //IL_046a: Unknown result type (might be due to invalid IL or missing references) //IL_01a5: Unknown result type (might be due to invalid IL or missing references) //IL_0221: Unknown result type (might be due to invalid IL or missing references) //IL_037f: Unknown result type (might be due to invalid IL or missing references) //IL_0385: Invalid comparison between Unknown and I4 //IL_05de: Unknown result type (might be due to invalid IL or missing references) //IL_02b6: Unknown result type (might be due to invalid IL or missing references) //IL_02bc: Unknown result type (might be due to invalid IL or missing references) //IL_02c1: Unknown result type (might be due to invalid IL or missing references) //IL_02cc: 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_02d9: Unknown result type (might be due to invalid IL or missing references) //IL_030a: 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_0620: Unknown result type (might be due to invalid IL or missing references) //IL_0661: Unknown result type (might be due to invalid IL or missing references) //IL_0247: Unknown result type (might be due to invalid IL or missing references) //IL_06b8: 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_06ea: Unknown result type (might be due to invalid IL or missing references) //IL_06f0: Unknown result type (might be due to invalid IL or missing references) //IL_070a: Unknown result type (might be due to invalid IL or missing references) //IL_070f: Unknown result type (might be due to invalid IL or missing references) //IL_0714: Unknown result type (might be due to invalid IL or missing references) //IL_025a: Unknown result type (might be due to invalid IL or missing references) //IL_027a: Unknown result type (might be due to invalid IL or missing references) //IL_0282: Unknown result type (might be due to invalid IL or missing references) //IL_0287: 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_0768: Unknown result type (might be due to invalid IL or missing references) //IL_076d: Unknown result type (might be due to invalid IL or missing references) //IL_096f: Unknown result type (might be due to invalid IL or missing references) //IL_0996: Unknown result type (might be due to invalid IL or missing references) //IL_07c6: Unknown result type (might be due to invalid IL or missing references) //IL_07cb: Unknown result type (might be due to invalid IL or missing references) //IL_07e9: Unknown result type (might be due to invalid IL or missing references) //IL_080b: Unknown result type (might be due to invalid IL or missing references) //IL_0815: Expected O, but got Unknown //IL_0810: Unknown result type (might be due to invalid IL or missing references) //IL_09a9: Unknown result type (might be due to invalid IL or missing references) //IL_07a4: Unknown result type (might be due to invalid IL or missing references) //IL_07a9: Unknown result type (might be due to invalid IL or missing references) //IL_0797: Unknown result type (might be due to invalid IL or missing references) //IL_078a: Unknown result type (might be due to invalid IL or missing references) //IL_0aa3: Unknown result type (might be due to invalid IL or missing references) //IL_09d6: Unknown result type (might be due to invalid IL or missing references) //IL_09dd: Expected O, but got Unknown //IL_09ec: Unknown result type (might be due to invalid IL or missing references) //IL_0a2c: Unknown result type (might be due to invalid IL or missing references) //IL_0a34: Unknown result type (might be due to invalid IL or missing references) //IL_0a61: Unknown result type (might be due to invalid IL or missing references) //IL_0a91: Unknown result type (might be due to invalid IL or missing references) //IL_08c2: Unknown result type (might be due to invalid IL or missing references) if (!showPanel) { return; } InitStyles(); InitTextures(); UpdateScale(width, height); Matrix4x4 matrix = GUI.matrix; GUI.matrix = Matrix4x4.TRS(Vector3.zero, Quaternion.identity, Vector3.one * scale); float num = 860f; float num2 = 700f; num2 = Mathf.Min(num2, (float)height / scale - 8f); ((Rect)(ref panelRect)).x = Mathf.Clamp(((Rect)(ref panelRect)).x, 0f, Mathf.Max(0f, (float)width - num * scale)); ((Rect)(ref panelRect)).y = Mathf.Clamp(((Rect)(ref panelRect)).y, 0f, Mathf.Max(0f, (float)height - num2 * scale)); float num3 = ((Rect)(ref panelRect)).x / scale; float num4 = ((Rect)(ref panelRect)).y / scale; Rect val = default(Rect); ((Rect)(ref val))..ctor(num3, num4, num, num2); Rect rect = default(Rect); ((Rect)(ref rect))..ctor(num3 + num - 56f, num4 + 10f, 36f, 36f); Rect rect2 = default(Rect); ((Rect)(ref rect2))..ctor(num3 + num - 100f, num4 + 10f, 36f, 36f); Rect val2 = default(Rect); ((Rect)(ref val2))..ctor(num3 + 300f, num4 + 10f, 266f, 36f); if ((int)Event.current.type == 0 && Event.current.button == 0 && !((Rect)(ref val)).Contains(Event.current.mousePosition)) { ClosePanel(); Event.current.Use(); GUI.matrix = matrix; return; } Rect val3 = default(Rect); ((Rect)(ref val3))..ctor(num3, num4, num, 56f); int controlID = GUIUtility.GetControlID("PeakFilterPanelDrag".GetHashCode(), (FocusType)2, val3); Event current = Event.current; EventType typeForControl = current.GetTypeForControl(controlID); switch ((int)typeForControl) { default: if ((int)typeForControl != 11) { break; } goto case 1; case 0: if (current.button == 0 && GUIUtility.hotControl == 0 && ((Rect)(ref val3)).Contains(current.mousePosition) && !((Rect)(ref rect)).Contains(current.mousePosition) && !((Rect)(ref rect2)).Contains(current.mousePosition) && !((Rect)(ref val2)).Contains(current.mousePosition)) { GUIUtility.hotControl = controlID; isDragging = true; dragOffset = current.mousePosition - new Vector2(num3, num4); current.Use(); } break; case 3: if (isDragging && GUIUtility.hotControl == controlID) { Vector2 val4 = (current.mousePosition - dragOffset) * scale; ((Rect)(ref panelRect)).x = Mathf.Clamp(val4.x, 0f, Mathf.Max(0f, (float)width - num * scale)); ((Rect)(ref panelRect)).y = Mathf.Clamp(val4.y, 0f, Mathf.Max(0f, (float)height - num2 * scale)); current.Use(); } break; case 1: if (isDragging && GUIUtility.hotControl == controlID) { GUIUtility.hotControl = 0; isDragging = false; FilterConfig.SavePanelPosition(((Rect)(ref panelRect)).x, ((Rect)(ref panelRect)).y); FilterConfig.FlushPendingSave(force: true); if ((int)current.type == 1) { current.Use(); } } break; case 2: break; } num3 = ((Rect)(ref panelRect)).x / scale; num4 = ((Rect)(ref panelRect)).y / scale; ((Rect)(ref rect))..ctor(num3 + num - 56f, num4 + 10f, 36f, 36f); ((Rect)(ref rect2))..ctor(num3 + num - 100f, num4 + 10f, 36f, 36f); ((Rect)(ref val2))..ctor(num3 + 300f, num4 + 10f, 266f, 36f); GUI.DrawTexture(new Rect(num3, num4, num, num2), (Texture)(object)panelBgTex); GUI.DrawTexture(new Rect(num3, num4, num, 56f), (Texture)(object)titleBgTex); if (activeTheme == PanelThemeMode.Colorful) { GUI.DrawTexture(new Rect(num3 + 1f, num4 + 1f, num - 2f, 3f), (Texture)(object)gradSliderBg); } GUIContent val5 = new GUIContent(Localization.Get("title")); Vector2 val6 = titleStyle.CalcSize(val5); Rect val7 = default(Rect); ((Rect)(ref val7))..ctor(num3 + 20f, num4 + 8f, val6.x, 40f); GUI.Label(val7, val5, titleStyle); GUIContent val8 = new GUIContent("v1.1.7"); Vector2 val9 = versionStyle.CalcSize(val8); float num5 = ((Rect)(ref val7)).y + (val6.y - val9.y) * 0.5f; GUI.Label(new Rect(((Rect)(ref val7)).xMax + 10f, num5, Mathf.Max(64f, val9.x + 12f), ((Rect)(ref val7)).height), val8, versionStyle); DrawPanelScale(((Rect)(ref val2)).x, ((Rect)(ref val2)).y, ((Rect)(ref val2)).width); string text = Localization.Get("panelTheme") + ": " + Localization.Get("theme" + activeTheme); if (DrawIconButton(rect2, themeIconTex, text)) { Filter