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 REPO Wide Angle Camera v1.0.0
WideAngleCamera/repo.barackobusiness.wideangle.dll
Decompiled a day agousing System; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using HarmonyLib; using Microsoft.CodeAnalysis; using Mono.Cecil.Cil; using MonoMod.Cil; using MonoMod.RuntimeDetour; using UnityEngine; using UnityEngine.Rendering; using UnityEngine.Rendering.PostProcessing; using UnityEngine.SceneManagement; [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("repo.barackobusiness.wideangle")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0+2c2cf36ef66ac4e79f3c2d5aa65939b94853fe59")] [assembly: AssemblyProduct("Wide Angle Camera")] [assembly: AssemblyTitle("repo.barackobusiness.wideangle")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace WideAngleCamera { public class CameraManager : MonoBehaviour { public enum Projection { Stereographic, Equisolid } public static CameraManager Instance; private Shader stereographic; private Shader equisolid; private Camera front; private Camera back; private Camera left; private Camera right; private Camera down; private Camera up; private RenderTexture cubemap; private Material screen; [CompilerGenerated] private bool <RenderBackface>k__BackingField; [CompilerGenerated] private Projection <Mode>k__BackingField; [CompilerGenerated] private float <FarClipPlane>k__BackingField; public bool RenderBackface { [CompilerGenerated] get { return <RenderBackface>k__BackingField; } internal set { ((Component)back).gameObject.SetActive(value); <RenderBackface>k__BackingField = value; } } public Projection Mode { [CompilerGenerated] get { return <Mode>k__BackingField; } internal set { switch (value) { case Projection.Stereographic: screen.shader = stereographic; break; case Projection.Equisolid: screen.shader = equisolid; break; } <Mode>k__BackingField = value; } } public float FOV { get { return screen.GetFloat("_FOV"); } internal set { screen.SetFloat("_FOV", value); } } public float FarClipPlane { [CompilerGenerated] get { return <FarClipPlane>k__BackingField; } internal set { Camera[] array = (Camera[])(object)new Camera[6] { front, back, left, right, down, up }; for (int i = 0; i < array.Length; i++) { array[i].farClipPlane = value; } <FarClipPlane>k__BackingField = value; } } private void Awake() { //IL_00b5: Unknown result type (might be due to invalid IL or missing references) //IL_00bf: Expected O, but got Unknown Instance = this; front = ((Component)((Component)this).transform.Find("Front")).GetComponent<Camera>(); back = ((Component)((Component)this).transform.Find("Back")).GetComponent<Camera>(); left = ((Component)((Component)this).transform.Find("Left")).GetComponent<Camera>(); right = ((Component)((Component)this).transform.Find("Right")).GetComponent<Camera>(); down = ((Component)((Component)this).transform.Find("Down")).GetComponent<Camera>(); up = ((Component)((Component)this).transform.Find("Up")).GetComponent<Camera>(); cubemap = new RenderTexture(512, 512, 16); ((Texture)cubemap).dimension = (TextureDimension)4; screen = ((Renderer)((Component)((Component)this).transform.parent.Find("Projector Screen")).GetComponent<MeshRenderer>()).material; screen.mainTexture = (Texture)(object)cubemap; FOV = WideAnglePlugin.Instance.FieldOfView.Value; stereographic = screen.shader; equisolid = WideAnglePlugin.Bundle.LoadAsset<Shader>("Assets/Shaders/Equisolid.shader"); } private void Update() { Graphics.CopyTexture((Texture)(object)front.targetTexture, 0, (Texture)(object)cubemap, 4); if (((Component)back).gameObject.activeSelf) { Graphics.CopyTexture((Texture)(object)back.targetTexture, 0, (Texture)(object)cubemap, 5); } Graphics.CopyTexture((Texture)(object)right.targetTexture, 0, (Texture)(object)cubemap, 0); Graphics.CopyTexture((Texture)(object)left.targetTexture, 0, (Texture)(object)cubemap, 1); Graphics.CopyTexture((Texture)(object)up.targetTexture, 0, (Texture)(object)cubemap, 2); Graphics.CopyTexture((Texture)(object)down.targetTexture, 0, (Texture)(object)cubemap, 3); float value = WideAnglePlugin.Instance.FieldOfView.Value; if (FOV != value) { FOV = Utility.ExpDecay(FOV, value, 5f, Time.deltaTime); } } } internal static class Hooks { [CompilerGenerated] private static class <>O { public static Manipulator <0>__EnvironmentDirector_FogLogic; public static Manipulator <1>__ValuableDiscoverGraphic_RendererBoundsInScreenSpace; public static Manipulator <2>__SemiFunc_OnScreen; public static Manipulator <3>__CrystalBall_StateActive; public static Manipulator <4>__CrystalBall_StateIdle; } private const BindingFlags Public = BindingFlags.Public; private const BindingFlags Private = BindingFlags.NonPublic; private const BindingFlags Static = BindingFlags.Static; private const BindingFlags Instance = BindingFlags.Instance; private static ManualLogSource _logger; private static List<ILHook> _hooks; internal static void Hook(ManualLogSource logger) { //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Expected O, but got Unknown //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Expected O, but got Unknown //IL_0090: Unknown result type (might be due to invalid IL or missing references) //IL_009a: Expected O, but got Unknown //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_0090: Expected O, but got Unknown //IL_00df: Unknown result type (might be due to invalid IL or missing references) //IL_00e9: Expected O, but got Unknown //IL_00d4: Unknown result type (might be due to invalid IL or missing references) //IL_00d9: Unknown result type (might be due to invalid IL or missing references) //IL_00df: Expected O, but got Unknown //IL_0124: Unknown result type (might be due to invalid IL or missing references) //IL_012e: Expected O, but got Unknown //IL_0119: Unknown result type (might be due to invalid IL or missing references) //IL_011e: Unknown result type (might be due to invalid IL or missing references) //IL_0124: Expected O, but got Unknown //IL_0169: Unknown result type (might be due to invalid IL or missing references) //IL_0173: Expected O, but got Unknown //IL_015e: Unknown result type (might be due to invalid IL or missing references) //IL_0163: Unknown result type (might be due to invalid IL or missing references) //IL_0169: Expected O, but got Unknown _logger = logger; _hooks = new List<ILHook>(); _logger.LogInfo((object)"Hooking `EnvironmentDirector::FogLogic`"); List<ILHook> hooks = _hooks; MethodInfo method = GetMethod<EnvironmentDirector>("FogLogic", BindingFlags.Instance | BindingFlags.NonPublic); object obj = <>O.<0>__EnvironmentDirector_FogLogic; if (obj == null) { Manipulator val = EnvironmentDirector_FogLogic; <>O.<0>__EnvironmentDirector_FogLogic = val; obj = (object)val; } hooks.Add(new ILHook((MethodBase)method, (Manipulator)obj)); _logger.LogInfo((object)"Hooking `ValuableDiscoverGraphic::RendererBoundsInScreenSpace`"); List<ILHook> hooks2 = _hooks; MethodInfo method2 = GetMethod<ValuableDiscoverGraphic>("RendererBoundsInScreenSpace", BindingFlags.Instance | BindingFlags.NonPublic); object obj2 = <>O.<1>__ValuableDiscoverGraphic_RendererBoundsInScreenSpace; if (obj2 == null) { Manipulator val2 = ValuableDiscoverGraphic_RendererBoundsInScreenSpace; <>O.<1>__ValuableDiscoverGraphic_RendererBoundsInScreenSpace = val2; obj2 = (object)val2; } hooks2.Add(new ILHook((MethodBase)method2, (Manipulator)obj2)); _logger.LogInfo((object)"Hooking `SemiFunc::OnScreen`"); List<ILHook> hooks3 = _hooks; MethodInfo? method3 = typeof(SemiFunc).GetMethod("OnScreen", BindingFlags.Static | BindingFlags.Public); object obj3 = <>O.<2>__SemiFunc_OnScreen; if (obj3 == null) { Manipulator val3 = SemiFunc_OnScreen; <>O.<2>__SemiFunc_OnScreen = val3; obj3 = (object)val3; } hooks3.Add(new ILHook((MethodBase)method3, (Manipulator)obj3)); _logger.LogInfo((object)"Hooking `CrystalBallValuable::StateActive`"); List<ILHook> hooks4 = _hooks; MethodInfo method4 = GetMethod<CrystalBallValuable>("StateActive", BindingFlags.Instance | BindingFlags.NonPublic); object obj4 = <>O.<3>__CrystalBall_StateActive; if (obj4 == null) { Manipulator val4 = CrystalBall_StateActive; <>O.<3>__CrystalBall_StateActive = val4; obj4 = (object)val4; } hooks4.Add(new ILHook((MethodBase)method4, (Manipulator)obj4)); _logger.LogInfo((object)"Hooking `CrystalBallValuable::StateIdle`"); List<ILHook> hooks5 = _hooks; MethodInfo method5 = GetMethod<CrystalBallValuable>("StateIdle", BindingFlags.Instance | BindingFlags.NonPublic); object obj5 = <>O.<4>__CrystalBall_StateIdle; if (obj5 == null) { Manipulator val5 = CrystalBall_StateIdle; <>O.<4>__CrystalBall_StateIdle = val5; obj5 = (object)val5; } hooks5.Add(new ILHook((MethodBase)method5, (Manipulator)obj5)); } internal static void Unhook() { foreach (ILHook hook in _hooks) { hook.Dispose(); } } private static MethodInfo GetMethod<T>(string name, BindingFlags flags) { return typeof(T).GetMethod(name, flags); } private static void EnvironmentDirector_FogLogic(ILContext il) { //IL_0001: 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_0091: Unknown result type (might be due to invalid IL or missing references) //IL_01c5: Unknown result type (might be due to invalid IL or missing references) //IL_01d1: Unknown result type (might be due to invalid IL or missing references) ILCursor val = new ILCursor(il).Goto(0, (MoveType)0, false); if (val.TryGotoNext((MoveType)2, new Func<Instruction, bool>[3] { (Instruction x) => ILPatternMatchingExt.MatchLdarg(x, 0), (Instruction x) => ILPatternMatchingExt.MatchLdfld<EnvironmentDirector>(x, "FogStartDistance"), (Instruction x) => ILPatternMatchingExt.MatchCall<RenderSettings>(x, "set_fogStartDistance") })) { val.Emit(OpCodes.Ldarg_0); val.Emit<EnvironmentDirector>(OpCodes.Ldfld, "FogEndDistance"); val.EmitDelegate<Action<float>>((Action<float>)delegate(float FogEndDistance) { if (RenderSettings.fogEndDistance != FogEndDistance) { RenderSettings.fogEndDistance = FogEndDistance; } }); } if (!val.TryGotoNext((MoveType)2, new Func<Instruction, bool>[7] { (Instruction x) => ILPatternMatchingExt.MatchLdarg(x, 0), (Instruction x) => ILPatternMatchingExt.MatchLdfld<EnvironmentDirector>(x, "MainCamera"), (Instruction x) => ILPatternMatchingExt.MatchLdarg(x, 0), (Instruction x) => ILPatternMatchingExt.MatchLdfld<EnvironmentDirector>(x, "FogEndDistance"), (Instruction x) => ILPatternMatchingExt.MatchLdcR4(x, 1f), (Instruction x) => ILPatternMatchingExt.MatchAdd(x), (Instruction x) => ILPatternMatchingExt.MatchCallvirt<Camera>(x, "set_farClipPlane") })) { return; } val.Emit(OpCodes.Ldarg_0); val.Emit<EnvironmentDirector>(OpCodes.Ldfld, "FogEndDistance"); val.EmitDelegate<Action<float>>((Action<float>)delegate(float FogEndDistance) { if ((Object)(object)CameraManager.Instance != (Object)null) { CameraManager.Instance.FarClipPlane = FogEndDistance + 1f; } }); } private static void ValuableDiscoverGraphic_RendererBoundsInScreenSpace(ILContext il) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Expected O, but got Unknown ILCursor val = new ILCursor(il); int i; for (i = 0; i < 8; i++) { if (val.TryGotoNext((MoveType)2, new Func<Instruction, bool>[3] { (Instruction x) => ILPatternMatchingExt.MatchLdarg(x, 0), (Instruction x) => ILPatternMatchingExt.MatchLdfld<ValuableDiscoverGraphic>(x, "screenSpaceCorners"), (Instruction x) => ILPatternMatchingExt.MatchLdcI4(x, i) })) { val.RemoveRange(2); val.Index += 22; val.Remove(); val.EmitDelegate<Func<Vector3, Vector3>>((Func<Vector3, Vector3>)((Vector3 bound) => Utility.WorldToViewportPoint(((Component)CameraManager.Instance).transform, bound))); } } } private static void SemiFunc_OnScreen(ILContext il) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Expected O, but got Unknown //IL_00c8: Unknown result type (might be due to invalid IL or missing references) ILCursor val = new ILCursor(il); if (!val.TryGotoNext(new Func<Instruction, bool>[5] { (Instruction x) => ILPatternMatchingExt.MatchLdsfld<CameraUtils>(x, "Instance"), (Instruction x) => ILPatternMatchingExt.MatchLdfld<CameraUtils>(x, "MainCamera"), (Instruction x) => ILPatternMatchingExt.MatchLdarg(x, 0), (Instruction x) => ILPatternMatchingExt.MatchCallvirt<Camera>(x, "WorldToScreenPoint"), (Instruction x) => ILPatternMatchingExt.MatchStloc(x, 0) })) { return; } val.RemoveRange(4); val.Emit(OpCodes.Ldarg_0); val.EmitDelegate<Func<Vector3, Vector3>>((Func<Vector3, Vector3>)delegate(Vector3 position) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0053: 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_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Unknown result type (might be due to invalid IL or missing references) Vector3 zero = Vector3.zero; if ((Object)(object)CameraManager.Instance != (Object)null) { zero = Utility.WorldToViewportPoint(((Component)CameraManager.Instance).transform, position); zero.x *= Screen.width; zero.y *= Screen.height; } else { zero = Camera.main.WorldToScreenPoint(position); } return zero; }); } private static void CrystalBall_StateActive(ILContext il) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Expected O, but got Unknown ILCursor val = new ILCursor(il); ILLabel val2 = default(ILLabel); if (val.TryGotoNext((MoveType)2, new Func<Instruction, bool>[3] { (Instruction x) => ILPatternMatchingExt.MatchLdarg(x, 0), (Instruction x) => ILPatternMatchingExt.MatchLdfld<CrystalBallValuable>(x, "activeLocal"), (Instruction x) => ILPatternMatchingExt.MatchBrtrue(x, ref val2) })) { val.EmitDelegate<Action>((Action)delegate { CameraManager.Instance.Mode = CameraManager.Projection.Equisolid; }); } } private static void CrystalBall_StateIdle(ILContext il) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Expected O, but got Unknown ILCursor val = new ILCursor(il); ILLabel val2 = default(ILLabel); if (val.TryGotoNext((MoveType)2, new Func<Instruction, bool>[3] { (Instruction x) => ILPatternMatchingExt.MatchLdarg(x, 0), (Instruction x) => ILPatternMatchingExt.MatchLdfld<CrystalBallValuable>(x, "activeLocal"), (Instruction x) => ILPatternMatchingExt.MatchBrfalse(x, ref val2) })) { val.EmitDelegate<Action>((Action)delegate { CameraManager.Instance.Mode = CameraManager.Projection.Stereographic; }); } } } [BepInPlugin("repo.barackobusiness.wideangle", "Wide Angle Camera", "1.0.0")] public class WideAnglePlugin : BaseUnityPlugin { private Harmony Patcher; internal const int Resolution = 512; internal ConfigEntry<float> FieldOfView; internal ConfigEntry<bool> RenderBackface; internal static WideAnglePlugin Instance { get; private set; } internal static AssetBundle Bundle { get; private set; } private void Awake() { //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Expected O, but got Unknown //IL_00b2: Unknown result type (might be due to invalid IL or missing references) //IL_00bc: Expected O, but got Unknown Instance = this; ((Component)this).transform.parent = null; ((Object)((Component)this).gameObject).hideFlags = (HideFlags)61; FieldOfView = ((BaseUnityPlugin)this).Config.Bind<float>("", "Field of View", 145f, new ConfigDescription("The angle of visibility of the major axis of your display in degrees, generally this will be horizontal FOV.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(60f, 270f), Array.Empty<object>())); RenderBackface = ((BaseUnityPlugin)this).Config.Bind<bool>("", "Render Backface", true, "Whether or not to render the back view, affects performance and maximum possible FOV"); try { Bundle = AssetBundle.LoadFromFile(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location) + "\\WideAngleAssets"); Hooks.Hook(((BaseUnityPlugin)this).Logger); Patcher = new Harmony("repo.barackobusiness.wideangle"); Patcher.PatchAll(typeof(Patches)); ((BaseUnityPlugin)this).Logger.LogInfo((object)"Harmony instance created; patched `RenderTextureMain::Start` and `SpectateCamera::Awake`"); SceneManager.sceneLoaded += OnSceneLoad; ((BaseUnityPlugin)this).Config.SettingChanged += OnSettingChanged; ((BaseUnityPlugin)this).Logger.LogInfo((object)"repo.barackobusiness.wideangle v1.0.0 has loaded!"); } catch (Exception arg) { ((BaseUnityPlugin)this).Logger.LogError((object)string.Format("{0} failed to load: {1}", "repo.barackobusiness.wideangle", arg)); } } private void OnDestroy() { ((BaseUnityPlugin)this).Config.SettingChanged -= OnSettingChanged; SceneManager.sceneLoaded -= OnSceneLoad; Patcher.UnpatchSelf(); Hooks.Unhook(); } private void OnSceneLoad(Scene scene, LoadSceneMode mode) { //IL_0096: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: Expected O, but got Unknown //IL_00c2: Unknown result type (might be due to invalid IL or missing references) //IL_00d8: Unknown result type (might be due to invalid IL or missing references) //IL_00df: Expected O, but got Unknown if (!(((Scene)(ref scene)).name == "Reload") && !SemiFunc.IsMainMenu() && !SemiFunc.RunIsLobbyMenu()) { Transform transform = ((Component)Camera.main).transform; Transform obj = Utility.CopyCamera(((Component)transform).gameObject, Utility.Orientation.Front); Transform val = Utility.CopyCamera(((Component)obj).gameObject, Utility.Orientation.Back); Transform val2 = Utility.CopyCamera(((Component)obj).gameObject, Utility.Orientation.Left); Transform val3 = Utility.CopyCamera(((Component)obj).gameObject, Utility.Orientation.Right); Transform val4 = Utility.CopyCamera(((Component)obj).gameObject, Utility.Orientation.Down); Transform val5 = Utility.CopyCamera(((Component)obj).gameObject, Utility.Orientation.Up); GameObject obj2 = Utility.Projector(); ((Renderer)obj2.GetComponent<MeshRenderer>()).material = new Material(Bundle.LoadAsset<Shader>("Assets/Shaders/Stereographic.shader")); obj2.transform.SetParent(transform, false); obj2.transform.localPosition = new Vector3(0f, 0f, 0.5f); obj2.layer = 31; GameObject val6 = new GameObject("Wide Angle Camera"); ((Component)obj).transform.SetParent(val6.transform, false); ((Component)val).transform.SetParent(val6.transform, false); ((Component)val2).transform.SetParent(val6.transform, false); ((Component)val3).transform.SetParent(val6.transform, false); ((Component)val4).transform.SetParent(val6.transform, false); ((Component)val5).transform.SetParent(val6.transform, false); val6.transform.SetParent(transform, false); val6.AddComponent<CameraManager>().RenderBackface = RenderBackface.Value; Camera.main.nearClipPlane = 0f; Camera.main.farClipPlane = 1f; Camera.main.cullingMask = int.MinValue; Camera.main.orthographic = true; Camera.main.orthographicSize = 1f; Camera.main.useOcclusionCulling = false; Camera.main.clearFlags = (CameraClearFlags)4; Object.Destroy((Object)(object)((Component)Camera.main).GetComponent<PostProcessLayer>()); CameraGlitch.Instance = ((Component)((Component)Camera.main).transform.Find("Glitch")).GetComponent<CameraGlitch>(); } } private void OnSettingChanged(object sender, SettingChangedEventArgs arg) { if (!SemiFunc.IsMainMenu() && !SemiFunc.RunIsLobbyMenu() && Object.op_Implicit((Object)(object)CameraManager.Instance) && arg.ChangedSetting == RenderBackface) { CameraManager.Instance.RenderBackface = RenderBackface.Value; } } } internal static class Patches { [HarmonyPatch(typeof(SpectateCamera), "Awake")] [HarmonyPostfix] private static void Awake(SpectateCamera __instance, ref Camera ___TopCamera) { ___TopCamera = ((Component)((Component)Camera.main).transform.Find("Camera Top")).GetComponent<Camera>(); } [HarmonyPatch(typeof(RenderTextureMain), "Start")] [HarmonyPostfix] private static void Start(ref List<Camera> ___cameras) { ___cameras.RemoveAll((Camera cam) => (Object)(object)((Component)cam).transform.parent == (Object)null || (((Object)((Component)cam).transform.parent).name != "Camera Main" && ((Object)((Component)cam).transform.parent).name != "Tilt")); } } internal static class Utility { internal enum Orientation { Front, Back, Left, Right, Down, Up } internal static Transform CopyCamera(GameObject orig, Orientation orient) { //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_008b: Unknown result type (might be due to invalid IL or missing references) //IL_00aa: Unknown result type (might be due to invalid IL or missing references) //IL_00c6: Unknown result type (might be due to invalid IL or missing references) //IL_00e2: Unknown result type (might be due to invalid IL or missing references) //IL_011a: Unknown result type (might be due to invalid IL or missing references) //IL_00fe: Unknown result type (might be due to invalid IL or missing references) //IL_0130: Unknown result type (might be due to invalid IL or missing references) //IL_0136: Expected O, but got Unknown Transform transform = Object.Instantiate<GameObject>(orig).transform; ((Object)transform).name = orient.ToString(); foreach (Transform item in transform) { Object.Destroy((Object)(object)((Component)item).gameObject); } switch (orient) { case Orientation.Front: transform.localRotation = Quaternion.Euler(0f, 0f, 0f); break; case Orientation.Back: transform.localRotation = Quaternion.Euler(0f, 180f, 0f); break; case Orientation.Left: transform.localRotation = Quaternion.Euler(0f, 270f, 0f); break; case Orientation.Right: transform.localRotation = Quaternion.Euler(0f, 90f, 0f); break; case Orientation.Up: transform.localRotation = Quaternion.Euler(90f, 0f, 0f); break; case Orientation.Down: transform.localRotation = Quaternion.Euler(270f, 0f, 0f); break; } RenderTexture targetTexture = new RenderTexture(512, 512, 16); ((Component)transform).GetComponent<Camera>().targetTexture = targetTexture; ((Component)transform).GetComponent<Camera>().fieldOfView = 90f; return transform; } internal static GameObject Projector() { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Expected O, but got Unknown //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_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_008c: Unknown result type (might be due to invalid IL or missing references) //IL_0091: 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_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00d0: Unknown result type (might be due to invalid IL or missing references) //IL_00d5: Unknown result type (might be due to invalid IL or missing references) //IL_00dc: Unknown result type (might be due to invalid IL or missing references) //IL_010c: Expected O, but got Unknown Mesh val = new Mesh(); val.vertices = (Vector3[])(object)new Vector3[3] { new Vector3(-1f, -1f, 0f), new Vector3(3f, -1f, 0f), new Vector3(-1f, 3f, 0f) }; val.uv = (Vector2[])(object)new Vector2[3] { new Vector2(0f, 0f), new Vector2(2f, 0f), new Vector2(0f, 2f) }; val.triangles = new int[3] { 2, 1, 0 }; val.RecalculateBounds(); GameObject val2 = new GameObject("Projector Screen"); MeshFilter val3 = val2.AddComponent<MeshFilter>(); MeshRenderer obj = val2.AddComponent<MeshRenderer>(); ((Renderer)obj).receiveShadows = false; ((Renderer)obj).lightProbeUsage = (LightProbeUsage)0; ((Renderer)obj).shadowCastingMode = (ShadowCastingMode)0; ((Renderer)obj).motionVectorGenerationMode = (MotionVectorGenerationMode)2; ((Renderer)obj).reflectionProbeUsage = (ReflectionProbeUsage)0; val3.sharedMesh = val; return val2; } public static Vector3 WorldToViewportPoint(Transform cam, Vector3 worldPoint) { //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) //IL_0007: 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_0018: 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_0040: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Unknown result type (might be due to invalid IL or missing references) //IL_00bd: Unknown result type (might be due to invalid IL or missing references) Vector3 val = cam.InverseTransformPoint(worldPoint); val.z = 0f - val.z; Vector3 normalized = ((Vector3)(ref val)).normalized; float num = 1f / Mathf.Tan(CameraManager.Instance.FOV * (MathF.PI / 180f) * 0.25f); float num2 = num * (normalized.x / (1f - normalized.z)); float num3 = num * (normalized.y / (1f - normalized.z)); if ((double)Camera.main.aspect > 1.0) { num3 *= Camera.main.aspect; } else { num2 *= Camera.main.aspect; } return new Vector3(0.5f + num2 * 0.5f, 0.5f + num3 * 0.5f, ((Vector3)(ref val)).magnitude); } public static float ExpDecay(float a, float b, float decay, float dt) { return b + (a - b) * Mathf.Exp((0f - decay) * dt); } } public static class MyPluginInfo { public const string PLUGIN_GUID = "repo.barackobusiness.wideangle"; public const string PLUGIN_NAME = "Wide Angle Camera"; public const string PLUGIN_VERSION = "1.0.0"; } }