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 EdgeDetection v1.0.3
EdgeDetection.dll
Decompiled 2 weeks agousing System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.Globalization; using System.IO; using System.Linq; using System.Reflection; using System.Resources; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using System.Text; using System.Text.RegularExpressions; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using EdgeDetection.Components; using EdgeDetection.Menu; using EdgeDetection.Structs; using GlobalEnums; using HarmonyLib; using Microsoft.CodeAnalysis; using Newtonsoft.Json; using Silksong.ModMenu.Elements; using Silksong.ModMenu.Models; using Silksong.ModMenu.Plugin; using Silksong.ModMenu.Screens; using TeamCherry.Localization; using UnityEngine; using UnityEngine.SceneManagement; using UnityEngine.UI; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("EdgeDetection")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.0.3.0")] [assembly: AssemblyInformationalVersion("1.0.3+9a6de4eff79d7194381dac64344e803386501c0e")] [assembly: AssemblyProduct("EdgeDetection")] [assembly: AssemblyTitle("EdgeDetection")] [assembly: AssemblyMetadata("RepositoryUrl", "https://github.com/kaycodes13/Silksong.EdgeDetection")] [assembly: NeutralResourcesLanguage("EN")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.3.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] [CompilerGenerated] internal sealed class <>z__ReadOnlyArray<T> : IEnumerable, ICollection, IList, IEnumerable<T>, IReadOnlyCollection<T>, IReadOnlyList<T>, ICollection<T>, IList<T> { int ICollection.Count => _items.Length; bool ICollection.IsSynchronized => false; object ICollection.SyncRoot => this; object IList.this[int index] { get { return _items[index]; } set { throw new NotSupportedException(); } } bool IList.IsFixedSize => true; bool IList.IsReadOnly => true; int IReadOnlyCollection<T>.Count => _items.Length; T IReadOnlyList<T>.this[int index] => _items[index]; int ICollection<T>.Count => _items.Length; bool ICollection<T>.IsReadOnly => true; T IList<T>.this[int index] { get { return _items[index]; } set { throw new NotSupportedException(); } } public <>z__ReadOnlyArray(T[] items) { _items = items; } IEnumerator IEnumerable.GetEnumerator() { return ((IEnumerable)_items).GetEnumerator(); } void ICollection.CopyTo(Array array, int index) { ((ICollection)_items).CopyTo(array, index); } int IList.Add(object value) { throw new NotSupportedException(); } void IList.Clear() { throw new NotSupportedException(); } bool IList.Contains(object value) { return ((IList)_items).Contains(value); } int IList.IndexOf(object value) { return ((IList)_items).IndexOf(value); } void IList.Insert(int index, object value) { throw new NotSupportedException(); } void IList.Remove(object value) { throw new NotSupportedException(); } void IList.RemoveAt(int index) { throw new NotSupportedException(); } IEnumerator<T> IEnumerable<T>.GetEnumerator() { return ((IEnumerable<T>)_items).GetEnumerator(); } void ICollection<T>.Add(T item) { throw new NotSupportedException(); } void ICollection<T>.Clear() { throw new NotSupportedException(); } bool ICollection<T>.Contains(T item) { return ((ICollection<T>)_items).Contains(item); } void ICollection<T>.CopyTo(T[] array, int arrayIndex) { ((ICollection<T>)_items).CopyTo(array, arrayIndex); } bool ICollection<T>.Remove(T item) { throw new NotSupportedException(); } int IList<T>.IndexOf(T item) { return ((IList<T>)_items).IndexOf(item); } void IList<T>.Insert(int index, T item) { throw new NotSupportedException(); } void IList<T>.RemoveAt(int index) { throw new NotSupportedException(); } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)] internal sealed class NullableAttribute : Attribute { public readonly byte[] NullableFlags; public NullableAttribute(byte P_0) { NullableFlags = new byte[1] { P_0 }; } public NullableAttribute(byte[] P_0) { NullableFlags = P_0; } } [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] internal sealed class NullableContextAttribute : Attribute { public readonly byte Flag; public NullableContextAttribute(byte P_0) { Flag = P_0; } } [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Enum | AttributeTargets.Method | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] internal sealed class ExtensionMarkerAttribute : Attribute { private readonly string <Name>k__BackingField; public string Name => <Name>k__BackingField; public ExtensionMarkerAttribute(string name) { <Name>k__BackingField = name; } } } namespace BepInEx { [AttributeUsage(AttributeTargets.Class, Inherited = false, AllowMultiple = false)] [Conditional("CodeGeneration")] [Microsoft.CodeAnalysis.Embedded] internal sealed class BepInAutoPluginAttribute : Attribute { public BepInAutoPluginAttribute(string? id = null, string? name = null, string? version = null) { } } } namespace BepInEx.Preloader.Core.Patching { [AttributeUsage(AttributeTargets.Class, Inherited = false, AllowMultiple = false)] [Conditional("CodeGeneration")] [Microsoft.CodeAnalysis.Embedded] internal sealed class PatcherAutoPluginAttribute : Attribute { public PatcherAutoPluginAttribute(string? id = null, string? name = null, string? version = null) { } } } namespace Microsoft.CodeAnalysis { [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace EdgeDetection { [BepInDependency("org.silksong-modding.modmenu", "0.5.2")] [BepInDependency("org.silksong-modding.i18n", "1.0.2")] [BepInPlugin("io.github.kaycodes13.edgedetection", "EdgeDetection", "1.0.3")] public class EdgeDetectionPlugin : BaseUnityPlugin, IModMenuCustomMenu, IModMenuInterface { internal static readonly PassDef[] PassDefs = Utils.ReadJsonAsset<PassDef[]>("pass_definitions.json"); public const string Id = "io.github.kaycodes13.edgedetection"; internal static EdgeDetectionPlugin Inst { get; private set; } internal static ManualLogSource Log { get; private set; } internal static Shader EdgeDetectionShader { get; private set; } private static Harmony Harmony { get; } = new Harmony("io.github.kaycodes13.edgedetection"); public static string Name => "EdgeDetection"; public static string Version => "1.0.3"; private void Awake() { //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_007f: Unknown result type (might be due to invalid IL or missing references) //IL_00b6: Unknown result type (might be due to invalid IL or missing references) //IL_00c0: Expected O, but got Unknown Inst = this; Log = ((BaseUnityPlugin)this).Logger; Utils.ReadAsset("shader.bundle", delegate(Stream stream) { AssetBundle obj = AssetBundle.LoadFromStream(stream); EdgeDetectionShader = obj.LoadAsset<Shader>("assets/edgedetection.shader"); obj.Unload(false); }); int num = 0; PassDef[] passDefs = PassDefs; for (int i = 0; i < passDefs.Length; i++) { PassDef passDef = passDefs[i]; PassDefs[num++] = passDef with { Colour = ((BaseUnityPlugin)this).Config.Bind<Color>(passDef.Id, "Colour", passDef.Colour, (ConfigDescription)null).Value, Width = ((BaseUnityPlugin)this).Config.Bind<byte>(passDef.Id, "Width", passDef.Width, new ConfigDescription("", (AcceptableValueBase)(object)new AcceptableValueRange<byte>((byte)0, (byte)16), Array.Empty<object>())).Value, HalfRes = ((BaseUnityPlugin)this).Config.Bind<bool>(passDef.Id, "Low Res", passDef.HalfRes, (ConfigDescription)null).Value }; } Harmony.PatchAll(); Log.LogInfo((object)("Plugin " + Name + " (io.github.kaycodes13.edgedetection) has loaded!")); } internal bool GetPassConfig(string id, out ConfigEntry<Color> colour, out ConfigEntry<byte> width, out ConfigEntry<bool> halfRes) { bool num = ((BaseUnityPlugin)this).Config.TryGetEntry<Color>(id, "Colour", ref colour) & ((BaseUnityPlugin)this).Config.TryGetEntry<byte>(id, "Width", ref width) & ((BaseUnityPlugin)this).Config.TryGetEntry<bool>(id, "Low Res", ref halfRes); if (!num) { Log.LogWarning((object)("Failed to load configuration for " + id + " pass.")); } return num; } public LocalizedText ModMenuName() { //IL_0005: Unknown result type (might be due to invalid IL or missing references) return LocalizedText.op_Implicit(MenuUtils.Localized("EDGE_DETECTION")); } public AbstractMenuScreen BuildCustomMenu() { //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_0028: Expected O, but got Unknown ScrollingMenuScreen val = new ScrollingMenuScreen(ModMenuName()); val.AddRange(EdgeDetectionPass.Passes.SelectMany<KeyValuePair<string, EdgeDetectionPass>, MenuElement>((KeyValuePair<string, EdgeDetectionPass> x) => GenerateDetectorOptions(x.Value))); return (AbstractMenuScreen)val; } private IEnumerable<MenuElement> GenerateDetectorOptions(EdgeDetectionPass pass) { //IL_0010: 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_0020: Expected O, but got Unknown //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_0052: 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_0073: 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_00a4: Unknown result type (might be due to invalid IL or missing references) TextLabel val = new TextLabel(LocalizedText.op_Implicit(MenuUtils.Localized(pass.Id + "_NAME"))); ((MenuElement)val).SetFontSizes((FontSizes)2); val.Text.fontStyle = (FontStyle)2; RectTransform rectTransform = ((MenuElement)val).RectTransform; Vector2 sizeDelta = ((MenuElement)val).RectTransform.sizeDelta; sizeDelta.y = 105f; rectTransform.sizeDelta = sizeDelta; HexColorInput hexColorInput = new HexColorInput(LocalizedText.op_Implicit(MenuUtils.Localized("LINE_COLOUR_LABEL"))); WiderSliderElement<byte> widerSliderElement = new WiderSliderElement<byte>(LocalizedText.op_Implicit(MenuUtils.Localized("LINE_WIDTH_LABEL")), (SliderModel<byte>)(object)new ByteSliderModel(0, 16)); ChoiceElement<bool> val2 = new ChoiceElement<bool>(LocalizedText.op_Implicit(MenuUtils.Localized("HALF_RES_LABEL")), (IChoiceModel<bool>)(object)ChoiceModels.ForBool(), LocalizedText.op_Implicit(MenuUtils.Localized("HALF_RES_DESC"))); if (GetPassConfig(pass.Id, out ConfigEntry<Color> colour, out ConfigEntry<byte> width, out ConfigEntry<bool> halfRes)) { ConfigEntryFactoryExtensions.SynchronizeWith<Color>((SelectableValueElement<Color>)(object)hexColorInput, colour); ConfigEntryFactoryExtensions.SynchronizeWith<byte>((SelectableValueElement<byte>)(object)widerSliderElement, width); ConfigEntryFactoryExtensions.SynchronizeWith<bool>((SelectableValueElement<bool>)(object)val2, halfRes); } return new <>z__ReadOnlyArray<MenuElement>((MenuElement[])(object)new MenuElement[4] { (MenuElement)val, (MenuElement)hexColorInput, (MenuElement)widerSliderElement, (MenuElement)val2 }); } } internal static class Utils { [SpecialName] public sealed class <G>$1A716C91D2B72E1C13325FC88724110E { [SpecialName] public static class <M>$FD985437AAE2EF705567DB8FF4C7DF30 { } [ExtensionMarker("<M>$FD985437AAE2EF705567DB8FF4C7DF30")] internal void RotateVertices(Quaternion rotation) { throw new NotSupportedException(); } [ExtensionMarker("<M>$FD985437AAE2EF705567DB8FF4C7DF30")] internal void RotateVertices(Quaternion rotation, Vector3 center) { throw new NotSupportedException(); } } [CompilerGenerated] private sealed class <SelfAndWalkHierarchy>d__4 : IEnumerable<Transform>, IEnumerable, IEnumerator<Transform>, IEnumerator, IDisposable { private int <>1__state; private Transform <>2__current; private int <>l__initialThreadId; private GameObject go; public GameObject <>3__go; private IEnumerator<Transform> <>7__wrap1; Transform IEnumerator<Transform>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <SelfAndWalkHierarchy>d__4(int <>1__state) { this.<>1__state = <>1__state; <>l__initialThreadId = Environment.CurrentManagedThreadId; } [DebuggerHidden] void IDisposable.Dispose() { int num = <>1__state; if (num == -3 || num == 2) { try { } finally { <>m__Finally1(); } } <>7__wrap1 = null; <>1__state = -2; } private bool MoveNext() { try { switch (<>1__state) { default: return false; case 0: <>1__state = -1; <>2__current = go.transform; <>1__state = 1; return true; case 1: <>1__state = -1; <>7__wrap1 = WalkHierarchy(go).GetEnumerator(); <>1__state = -3; break; case 2: <>1__state = -3; break; } if (<>7__wrap1.MoveNext()) { Transform current = <>7__wrap1.Current; <>2__current = current; <>1__state = 2; return true; } <>m__Finally1(); <>7__wrap1 = null; return false; } catch { //try-fault ((IDisposable)this).Dispose(); throw; } } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } private void <>m__Finally1() { <>1__state = -1; if (<>7__wrap1 != null) { <>7__wrap1.Dispose(); } } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } [DebuggerHidden] IEnumerator<Transform> IEnumerable<Transform>.GetEnumerator() { <SelfAndWalkHierarchy>d__4 <SelfAndWalkHierarchy>d__; if (<>1__state == -2 && <>l__initialThreadId == Environment.CurrentManagedThreadId) { <>1__state = 0; <SelfAndWalkHierarchy>d__ = this; } else { <SelfAndWalkHierarchy>d__ = new <SelfAndWalkHierarchy>d__4(0); } <SelfAndWalkHierarchy>d__.go = <>3__go; return <SelfAndWalkHierarchy>d__; } [DebuggerHidden] IEnumerator IEnumerable.GetEnumerator() { return ((IEnumerable<Transform>)this).GetEnumerator(); } } [CompilerGenerated] private sealed class <WalkHierarchy>d__3 : IEnumerable<Transform>, IEnumerable, IEnumerator<Transform>, IEnumerator, IDisposable { private int <>1__state; private Transform <>2__current; private int <>l__initialThreadId; private IEnumerable<GameObject> roots; public IEnumerable<GameObject> <>3__roots; private IEnumerator<Transform> <>7__wrap1; Transform IEnumerator<Transform>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <WalkHierarchy>d__3(int <>1__state) { this.<>1__state = <>1__state; <>l__initialThreadId = Environment.CurrentManagedThreadId; } [DebuggerHidden] void IDisposable.Dispose() { int num = <>1__state; if (num == -3 || num == 1) { try { } finally { <>m__Finally1(); } } <>7__wrap1 = null; <>1__state = -2; } private bool MoveNext() { try { switch (<>1__state) { default: return false; case 0: <>1__state = -1; <>7__wrap1 = roots.SelectMany((GameObject x) => SelfAndWalkHierarchy(x)).GetEnumerator(); <>1__state = -3; break; case 1: <>1__state = -3; break; } if (<>7__wrap1.MoveNext()) { Transform current = <>7__wrap1.Current; <>2__current = current; <>1__state = 1; return true; } <>m__Finally1(); <>7__wrap1 = null; return false; } catch { //try-fault ((IDisposable)this).Dispose(); throw; } } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } private void <>m__Finally1() { <>1__state = -1; if (<>7__wrap1 != null) { <>7__wrap1.Dispose(); } } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } [DebuggerHidden] IEnumerator<Transform> IEnumerable<Transform>.GetEnumerator() { <WalkHierarchy>d__3 <WalkHierarchy>d__; if (<>1__state == -2 && <>l__initialThreadId == Environment.CurrentManagedThreadId) { <>1__state = 0; <WalkHierarchy>d__ = this; } else { <WalkHierarchy>d__ = new <WalkHierarchy>d__3(0); } <WalkHierarchy>d__.roots = <>3__roots; return <WalkHierarchy>d__; } [DebuggerHidden] IEnumerator IEnumerable.GetEnumerator() { return ((IEnumerable<Transform>)this).GetEnumerator(); } } [CompilerGenerated] private sealed class <WalkHierarchy>d__5 : IEnumerable<Transform>, IEnumerable, IEnumerator<Transform>, IEnumerator, IDisposable { private int <>1__state; private Transform <>2__current; private int <>l__initialThreadId; private GameObject go; public GameObject <>3__go; private IEnumerator <>7__wrap1; private Transform <t>5__3; private IEnumerator<Transform> <>7__wrap3; Transform IEnumerator<Transform>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <WalkHierarchy>d__5(int <>1__state) { this.<>1__state = <>1__state; <>l__initialThreadId = Environment.CurrentManagedThreadId; } [DebuggerHidden] void IDisposable.Dispose() { int num = <>1__state; if ((uint)(num - -4) <= 1u || (uint)(num - 1) <= 1u) { try { if (num == -4 || num == 2) { try { } finally { <>m__Finally2(); } } } finally { <>m__Finally1(); } } <>7__wrap1 = null; <t>5__3 = null; <>7__wrap3 = null; <>1__state = -2; } private bool MoveNext() { //IL_0056: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Expected O, but got Unknown try { switch (<>1__state) { default: return false; case 0: <>1__state = -1; <>7__wrap1 = go.transform.GetEnumerator(); <>1__state = -3; break; case 1: <>1__state = -3; <>7__wrap3 = WalkHierarchy(((Component)<t>5__3).gameObject).GetEnumerator(); <>1__state = -4; goto IL_00cd; case 2: { <>1__state = -4; goto IL_00cd; } IL_00cd: if (<>7__wrap3.MoveNext()) { Transform current = <>7__wrap3.Current; <>2__current = current; <>1__state = 2; return true; } <>m__Finally2(); <>7__wrap3 = null; <t>5__3 = null; break; } if (<>7__wrap1.MoveNext()) { <t>5__3 = (Transform)<>7__wrap1.Current; <>2__current = <t>5__3; <>1__state = 1; return true; } <>m__Finally1(); <>7__wrap1 = null; return false; } catch { //try-fault ((IDisposable)this).Dispose(); throw; } } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } private void <>m__Finally1() { <>1__state = -1; if (<>7__wrap1 is IDisposable disposable) { disposable.Dispose(); } } private void <>m__Finally2() { <>1__state = -3; if (<>7__wrap3 != null) { <>7__wrap3.Dispose(); } } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } [DebuggerHidden] IEnumerator<Transform> IEnumerable<Transform>.GetEnumerator() { <WalkHierarchy>d__5 <WalkHierarchy>d__; if (<>1__state == -2 && <>l__initialThreadId == Environment.CurrentManagedThreadId) { <>1__state = 0; <WalkHierarchy>d__ = this; } else { <WalkHierarchy>d__ = new <WalkHierarchy>d__5(0); } <WalkHierarchy>d__.go = <>3__go; return <WalkHierarchy>d__; } [DebuggerHidden] IEnumerator IEnumerable.GetEnumerator() { return ((IEnumerable<Transform>)this).GetEnumerator(); } } internal static readonly Assembly asm = Assembly.GetExecutingAssembly(); internal static void ReadAsset(string path, Action<Stream> action) { using Stream obj = asm.GetManifestResourceStream("EdgeDetection.Assets." + path); action(obj); } internal static T ReadJsonAsset<T>(string path) { using StreamReader streamReader = new StreamReader(asm.GetManifestResourceStream("EdgeDetection.Assets." + path)); return JsonConvert.DeserializeObject<T>(streamReader.ReadToEnd()); } [IteratorStateMachine(typeof(<WalkHierarchy>d__3))] internal static IEnumerable<Transform> WalkHierarchy(IEnumerable<GameObject> roots) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <WalkHierarchy>d__3(-2) { <>3__roots = roots }; } [IteratorStateMachine(typeof(<SelfAndWalkHierarchy>d__4))] internal static IEnumerable<Transform> SelfAndWalkHierarchy(GameObject go) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <SelfAndWalkHierarchy>d__4(-2) { <>3__go = go }; } [IteratorStateMachine(typeof(<WalkHierarchy>d__5))] internal static IEnumerable<Transform> WalkHierarchy(GameObject go) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <WalkHierarchy>d__5(-2) { <>3__go = go }; } internal static void RotateVertices(this Mesh mesh, Quaternion rotation) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Unknown result type (might be due to invalid IL or missing references) mesh.RotateVertices(rotation, Vector3.zero); } internal static void RotateVertices(this Mesh mesh, Quaternion rotation, Vector3 center) { //IL_0007: 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_000e: 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) mesh.vertices = mesh.vertices.Select((Vector3 v) => rotation * (v - center) + center).ToArray(); mesh.RecalculateNormals(); mesh.RecalculateBounds(); } } } namespace EdgeDetection.Structs { [Serializable] internal record struct ObjectMods(HashSet<string> HideViaLayer, Dictionary<string, PhysLayers> ChangeLayer, Dictionary<string, PhysLayers> ChangeAllLayers, HashSet<string> HideFromDetectors, HashSet<string> HideCollider, HashSet<string> HideSubColliders, Dictionary<string, PhysLayers> VisualizeSprite) { public const PhysLayers HIDE_LAYER = 18; public const int HIDE_LAYER_INT = 18; public readonly void Apply(Transform t) { Apply(((Component)t).gameObject); } public readonly void Apply(GameObject go) { //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Expected I4, but got Unknown //IL_0077: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Expected I4, but got Unknown //IL_0158: Unknown result type (might be due to invalid IL or missing references) //IL_0159: Unknown result type (might be due to invalid IL or missing references) string text = CleanName(go); Dictionary<string, PhysLayers> changeLayer = ChangeLayer; if (changeLayer != null && changeLayer.TryGetValue(text, out var value)) { go.layer = (int)value; } Dictionary<string, PhysLayers> changeAllLayers = ChangeAllLayers; if (changeAllLayers != null && changeAllLayers.TryGetValue(text, out var value2)) { foreach (Transform item in Utils.SelfAndWalkHierarchy(go)) { if (Object.op_Implicit((Object)(object)((Component)item).GetComponent<Renderer>()) && !Object.op_Implicit((Object)(object)((Component)item).GetComponent<Collider2D>())) { ((Component)item).gameObject.layer = (int)value2; } } } HashSet<string> hideViaLayer = HideViaLayer; if (hideViaLayer != null && hideViaLayer.Contains(text)) { go.layer = 18; } HashSet<string> hideFromDetectors = HideFromDetectors; if (hideFromDetectors != null && hideFromDetectors.Contains(text)) { Extensions.AddComponentIfNotPresent<HideFromCamera>(go).hideFromEdgeDetectors = true; } HashSet<string> hideCollider = HideCollider; if (hideCollider != null && hideCollider.Contains(text)) { go.AddComponent<RemoveColliderVisualizer>(); } HashSet<string> hideSubColliders = HideSubColliders; if (hideSubColliders != null && hideSubColliders.Contains(text)) { foreach (Transform item2 in Utils.WalkHierarchy(go)) { ((Component)item2).gameObject.AddComponent<RemoveColliderVisualizer>(); } } Dictionary<string, PhysLayers> visualizeSprite = VisualizeSprite; if (visualizeSprite != null && visualizeSprite.TryGetValue(text, out var value3)) { Extensions.AddComponentIfNotPresent<SpriteVisualizer>(go).layer = value3; } } public static string CleanName(GameObject go) { return Regex.Replace(((Object)go).name, "\\s?\\([a-zA-Z0-9]+\\)", "").Trim(); } public static ObjectMods Union(ObjectMods one, ObjectMods two) { ObjectMods result = default(ObjectMods); result.HideViaLayer = MergeSet<string>(one.HideViaLayer, two.HideViaLayer); result.HideFromDetectors = MergeSet<string>(one.HideFromDetectors, two.HideFromDetectors); result.HideCollider = MergeSet<string>(one.HideCollider, two.HideCollider); result.HideSubColliders = MergeSet<string>(one.HideSubColliders, two.HideSubColliders); result.ChangeLayer = MergeDict<string, PhysLayers>(one.ChangeLayer, two.ChangeLayer); result.ChangeAllLayers = MergeDict<string, PhysLayers>(one.ChangeAllLayers, two.ChangeAllLayers); result.VisualizeSprite = MergeDict<string, PhysLayers>(one.VisualizeSprite, two.VisualizeSprite); return result; static Dictionary<K, V> MergeDict<K, V>(Dictionary<K, V>? a, Dictionary<K, V>? b) where K : notnull where V : notnull { Dictionary<K, V> dictionary = new Dictionary<K, V>(); K key; V value; foreach (KeyValuePair<K, V> item in a ?? new Dictionary<K, V>()) { item.Deconstruct(out key, out value); K key2 = key; V value2 = value; dictionary.TryAdd(key2, value2); } foreach (KeyValuePair<K, V> item2 in b ?? new Dictionary<K, V>()) { item2.Deconstruct(out key, out value); K key3 = key; V value3 = value; dictionary.TryAdd(key3, value3); } return dictionary; } static HashSet<T> MergeSet<T>(HashSet<T>? a, HashSet<T>? b) where T : notnull { HashSet<T> hashSet = new HashSet<T>(); foreach (T item3 in (a ?? new HashSet<T>()).Union(b ?? new HashSet<T>())) { hashSet.Add(item3); } return hashSet; } } } [Serializable] internal record struct PassDef(string Id, Color Colour, byte Width, bool HalfRes, PhysLayers[] Layers, float Threshold, float ClipFar, float ClipNear, string ExcludePass) { [CompilerGenerated] private readonly bool PrintMembers(StringBuilder builder) { //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) builder.Append("Id = "); builder.Append((object?)Id); builder.Append(", Colour = "); Color colour = Colour; builder.Append(((object)(Color)(ref colour)).ToString()); builder.Append(", Width = "); builder.Append(Width.ToString()); builder.Append(", HalfRes = "); builder.Append(HalfRes.ToString()); builder.Append(", Layers = "); builder.Append(Layers); builder.Append(", Threshold = "); builder.Append(Threshold.ToString()); builder.Append(", ClipFar = "); builder.Append(ClipFar.ToString()); builder.Append(", ClipNear = "); builder.Append(ClipNear.ToString()); builder.Append(", ExcludePass = "); builder.Append((object?)ExcludePass); return true; } } } namespace EdgeDetection.Patches { [HarmonyPatch] internal static class ApplyObjectMods { [CompilerGenerated] private sealed class <<OnSceneLoad>g__Coro|1_2>d : IEnumerator<object>, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public Scene scene; private int <i>5__2; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <<OnSceneLoad>g__Coro|1_2>d(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { switch (<>1__state) { default: return false; case 0: <>1__state = -1; if (!Object.op_Implicit((Object)(object)GameManager.SilentInstance) || GameManager.instance.IsNonGameplayScene()) { return false; } <i>5__2 = 0; break; case 1: <>1__state = -1; <i>5__2++; break; } if (<i>5__2 < 2) { <>2__current = null; <>1__state = 1; return true; } if (!((Scene)(ref scene)).isLoaded) { return false; } GameObject[] rootGameObjects = ((Scene)(ref scene)).GetRootGameObjects(); foreach (Transform item in Utils.WalkHierarchy((IEnumerable<GameObject>)rootGameObjects)) { if (!ObjectVisualizer.IsVisualizer(item)) { ShowColliderHideParticles(item); } } foreach (Transform item2 in Utils.WalkHierarchy((IEnumerable<GameObject>)rootGameObjects)) { if (!ObjectVisualizer.IsVisualizer(item2)) { genericMods.Apply(item2); } } return false; } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } private static readonly ObjectMods genericMods = ObjectMods.Union(Utils.ReadJsonAsset<ObjectMods>("generic_modifications.json"), Utils.ReadJsonAsset<ObjectMods>("boss_modifications.json")); private static readonly HashSet<PhysLayers> colliderLayers = new HashSet<PhysLayers> { (PhysLayers)23, (PhysLayers)22, (PhysLayers)17, (PhysLayers)12 }; [HarmonyPatch(typeof(GameCameras), "Start")] [HarmonyPostfix] private static void SoKParticles(GameCameras __instance) { foreach (Transform item in Utils.WalkHierarchy(((Component)__instance.sceneParticles).gameObject)) { ((Component)item).gameObject.layer = 18; } foreach (Transform item2 in Utils.WalkHierarchy(((Component)((Component)__instance).transform.Find("Roar Wave Emitter")).gameObject)) { ((Component)item2).gameObject.layer = 18; } } [HarmonyPatch(typeof(GameManager), "Start")] [HarmonyPostfix] private static void OnSceneLoad() { SceneManager.activeSceneChanged -= SceneChangeHandler; SceneManager.activeSceneChanged += SceneChangeHandler; SceneManager.sceneLoaded -= SceneLoadHandler; SceneManager.sceneLoaded += SceneLoadHandler; [IteratorStateMachine(typeof(<<OnSceneLoad>g__Coro|1_2>d))] static IEnumerator Coro(Scene scene) { //IL_0007: 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) //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <<OnSceneLoad>g__Coro|1_2>d(0) { scene = scene }; } static void SceneChangeHandler(Scene _, Scene scene) { //IL_0005: Unknown result type (might be due to invalid IL or missing references) ((MonoBehaviour)EdgeDetectionPlugin.Inst).StartCoroutine(Coro(scene)); } static void SceneLoadHandler(Scene scene, LoadSceneMode mode) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Invalid comparison between Unknown and I4 //IL_0009: Unknown result type (might be due to invalid IL or missing references) if ((int)mode == 1) { ((MonoBehaviour)EdgeDetectionPlugin.Inst).StartCoroutine(Coro(scene)); } } } [HarmonyPatch(typeof(ObjectPool), "Spawn", new Type[] { typeof(GameObject), typeof(Transform), typeof(Vector3), typeof(Quaternion), typeof(bool) })] [HarmonyPostfix] private static void OnObjectSpawned(GameObject __result) { foreach (Transform item in Utils.SelfAndWalkHierarchy(__result)) { ShowColliderHideParticles(item); genericMods.Apply(item); } } [HarmonyPatch(typeof(HeroController), "Awake")] [HarmonyPostfix] private static void OnHeroAwake(HeroController __instance) { ObjectMods objectMods = Utils.ReadJsonAsset<ObjectMods>("hornet_modifications.json"); foreach (Transform item in Utils.WalkHierarchy(((Component)__instance).gameObject)) { ShowColliderHideParticles(item); objectMods.Apply(item); } } private static void ShowColliderHideParticles(Transform t) { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_00b8: Unknown result type (might be due to invalid IL or missing references) GameObject gameObject = ((Component)t).gameObject; PhysLayers item = (PhysLayers)gameObject.layer; Renderer component = gameObject.GetComponent<Renderer>(); if (!Object.op_Implicit((Object)(object)gameObject.GetComponent<Collider2D>())) { if (component is ParticleSystemRenderer) { gameObject.layer = 18; } else { if (!Object.op_Implicit((Object)(object)component) || !Object.op_Implicit((Object)(object)gameObject.GetComponent<Lever>())) { return; } foreach (Transform item2 in Utils.SelfAndWalkHierarchy(gameObject)) { if (Object.op_Implicit((Object)(object)((Component)item2).GetComponent<Renderer>()) && !Object.op_Implicit((Object)(object)((Component)t).GetComponent<Collider2D>())) { ((Component)item2).gameObject.layer = 19; } } } } else if (!Object.op_Implicit((Object)(object)component) && (Object.op_Implicit((Object)(object)gameObject.GetComponent<DamageHero>()) || colliderLayers.Contains(item))) { Extensions.AddComponentIfNotPresent<ColliderVisualizer>(gameObject); } } } [HarmonyPatch(typeof(GameCameras), "Start")] internal static class CameraSetup { private static void Postfix(GameCameras __instance) { //IL_009e: Unknown result type (might be due to invalid IL or missing references) PassDef[] passDefs = EdgeDetectionPlugin.PassDefs; for (int i = 0; i < passDefs.Length; i++) { PassDef passDef = passDefs[i]; EdgeDetectionPass detector = ((Component)__instance.mainCamera).gameObject.AddComponent<EdgeDetectionPass>(); EdgeDetectionPass edgeDetectionPass = detector; EdgeDetectionPass edgeDetectionPass2 = detector; EdgeDetectionPass edgeDetectionPass3 = detector; EdgeDetectionPass edgeDetectionPass4 = detector; EdgeDetectionPass edgeDetectionPass5 = detector; EdgeDetectionPass edgeDetectionPass6 = detector; EdgeDetectionPass edgeDetectionPass7 = detector; EdgeDetectionPass edgeDetectionPass8 = detector; EdgeDetectionPass edgeDetectionPass9 = detector; PassDef passDef2 = passDef; (edgeDetectionPass.Id, edgeDetectionPass2.LineColor, edgeDetectionPass3.LineWidth, edgeDetectionPass4.HalfResolution, edgeDetectionPass5.Layers, edgeDetectionPass6.AlphaThreshold, edgeDetectionPass7.ClipFar, edgeDetectionPass8.ClipNear, edgeDetectionPass9.ExcludePass) = (PassDef)(ref passDef2); if (EdgeDetectionPlugin.Inst.GetPassConfig(passDef.Id, out ConfigEntry<Color> colour, out ConfigEntry<byte> width, out ConfigEntry<bool> halfRes)) { colour.SettingChanged += delegate(object _, EventArgs e) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) detector.LineColor = GetValue<Color>(e); }; width.SettingChanged += delegate(object _, EventArgs e) { detector.LineWidth = GetValue<byte>(e); }; halfRes.SettingChanged += delegate(object _, EventArgs e) { detector.HalfResolution = GetValue<bool>(e); }; } } static T GetValue<T>(EventArgs e) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) return (T)((SettingChangedEventArgs)e).ChangedSetting.BoxedValue; } } } } namespace EdgeDetection.Menu { internal class ByteSliderModel : SliderModel<byte> { public ByteSliderModel(byte min, byte max) : base((int)min, (int)max) { } protected override bool GetIndex(byte value, out int index) { index = value; if (base.MinimumIndex <= index) { return index <= base.MaximumIndex; } return false; } protected override byte GetValue(int index) { return (byte)Math.Clamp(index, 0, 255); } } internal class HexColorInput : TextInput<Color> { [CompilerGenerated] private static class <>O { public static OnValidateInput <0>__HexValidation; public static Parse<Color> <1>__HexParser; public static Unparse<Color> <2>__HexUnparser; } private readonly GameObject swatch; private static readonly Color InvalidColor = new Color(-1f, -1f, -1f, -1f); public HexColorInput(LocalizedText label) : this(label, LocalizedText.op_Implicit("")) { } public HexColorInput(LocalizedText label, LocalizedText description) : base(label, (ITextModel<Color>)(object)HexRGBModel(), description) { //IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_007f: Unknown result type (might be due to invalid IL or missing references) //IL_008b: Expected O, but got Unknown //IL_00e2: Unknown result type (might be due to invalid IL or missing references) //IL_00e7: Unknown result type (might be due to invalid IL or missing references) //IL_00e8: Unknown result type (might be due to invalid IL or missing references) //IL_00f7: Expected O, but got Unknown //IL_0117: 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_0140: Unknown result type (might be due to invalid IL or missing references) //IL_0145: Unknown result type (might be due to invalid IL or missing references) //IL_0150: 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_016c: Unknown result type (might be due to invalid IL or missing references) //IL_0172: 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_0068: Expected O, but got Unknown ((Object)((MenuElement)this).Container).name = label.Text + "Input"; base.InputField.characterLimit = 6; base.InputField.contentType = (ContentType)9; InputField inputField = base.InputField; object obj = <>O.<0>__HexValidation; if (obj == null) { OnValidateInput val = HexValidation; <>O.<0>__HexValidation = val; obj = (object)val; } inputField.onValidateInput = (OnValidateInput)obj; ((MenuElement)this).ApplyDefaultColors = true; swatch = new GameObject("Swatch") { layer = 5 }; swatch.transform.SetParent(((Component)base.InputField).transform.Find("Menu Option Text"), false); Extensions.Reset(swatch.transform); Image image = swatch.AddComponent<Image>(); ((Graphic)image).material = new Material(Shader.Find("UI/Default")) { color = Color.white }; Outline obj2 = swatch.AddComponent<Outline>(); ((Shadow)obj2).effectColor = new Color(0.4f, 0.4f, 0.4f, 1f); ((Shadow)obj2).effectDistance = new Vector2(3f, 3f); RectTransform val2 = (RectTransform)swatch.transform; val2.sizeDelta = new Vector2(40f, 40f); Vector2 val3 = default(Vector2); ((Vector2)(ref val3))..ctor(0f, 0.5f); val2.anchorMin = val3; val2.anchorMax = val3; ((SelectableValueElement<Color>)(object)this).Model.OnValueChanged += delegate(Color color) { //IL_000b: Unknown result type (might be due to invalid IL or missing references) ((Graphic)image).material.color = color; }; } public static char HexValidation(string input, int index, char addedChar) { if (!Parse($"{addedChar}", out var _)) { return '0'; } return addedChar; } public static ParserTextModel<Color> HexRGBModel() { //IL_0036: Unknown result type (might be due to invalid IL or missing references) return new ParserTextModel<Color>((Parse<Color>)HexParser, (Unparse<Color>)HexUnparser, InvalidColor); } private static bool HexParser(string x, out Color c) { //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_0069: 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_0073: Unknown result type (might be due to invalid IL or missing references) c = InvalidColor; x = x.Replace("#", "").Trim(); if (x.Length < 6) { return false; } if (Parse(x.Substring(0, 2), out var b) && Parse(x.Substring(2, 2), out var b2) && Parse(x.Substring(4, 2), out var b3)) { c = Color32.op_Implicit(new Color32(b, b2, b3, byte.MaxValue)); return true; } return false; } private static bool HexUnparser(Color c, out string x) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_000d: 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_0027: 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_0034: 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_004a: Unknown result type (might be due to invalid IL or missing references) if (In01(c.r) && In01(c.g) && In01(c.b)) { Color32 val = Color32.op_Implicit(c); x = $"{val.r:X2}{val.g:X2}{val.b:X2}"; } else { x = "######"; } return true; static bool In01(float f) { if (0f <= f) { return f <= 1f; } return false; } } private static bool Parse(string s, out byte b) { return byte.TryParse(s, NumberStyles.HexNumber, null, out b); } } internal static class MenuUtils { [SpecialName] public sealed class <G>$5E80EE1F91F68F4C0C8D9D82C38C5E67 { [SpecialName] public static class <M>$DA8EECEBA43A0DEF5767F437FCA1FFA2 { } [ExtensionMarker("<M>$DA8EECEBA43A0DEF5767F437FCA1FFA2")] internal RectTransform RectTransform { [ExtensionMarker("<M>$DA8EECEBA43A0DEF5767F437FCA1FFA2")] get { throw new NotSupportedException(); } } [ExtensionMarker("<M>$DA8EECEBA43A0DEF5767F437FCA1FFA2")] internal void SetAnchors(Vector2 anchor) { throw new NotSupportedException(); } [ExtensionMarker("<M>$DA8EECEBA43A0DEF5767F437FCA1FFA2")] internal void SetSizeDelta(Vector2 size) { throw new NotSupportedException(); } } [SpecialName] public sealed class <G>$1945437846AC44BD79BE419C90BB2AE7 { [SpecialName] public static class <M>$D30A0C6AD6B3A0DECA793BBD3009BA46 { } [ExtensionMarker("<M>$D30A0C6AD6B3A0DECA793BBD3009BA46")] internal RectTransform AsRect { [ExtensionMarker("<M>$D30A0C6AD6B3A0DECA793BBD3009BA46")] get { throw new NotSupportedException(); } } [ExtensionMarker("<M>$D30A0C6AD6B3A0DECA793BBD3009BA46")] internal void SetAnchors(Vector2 anchor) { throw new NotSupportedException(); } } [SpecialName] public sealed class <G>$22B4D88CDD78D2CB2B453E84388FEC0B { [SpecialName] public static class <M>$66ED77F0E377F9BDC76426701AFF25DC { } [ExtensionMarker("<M>$66ED77F0E377F9BDC76426701AFF25DC")] internal IEnumerable<Selectable> AllSelectables() { throw new NotSupportedException(); } } private static Shader? uiShader; internal static LocalisedString Localized(string key) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) return new LocalisedString("Mods.io.github.kaycodes13.edgedetection", key); } internal static GameObject UIGameObject(string name, GameObject? parent) { //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 GameObject val = new GameObject(name) { layer = 5 }; if (Object.op_Implicit((Object)(object)parent)) { Extensions.SetParentReset(val.transform, parent.transform); } return val; } internal static Material UIMaterial(Color? color = null) { //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Expected O, but got Unknown if (!Object.op_Implicit((Object)(object)uiShader)) { uiShader = Shader.Find("UI/Default"); } return new Material(uiShader) { color = (Color)(((??)color) ?? Color.white) }; } internal static RectTransform get_RectTransform(GameObject go) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Expected O, but got Unknown return (RectTransform)go.transform; } internal static void SetAnchors(this GameObject go, Vector2 anchor) { //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_000e: 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) RectTransform obj = get_RectTransform(go); Vector2 anchorMax = (get_RectTransform(go).anchorMin = anchor); obj.anchorMax = anchorMax; } internal static void SetSizeDelta(this GameObject go, Vector2 size) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) get_RectTransform(go).sizeDelta = size; } internal static RectTransform get_AsRect(Transform t) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Expected O, but got Unknown return (RectTransform)t; } internal static void SetAnchors(this Transform t, Vector2 anchor) { //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_000e: 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) RectTransform obj = get_AsRect(t); Vector2 anchorMax = (get_AsRect(t).anchorMin = anchor); obj.anchorMax = anchorMax; } internal static IEnumerable<Selectable> AllSelectables(this VerticalGroup v) { return from x in ((AbstractGroup)v).AllElements().OfType<SelectableElement>() select x.SelectableComponent; } } internal class WiderSliderElement<T> : SliderElement<T> { public WiderSliderElement(LocalizedText label, SliderModel<T> model) : base(label, model) { //IL_004c: 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_005b: Unknown result type (might be due to invalid IL or missing references) //IL_00c8: Unknown result type (might be due to invalid IL or missing references) //IL_00cd: Unknown result type (might be due to invalid IL or missing references) //IL_00db: 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_00fb: Unknown result type (might be due to invalid IL or missing references) //IL_0100: Unknown result type (might be due to invalid IL or missing references) //IL_010e: 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_0128: Unknown result type (might be due to invalid IL or missing references) //IL_0134: Unknown result type (might be due to invalid IL or missing references) //IL_0140: 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_016a: Unknown result type (might be due to invalid IL or missing references) //IL_0176: Unknown result type (might be due to invalid IL or missing references) //IL_017e: Unknown result type (might be due to invalid IL or missing references) //IL_018c: Unknown result type (might be due to invalid IL or missing references) //IL_019b: Unknown result type (might be due to invalid IL or missing references) //IL_01b2: Unknown result type (might be due to invalid IL or missing references) //IL_01c2: Unknown result type (might be due to invalid IL or missing references) //IL_01ce: Unknown result type (might be due to invalid IL or missing references) //IL_01d6: 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_01ea: Unknown result type (might be due to invalid IL or missing references) Vector2 anchor = default(Vector2); ((Vector2)(ref anchor))..ctor(1f, 0.5f); Vector2 val = default(Vector2); ((Vector2)(ref val))..ctor(0f, 0.5f); Vector2 anchorMax = default(Vector2); ((Vector2)(ref anchorMax))..ctor(0.5f, 1f); Vector2 anchorMin = default(Vector2); ((Vector2)(ref anchorMin))..ctor(0.5f, 0f); Vector2 anchor2 = Vector2.one * 0.5f; RectTransform obj = MenuUtils.get_AsRect(((Transform)((MenuElement)this).RectTransform).Find("Slider")); RectTransform val2 = MenuUtils.get_AsRect(((Transform)obj).Find("Menu Option Label")); RectTransform val3 = MenuUtils.get_AsRect(((Transform)obj).Find("CursorHotspot")); RectTransform val4 = MenuUtils.get_AsRect(((Transform)val3).Find("CursorLeft")); RectTransform val5 = MenuUtils.get_AsRect(((Transform)val3).Find("CursorRight")); RectTransform rectTransform = ((MenuElement)this).RectTransform; Vector2 sizeDelta = ((MenuElement)this).RectTransform.sizeDelta; sizeDelta.x = 720f; rectTransform.sizeDelta = sizeDelta; ((Transform)(object)((MenuElement)this).RectTransform).SetAnchors(anchor2); RectTransform rectTransform2 = ((MenuElement)this).RectTransform; sizeDelta = ((MenuElement)this).RectTransform.anchoredPosition; sizeDelta.x = 0f; rectTransform2.anchoredPosition = sizeDelta; ((Transform)(object)obj).SetAnchors(anchor); obj.anchoredPosition = Vector2.zero; val2.anchorMin = Vector2.zero; val2.anchorMax = Vector2.one; val2.pivot = val; val2.anchoredPosition = new Vector2(0f - 2f * ((MenuElement)this).RectTransform.offsetMax.x - 91f, 0f); val3.anchorMax = anchorMax; val3.anchorMin = anchorMin; val3.anchoredPosition = new Vector2(((MenuElement)this).RectTransform.offsetMin.x, 0f); val3.sizeDelta = new Vector2(1000f + ((MenuElement)this).RectTransform.offsetMax.x, 0f); ((Transform)(object)val4).SetAnchors(val); val4.anchoredPosition = Vector2.zero; ((Transform)(object)val5).SetAnchors(anchor); val5.anchoredPosition = Vector2.zero; base.ValueText.alignByGeometry = true; } } } namespace EdgeDetection.Components { internal class ColliderVisualizer : ObjectVisualizer { private Collider2D collider; private Lever? lever; private Vector3 origScale; private Mesh mesh; private static readonly Shader shader = Shader.Find("Sprites/Default"); private static readonly Type[] validTriggerTypes = new Type[3] { typeof(BouncePod), typeof(BounceBalloon), typeof(DamageHero) }; protected override void InitDupe() { //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_00e0: Unknown result type (might be due to invalid IL or missing references) //IL_00e5: Unknown result type (might be due to invalid IL or missing references) //IL_00f5: Unknown result type (might be due to invalid IL or missing references) //IL_0171: Unknown result type (might be due to invalid IL or missing references) //IL_017b: Expected O, but got Unknown ((Object)base.Dupe).name = ((Object)((Component)this).gameObject).name + " Collider"; origScale = ((Component)this).transform.lossyScale; lever = ((Component)((Component)this).transform).GetComponent<Lever>(); collider = ((Component)((Component)this).transform).GetComponent<Collider2D>(); if (!Object.op_Implicit((Object)(object)collider) || (collider.isTrigger && !IsTriggerVisualizable(collider))) { return; } Object.Destroy((Object)(object)mesh); mesh = collider.CreateMesh(true, true, true); if (Object.op_Implicit((Object)(object)mesh)) { mesh.vertices = mesh.vertices.Select((Vector3 v) => v - ((Component)this).transform.position).ToArray(); mesh.RotateVertices(Quaternion.Inverse(((Component)this).transform.rotation)); mesh.colors = Enumerable.Repeat<Color>(Color.white, mesh.vertexCount).ToArray(); if (Object.op_Implicit((Object)(object)((Component)((Component)this).transform).GetComponent<DamageHero>())) { base.Dupe.layer = 11; } else { base.Dupe.layer = ((Component)this).gameObject.layer; } base.Dupe.AddComponent<MeshFilter>().mesh = mesh; ((Renderer)base.Dupe.AddComponent<MeshRenderer>()).material = new Material(shader); base.Dupe.AddComponent<HideFromCamera>().hideFromMain = true; } } protected override void UpdateDupe() { //IL_0053: 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_0064: Unknown result type (might be due to invalid IL or missing references) //IL_0069: 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) if (!Object.op_Implicit((Object)(object)mesh)) { InitDupe(); } else if (!((Behaviour)collider).enabled || (Object.op_Implicit((Object)(object)lever) && lever.hitBlocked)) { base.Dupe.SetActive(false); } else { base.Dupe.transform.localScale = Vector3.Scale(Vector3.one, Extensions.DivideElements(((Component)this).transform.lossyScale, origScale)); } } protected override void DestroyDupe() { Object.Destroy((Object)(object)mesh); } private static bool IsTriggerVisualizable(Collider2D collider) { Collider2D collider2 = collider; if (!validTriggerTypes.Any((Type x) => Object.op_Implicit((Object)(object)((Component)collider2).GetComponent(x)))) { PlayMakerFSM val = default(PlayMakerFSM); if (((Component)collider2).TryGetComponent<PlayMakerFSM>(ref val)) { return val.FsmName == "hornet_multi_wounder"; } return false; } return true; } } [RequireComponent(typeof(Camera))] [RequireComponent(typeof(CameraShakeManager))] public class EdgeDetectionPass : MonoBehaviour { [CompilerGenerated] private string <Id>k__BackingField = ""; [CompilerGenerated] private byte <LineWidth>k__BackingField = 1; [CompilerGenerated] private PhysLayers[] <Layers>k__BackingField = (PhysLayers[])(object)new PhysLayers[1] { (PhysLayers)9 }; private int layerMask = LayerMask.GetMask(new string[1] { LayerMask.LayerToName(9) }); [CompilerGenerated] private float <AlphaThreshold>k__BackingField = 0.4f; [CompilerGenerated] private float <ClipFar>k__BackingField = 1.8f; [CompilerGenerated] private float <ClipNear>k__BackingField = 1.8f; [CompilerGenerated] private string <ExcludePass>k__BackingField = ""; internal static readonly Dictionary<string, EdgeDetectionPass> Passes = new Dictionary<string, EdgeDetectionPass>(); internal const byte WIDTH_MIN = 0; internal const byte WIDTH_MAX = 16; private Material edgeMat; private Camera mainCam; private Camera detectorCam; private CameraShakeManager mainShaker; private CameraShakeManager detectorShaker; private static readonly int thresholdID = Shader.PropertyToID("_AlphaThreshold"); private static readonly int lineColorID = Shader.PropertyToID("_LineColor"); private static readonly int sceneTexID = Shader.PropertyToID("_SceneTex"); private static readonly int subtractTexID = Shader.PropertyToID("_SubtractTex"); private const int SILHOUETTE_PASS = 0; private const int DETECT_PASS = 1; private const int COMPOSITE_PASS = 2; public string Id { get { return <Id>k__BackingField; } set { if (<Id>k__BackingField != value) { if (Passes.ContainsKey(value)) { throw new InvalidOperationException("The Id must be unique."); } Passes.Remove(<Id>k__BackingField); Passes.TryAdd(value, this); <Id>k__BackingField = value; } } } public Color LineColor { get; set; } = Color.white; public byte LineWidth { get { return <LineWidth>k__BackingField; } set { <LineWidth>k__BackingField = Math.Clamp(value, (byte)0, (byte)16); } } public PhysLayers[] Layers { get { return <Layers>k__BackingField; } set { <Layers>k__BackingField = value; layerMask = LayerMask.GetMask(<Layers>k__BackingField.Select((PhysLayers x) => LayerMask.LayerToName((int)x)).ToArray()); } } public bool HalfResolution { get; set; } public float AlphaThreshold { get { return <AlphaThreshold>k__BackingField; } set { <AlphaThreshold>k__BackingField = Mathf.Clamp01(value); } } public float ClipFar { get { return <ClipFar>k__BackingField; } set { <ClipFar>k__BackingField = Mathf.Max(0f, value); } } public float ClipNear { get { return <ClipNear>k__BackingField; } set { <ClipNear>k__BackingField = Mathf.Max(0f, value); } } public string ExcludePass { get { return <ExcludePass>k__BackingField; } set { <ExcludePass>k__BackingField = value ?? ""; } } private void Start() { //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Expected O, but got Unknown //IL_0093: Unknown result type (might be due to invalid IL or missing references) //IL_009d: Expected O, but got Unknown Passes.TryAdd(Id, this); mainCam = ((Component)this).GetComponent<Camera>(); GameObject val = new GameObject(Id + " Edge Detection Camera"); Extensions.SetParentReset(val.transform, ((Component)this).transform); detectorCam = Extensions.AddComponentIfNotPresent<Camera>(val); ((Behaviour)detectorCam).enabled = false; mainShaker = ((Component)this).GetComponent<CameraShakeManager>(); detectorShaker = Extensions.AddComponentIfNotPresent<CameraShakeManager>(val); mainShaker.CopyTo(val); val.AddComponent<EdgeDetector>().Settings = this; edgeMat = new Material(EdgeDetectionPlugin.EdgeDetectionShader); } private void OnDestroy() { Object.DestroyImmediate((Object)(object)((Component)detectorCam).gameObject); Object.DestroyImmediate((Object)(object)edgeMat); Passes.Remove(Id); } private void OnRenderImage(RenderTexture source, RenderTexture destination) { //IL_008c: Unknown result type (might be due to invalid IL or missing references) if (LineWidth < 1) { Graphics.Blit((Texture)(object)source, destination); return; } int num = ((!HalfResolution) ? 1 : 2); int width = ((Texture)source).width / num; int height = ((Texture)source).height / num; RenderTexture[] emptyTemporaryTextures; if (TryGetExcludePass(out EdgeDetectionPass other)) { emptyTemporaryTextures = GetEmptyTemporaryTextures(3, width, height); other.RenderSilhouette(emptyTemporaryTextures[2]); edgeMat.SetTexture(subtractTexID, (Texture)(object)emptyTemporaryTextures[2]); } else { emptyTemporaryTextures = GetEmptyTemporaryTextures(2, width, height); edgeMat.SetTexture(subtractTexID, (Texture)(object)Texture2D.blackTexture); } edgeMat.SetColor(lineColorID, LineColor); edgeMat.SetTexture(sceneTexID, (Texture)(object)source); RenderSilhouette(emptyTemporaryTextures[0]); for (int i = 0; i < LineWidth; i++) { Graphics.Blit((Texture)(object)emptyTemporaryTextures[0], emptyTemporaryTextures[1], edgeMat, 1); RenderTexture[] array = emptyTemporaryTextures; RenderTexture[] array2 = emptyTemporaryTextures; RenderTexture val = emptyTemporaryTextures[1]; RenderTexture val2 = emptyTemporaryTextures[0]; array[0] = val; array2[1] = val2; } Graphics.Blit((Texture)(object)emptyTemporaryTextures[0], destination, edgeMat, 2); for (int j = 0; j < emptyTemporaryTextures.Length; j++) { RenderTexture.ReleaseTemporary(emptyTemporaryTextures[j]); } } internal void RenderSilhouette(RenderTexture output) { //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0087: Unknown result type (might be due to invalid IL or missing references) //IL_009c: Unknown result type (might be due to invalid IL or missing references) detectorCam.CopyFrom(mainCam); detectorCam.clearFlags = (CameraClearFlags)2; detectorCam.backgroundColor = Color.clear; detectorCam.cullingMask = layerMask; if ((Object)(object)detectorShaker.cameraTypeReference != (Object)(object)mainShaker.cameraTypeReference) { mainShaker.CopyTo(((Component)detectorCam).gameObject); } if (Object.op_Implicit((Object)(object)HeroController.instance)) { float num = HeroController.instance.transform.position.z - ((Component)detectorCam).transform.position.z; detectorCam.farClipPlane = num + ClipFar; detectorCam.nearClipPlane = num - ClipNear; } else { detectorCam.farClipPlane = 42f; detectorCam.nearClipPlane = 38f; } RenderTexture val = GetEmptyTemporaryTextures(1, ((Texture)output).width, ((Texture)output).height)[0]; detectorCam.targetTexture = val; detectorCam.Render(); edgeMat.SetFloat(thresholdID, AlphaThreshold); Graphics.Blit((Texture)(object)val, output, edgeMat, 0); detectorCam.targetTexture = null; RenderTexture.ReleaseTemporary(val); } private bool TryGetExcludePass(out EdgeDetectionPass other) { other = null; if (ExcludePass != "" && ExcludePass != Id) { return Passes.TryGetValue(ExcludePass, out other); } return false; } private static RenderTexture[] GetEmptyTemporaryTextures(int count, int width, int height) { //IL_0028: Unknown result type (might be due to invalid IL or missing references) RenderTexture[] array = (RenderTexture[])(object)new RenderTexture[count]; RenderTexture active = RenderTexture.active; for (int i = 0; i < count; i++) { array[i] = RenderTexture.GetTemporary(width, height, 32, (RenderTextureFormat)0); RenderTexture.active = array[i]; GL.Clear(true, true, Color.clear); } RenderTexture.active = active; return array; } } [RequireComponent(typeof(Camera))] public class EdgeDetector : MonoBehaviour { public EdgeDetectionPass Settings { get; internal set; } } [RequireComponent(typeof(Renderer))] public class HideFromCamera : MonoBehaviour { public bool hideFromMain; public bool hideFromEdgeDetectors; public readonly HashSet<Camera> filteredCameras = new HashSet<Camera>(); private Renderer rend; private void Start() { rend = ((Component)this).GetComponent<Renderer>(); } private void OnDisable() { SetVisible(value: true); } private void OnWillRenderObject() { SetVisible(value: true); if ((hideFromMain && (Object)(object)Camera.current == (Object)(object)GameCameras.instance.mainCamera) || (hideFromEdgeDetectors && Object.op_Implicit((Object)(object)((Component)Camera.current).GetComponent<EdgeDetector>())) || filteredCameras.Contains(Camera.current)) { SetVisible(value: false); } } private void SetVisible(bool value) { //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0030: 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_0072: Unknown result type (might be due to invalid IL or missing references) if (!Object.op_Implicit((Object)(object)rend)) { Start(); } if (Object.op_Implicit((Object)(object)rend)) { Color color = (value ? Color.white : Color.clear); if (Object.op_Implicit((Object)(object)rend.sharedMaterial)) { rend.sharedMaterial.color = color; } else if (Object.op_Implicit((Object)(object)rend.material)) { rend.material.color = color; } } } } internal abstract class ObjectVisualizer : MonoBehaviour { private static GameObject dupeParent; protected GameObject Dupe { get; private set; } private void Start() { //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Expected O, but got Unknown //IL_0056: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Expected O, but got Unknown if (IsVisualizer(((Component)this).gameObject)) { Object.Destroy((Object)(object)this); return; } if (!Object.op_Implicit((Object)(object)dupeParent)) { dupeParent = new GameObject("Edge Detection Visualizers"); Object.DontDestroyOnLoad((Object)(object)dupeParent); Extensions.Reset(dupeParent.transform); } if (!Object.op_Implicit((Object)(object)Dupe)) { Dupe = new GameObject(); Extensions.SetParentReset(Dupe.transform, dupeParent.transform); InitDupe(); } } private void OnEnable() { Start(); if (Object.op_Implicit((Object)(object)Dupe) && ((Component)this).gameObject.activeInHierarchy) { Dupe.SetActive(true); } } private void Update() { //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Unknown result type (might be due to invalid IL or missing references) if (!Object.op_Implicit((Object)(object)Dupe)) { Start(); } if (Object.op_Implicit((Object)(object)Dupe)) { if (!((Component)this).gameObject.activeInHierarchy) { Dupe.SetActive(false); return; } Dupe.SetActive(true); Dupe.transform.SetPositionAndRotation(((Component)this).transform.position, ((Component)this).transform.rotation); Dupe.transform.localScale = ((Component)this).transform.lossyScale; UpdateDupe(); } } private void OnDisable() { if (Object.op_Implicit((Object)(object)Dupe)) { Dupe.SetActive(false); } } private void OnDestroy() { DestroyDupe(); Object.Destroy((Object)(object)Dupe); } public static bool IsVisualizer(GameObject go) { return IsVisualizer(go.transform); } public static bool IsVisualizer(Transform t) { if (Object.op_Implicit((Object)(object)dupeParent)) { if (!((Object)(object)t == (Object)(object)dupeParent.transform)) { return (Object)(object)t.parent == (Object)(object)dupeParent.transform; } return true; } return false; } protected abstract void InitDupe(); protected abstract void UpdateDupe(); protected abstract void DestroyDupe(); } internal class RemoveColliderVisualizer : MonoBehaviour { private const int MAX_TRIES = 10; private int tries; private void Awake() { TryRemove(); } private void Start() { TryRemove(); } private void Update() { TryRemove(); } private void TryRemove() { tries++; ColliderVisualizer colliderVisualizer = default(ColliderVisualizer); if (((Component)this).TryGetComponent<ColliderVisualizer>(ref colliderVisualizer)) { Object.Destroy((Object)(object)colliderVisualizer); Object.Destroy((Object)(object)this); } if (tries > 10) { Object.Destroy((Object)(object)this); } } } internal class SpriteVisualizer : ObjectVisualizer { public PhysLayers layer; private SpriteRenderer sprite; private SpriteRenderer dupeSprite; private tk2dSprite tk2d; private tk2dSprite dupeTk2d; private MeshRenderer dupeMesh; private Material dupeMat; protected override void InitDupe() { ((Object)base.Dupe).name = ((Object)((Component)this).gameObject).name + " Sprite"; if (((Component)this).TryGetComponent<SpriteRenderer>(ref sprite)) { dupeSprite = base.Dupe.AddComponent<SpriteRenderer>(); ((Renderer)dupeSprite).materials = ((IEnumerable<Material>)((Renderer)sprite).materials).Select((Func<Material, Material>)((Material x) => new Material(x.shader))).ToArray(); } else if (((Component)this).TryGetComponent<tk2dSprite>(ref tk2d)) { base.Dupe.AddComponent<MeshFilter>(); dupeMesh = base.Dupe.AddComponent<MeshRenderer>(); dupeTk2d = base.Dupe.AddComponent<tk2dSprite>(); } if (Object.op_Implicit((Object)(object)sprite) || Object.op_Implicit((Object)(object)tk2d)) { base.Dupe.AddComponent<HideFromCamera>().hideFromMain = true; } } protected override void UpdateDupe() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Expected I4, but got Unknown //IL_00ad: Unknown result type (might be due to invalid IL or missing references) //IL_00ea: Unknown result type (might be due to invalid IL or missing references) //IL_00ef: Unknown result type (might be due to invalid IL or missing references) //IL_00f1: Expected O, but got Unknown //IL_00f6: Expected O, but got Unknown base.Dupe.layer = (int)layer; if (Object.op_Implicit((Object)(object)sprite)) { dupeSprite.sprite = sprite.sprite; dupeSprite.flipX = sprite.flipX; dupeSprite.flipY = sprite.flipY; } else if (Object.op_Implicit((Object)(object)tk2d) && ((tk2dBaseSprite)tk2d).CurrentSprite != ((tk2dBaseSprite)dupeTk2d).CurrentSprite) { if (Object.op_Implicit((Object)(object)dupeMat)) { Object.Destroy((Object)(object)dupeMat); } ((tk2dBaseSprite)dupeTk2d).scale = ((tk2dBaseSprite)tk2d).scale; ((tk2dBaseSprite)dupeTk2d).SetSprite(((tk2dBaseSprite)tk2d).collection, ((tk2dBaseSprite)tk2d).spriteId); MeshRenderer obj = dupeMesh; Material val = new Material(((Renderer)dupeMesh).material); Material material = val; dupeMat = val; ((Renderer)obj).material = material; } } protected override void DestroyDupe() { Object.Destroy((Object)(object)dupeMat); } } }