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 SimpleCompassPlus v1.0.0
SimpleCompassPlus.dll
Decompiled 2 days agousing System; using System.Collections.Generic; using System.Diagnostics; using System.Globalization; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using BepInEx; using BepInEx.Configuration; using HarmonyLib; using Microsoft.CodeAnalysis; using TMPro; using UnityEngine; using UnityEngine.UI; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")] [assembly: AssemblyCompany("SimpleCompassPlus")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.0.1.0")] [assembly: AssemblyInformationalVersion("1.0.1")] [assembly: AssemblyProduct("SimpleCompassPlus")] [assembly: AssemblyTitle("SimpleCompassPlus")] [assembly: AssemblyVersion("1.0.1.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 SimpleCompassPlus { public sealed class CompassLineGraphic : MaskableGraphic { private const int LineSegments = 24; private const int FullCircle = 360; private const int TickStep = 45; private const int CardinalStep = 90; private const float LineHalfThickness = 1f; private const float TickHalfWidth = 1f; private const float CardinalTickHeight = 7f; private const float IntercardinalTickHeight = 4f; private const float MarkerTop = -2f; private const float MarkerBottom = -9f; private const float MarkerHalfWidth = 5f; private const float Half = 0.5f; private const float BarEdge = 1f; public float heading; public float fov; public bool intercardinalTicks = true; public float gapCenter; public float gapHalfWidth; protected override void OnPopulateMesh(VertexHelper vh) { //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0011: 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) //IL_002f: 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_007a: 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_01ac: Unknown result type (might be due to invalid IL or missing references) //IL_01b1: Unknown result type (might be due to invalid IL or missing references) //IL_01b2: Unknown result type (might be due to invalid IL or missing references) //IL_01c7: Unknown result type (might be due to invalid IL or missing references) //IL_01cc: Unknown result type (might be due to invalid IL or missing references) //IL_01cd: 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_01e7: Unknown result type (might be due to invalid IL or missing references) //IL_01e8: Unknown result type (might be due to invalid IL or missing references) //IL_0120: Unknown result type (might be due to invalid IL or missing references) //IL_0128: Unknown result type (might be due to invalid IL or missing references) //IL_012d: Unknown result type (might be due to invalid IL or missing references) //IL_0140: Unknown result type (might be due to invalid IL or missing references) //IL_0152: Unknown result type (might be due to invalid IL or missing references) //IL_0164: 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) vh.Clear(); Rect rect = ((Graphic)this).rectTransform.rect; float num = ((Rect)(ref rect)).width * 0.5f; if (num <= 0f) { return; } Color32 val = Color32.op_Implicit(((Graphic)this).color); for (int i = 0; i < 24; i++) { float num2 = Mathf.Lerp(0f - num, num, (float)i / 24f); float num3 = Mathf.Lerp(0f - num, num, (float)(i + 1) / 24f); LinePiece(vh, num2, Mathf.Min(num3, gapCenter - gapHalfWidth), num, val); LinePiece(vh, Mathf.Max(num2, gapCenter + gapHalfWidth), num3, num, val); } for (int j = 0; j < 360; j += 45) { bool flag = j % 90 == 0; if (!flag && !intercardinalTicks) { continue; } float num4 = CompassMath.BarPosition(heading, j, fov); if (!(Mathf.Abs(num4) > 1f)) { float num5 = num4 * num; if (!(Mathf.Abs(num5 - gapCenter) < gapHalfWidth)) { float num6 = (flag ? 7f : 4f); Color32 val2 = Alpha(val, CompassMath.EdgeFade(num4)); Quad(vh, new Vector2(num5 - 1f, -1f - num6), new Vector2(num5 - 1f, -1f), new Vector2(num5 + 1f, -1f), new Vector2(num5 + 1f, -1f - num6), val2, val2); } } } int currentVertCount = vh.currentVertCount; vh.AddVert(new Vector3(0f, -2f), val, Vector4.zero); vh.AddVert(new Vector3(5f, -9f), val, Vector4.zero); vh.AddVert(new Vector3(-5f, -9f), val, Vector4.zero); vh.AddTriangle(currentVertCount, currentVertCount + 1, currentVertCount + 2); } private static void LinePiece(VertexHelper vh, float start, float end, float half, Color32 lineColor) { //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_0022: 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_0032: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) if (!(end <= start)) { Quad(vh, new Vector2(start, -1f), new Vector2(start, 1f), new Vector2(end, 1f), new Vector2(end, -1f), Alpha(lineColor, CompassMath.EdgeFade(start / half)), Alpha(lineColor, CompassMath.EdgeFade(end / half))); } } private static Color32 Alpha(Color32 source, float alpha) { //IL_0000: 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_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) return new Color32(source.r, source.g, source.b, (byte)((float)(int)source.a * alpha)); } private static void Quad(VertexHelper vh, Vector2 a, Vector2 b, Vector2 c, Vector2 d, Color32 left, Color32 right) { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0009: 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_0010: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0021: 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_002e: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0034: 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_0041: 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_004a: Unknown result type (might be due to invalid IL or missing references) int currentVertCount = vh.currentVertCount; vh.AddVert(Vector2.op_Implicit(a), left, Vector4.zero); vh.AddVert(Vector2.op_Implicit(b), left, Vector4.zero); vh.AddVert(Vector2.op_Implicit(c), right, Vector4.zero); vh.AddVert(Vector2.op_Implicit(d), right, Vector4.zero); vh.AddTriangle(currentVertCount, currentVertCount + 1, currentVertCount + 2); vh.AddTriangle(currentVertCount, currentVertCount + 2, currentVertCount + 3); } } internal static class CompassMath { private const float FullCircle = 360f; private const float Half = 0.5f; private const float FadeStart = 0.7f; private const float FadeEnd = 1f; private const float MetersPerKilometer = 1000f; private const string KilometerFormat = "0.0"; internal static float Bearing(float dx, float dz) { return Mathf.Repeat(Mathf.Atan2(dx, dz) * 57.29578f, 360f); } internal static float BarPosition(float heading, float bearing, float fov) { return Mathf.DeltaAngle(heading, bearing) / (fov * 0.5f); } internal static float EdgeFade(float barPosition) { return 1f - Mathf.SmoothStep(0f, 1f, Mathf.InverseLerp(0.7f, 1f, Mathf.Abs(barPosition))); } internal static string FormatDistance(float meters) { if (!(meters < 1000f)) { return (meters / 1000f).ToString("0.0", CultureInfo.InvariantCulture) + " km"; } return Mathf.RoundToInt(meters) + " m"; } } [BepInPlugin("com.dreich.simplecompassplus", "Simple Compass Plus", "1.0.0")] public class SimpleCompassPlusPlugin : BaseUnityPlugin { public const string Guid = "com.dreich.simplecompassplus"; public const string Name = "Simple Compass Plus"; public const string Version = "1.0.0"; private const string GeneralSection = "1 - General"; private const string LayoutSection = "2 - Layout"; private const string PinsSection = "3 - Pins"; private const string ShoutsSection = "4 - Shouts"; private const float PinDeadZone = 5f; private const float FocusDegrees = 10f; private const int Directions = 4; private const float DegreesPerDirection = 90f; private const float BarEdge = 1f; private const float Half = 0.5f; private const float BarHeight = 40f; private const float LineHeight = 20f; private const float LetterOffset = -11f; private const float IconGap = 3f; private const float FarIconScale = 0.5f; private const float FadeFrom = 0.8f; private const float FadeTo = 1f; private const float FocusFontScale = 0.85f; private const float ShoutFontScale = 0.75f; private const float LabelPadding = 5f; private const float ShoutNameGap = 2f; private const float TextWidth = 300f; private const float TextHeight = 30f; private const string ShoutNameSeparator = ": "; private const long OwnPin = 0L; private static readonly string[] Letters = new string[4] { "N", "E", "S", "W" }; private static readonly Color LineColor = new Color(0.95f, 0.93f, 0.88f, 0.9f); private static readonly Color TextColor = new Color(0.95f, 0.93f, 0.88f); private static readonly Color FocusColor = new Color(1f, 0.8f, 0.4f); private static readonly Color ShoutColor = new Color(1f, 0.9f, 0.6f); private static readonly Vector2 TopPivot = new Vector2(0.5f, 1f); private static readonly Vector2 MiddlePivot = new Vector2(0.5f, 0.5f); private static readonly FieldRef<Minimap, List<PinData>> Pins = AccessTools.FieldRefAccess<Minimap, List<PinData>>("m_pins"); private ConfigEntry<bool> compassEnabled; private ConfigEntry<Vector2> position; private ConfigEntry<float> width; private ConfigEntry<float> fov; private ConfigEntry<float> opacity; private ConfigEntry<bool> intercardinalTicks; private ConfigEntry<float> fontSize; private ConfigEntry<float> pinRange; private ConfigEntry<float> iconSize; private ConfigEntry<bool> hideCheckedPins; private ConfigEntry<bool> hideSharedPins; private ConfigEntry<bool> showPinNames; private ConfigEntry<bool> showShouts; private RectTransform root; private CanvasGroup rootGroup; private CompassLineGraphic line; private readonly TextMeshProUGUI[] letters = (TextMeshProUGUI[])(object)new TextMeshProUGUI[4]; private readonly List<Image> icons = new List<Image>(); private readonly List<TextMeshProUGUI> shoutNames = new List<TextMeshProUGUI>(); private TextMeshProUGUI focusLabel; private TMP_Text vanillaText; private Sprite pingIcon; private bool dragging; private Vector2 dragOffset; private void Awake() { //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Expected O, but got Unknown //IL_009b: Unknown result type (might be due to invalid IL or missing references) //IL_00de: Unknown result type (might be due to invalid IL or missing references) //IL_00e8: Expected O, but got Unknown //IL_011c: Unknown result type (might be due to invalid IL or missing references) //IL_0126: Expected O, but got Unknown //IL_015a: Unknown result type (might be due to invalid IL or missing references) //IL_0164: Expected O, but got Unknown //IL_0198: Unknown result type (might be due to invalid IL or missing references) //IL_01a2: Expected O, but got Unknown //IL_01d6: Unknown result type (might be due to invalid IL or missing references) //IL_01e0: Expected O, but got Unknown compassEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>("1 - General", "Enabled", true, "Show the compass."); fov = ((BaseUnityPlugin)this).Config.Bind<float>("1 - General", "FieldOfView", 160f, new ConfigDescription("Degrees of heading visible across the bar.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(60f, 360f), Array.Empty<object>())); intercardinalTicks = ((BaseUnityPlugin)this).Config.Bind<bool>("1 - General", "IntercardinalTicks", true, "Small ticks at NE, SE, SW and NW."); position = ((BaseUnityPlugin)this).Config.Bind<Vector2>("2 - Layout", "Position", new Vector2(0.5f, 0.955f), "Bar centre on screen, from 0 to 1 (x from the left, y from the bottom). You can also open your inventory and drag the compass."); width = ((BaseUnityPlugin)this).Config.Bind<float>("2 - Layout", "Width", 640f, new ConfigDescription("Bar width.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(200f, 1600f), Array.Empty<object>())); opacity = ((BaseUnityPlugin)this).Config.Bind<float>("2 - Layout", "Opacity", 0.9f, new ConfigDescription("Overall opacity.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0.2f, 1f), Array.Empty<object>())); fontSize = ((BaseUnityPlugin)this).Config.Bind<float>("2 - Layout", "FontSize", 18f, new ConfigDescription("Size of the direction letters and pin label.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(10f, 36f), Array.Empty<object>())); pinRange = ((BaseUnityPlugin)this).Config.Bind<float>("3 - Pins", "Range", 300f, new ConfigDescription("Map pins further than this many meters are not shown. 0 shows no pins.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 5000f), Array.Empty<object>())); iconSize = ((BaseUnityPlugin)this).Config.Bind<float>("3 - Pins", "IconSize", 22f, new ConfigDescription("Icon size of a nearby pin. Far pins shrink to half.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(8f, 64f), Array.Empty<object>())); hideCheckedPins = ((BaseUnityPlugin)this).Config.Bind<bool>("3 - Pins", "HideCheckedPins", true, "Don't show pins you crossed out on the map."); hideSharedPins = ((BaseUnityPlugin)this).Config.Bind<bool>("3 - Pins", "HideSharedPins", true, "Don't show pins other players shared with you through a cartography table. Your own pins still show."); showPinNames = ((BaseUnityPlugin)this).Config.Bind<bool>("3 - Pins", "ShowPinNames", true, "Show the name next to the distance of the pin closest to the centre."); showShouts = ((BaseUnityPlugin)this).Config.Bind<bool>("4 - Shouts", "ShowShouts", true, "When another player shouts, show the ping icon in their direction with their name above it, for as long as the shout lasts. Shouts show at any distance."); } private void Update() { //IL_00aa: Unknown result type (might be due to invalid IL or missing references) //IL_00cc: Unknown result type (might be due to invalid IL or missing references) //IL_017f: Unknown result type (might be due to invalid IL or missing references) //IL_0160: Unknown result type (might be due to invalid IL or missing references) Player localPlayer = Player.m_localPlayer; if ((Object)(object)Hud.instance == (Object)null || (Object)(object)localPlayer == (Object)null || (Object)(object)GameCamera.instance == (Object)null || ((Object)(object)root == (Object)null && !TryCreate())) { return; } bool flag = compassEnabled.Value && !Minimap.IsOpen(); if (((Component)root).gameObject.activeSelf != flag) { ((Component)root).gameObject.SetActive(flag); } if (!flag) { return; } float value = fov.Value; float num = width.Value * 0.5f; float y = ((Component)GameCamera.instance).transform.eulerAngles.y; root.sizeDelta = new Vector2(width.Value, 40f); rootGroup.alpha = opacity.Value; for (int i = 0; i < 4; i++) { float num2 = CompassMath.BarPosition(y, (float)i * 90f, value); TextMeshProUGUI val = letters[i]; ((Behaviour)val).enabled = Mathf.Abs(num2) <= 1f; if (((Behaviour)val).enabled) { ((TMP_Text)val).fontSize = fontSize.Value; ((TMP_Text)val).alpha = CompassMath.EdgeFade(num2); ((TMP_Text)val).rectTransform.anchoredPosition = new Vector2(num2 * num, -11f); } } float gapCenter; float num3 = UpdatePins(((Component)localPlayer).transform.position, y, value, num, out gapCenter); if (line.heading != y || line.fov != value || line.intercardinalTicks != intercardinalTicks.Value || line.gapCenter != gapCenter || line.gapHalfWidth != num3) { line.heading = y; line.fov = value; line.intercardinalTicks = intercardinalTicks.Value; line.gapCenter = gapCenter; line.gapHalfWidth = num3; ((Graphic)line).SetVerticesDirty(); } Drag(InventoryGui.IsVisible()); } private float UpdatePins(Vector3 from, float heading, float barFov, float half, out float gapCenter) { //IL_0066: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Invalid comparison between Unknown and I4 //IL_0286: Unknown result type (might be due to invalid IL or missing references) //IL_028b: Unknown result type (might be due to invalid IL or missing references) //IL_028c: Unknown result type (might be due to invalid IL or missing references) //IL_0291: 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_009e: 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_00a5: 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_00b3: 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) //IL_02c1: Unknown result type (might be due to invalid IL or missing references) //IL_02c8: Unknown result type (might be due to invalid IL or missing references) //IL_02cf: Unknown result type (might be due to invalid IL or missing references) //IL_02d4: Unknown result type (might be due to invalid IL or missing references) //IL_00dd: Unknown result type (might be due to invalid IL or missing references) //IL_00e4: Unknown result type (might be due to invalid IL or missing references) //IL_032e: Unknown result type (might be due to invalid IL or missing references) //IL_034c: Unknown result type (might be due to invalid IL or missing references) //IL_0372: 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) gapCenter = 0f; int num = 0; int num2 = 0; PinData val = null; Image val2 = null; float num3 = 10f; float value = pinRange.Value; List<PinData> list = (((Object)(object)Minimap.instance != (Object)null) ? Pins.Invoke(Minimap.instance) : null); Vector2 val4; if (list != null) { foreach (PinData item in list) { bool flag = (int)item.m_type == 7; if (flag ? (!showShouts.Value) : (!Shown(item, value))) { continue; } Vector3 val3 = item.m_pos - from; val4 = new Vector2(val3.x, val3.z); float magnitude = ((Vector2)(ref val4)).magnitude; if (magnitude < 5f || (!flag && magnitude > value)) { continue; } float num4 = CompassMath.BarPosition(heading, CompassMath.Bearing(val3.x, val3.z), barFov); if (Mathf.Abs(num4) > 1f) { continue; } Image val5 = Icon(num++); float x = num4 * half; if (flag) { ShowShout(val5, item, x, num4, num2++); continue; } float num5 = magnitude / value; val5.sprite = item.m_icon; ((Graphic)val5).color = new Color(1f, 1f, 1f, CompassMath.EdgeFade(num4) * (1f - Mathf.InverseLerp(0.8f, 1f, num5))); Place(val5, x, iconSize.Value * Mathf.Lerp(1f, 0.5f, num5)); float num6 = Mathf.Abs(num4) * barFov * 0.5f; if (num6 < num3) { num3 = num6; val = item; val2 = val5; } } } for (int i = num; i < icons.Count; i++) { if (((Behaviour)icons[i]).enabled) { ((Behaviour)icons[i]).enabled = false; } } for (int j = num2; j < shoutNames.Count; j++) { if (((Behaviour)shoutNames[j]).enabled) { ((Behaviour)shoutNames[j]).enabled = false; } } ((Behaviour)focusLabel).enabled = val != null; if (val == null) { return 0f; } Vector3 val6 = val.m_pos - from; string text = ((!showPinNames.Value) ? null : Localization.instance.Localize(val.m_name)?.Trim()); val4 = new Vector2(val6.x, val6.z); string text2 = CompassMath.FormatDistance(((Vector2)(ref val4)).magnitude); ((TMP_Text)focusLabel).text = (string.IsNullOrEmpty(text) ? text2 : (text + " " + text2)); ((TMP_Text)focusLabel).fontSize = fontSize.Value * 0.85f; gapCenter = ((Graphic)val2).rectTransform.anchoredPosition.x; ((TMP_Text)focusLabel).rectTransform.anchoredPosition = new Vector2(gapCenter, 0f); ((Component)val2).transform.SetAsLastSibling(); return ((TMP_Text)focusLabel).GetPreferredValues(((TMP_Text)focusLabel).text).x * 0.5f + 5f; } private bool Shown(PinData pin, float range) { //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Invalid comparison between Unknown and I4 if (range > 0f && (Object)(object)pin.m_icon != (Object)null && (int)pin.m_type != 13 && (!pin.m_checked || !hideCheckedPins.Value)) { if (pin.m_ownerID != 0L) { return !hideSharedPins.Value; } return true; } return false; } private void ShowShout(Image icon, PinData pin, float x, float barPosition, int index) { //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_00b9: Unknown result type (might be due to invalid IL or missing references) float num = CompassMath.EdgeFade(barPosition); icon.sprite = PingIcon() ?? pin.m_icon; ((Graphic)icon).color = new Color(1f, 1f, 1f, num); Place(icon, x, iconSize.Value); ((Component)icon).transform.SetAsLastSibling(); TextMeshProUGUI val = ShoutName(index); ((TMP_Text)val).text = Shouter(pin.m_name); ((TMP_Text)val).fontSize = fontSize.Value * 0.75f; ((TMP_Text)val).alpha = num; ((TMP_Text)val).rectTransform.anchoredPosition = new Vector2(x, iconSize.Value + 3f + 2f + ((TMP_Text)val).fontSize * 0.5f); } private static void Place(Image icon, float x, float size) { //IL_0006: 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_002a: Unknown result type (might be due to invalid IL or missing references) ((Graphic)icon).rectTransform.sizeDelta = Vector2.one * size; ((Graphic)icon).rectTransform.anchoredPosition = new Vector2(x, size * 0.5f + 3f); } private static string Shouter(string pinName) { if (string.IsNullOrEmpty(pinName)) { return ""; } int num = pinName.IndexOf(": ", StringComparison.Ordinal); if (num <= 0) { return pinName; } return pinName.Substring(0, num); } private Sprite PingIcon() { //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_0048: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Invalid comparison between Unknown and I4 //IL_0053: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)pingIcon != (Object)null || (Object)(object)Minimap.instance == (Object)null || Minimap.instance.m_icons == null) { return pingIcon; } foreach (SpriteData icon in Minimap.instance.m_icons) { if ((int)icon.m_name == 12) { pingIcon = icon.m_icon; } } return pingIcon; } private Image Icon(int index) { //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) if (index == icons.Count) { GameObject val = new GameObject("Pin", new Type[2] { typeof(RectTransform), typeof(Image) }); val.transform.SetParent((Transform)(object)root, false); Image component = val.GetComponent<Image>(); ((Graphic)component).raycastTarget = false; component.preserveAspect = true; icons.Add(component); } Image obj = icons[index]; ((Behaviour)obj).enabled = true; return obj; } private TextMeshProUGUI ShoutName(int index) { //IL_0014: 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) if (index == shoutNames.Count) { TextMeshProUGUI val = Text("", MiddlePivot); ((Graphic)val).color = ShoutColor; shoutNames.Add(val); } TextMeshProUGUI obj = shoutNames[index]; ((Behaviour)obj).enabled = true; return obj; } private void Drag(bool editing) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_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_010a: Unknown result type (might be due to invalid IL or missing references) //IL_010b: 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_0113: Unknown result type (might be due to invalid IL or missing references) //IL_0120: Unknown result type (might be due to invalid IL or missing references) //IL_00ad: Unknown result type (might be due to invalid IL or missing references) //IL_00c4: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_00f8: Unknown result type (might be due to invalid IL or missing references) //IL_0067: 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_0087: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_008d: Unknown result type (might be due to invalid IL or missing references) //IL_0092: Unknown result type (might be due to invalid IL or missing references) Vector2 val = default(Vector2); ((Vector2)(ref val))..ctor(Input.mousePosition.x / (float)Screen.width, Input.mousePosition.y / (float)Screen.height); if (!dragging && editing && Input.GetMouseButtonDown(0)) { Canvas rootCanvas = ((Component)root).GetComponentInParent<Canvas>().rootCanvas; Camera val2 = (((int)rootCanvas.renderMode == 0) ? null : rootCanvas.worldCamera); if (RectTransformUtility.RectangleContainsScreenPoint(root, Vector2.op_Implicit(Input.mousePosition), val2)) { dragging = true; dragOffset = position.Value - val; } } Vector2 value = position.Value; if (dragging) { ((Vector2)(ref value))..ctor(Mathf.Clamp01(val.x + dragOffset.x), Mathf.Clamp01(val.y + dragOffset.y)); if (!editing || !Input.GetMouseButton(0)) { dragging = false; position.Value = value; } } RectTransform obj = root; Vector2 anchorMin = (root.anchorMax = value); obj.anchorMin = anchorMin; root.anchoredPosition = Vector2.zero; } private bool TryCreate() { //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0065: Expected O, but got Unknown //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_0076: Expected O, but got Unknown //IL_00f7: Unknown result type (might be due to invalid IL or missing references) //IL_00fd: Expected O, but got Unknown //IL_0103: 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_0115: Unknown result type (might be due to invalid IL or missing references) //IL_0120: Unknown result type (might be due to invalid IL or missing references) //IL_012a: 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_0149: 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_018e: Unknown result type (might be due to invalid IL or missing references) //IL_01a8: Unknown result type (might be due to invalid IL or missing references) //IL_01bd: Unknown result type (might be due to invalid IL or missing references) vanillaText = (Object.op_Implicit((Object)(object)Hud.instance.m_statusEffectTemplate) ? ((Component)Hud.instance.m_statusEffectTemplate).GetComponentInChildren<TMP_Text>(true) : null); if ((Object)(object)vanillaText == (Object)null) { return false; } GameObject val = new GameObject("SimpleCompassPlus", new Type[2] { typeof(RectTransform), typeof(CanvasGroup) }); root = (RectTransform)val.transform; icons.Clear(); shoutNames.Clear(); pingIcon = null; ((Transform)root).SetParent(Hud.instance.m_rootObject.transform, false); rootGroup = val.GetComponent<CanvasGroup>(); rootGroup.blocksRaycasts = false; rootGroup.interactable = false; GameObject val2 = new GameObject("Line", new Type[2] { typeof(RectTransform), typeof(CompassLineGraphic) }); RectTransform val3 = (RectTransform)val2.transform; ((Transform)val3).SetParent((Transform)(object)root, false); val3.anchorMin = new Vector2(0f, 0.5f); val3.anchorMax = new Vector2(1f, 0.5f); val3.sizeDelta = new Vector2(0f, 20f); line = val2.GetComponent<CompassLineGraphic>(); ((Graphic)line).raycastTarget = false; ((Graphic)line).color = LineColor; for (int i = 0; i < 4; i++) { letters[i] = Text(Letters[i], TopPivot); } focusLabel = Text("", MiddlePivot); ((Graphic)focusLabel).color = FocusColor; return true; } private TextMeshProUGUI Text(string text, Vector2 pivot) { //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) //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_0043: 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_009a: Unknown result type (might be due to invalid IL or missing references) //IL_00c0: Unknown result type (might be due to invalid IL or missing references) GameObject val = new GameObject("Text", new Type[2] { typeof(RectTransform), typeof(TextMeshProUGUI) }); RectTransform val2 = (RectTransform)val.transform; ((Transform)val2).SetParent((Transform)(object)root, false); val2.pivot = pivot; val2.sizeDelta = new Vector2(300f, 30f); TextMeshProUGUI component = val.GetComponent<TextMeshProUGUI>(); ((TMP_Text)component).font = vanillaText.font; ((TMP_Text)component).fontSharedMaterial = vanillaText.fontSharedMaterial; ((TMP_Text)component).text = text; ((Graphic)component).raycastTarget = false; ((TMP_Text)component).richText = true; ((TMP_Text)component).alignment = (TextAlignmentOptions)((pivot.y > 0.5f) ? 258 : 4098); ((TMP_Text)component).textWrappingMode = (TextWrappingModes)0; ((Graphic)component).color = TextColor; return component; } private void OnDestroy() { if ((Object)(object)root != (Object)null) { Object.Destroy((Object)(object)((Component)root).gameObject); } } } }