Please disclose if any significant portion of your mod was created using AI tools by adding the 'AI Generated' category. Failing to do so may result in the mod being removed from Thunderstore.
Decompiled source of RoR2Shaders v1.2.0
RoR2Shaders.dll
Decompiled 2 years agousing System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Security.Permissions; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using HG.Reflection; using RiskOfOptions; using RiskOfOptions.OptionConfigs; using RiskOfOptions.Options; using RoR2; using RoR2.ContentManagement; using UnityEngine; using UnityEngine.AddressableAssets; using UnityEngine.Rendering.PostProcessing; using UnityEngine.ResourceManagement.AsyncOperations; using UnityEngine.ResourceManagement.ResourceProviders; using UnityEngine.SceneManagement; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: OptIn] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("0.0.0.0")] public class SceneLoader : MonoBehaviour { public string sceneName; public GameObject cameraPrefab; private void Start() { //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) AsyncOperationHandle<SceneInstance> val = Addressables.LoadSceneAsync((object)sceneName, (LoadSceneMode)0, true, 100); val.Completed += OnSceneLoaded; } private void OnSceneLoaded(AsyncOperationHandle<SceneInstance> obj) { Object.Instantiate<GameObject>(cameraPrefab); } } namespace ProceduralStages { public class DelayedInstantier : MonoBehaviour { public GameObject prefab; private bool instantied; public void OnDisable() { instantied = false; } public void Update() { if (!instantied) { Object.Instantiate<GameObject>(prefab); instantied = true; } } } public class FlyCamera : MonoBehaviour { public float acceleration = 300f; public float accSprintMultiplier = 8f; public float lookSensitivity = 2f; public float dampingCoefficient = 5f; public bool focusOnEnable = true; [Range(0f, 180f)] public float fov = 90f; public PostProcessProfile postProcessProfile; private Vector3 velocity; private GameObject cameraObject; private static bool Focused { get { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Invalid comparison between Unknown and I4 return (int)Cursor.lockState == 1; } set { Cursor.lockState = (CursorLockMode)(value ? 1 : 0); Cursor.visible = !value; } } private void Awake() { //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Unknown result type (might be due to invalid IL or missing references) if (!Application.isPlaying) { return; } GameObject val = Object.Instantiate<GameObject>(Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/Core/Main Camera.prefab").WaitForCompletion(), ((Component)this).transform); CameraRigController component = val.GetComponent<CameraRigController>(); val.GetComponent<CameraRigController>().isCutscene = true; component.sceneCam.fieldOfView = fov; cameraObject = ((Component)val.transform.GetChild(0)).gameObject; PostProcessVolume component2 = ((Component)cameraObject.transform.Find("GlobalPostProcessVolume")).GetComponent<PostProcessVolume>(); foreach (PostProcessEffectSettings setting in postProcessProfile.settings) { component2.profile.AddSettings(setting); } } private void OnEnable() { if (focusOnEnable) { Focused = true; } } private void OnDisable() { Focused = false; } private void Update() { //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_0078: 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) if (Application.isPlaying) { GameObject obj = GameObject.Find("HUDSimple(Clone)"); if (obj != null) { obj.SetActive(false); } } if (Focused) { UpdateInput(); } else if (Input.GetMouseButtonDown(0)) { Focused = true; } velocity = Vector3.Lerp(velocity, Vector3.zero, dampingCoefficient * Time.deltaTime); Transform transform = cameraObject.transform; transform.position += velocity * Time.deltaTime; } private void UpdateInput() { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0051: 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_0057: 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_0067: 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_0072: Unknown result type (might be due to invalid IL or missing references) //IL_0077: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Unknown result type (might be due to invalid IL or missing references) //IL_0085: 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_008b: Unknown result type (might be due to invalid IL or missing references) velocity += GetAccelerationVector() * Time.deltaTime; Vector2 val = lookSensitivity * new Vector2(Input.GetAxis("Mouse X"), 0f - Input.GetAxis("Mouse Y")); Quaternion rotation = cameraObject.transform.rotation; Quaternion val2 = Quaternion.AngleAxis(val.x, Vector3.up); Quaternion val3 = Quaternion.AngleAxis(val.y, Vector3.right); cameraObject.transform.rotation = val2 * rotation * val3; if (Input.GetKeyDown((KeyCode)27)) { Focused = false; } } private Vector3 GetAccelerationVector() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_001d: 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_0039: 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_0058: Unknown result type (might be due to invalid IL or missing references) //IL_0076: 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) //IL_0080: Unknown result type (might be due to invalid IL or missing references) //IL_00a1: 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_008d: Unknown result type (might be due to invalid IL or missing references) //IL_009b: Unknown result type (might be due to invalid IL or missing references) Vector3 moveInput = default(Vector3); AddMovement((KeyCode)119, Vector3.forward); AddMovement((KeyCode)115, Vector3.back); AddMovement((KeyCode)100, Vector3.right); AddMovement((KeyCode)97, Vector3.left); AddMovement((KeyCode)304, Vector3.down); AddMovement((KeyCode)32, Vector3.up); Vector3 val = cameraObject.transform.TransformVector(((Vector3)(ref moveInput)).normalized); if (Input.GetKey((KeyCode)306)) { return val * (acceleration * accSprintMultiplier); } return val * acceleration; void AddMovement(KeyCode key, Vector3 dir) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_000f: 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) //IL_0015: Unknown result type (might be due to invalid IL or missing references) if (Input.GetKey(key)) { moveInput += dir; } } } } } namespace RoR2Shaders { public static class Commands { [ConCommand(/*Could not decode attribute arguments.*/)] public static void ToggleReport(ConCommandArgs args) { } } public class ContentProvider : IContentPackProvider { public static ContentPack ContentPack = new ContentPack(); public string identifier => "Lawlzee.RoR2Shaders.ContentProvider"; public IEnumerator LoadStaticContentAsync(LoadStaticContentAsyncArgs args) { ContentPack.identifier = identifier; string directoryName = Path.GetDirectoryName(typeof(ContentProvider).Assembly.Location); AssetBundle stageReportBundle = null; yield return LoadAssetBundle(Path.Combine(directoryName, "ror2shaders"), args.progressReceiver, delegate(AssetBundle assetBundle) { stageReportBundle = assetBundle; }); yield return LoadAllAssetsAsync<Shader>(stageReportBundle, args.progressReceiver, (Action<Shader[]>)delegate(Shader[] shaders) { Dictionary<string, Shader> dictionary = (Dictionary<string, Shader>)typeof(LegacyShaderAPI).GetField("shaderNameToShaderCache", BindingFlags.Static | BindingFlags.NonPublic).GetValue(null); foreach (Shader val in shaders) { dictionary.Add(((Object)val).name, val); } }); } private IEnumerator LoadAssetBundle(string assetBundleFullPath, IProgress<float> progress, Action<AssetBundle> onAssetBundleLoaded) { AssetBundleCreateRequest assetBundleCreateRequest = AssetBundle.LoadFromFileAsync(assetBundleFullPath); while (!((AsyncOperation)assetBundleCreateRequest).isDone) { progress.Report(((AsyncOperation)assetBundleCreateRequest).progress); yield return null; } onAssetBundleLoaded(assetBundleCreateRequest.assetBundle); } private static IEnumerator LoadAllAssetsAsync<T>(AssetBundle assetBundle, IProgress<float> progress, Action<T[]> onAssetsLoaded) where T : Object { AssetBundleRequest sceneDefsRequest = assetBundle.LoadAllAssetsAsync<T>(); while (!((AsyncOperation)sceneDefsRequest).isDone) { progress.Report(((AsyncOperation)sceneDefsRequest).progress); yield return null; } onAssetsLoaded(sceneDefsRequest.allAssets.Cast<T>().ToArray()); } public IEnumerator GenerateContentPackAsync(GetContentPackAsyncArgs args) { ContentPack.Copy(ContentPack, args.output); args.ReportProgress(1f); yield break; } public IEnumerator FinalizeAsync(FinalizeAsyncArgs args) { args.ReportProgress(1f); yield break; } } public static class Log { private static ManualLogSource _logSource; public static void Init(ManualLogSource logSource) { _logSource = logSource; } public static void Debug(object data) { if (_logSource == null) { Debug.Log(data); } else { _logSource.LogDebug(data); } } public static void Error(object data) { if (_logSource == null) { Debug.LogError(data); } else { _logSource.LogError(data); } } public static void Fatal(object data) { if (_logSource == null) { Debug.LogError(data); } else { _logSource.LogFatal(data); } } public static void Info(object data) { if (_logSource == null) { Debug.Log(data); } else { _logSource.LogInfo(data); } } public static void Message(object data) { if (_logSource == null) { Debug.Log(data); } else { _logSource.LogMessage(data); } } public static void Warning(object data) { if (_logSource == null) { Debug.LogWarning(data); } else { _logSource.LogWarning(data); } } } [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInPlugin("Lawlzee.RoR2Shaders", "RoR2Shaders", "1.2.0")] public class Main : BaseUnityPlugin { public const string PluginGUID = "Lawlzee.RoR2Shaders"; public const string PluginAuthor = "Lawlzee"; public const string PluginName = "RoR2Shaders"; public const string PluginVersion = "1.2.0"; public void Awake() { //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Expected O, but got Unknown Log.Init(((BaseUnityPlugin)this).Logger); Texture2D val = LoadTexture("icon.png"); ModSettingsManager.SetModIcon(Sprite.Create(val, new Rect(0f, 0f, (float)((Texture)val).width, (float)((Texture)val).height), new Vector2(0f, 0f))); ModSettingsManager.SetModDescription("This mod adds custom shaders to Risk of Rain 2."); PostProcessProfileManager.Init(); RoR2Application.onLoad = (Action)Delegate.Combine(RoR2Application.onLoad, (Action)delegate { ColorBanding.Init(((BaseUnityPlugin)this).Config); Grayscale.Init(((BaseUnityPlugin)this).Config); Outline.Init(((BaseUnityPlugin)this).Config); }); ContentManager.collectContentPackProviders += new CollectContentPackProvidersDelegate(GiveToRoR2OurContentPackProviders); } private Texture2D LoadTexture(string name) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Expected O, but got Unknown //IL_002a: Expected O, but got Unknown Texture2D val = new Texture2D(2, 2); ImageConversion.LoadImage(val, File.ReadAllBytes(Path.Combine(Path.GetDirectoryName(((BaseUnityPlugin)this).Info.Location), name))); return val; } private void GiveToRoR2OurContentPackProviders(AddContentPackProviderDelegate addContentPackProvider) { addContentPackProvider.Invoke((IContentPackProvider)(object)new ContentProvider()); } } public class SemanticVersion { public int Major; public int Minor; public int Patch; public static SemanticVersion Parse(string version) { string[] array = version.Split('.'); return new SemanticVersion { Major = int.Parse(array[0]), Minor = int.Parse(array[1]), Patch = int.Parse(array[2]) }; } public static bool operator <(SemanticVersion a, SemanticVersion b) { if (a.Major < b.Major) { return true; } if (a.Major > b.Major) { return false; } if (a.Minor < b.Minor) { return true; } if (a.Minor > b.Minor) { return false; } if (a.Patch < b.Patch) { return true; } return false; } public static bool operator >(SemanticVersion a, SemanticVersion b) { if (a.Major > b.Major) { return true; } if (a.Major < b.Major) { return false; } if (a.Minor > b.Minor) { return true; } if (a.Minor < b.Minor) { return false; } if (a.Patch > b.Patch) { return true; } return false; } public static bool operator ==(SemanticVersion a, SemanticVersion b) { if (a.Major == b.Major && a.Minor == b.Minor) { return a.Patch == b.Patch; } return false; } public static bool operator !=(SemanticVersion a, SemanticVersion b) { if (a.Major == b.Major && a.Minor == b.Minor) { return a.Patch != b.Patch; } return true; } public override bool Equals(object obj) { if (obj is SemanticVersion semanticVersion && Major == semanticVersion.Major && Minor == semanticVersion.Minor) { return Patch == semanticVersion.Patch; } return false; } public override int GetHashCode() { return ((-639545495 * -1521134295 + Major.GetHashCode()) * -1521134295 + Minor.GetHashCode()) * -1521134295 + Patch.GetHashCode(); } } [Serializable] [PostProcess(/*Could not decode attribute arguments.*/)] public sealed class ColorBanding : PostProcessEffectSettings { [Tooltip("Color banding bins")] public IntParameter bins; public static void Init(ConfigFile config) { //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Expected O, but got Unknown //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_0060: Unknown result type (might be due to invalid IL or missing references) //IL_0070: Expected O, but got Unknown //IL_006b: Unknown result type (might be due to invalid IL or missing references) //IL_0075: Expected O, but got Unknown ConfigEntry<bool> colorBandingEnabled = config.Bind<bool>("Color Banding", "Color Banding Enabled", true, "Toggles the Color Banding shader on or off"); ModSettingsManager.AddOption((BaseOption)new CheckBoxOption(colorBandingEnabled)); ConfigEntry<int> colorBandingBins = config.Bind<int>("Color Banding", "Color Banding Bins", 64, "Sets the number of color bins used in the Color Banding shader; higher values increase color detail."); ModSettingsManager.AddOption((BaseOption)new IntSliderOption(colorBandingBins, new IntSliderConfig { min = 8, max = 128 })); PostProcessProfileManager.AddHandler(delegate(ColorBanding colorBanding) { ((ParameterOverride<bool>)(object)((PostProcessEffectSettings)colorBanding).enabled).Override(colorBandingEnabled.Value); ((ParameterOverride<int>)(object)colorBanding.bins).Override(colorBandingBins.Value); }); colorBandingEnabled.SettingChanged += delegate { PostProcessProfileManager.OnChange<ColorBanding>(); }; colorBandingBins.SettingChanged += delegate { PostProcessProfileManager.OnChange<ColorBanding>(); }; } public ColorBanding() { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Expected O, but got Unknown //IL_0013: Expected O, but got Unknown IntParameter val = new IntParameter(); ((ParameterOverride<int>)val).value = 16; bins = val; ((PostProcessEffectSettings)this)..ctor(); } } public sealed class ColorBandingRenderer : PostProcessEffectRenderer<ColorBanding> { public override void Render(PostProcessRenderContext context) { //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) PropertySheet val = context.propertySheets.Get(Shader.Find("Hidden/Custom/ColorBanding")); val.properties.SetInt("_Bins", ParameterOverride<int>.op_Implicit((ParameterOverride<int>)(object)base.settings.bins)); RuntimeUtilities.BlitFullscreenTriangle(context.command, context.source, context.destination, val, 0, false, (Rect?)null); } } [Serializable] [PostProcess(/*Could not decode attribute arguments.*/)] public sealed class Grayscale : PostProcessEffectSettings { [Range(0f, 1f)] [Tooltip("Grayscale effect intensity.")] public FloatParameter blend; public static void Init(ConfigFile config) { //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Expected O, but got Unknown //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_0082: Expected O, but got Unknown //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0087: Expected O, but got Unknown ConfigEntry<bool> grayscaleEnabled = config.Bind<bool>("Grayscale", "Grayscale Enabled", false, "Toggles the grayscale shader on or off"); ModSettingsManager.AddOption((BaseOption)new CheckBoxOption(grayscaleEnabled)); ConfigEntry<float> grayscaleBlend = config.Bind<float>("Grayscale", "Grayscale Blend", 1f, "Adjusts the intensity of the grayscale effect. 1 = full grayscale, 0 = no effect"); ModSettingsManager.AddOption((BaseOption)new SliderOption(grayscaleBlend, new SliderConfig { min = 0f, max = 1f, formatString = "{0:0.##}" })); PostProcessProfileManager.AddHandler(delegate(Grayscale grayscale) { ((ParameterOverride<bool>)(object)((PostProcessEffectSettings)grayscale).enabled).Override(grayscaleEnabled.Value); ((ParameterOverride<float>)(object)grayscale.blend).Override(grayscaleBlend.Value); }); grayscaleEnabled.SettingChanged += delegate { PostProcessProfileManager.OnChange<Grayscale>(); }; grayscaleBlend.SettingChanged += delegate { PostProcessProfileManager.OnChange<Grayscale>(); }; } public Grayscale() { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Expected O, but got Unknown //IL_0016: Expected O, but got Unknown FloatParameter val = new FloatParameter(); ((ParameterOverride<float>)val).value = 0.5f; blend = val; ((PostProcessEffectSettings)this)..ctor(); } } public sealed class GrayscaleRenderer : PostProcessEffectRenderer<Grayscale> { public override void Render(PostProcessRenderContext context) { //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) PropertySheet val = context.propertySheets.Get(Shader.Find("Hidden/Custom/Grayscale")); val.properties.SetFloat("_Blend", ParameterOverride<float>.op_Implicit((ParameterOverride<float>)(object)base.settings.blend)); RuntimeUtilities.BlitFullscreenTriangle(context.command, context.source, context.destination, val, 0, false, (Rect?)null); } } [Serializable] [PostProcess(/*Could not decode attribute arguments.*/)] public sealed class Outline : PostProcessEffectSettings { [Tooltip("Outline color")] public ColorParameter color; [Tooltip("Outline thinness")] public FloatParameter thinness; [Tooltip("Outline density")] [Range(0f, 1f)] public FloatParameter densityInverse; public static void Init(ConfigFile config) { //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Expected O, but got Unknown //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Expected O, but got Unknown //IL_0087: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Unknown result type (might be due to invalid IL or missing references) //IL_00a2: Unknown result type (might be due to invalid IL or missing references) //IL_00b2: Expected O, but got Unknown //IL_00ad: Unknown result type (might be due to invalid IL or missing references) //IL_00b7: Expected O, but got Unknown //IL_00dd: Unknown result type (might be due to invalid IL or missing references) //IL_00e2: Unknown result type (might be due to invalid IL or missing references) //IL_00ed: Unknown result type (might be due to invalid IL or missing references) //IL_00f8: Unknown result type (might be due to invalid IL or missing references) //IL_0108: Expected O, but got Unknown //IL_0103: Unknown result type (might be due to invalid IL or missing references) //IL_010d: Expected O, but got Unknown ConfigEntry<bool> outlineEnabled = config.Bind<bool>("Outline", "Outline Enabled", true, "Toggles the outline shader on or off"); ModSettingsManager.AddOption((BaseOption)new CheckBoxOption(outlineEnabled)); ConfigEntry<Color> outlineColor = config.Bind<Color>("Outline", "Outline Color", Color.black, "Specifies the color of the outline"); ModSettingsManager.AddOption((BaseOption)new ColorOption(outlineColor)); ConfigEntry<float> outlineThiness = config.Bind<float>("Outline", "Outline Thiness", 2f, "Controls the thickness of the outline; a higher value results in a thinner outline."); ModSettingsManager.AddOption((BaseOption)new SliderOption(outlineThiness, new SliderConfig { min = 0.1f, max = 25f, formatString = "{0:0.##}" })); ConfigEntry<float> outlineDensity = config.Bind<float>("Outline", "Outline Density", 0.75f, "Adjusts the density of the outline effect; a higher value increases the quantity of outlines."); ModSettingsManager.AddOption((BaseOption)new SliderOption(outlineDensity, new SliderConfig { min = 0f, max = 1f, formatString = "{0:0.##}" })); PostProcessProfileManager.AddHandler(delegate(Outline outline) { //IL_0022: Unknown result type (might be due to invalid IL or missing references) ((ParameterOverride<bool>)(object)((PostProcessEffectSettings)outline).enabled).Override(outlineEnabled.Value); ((ParameterOverride<Color>)(object)outline.color).Override(outlineColor.Value); ((ParameterOverride<float>)(object)outline.thinness).Override(outlineThiness.Value); ((ParameterOverride<float>)(object)outline.densityInverse).Override(1f - outlineDensity.Value); }); outlineEnabled.SettingChanged += delegate { PostProcessProfileManager.OnChange<Outline>(); }; outlineColor.SettingChanged += delegate { PostProcessProfileManager.OnChange<Outline>(); }; outlineThiness.SettingChanged += delegate { PostProcessProfileManager.OnChange<Outline>(); }; outlineDensity.SettingChanged += delegate { PostProcessProfileManager.OnChange<Outline>(); }; } public Outline() { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Expected O, but got Unknown //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Expected O, but got Unknown //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Expected O, but got Unknown //IL_002c: Expected O, but got Unknown //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Expected O, but got Unknown //IL_0042: Expected O, but got Unknown ColorParameter val = new ColorParameter(); ((ParameterOverride<Color>)val).value = Color.black; color = val; FloatParameter val2 = new FloatParameter(); ((ParameterOverride<float>)val2).value = 2f; thinness = val2; FloatParameter val3 = new FloatParameter(); ((ParameterOverride<float>)val3).value = 0.25f; densityInverse = val3; ((PostProcessEffectSettings)this)..ctor(); } } public sealed class OutlineRenderer : PostProcessEffectRenderer<Outline> { public override void Render(PostProcessRenderContext context) { //IL_002c: 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_0083: Unknown result type (might be due to invalid IL or missing references) PropertySheet val = context.propertySheets.Get(Shader.Find("Hidden/Custom/Outline")); val.properties.SetColor("_Color", ParameterOverride<Color>.op_Implicit((ParameterOverride<Color>)(object)base.settings.color)); val.properties.SetFloat("_Thinness", ParameterOverride<float>.op_Implicit((ParameterOverride<float>)(object)base.settings.thinness)); val.properties.SetFloat("_DensityInverse", ParameterOverride<float>.op_Implicit((ParameterOverride<float>)(object)base.settings.densityInverse)); RuntimeUtilities.BlitFullscreenTriangle(context.command, context.source, context.destination, val, 0, false, (Rect?)null); } } public class PostProcessProfileManager { private static readonly List<PostProcessProfile> _postProcessProfiles = new List<PostProcessProfile>(); private static readonly Dictionary<Type, Action<PostProcessProfile>> _shaderHandler = new Dictionary<Type, Action<PostProcessProfile>>(); public static void Init() { CameraRigController.onCameraEnableGlobal += delegate(CameraRigController cameraRig) { PostProcessProfile profile2 = ((Component)((Component)cameraRig).transform.GetChild(0).Find("GlobalPostProcessVolume")).GetComponent<PostProcessVolume>().profile; bool num = _postProcessProfiles.Contains(profile2); _postProcessProfiles.Add(profile2); if (num) { return; } foreach (Action<PostProcessProfile> value in _shaderHandler.Values) { value(profile2); } }; CameraRigController.onCameraDisableGlobal += delegate(CameraRigController cameraRig) { PostProcessProfile profile = ((Component)((Component)cameraRig).transform.GetChild(0).Find("GlobalPostProcessVolume")).GetComponent<PostProcessVolume>().profile; if (_postProcessProfiles.Remove(profile) && !_postProcessProfiles.Contains(profile)) { foreach (Type key in _shaderHandler.Keys) { profile.RemoveSettings(key); } } }; } public static void AddHandler<T>(Action<T> handler) where T : PostProcessEffectSettings { _shaderHandler[typeof(T)] = delegate(PostProcessProfile profile) { T val = default(T); if (!profile.TryGetSettings<T>(ref val)) { val = ScriptableObject.CreateInstance<T>(); profile.AddSettings((PostProcessEffectSettings)(object)val); } handler(val); }; OnChange<T>(); } public static void OnChange<T>() where T : PostProcessEffectSettings { if (!_shaderHandler.TryGetValue(typeof(T), out var value)) { return; } foreach (PostProcessProfile item in _postProcessProfiles.Distinct()) { value(item); } } } }