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 FpvDrone v1.0.0
plugins/FpvDrone.dll
Decompiled 2 days agousing System; using System.Collections.Generic; using System.Diagnostics; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using HarmonyLib; using Microsoft.CodeAnalysis; using UnityEngine; using UnityEngine.Events; using UnityEngine.InputSystem; using UnityEngine.InputSystem.Controls; using UnityEngine.UI; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")] [assembly: AssemblyCompany("FpvDrone")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0+93bb2dd43a7d87dde4ee80ea1037d7e2898f25c0")] [assembly: AssemblyProduct("FpvDrone")] [assembly: AssemblyTitle("FpvDrone")] [assembly: AssemblyVersion("1.0.0.0")] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace Jatify.FpvDrone { internal static class Log { private static ManualLogSource _s; internal static void Bind(ManualLogSource s) { if (_s == null) { _s = s; } } internal static void Info(string m) { ManualLogSource s = _s; if (s != null) { s.LogInfo((object)m); } } internal static void Warn(string m) { ManualLogSource s = _s; if (s != null) { s.LogWarning((object)m); } } } [BepInPlugin("jatify.fpvdrone", "FpvDrone", "1.0.0")] public class Plugin : BaseUnityPlugin { public const string Guid = "jatify.fpvdrone"; internal static ConfigEntry<KeyCode> Key; internal static ConfigEntry<KeyCode> SettingsKey; internal static ConfigEntry<float> MaxRate; internal static ConfigEntry<float> Expo; internal static ConfigEntry<float> ThrustG; internal static ConfigEntry<float> Drag; internal static ConfigEntry<float> CamTilt; internal static ConfigEntry<float> Fov; internal static ConfigEntry<float> Range; internal static ConfigEntry<float> BatteryMin; internal static ConfigEntry<float> Deadzone; internal static ConfigEntry<float> AngleMax; internal static ConfigEntry<bool> HideHud; internal static ConfigEntry<bool> InvertPitch; private void Awake() { //IL_0200: Unknown result type (might be due to invalid IL or missing references) //IL_0206: Expected O, but got Unknown //IL_0270: Unknown result type (might be due to invalid IL or missing references) //IL_0275: Unknown result type (might be due to invalid IL or missing references) Log.Bind(((BaseUnityPlugin)this).Logger); Key = ((BaseUnityPlugin)this).Config.Bind<KeyCode>("Controls", "LaunchKey", (KeyCode)278, "Keyboard key to launch / land the drone (Valheim uses every gamepad button, so launching is keyboard only)."); SettingsKey = ((BaseUnityPlugin)this).Config.Bind<KeyCode>("Controls", "SettingsKey", (KeyCode)279, "Opens the drone settings panel (sliders for sensitivity, thrust, camera)."); Deadzone = ((BaseUnityPlugin)this).Config.Bind<float>("Controls", "Deadzone", 0.06f, "Stick deadzone."); InvertPitch = ((BaseUnityPlugin)this).Config.Bind<bool>("Controls", "InvertPitch", false, "Pull back to dive instead of push forward."); MaxRate = ((BaseUnityPlugin)this).Config.Bind<float>("Rates", "MaxRate", 670f, "Acro: rotation rate at full stick, degrees per second."); Expo = ((BaseUnityPlugin)this).Config.Bind<float>("Rates", "Expo", 0.45f, "0 = linear sticks, 1 = very soft around the centre."); AngleMax = ((BaseUnityPlugin)this).Config.Bind<float>("Rates", "AngleModeMaxTilt", 45f, "Angle mode: tilt at full stick, degrees."); ThrustG = ((BaseUnityPlugin)this).Config.Bind<float>("Physics", "ThrustG", 4f, "Thrust at full throttle, in g (1 = just hovers)."); Drag = ((BaseUnityPlugin)this).Config.Bind<float>("Physics", "Drag", 0.011f, "Air drag (higher = lower top speed)."); CamTilt = ((BaseUnityPlugin)this).Config.Bind<float>("Camera", "UptiltDegrees", 25f, "Camera tilted up from the frame, like a real FPV quad."); Fov = ((BaseUnityPlugin)this).Config.Bind<float>("Camera", "Fov", 105f, "Field of view while flying."); HideHud = ((BaseUnityPlugin)this).Config.Bind<bool>("Camera", "HideHud", true, "Hide the game HUD while flying."); Range = ((BaseUnityPlugin)this).Config.Bind<float>("Flight", "RangeMeters", 230f, "Signal range from your character (the world only streams around you)."); BatteryMin = ((BaseUnityPlugin)this).Config.Bind<float>("Flight", "BatteryMinutes", 5f, "Flight time per launch."); Harmony val = new Harmony("jatify.fpvdrone"); Type[] types = typeof(Plugin).Assembly.GetTypes(); foreach (Type type in types) { try { val.CreateClassProcessor(type).Patch(); } catch (Exception ex) { Log.Warn("patch " + type.Name + " failed: " + ex.GetBaseException().Message); } } Log.Info("ready: press " + ((object)Key.Value/*cast due to .constrained prefix*/).ToString() + " to fly"); } private void Update() { Drone.Tick(Time.deltaTime); } } internal static class Drone { internal static bool Flying; private static Vector3 _pos; private static Vector3 _vel; private static Quaternion _rot; private static bool _angleMode; private static bool _crashed; private static float _battery; private static float _crashTimer; private static float _throttle; private static float _savedFov = -1f; private static string _crashText; private const float Radius = 0.18f; private static int _mask; internal static Vector3 CamPos => _pos; internal static Quaternion CamRot => _rot * Quaternion.Euler(0f - Plugin.CamTilt.Value, 0f, 0f); internal static void Tick(float dt) { //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_0079: Unknown result type (might be due to invalid IL or missing references) //IL_012f: Unknown result type (might be due to invalid IL or missing references) //IL_0134: Unknown result type (might be due to invalid IL or missing references) //IL_02db: Unknown result type (might be due to invalid IL or missing references) //IL_02e6: Unknown result type (might be due to invalid IL or missing references) //IL_0306: Unknown result type (might be due to invalid IL or missing references) //IL_030b: Unknown result type (might be due to invalid IL or missing references) Player localPlayer = Player.m_localPlayer; if ((Object)(object)localPlayer == (Object)null) { if (Flying) { Land(); } return; } Gamepad current = Gamepad.current; if (!Console.IsVisible() && (!((Object)(object)Chat.instance != (Object)null) || !Chat.instance.HasFocus()) && Input.GetKeyDown(Plugin.SettingsKey.Value)) { Settings.Toggle(); } if (Settings.Open) { if (Input.GetKeyDown((KeyCode)27)) { Settings.Close(); } return; } if (Input.GetKeyDown(Plugin.Key.Value) && !Console.IsVisible() && (!((Object)(object)Chat.instance != (Object)null) || !Chat.instance.HasFocus())) { if (Flying) { Land(); } else { Launch(localPlayer); } } if (!Flying) { return; } if (Input.GetKeyDown((KeyCode)27)) { Land(); return; } if (current != null && current.buttonEast.wasPressedThisFrame) { Reset(localPlayer, "RESET"); return; } if (current != null && current.buttonNorth.wasPressedThisFrame) { _angleMode = !_angleMode; } if (_crashed) { _crashTimer -= dt; if (_crashTimer <= 0f) { Reset(localPlayer, null); } Osd.Paint(_pos, _vel, localPlayer, _throttle, _battery, _angleMode, _crashText, current != null); return; } float num; float yaw; float num2; float roll; if (current != null) { num = ((InputControl<float>)(object)current.rightTrigger).ReadValue(); yaw = Dz(((InputControl<float>)(object)((Vector2Control)current.leftStick).x).ReadValue()); num2 = Dz(((InputControl<float>)(object)((Vector2Control)current.rightStick).y).ReadValue()); roll = Dz(((InputControl<float>)(object)((Vector2Control)current.rightStick).x).ReadValue()); } else { num = (Input.GetKey((KeyCode)32) ? 1f : (Input.GetKey((KeyCode)304) ? 0.35f : 0f)); num2 = (Input.GetKey((KeyCode)119) ? 1f : 0f) - (Input.GetKey((KeyCode)115) ? 1f : 0f); roll = (Input.GetKey((KeyCode)100) ? 1f : 0f) - (Input.GetKey((KeyCode)97) ? 1f : 0f); yaw = (Input.GetKey((KeyCode)101) ? 1f : 0f) - (Input.GetKey((KeyCode)113) ? 1f : 0f); } if (Plugin.InvertPitch.Value) { num2 = 0f - num2; } _throttle = num; int num3 = Mathf.Clamp(Mathf.CeilToInt(dt / 0.004f), 1, 20); float h = dt / (float)num3; for (int i = 0; i < num3; i++) { if (_crashed) { break; } Step(h, num, yaw, num2, roll, localPlayer); } _battery -= dt; if (_battery <= 0f) { Crash("BATTERY EMPTY"); } if (Vector3.Distance(_pos, ((Component)localPlayer).transform.position) > Plugin.Range.Value) { Crash("SIGNAL LOST"); } Osd.Paint(_pos, _vel, localPlayer, num, _battery, _angleMode, _crashed ? _crashText : null, current != null); } private static void Step(float h, float thr, float yaw, float pitch, float roll, Player p) { //IL_00d6: Unknown result type (might be due to invalid IL or missing references) //IL_00f6: 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_000a: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_0019: 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_0105: Unknown result type (might be due to invalid IL or missing references) //IL_010a: Unknown result type (might be due to invalid IL or missing references) //IL_010f: Unknown result type (might be due to invalid IL or missing references) //IL_0114: Unknown result type (might be due to invalid IL or missing references) //IL_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_0135: Unknown result type (might be due to invalid IL or missing references) //IL_013a: Unknown result type (might be due to invalid IL or missing references) //IL_0144: Unknown result type (might be due to invalid IL or missing references) //IL_0149: Unknown result type (might be due to invalid IL or missing references) //IL_014e: Unknown result type (might be due to invalid IL or missing references) //IL_014f: Unknown result type (might be due to invalid IL or missing references) //IL_0150: Unknown result type (might be due to invalid IL or missing references) //IL_015f: Unknown result type (might be due to invalid IL or missing references) //IL_016e: Unknown result type (might be due to invalid IL or missing references) //IL_0173: Unknown result type (might be due to invalid IL or missing references) //IL_0178: Unknown result type (might be due to invalid IL or missing references) //IL_0179: 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_0180: Unknown result type (might be due to invalid IL or missing references) //IL_0185: Unknown result type (might be due to invalid IL or missing references) //IL_018a: Unknown result type (might be due to invalid IL or missing references) //IL_018f: Unknown result type (might be due to invalid IL or missing references) //IL_0195: Unknown result type (might be due to invalid IL or missing references) //IL_019a: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_005f: 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_007b: Unknown result type (might be due to invalid IL or missing references) //IL_0080: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: 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_00af: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: 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_00ca: Unknown result type (might be due to invalid IL or missing references) //IL_00cf: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Unknown result type (might be due to invalid IL or missing references) //IL_0289: Unknown result type (might be due to invalid IL or missing references) //IL_028e: Unknown result type (might be due to invalid IL or missing references) //IL_028f: Unknown result type (might be due to invalid IL or missing references) //IL_0294: Unknown result type (might be due to invalid IL or missing references) //IL_01ae: Unknown result type (might be due to invalid IL or missing references) //IL_01b8: Unknown result type (might be due to invalid IL or missing references) //IL_01ba: Unknown result type (might be due to invalid IL or missing references) //IL_0220: Unknown result type (might be due to invalid IL or missing references) //IL_0227: Unknown result type (might be due to invalid IL or missing references) //IL_0243: Unknown result type (might be due to invalid IL or missing references) //IL_024a: Unknown result type (might be due to invalid IL or missing references) //IL_0254: Unknown result type (might be due to invalid IL or missing references) //IL_0259: Unknown result type (might be due to invalid IL or missing references) //IL_025e: Unknown result type (might be due to invalid IL or missing references) //IL_0263: Unknown result type (might be due to invalid IL or missing references) //IL_0268: Unknown result type (might be due to invalid IL or missing references) //IL_026f: Unknown result type (might be due to invalid IL or missing references) //IL_0274: Unknown result type (might be due to invalid IL or missing references) //IL_027e: Unknown result type (might be due to invalid IL or missing references) //IL_0283: Unknown result type (might be due to invalid IL or missing references) //IL_01e3: 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) //IL_0206: Unknown result type (might be due to invalid IL or missing references) //IL_020b: Unknown result type (might be due to invalid IL or missing references) //IL_0210: Unknown result type (might be due to invalid IL or missing references) if (_angleMode) { Vector3 val = Vector3.ProjectOnPlane(_rot * Vector3.forward, Vector3.up); if (((Vector3)(ref val)).sqrMagnitude < 0.01f) { val = Vector3.ProjectOnPlane(_rot * Vector3.up, Vector3.up) * -1f; } Quaternion val2 = Quaternion.LookRotation(((Vector3)(ref val)).normalized, Vector3.up) * Quaternion.Euler(0f, Rate(yaw) * h, 0f) * Quaternion.Euler((0f - pitch) * Plugin.AngleMax.Value, 0f, (0f - roll) * Plugin.AngleMax.Value); _rot = Quaternion.Slerp(_rot, val2, 1f - Mathf.Exp(-10f * h)); } else { _rot *= Quaternion.Euler((0f - Rate(pitch)) * h, Rate(yaw) * h, (0f - Rate(roll)) * h); } _rot = Quaternion.Normalize(_rot); Vector3 val3 = _rot * Vector3.up * (Plugin.ThrustG.Value * 9.81f * thr) + Vector3.down * 9.81f; val3 -= _vel * ((Vector3)(ref _vel)).magnitude * Plugin.Drag.Value; _vel += val3 * h; Vector3 val4 = _vel * h; float magnitude = ((Vector3)(ref val4)).magnitude; RaycastHit val5 = default(RaycastHit); if (magnitude > 1E-05f && Physics.SphereCast(_pos, 0.18f, val4 / magnitude, ref val5, magnitude, _mask, (QueryTriggerInteraction)1)) { if (((Vector3)(ref _vel)).magnitude > 7f) { _pos += ((Vector3)(ref val4)).normalized * Mathf.Max(0f, ((RaycastHit)(ref val5)).distance - 0.02f); Crash("CRASHED"); } else { _pos += ((Vector3)(ref val4)).normalized * Mathf.Max(0f, ((RaycastHit)(ref val5)).distance - 0.02f) + ((RaycastHit)(ref val5)).normal * 0.01f; _vel = Vector3.ProjectOnPlane(_vel, ((RaycastHit)(ref val5)).normal) * 0.6f; } } else { _pos += val4; float num = (((Object)(object)ZoneSystem.instance != (Object)null) ? ZoneSystem.instance.m_waterLevel : 30f); if (_pos.y < num - 0.1f) { Crash("IN THE WATER"); } } } private static float Dz(float v) { float value = Plugin.Deadzone.Value; if (!(Mathf.Abs(v) < value)) { return Mathf.Sign(v) * (Mathf.Abs(v) - value) / (1f - value); } return 0f; } private static float Rate(float s) { float num = Mathf.Clamp01(Plugin.Expo.Value); return Plugin.MaxRate.Value * (num * s * s * s + (1f - num) * s); } private static void Launch(Player p) { if (_mask == 0) { _mask = LayerMask.GetMask(new string[10] { "Default", "static_solid", "terrain", "piece", "Default_small", "vehicle", "character", "character_net", "tree", "rock" }); } Flying = true; _angleMode = false; if (Plugin.HideHud.Value && (Object)(object)Hud.instance != (Object)null) { Hud.instance.m_rootObject.SetActive(false); } Reset(p, null); Osd.Show(on: true); Log.Info("drone launched"); } internal static void Land() { Flying = false; _crashed = false; if ((Object)(object)Hud.instance != (Object)null) { Hud.instance.m_rootObject.SetActive(true); } Camera val = (((Object)(object)GameCamera.instance != (Object)null) ? ((Component)GameCamera.instance).GetComponent<Camera>() : null); if ((Object)(object)val != (Object)null && _savedFov > 0f) { val.fieldOfView = _savedFov; } _savedFov = -1f; Osd.Show(on: false); Log.Info("drone landed"); } private static void Reset(Player p, string why) { //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_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) //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_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Unknown result type (might be due to invalid IL or missing references) //IL_004d: 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_0053: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Unknown result type (might be due to invalid IL or missing references) Vector3 val = Vector3.ProjectOnPlane(((Component)p).transform.forward, Vector3.up); Vector3 normalized = ((Vector3)(ref val)).normalized; _pos = ((Component)p).transform.position + Vector3.up * 1.8f + normalized * 1.2f; _rot = Quaternion.LookRotation(normalized, Vector3.up); _vel = Vector3.zero; _crashed = false; _battery = Plugin.BatteryMin.Value * 60f; if (why != null) { Log.Info(why); } } private static void Crash(string why) { //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) if (!_crashed) { _crashed = true; _crashText = why; _crashTimer = 1.6f; _vel = Vector3.zero; } } internal static void ApplyCamera(Camera cam) { //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Unknown result type (might be due to invalid IL or missing references) if (_savedFov < 0f) { _savedFov = cam.fieldOfView; } ((Component)cam).transform.SetPositionAndRotation(CamPos, CamRot); cam.fieldOfView = Plugin.Fov.Value; } } [HarmonyPatch(typeof(GameCamera), "LateUpdate")] internal static class CameraFollowsDrone { private static void Postfix(GameCamera __instance) { //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) if (Drone.Flying) { Camera component = ((Component)__instance).GetComponent<Camera>(); if ((Object)(object)component != (Object)null) { Drone.ApplyCamera(component); } else { ((Component)__instance).transform.SetPositionAndRotation(Drone.CamPos, Drone.CamRot); } } } } [HarmonyPatch(typeof(Player), "TakeInput")] internal static class PlayerStill { private static void Postfix(ref bool __result) { if (Drone.Flying) { __result = false; } } } [HarmonyPatch] internal static class MuteValheimGamepad { private static IEnumerable<MethodBase> TargetMethods() { return from m in AccessTools.GetDeclaredMethods(typeof(ZInput)) where m.IsStatic && m.ReturnType == typeof(bool) && !m.IsGenericMethod && (m.Name.StartsWith("GetButton") || m.Name.StartsWith("GetJoy")) select m; } private static bool Prefix(MethodBase __originalMethod, object[] __args, ref bool __result) { if (!Drone.Flying) { return true; } if (__args.Length != 0 && __args[0] is string text && text.Contains("Menu")) { return true; } __result = false; return false; } } [HarmonyPatch] internal static class MuteValheimSticks { private static IEnumerable<MethodBase> TargetMethods() { return from m in AccessTools.GetDeclaredMethods(typeof(ZInput)) where m.IsStatic && m.ReturnType == typeof(float) && !m.IsGenericMethod && m.Name.StartsWith("GetJoy") select m; } private static bool Prefix(ref float __result) { if (!Drone.Flying) { return true; } __result = 0f; return false; } } internal static class Osd { private static GameObject _go; private static Text _left; private static Text _center; private static Text _right; private static Image _thrBar; internal static void Show(bool on) { if (on && (Object)(object)_go == (Object)null) { Build(); } if ((Object)(object)_go != (Object)null) { _go.SetActive(on); } } private static void Build() { //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Expected O, but got Unknown //IL_0066: Unknown result type (might be due to invalid IL or missing references) //IL_009a: Unknown result type (might be due to invalid IL or missing references) //IL_00a9: Unknown result type (might be due to invalid IL or missing references) //IL_00c6: 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_00f2: Unknown result type (might be due to invalid IL or missing references) //IL_0101: Unknown result type (might be due to invalid IL or missing references) //IL_0138: Unknown result type (might be due to invalid IL or missing references) //IL_018e: Unknown result type (might be due to invalid IL or missing references) //IL_019d: Unknown result type (might be due to invalid IL or missing references) //IL_01ac: Unknown result type (might be due to invalid IL or missing references) //IL_01db: Unknown result type (might be due to invalid IL or missing references) //IL_0211: Unknown result type (might be due to invalid IL or missing references) //IL_0221: Unknown result type (might be due to invalid IL or missing references) //IL_0226: Unknown result type (might be due to invalid IL or missing references) //IL_0227: Unknown result type (might be due to invalid IL or missing references) //IL_0228: Unknown result type (might be due to invalid IL or missing references) //IL_023a: Unknown result type (might be due to invalid IL or missing references) //IL_0240: Unknown result type (might be due to invalid IL or missing references) //IL_0241: Unknown result type (might be due to invalid IL or missing references) //IL_0242: Unknown result type (might be due to invalid IL or missing references) //IL_0248: Unknown result type (might be due to invalid IL or missing references) //IL_024e: Unknown result type (might be due to invalid IL or missing references) //IL_0259: Unknown result type (might be due to invalid IL or missing references) //IL_026d: Unknown result type (might be due to invalid IL or missing references) //IL_029c: Unknown result type (might be due to invalid IL or missing references) //IL_02da: Unknown result type (might be due to invalid IL or missing references) //IL_02ee: Unknown result type (might be due to invalid IL or missing references) //IL_02f3: Unknown result type (might be due to invalid IL or missing references) //IL_02fe: Unknown result type (might be due to invalid IL or missing references) //IL_0308: Unknown result type (might be due to invalid IL or missing references) //IL_0313: Unknown result type (might be due to invalid IL or missing references) //IL_031d: Unknown result type (might be due to invalid IL or missing references) //IL_0328: Unknown result type (might be due to invalid IL or missing references) //IL_0332: Unknown result type (might be due to invalid IL or missing references) //IL_0333: Unknown result type (might be due to invalid IL or missing references) //IL_0347: Unknown result type (might be due to invalid IL or missing references) _go = new GameObject("FpvDroneOsd", new Type[2] { typeof(Canvas), typeof(CanvasScaler) }); Canvas component = _go.GetComponent<Canvas>(); component.renderMode = (RenderMode)0; component.sortingOrder = 30000; CanvasScaler component2 = _go.GetComponent<CanvasScaler>(); component2.uiScaleMode = (ScaleMode)1; component2.referenceResolution = new Vector2(1920f, 1080f); component2.matchWidthOrHeight = 1f; Object.DontDestroyOnLoad((Object)(object)_go); Font builtinResource = Resources.GetBuiltinResource<Font>("LegacyRuntime.ttf"); _left = MakeText(builtinResource, new Vector2(0f, 0f), new Vector2(28f, 26f), (TextAnchor)6, 26); _right = MakeText(builtinResource, new Vector2(1f, 0f), new Vector2(-28f, 26f), (TextAnchor)8, 26); _center = MakeText(builtinResource, new Vector2(0.5f, 0.5f), new Vector2(0f, 80f), (TextAnchor)4, 44); Text component3 = new GameObject("cross", new Type[2] { typeof(RectTransform), typeof(Text) }).GetComponent<Text>(); ((Component)component3).transform.SetParent(_go.transform, false); component3.font = builtinResource; component3.fontSize = 34; component3.alignment = (TextAnchor)4; component3.text = "—+—"; ((Graphic)component3).color = new Color(1f, 1f, 1f, 0.75f); ((RectTransform)((Component)component3).transform).sizeDelta = new Vector2(200f, 60f); Image component4 = new GameObject("thrbg", new Type[2] { typeof(RectTransform), typeof(Image) }).GetComponent<Image>(); ((Component)component4).transform.SetParent(_go.transform, false); ((Graphic)component4).color = new Color(0f, 0f, 0f, 0.45f); RectTransform val = (RectTransform)((Component)component4).transform; Vector2 val2 = default(Vector2); ((Vector2)(ref val2))..ctor(0f, 0.5f); val.pivot = val2; Vector2 anchorMin = (val.anchorMax = val2); val.anchorMin = anchorMin; val.anchoredPosition = new Vector2(30f, 0f); val.sizeDelta = new Vector2(14f, 260f); _thrBar = new GameObject("thr", new Type[2] { typeof(RectTransform), typeof(Image) }).GetComponent<Image>(); ((Component)_thrBar).transform.SetParent(((Component)component4).transform, false); ((Graphic)_thrBar).color = new Color(1f, 1f, 1f, 0.85f); RectTransform val4 = (RectTransform)((Component)_thrBar).transform; val4.anchorMin = new Vector2(0f, 0f); val4.anchorMax = new Vector2(1f, 0f); val4.pivot = new Vector2(0.5f, 0f); val4.anchoredPosition = Vector2.zero; val4.sizeDelta = new Vector2(0f, 0f); } private static Text MakeText(Font font, Vector2 anchor, Vector2 pos, TextAnchor align, int size) { //IL_0032: 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_0069: Unknown result type (might be due to invalid IL or missing references) //IL_008d: Unknown result type (might be due to invalid IL or missing references) //IL_009d: Unknown result type (might be due to invalid IL or missing references) //IL_00a2: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_00a6: 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_00ad: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: Unknown result type (might be due to invalid IL or missing references) //IL_00af: Unknown result type (might be due to invalid IL or missing references) //IL_00b5: Unknown result type (might be due to invalid IL or missing references) //IL_00bb: Unknown result type (might be due to invalid IL or missing references) //IL_00bc: Unknown result type (might be due to invalid IL or missing references) //IL_00cc: Unknown result type (might be due to invalid IL or missing references) Text component = new GameObject("t", new Type[3] { typeof(RectTransform), typeof(Text), typeof(Outline) }).GetComponent<Text>(); ((Component)component).transform.SetParent(_go.transform, false); component.font = font; component.fontSize = size; component.alignment = align; ((Graphic)component).color = Color.white; ((Shadow)((Component)component).GetComponent<Outline>()).effectColor = new Color(0f, 0f, 0f, 0.85f); RectTransform val = (RectTransform)((Component)component).transform; Vector2 val2 = (val.pivot = anchor); Vector2 anchorMin = (val.anchorMax = val2); val.anchorMin = anchorMin; val.anchoredPosition = pos; val.sizeDelta = new Vector2(900f, 120f); return component; } internal static void Paint(Vector3 pos, Vector3 vel, Player p, float thr, float battery, bool angle, string alert, bool pad) { //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_0083: 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_015b: Unknown result type (might be due to invalid IL or missing references) //IL_0185: Unknown result type (might be due to invalid IL or missing references) //IL_0196: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)_go == (Object)null)) { float num2 = default(float); float num = (((Object)(object)ZoneSystem.instance != (Object)null && ZoneSystem.instance.GetGroundHeight(pos, ref num2)) ? num2 : pos.y); float num3 = Vector3.Distance(pos, ((Component)p).transform.position); int num4 = Mathf.Max(0, (int)(battery / 60f)); int num5 = Mathf.Max(0, (int)(battery % 60f)); _left.text = $"{((Vector3)(ref vel)).magnitude * 3.6f:0} km/h ALT {pos.y - num:0} m DIST {num3:0} m"; _right.text = string.Format("{0} THR {1:0}% BAT {2}:{3:00}", angle ? "ANGLE" : "ACRO", thr * 100f, num4, num5) + (pad ? "" : "\nno gamepad: Space / Shift throttle, WASD, Q/E"); _center.text = alert ?? ((num3 > Plugin.Range.Value * 0.85f) ? "LOW SIGNAL" : ((battery < 30f) ? "LOW BATTERY" : "")); ((Graphic)_center).color = ((alert != null) ? new Color(1f, 0.35f, 0.3f) : new Color(1f, 0.85f, 0.3f)); ((RectTransform)((Component)_thrBar).transform).sizeDelta = new Vector2(0f, 260f * thr); } } } internal static class Settings { private static GameObject _go; private static readonly List<Action> _refresh = new List<Action>(); private static readonly Color Bg = new Color(0.07f, 0.065f, 0.06f, 0.94f); private static readonly Color Line = new Color(0.85f, 0.7f, 0.43f, 0.45f); private static readonly Color Gold = new Color(0.9f, 0.78f, 0.49f); private static readonly Color Text = new Color(0.94f, 0.9f, 0.83f); private static readonly Color Dim = new Color(0.66f, 0.61f, 0.53f); private static Font _font; internal static bool Open { get { if ((Object)(object)_go != (Object)null) { return _go.activeSelf; } return false; } } internal static void Toggle() { if ((Object)(object)_go == (Object)null) { Build(); } _go.SetActive(!_go.activeSelf); foreach (Action item in _refresh) { item(); } } internal static void Close() { if ((Object)(object)_go != (Object)null) { _go.SetActive(false); } } private static void Build() { //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Expected O, but got Unknown //IL_0082: Unknown result type (might be due to invalid IL or missing references) //IL_00af: Unknown result type (might be due to invalid IL or missing references) //IL_00be: Unknown result type (might be due to invalid IL or missing references) //IL_00cf: Unknown result type (might be due to invalid IL or missing references) //IL_00d5: Expected O, but got Unknown //IL_00e9: Unknown result type (might be due to invalid IL or missing references) //IL_00f0: Unknown result type (might be due to invalid IL or missing references) //IL_00f2: Unknown result type (might be due to invalid IL or missing references) //IL_00f3: Unknown result type (might be due to invalid IL or missing references) //IL_00fa: Unknown result type (might be due to invalid IL or missing references) //IL_010d: Unknown result type (might be due to invalid IL or missing references) //IL_0121: Unknown result type (might be due to invalid IL or missing references) //IL_013e: Unknown result type (might be due to invalid IL or missing references) //IL_0149: Unknown result type (might be due to invalid IL or missing references) //IL_016f: Unknown result type (might be due to invalid IL or missing references) //IL_017a: Unknown result type (might be due to invalid IL or missing references) //IL_0255: Unknown result type (might be due to invalid IL or missing references) //IL_0403: Unknown result type (might be due to invalid IL or missing references) //IL_0441: Unknown result type (might be due to invalid IL or missing references) _font = Resources.GetBuiltinResource<Font>("LegacyRuntime.ttf"); _go = new GameObject("FpvDroneSettings", new Type[3] { typeof(Canvas), typeof(CanvasScaler), typeof(GraphicRaycaster) }); Canvas component = _go.GetComponent<Canvas>(); component.renderMode = (RenderMode)0; component.sortingOrder = 30001; CanvasScaler component2 = _go.GetComponent<CanvasScaler>(); component2.uiScaleMode = (ScaleMode)1; component2.referenceResolution = new Vector2(1920f, 1080f); component2.matchWidthOrHeight = 1f; Object.DontDestroyOnLoad((Object)(object)_go); Image val = Box(_go.transform, "panel", Bg, new Vector2(620f, 0f)); RectTransform val2 = (RectTransform)((Component)val).transform; Vector2 val3 = default(Vector2); ((Vector2)(ref val3))..ctor(0.5f, 0.5f); val2.pivot = val3; Vector2 anchorMin = (val2.anchorMax = val3); val2.anchorMin = anchorMin; Outline obj = ((Component)val).gameObject.AddComponent<Outline>(); ((Shadow)obj).effectColor = Line; ((Shadow)obj).effectDistance = new Vector2(1.5f, -1.5f); float num = -24f; Label(((Component)val).transform, "Drone settings", 30, Gold, new Vector2(28f, num), (TextAnchor)0, 560f); num -= 46f; Label(((Component)val).transform, "End: close · changes apply now and are saved", 17, Dim, new Vector2(28f, num), (TextAnchor)0, 560f); num -= 40f; float num2 = 28f; (string, float, float, float)[] array = new(string, float, float, float)[3] { ("Beginner", 300f, 0.6f, 3f), ("Normal", 480f, 0.5f, 3.6f), ("Racer", 670f, 0.45f, 4.5f) }; for (int i = 0; i < array.Length; i++) { var (label, rate, expo, thrust) = array[i]; Button(((Component)val).transform, label, new Vector2(num2, num), 170f, delegate { Plugin.MaxRate.Value = rate; Plugin.Expo.Value = expo; Plugin.ThrustG.Value = thrust; foreach (Action item in _refresh) { item(); } }); num2 += 184f; } num -= 64f; num = Row(((Component)val).transform, "Rotation speed", "how fast it flips and turns at full stick (deg/s)", Plugin.MaxRate, 150f, 1000f, "0", num); num = Row(((Component)val).transform, "Expo", "softer around the stick centre (0 = linear)", Plugin.Expo, 0f, 0.9f, "0.00", num); num = Row(((Component)val).transform, "Angle mode tilt", "how far it leans in Angle mode (degrees)", Plugin.AngleMax, 15f, 70f, "0", num); num = Row(((Component)val).transform, "Thrust", "power at full throttle (1 = just hovers)", Plugin.ThrustG, 1.5f, 8f, "0.0", num); num = Row(((Component)val).transform, "Air drag", "higher = slower top speed", Plugin.Drag, 0.003f, 0.03f, "0.000", num); num = Row(((Component)val).transform, "Stick deadzone", "ignore small stick movement", Plugin.Deadzone, 0f, 0.25f, "0.00", num); num = Row(((Component)val).transform, "Camera uptilt", "camera tilted up from the frame (degrees)", Plugin.CamTilt, 0f, 50f, "0", num); num = Row(((Component)val).transform, "Field of view", "", Plugin.Fov, 70f, 130f, "0", num); num -= 8f; Button(((Component)val).transform, "Reset all to defaults", new Vector2(28f, num), 260f, delegate { ConfigEntryBase[] array2 = (ConfigEntryBase[])(object)new ConfigEntryBase[8] { (ConfigEntryBase)Plugin.MaxRate, (ConfigEntryBase)Plugin.Expo, (ConfigEntryBase)Plugin.AngleMax, (ConfigEntryBase)Plugin.ThrustG, (ConfigEntryBase)Plugin.Drag, (ConfigEntryBase)Plugin.Deadzone, (ConfigEntryBase)Plugin.CamTilt, (ConfigEntryBase)Plugin.Fov }; foreach (ConfigEntryBase obj2 in array2) { obj2.BoxedValue = obj2.DefaultValue; } foreach (Action item2 in _refresh) { item2(); } }); num -= 70f; val2.sizeDelta = new Vector2(620f, 0f - num); _go.SetActive(false); } private static float Row(Transform parent, string name, string hint, ConfigEntry<float> entry, float min, float max, string fmt, float y) { //IL_0019: 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_003f: 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_006d: 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_00af: Unknown result type (might be due to invalid IL or missing references) Label(parent, name, 21, Text, new Vector2(28f, y), (TextAnchor)0, 300f); Text value = Label(parent, "", 21, Gold, new Vector2(470f, y), (TextAnchor)2, 120f); if (hint.Length > 0) { Label(parent, hint, 15, Dim, new Vector2(28f, y - 26f), (TextAnchor)0, 560f); } Slider slider = Slider(parent, new Vector2(28f, y - ((hint.Length > 0) ? 52f : 30f)), 562f, min, max); ((UnityEvent<float>)(object)slider.onValueChanged).AddListener((UnityAction<float>)delegate(float v) { entry.Value = v; value.text = v.ToString(fmt); }); _refresh.Add(delegate { slider.SetValueWithoutNotify(entry.Value); value.text = entry.Value.ToString(fmt); }); return y - ((hint.Length > 0) ? 84f : 62f); } private static Image Box(Transform parent, string name, Color color, Vector2 size) { //IL_0021: 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_0045: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Unknown result type (might be due to invalid IL or missing references) Image component = new GameObject(name, new Type[2] { typeof(RectTransform), typeof(Image) }).GetComponent<Image>(); ((Component)component).transform.SetParent(parent, false); ((Graphic)component).color = color; ((RectTransform)((Component)component).transform).sizeDelta = size; return component; } private static RectTransform TopLeft(Component c, Vector2 pos, Vector2 size) { //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_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_001f: 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_0026: 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_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_0034: 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_003b: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Expected O, but got Unknown RectTransform val = (RectTransform)c.transform; Vector2 val2 = default(Vector2); ((Vector2)(ref val2))..ctor(0f, 1f); val.pivot = val2; Vector2 anchorMin = (val.anchorMax = val2); val.anchorMin = anchorMin; val.anchoredPosition = pos; val.sizeDelta = size; return val; } private static Text Label(Transform parent, string text, int size, Color color, Vector2 pos, TextAnchor align, float width) { //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_004f: 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_006c: Unknown result type (might be due to invalid IL or missing references) //IL_0078: Unknown result type (might be due to invalid IL or missing references) Text component = new GameObject("t", new Type[2] { typeof(RectTransform), typeof(Text) }).GetComponent<Text>(); ((Component)component).transform.SetParent(parent, false); component.font = _font; component.fontSize = size; ((Graphic)component).color = color; component.alignment = align; component.text = text; ((Graphic)component).raycastTarget = false; TopLeft((Component)(object)component, pos, new Vector2(width, (float)size + 10f)); return component; } private static void Button(Transform parent, string label, Vector2 pos, float width, Action click) { //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_003f: 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_006b: Unknown result type (might be due to invalid IL or missing references) //IL_0070: Unknown result type (might be due to invalid IL or missing references) //IL_0082: Unknown result type (might be due to invalid IL or missing references) //IL_009d: Unknown result type (might be due to invalid IL or missing references) //IL_00a8: Unknown result type (might be due to invalid IL or missing references) //IL_00ba: Unknown result type (might be due to invalid IL or missing references) //IL_00c4: Expected O, but got Unknown //IL_00cc: Unknown result type (might be due to invalid IL or missing references) //IL_00d1: 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_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_00f2: Unknown result type (might be due to invalid IL or missing references) //IL_00f3: Unknown result type (might be due to invalid IL or missing references) //IL_00fd: Unknown result type (might be due to invalid IL or missing references) //IL_0108: Unknown result type (might be due to invalid IL or missing references) //IL_0112: Unknown result type (might be due to invalid IL or missing references) //IL_0113: Unknown result type (might be due to invalid IL or missing references) //IL_0118: Unknown result type (might be due to invalid IL or missing references) //IL_0119: Unknown result type (might be due to invalid IL or missing references) //IL_011f: Unknown result type (might be due to invalid IL or missing references) Image obj = Box(parent, "btn", new Color(0.24f, 0.2f, 0.16f, 1f), Vector2.zero); TopLeft((Component)(object)obj, pos, new Vector2(width, 44f)); ((Shadow)((Component)obj).gameObject.AddComponent<Outline>()).effectColor = Line; Button obj2 = ((Component)obj).gameObject.AddComponent<Button>(); ColorBlock colors = ((Selectable)obj2).colors; ((ColorBlock)(ref colors)).highlightedColor = new Color(1.25f, 1.15f, 1f); ((ColorBlock)(ref colors)).pressedColor = new Color(0.8f, 0.75f, 0.7f); ((Selectable)obj2).colors = colors; ((UnityEvent)obj2.onClick).AddListener((UnityAction)delegate { click(); }); RectTransform val = (RectTransform)((Component)Label(((Component)obj).transform, label, 20, Text, Vector2.zero, (TextAnchor)4, width)).transform; val.anchorMin = Vector2.zero; val.anchorMax = Vector2.one; val.pivot = new Vector2(0.5f, 0.5f); Vector2 offsetMin = (val.offsetMax = Vector2.zero); val.offsetMin = offsetMin; } private static Slider Slider(Transform parent, Vector2 pos, float width, float min, float max) { //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Expected O, but got Unknown //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_0053: 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_005b: 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_0063: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Unknown result type (might be due to invalid IL or missing references) //IL_0098: Unknown result type (might be due to invalid IL or missing references) //IL_009d: Unknown result type (might be due to invalid IL or missing references) //IL_00ac: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: Unknown result type (might be due to invalid IL or missing references) //IL_00bc: Unknown result type (might be due to invalid IL or missing references) //IL_00c6: Unknown result type (might be due to invalid IL or missing references) //IL_00d1: 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_0107: Unknown result type (might be due to invalid IL or missing references) //IL_010c: 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: Unknown result type (might be due to invalid IL or missing references) //IL_0129: 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_013e: Unknown result type (might be due to invalid IL or missing references) //IL_0149: Unknown result type (might be due to invalid IL or missing references) //IL_015d: 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_0176: Unknown result type (might be due to invalid IL or missing references) //IL_0185: Unknown result type (might be due to invalid IL or missing references) //IL_018b: Expected O, but got Unknown //IL_018c: Unknown result type (might be due to invalid IL or missing references) //IL_01a1: Unknown result type (might be due to invalid IL or missing references) //IL_01ac: 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_01d3: Unknown result type (might be due to invalid IL or missing references) //IL_01e5: Unknown result type (might be due to invalid IL or missing references) //IL_01eb: Unknown result type (might be due to invalid IL or missing references) //IL_01f0: Unknown result type (might be due to invalid IL or missing references) //IL_01f1: Unknown result type (might be due to invalid IL or missing references) //IL_01fb: Unknown result type (might be due to invalid IL or missing references) //IL_01fc: Unknown result type (might be due to invalid IL or missing references) //IL_0210: Unknown result type (might be due to invalid IL or missing references) //IL_0233: Unknown result type (might be due to invalid IL or missing references) //IL_0242: Unknown result type (might be due to invalid IL or missing references) //IL_0253: Unknown result type (might be due to invalid IL or missing references) //IL_0259: Expected O, but got Unknown //IL_0264: Unknown result type (might be due to invalid IL or missing references) //IL_0279: Unknown result type (might be due to invalid IL or missing references) GameObject val = new GameObject("slider", new Type[1] { typeof(RectTransform) }); val.transform.SetParent(parent, false); RectTransform val2 = (RectTransform)val.transform; Vector2 val3 = default(Vector2); ((Vector2)(ref val3))..ctor(0f, 1f); val2.pivot = val3; Vector2 anchorMin = (val2.anchorMax = val3); val2.anchorMin = anchorMin; val2.anchoredPosition = pos; val2.sizeDelta = new Vector2(width, 24f); RectTransform val5 = (RectTransform)((Component)Box(val.transform, "track", new Color(0f, 0f, 0f, 0.55f), Vector2.zero)).transform; val5.anchorMin = new Vector2(0f, 0.5f); val5.anchorMax = new Vector2(1f, 0.5f); val5.sizeDelta = new Vector2(0f, 8f); GameObject val6 = new GameObject("fillArea", new Type[1] { typeof(RectTransform) }); val6.transform.SetParent(val.transform, false); RectTransform val7 = (RectTransform)val6.transform; val7.anchorMin = new Vector2(0f, 0.5f); val7.anchorMax = new Vector2(1f, 0.5f); val7.sizeDelta = new Vector2(0f, 8f); RectTransform val8 = (RectTransform)((Component)Box(val6.transform, "fill", Gold, Vector2.zero)).transform; val8.anchorMin = Vector2.zero; val8.anchorMax = new Vector2(0f, 1f); val8.sizeDelta = Vector2.zero; GameObject val9 = new GameObject("handleArea", new Type[1] { typeof(RectTransform) }); val9.transform.SetParent(val.transform, false); RectTransform val10 = (RectTransform)val9.transform; val10.anchorMin = Vector2.zero; val10.anchorMax = Vector2.one; val10.sizeDelta = new Vector2(-20f, 0f); Image val11 = Box(val9.transform, "handle", new Color(0.96f, 0.86f, 0.6f), new Vector2(20f, 0f)); RectTransform val12 = (RectTransform)((Component)val11).transform; val12.anchorMin = new Vector2(0f, 0f); val12.anchorMax = new Vector2(0f, 1f); Slider obj = val.AddComponent<Slider>(); obj.fillRect = val8; obj.handleRect = val12; ((Selectable)obj).targetGraphic = (Graphic)(object)val11; obj.direction = (Direction)0; obj.minValue = min; obj.maxValue = max; return obj; } } [HarmonyPatch(typeof(GameCamera), "UpdateMouseCapture")] internal static class SettingsCursor { private static bool Prefix() { if (!Settings.Open) { return true; } ZCursor.LockState = (CursorLockMode)0; ZCursor.Show(); return false; } } [HarmonyPatch(typeof(Menu), "IsVisible")] internal static class SettingsIsAMenu { private static void Postfix(ref bool __result) { if (Settings.Open) { __result = true; } } } }