Decompiled source of ezCrosshair v1.3.7
BepInEx/plugins/ezCrosshair/ezCrosshair.dll
Decompiled a week ago
The result has been truncated due to the large size, download it to view full contents!
using System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.Globalization; using System.IO; using System.Reflection; using System.Runtime.CompilerServices; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Bootstrap; using BepInEx.Configuration; using BepInEx.Logging; using ComputerysModdingUtilities; using HarmonyLib; using ModMenu.Api; using TMPro; using UnityEngine; using UnityEngine.EventSystems; using UnityEngine.Events; using UnityEngine.SceneManagement; using UnityEngine.UI; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: AssemblyTitle("ezCrosshair")] [assembly: AssemblyDescription("Pick your own crosshair, its color and size.")] [assembly: AssemblyFileVersion("1.3.7.0")] [assembly: StraftatMod(true)] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.3.7.0")] [module: UnverifiableCode] namespace EzCrosshair; internal static class Images { public static string Get(string name) { return name switch { "brackets" => "iVBORw0KGgoAAAANSUhEUgAAACAAAAAWCAYAAAChWZ5EAAABsUlEQVR4XuWWoU8DMRTGP2BiEoEgFwRJJxA4JBZxAhLEBH5BkC1hgj8DcSRbINk/gJiABHECJBKHOLEmiOUygUBObAl5l/dKO7al26rgS5o0u/b3vX1t7wr8d61NBqBzvQWgCuBBRWoQIiCd620ApwC6KlKfNnN9isEtULROCHMWsYTryClA5zrmf096DViAsKrsYTSZwCU/+QBwHbAAYhGTJB6FTAE61zsAKAFSW0VqFKoAZrWZF7OXWwCAI8vwfpZ5uVTemNdmzQMcpvGyl+CAJ/dUpPpzQEuJmT2eLF5OAXv88N3HIblLGlk/y7JBliWdpOEzBzBs8XIKKDHkywcWH8dkWqEWnxR9HwlbvH46C6vMM4YLz3Rk7wHZ9Zs+yPQxbQHFmvbSp6LvI2GbE2aiAJDxSdj3ITVrzRZq8DUWCZu8CtkJvPFvFfuchhIzac+QxMtJ4NkyO5v1JhyOhuMliyKmyHiZBPicpjyirnNtL89KYladIan9npn8FtzwoF0AVyu5uiIWMUni8WsPUAqUQJcHHgYsQFh0H5CUC02L+QLAC11IAhZwLheSgMw/om9Q7m1ZK7JOsgAAAABJRU5ErkJggg==", "chunky plus" => "iVBORw0KGgoAAAANSUhEUgAAAAoAAAAKCAYAAACNMs+9AAAAPUlEQVR4nMXOOwoAIAwE0Vnvf+e18IMhKFppFcjwomwDIKkN+ck2ZbPMNRCk5UII38UhpaDLn/84sVNzLVbxsxQK66rOnQAAAABJRU5ErkJggg==", "circle" => "iVBORw0KGgoAAAANSUhEUgAAAAgAAAAICAYAAADED76LAAABhWlDQ1BJQ0MgUHJvZmlsZQAAeJx9kT1Iw0AcxV9TtaIVBTuIOmSoThZERRylikWwUNoKrTqYXPohNGlIUlwcBdeCgx+LVQcXZ10dXAVB8APEydFJ0UVK/F9SaBHjwXE/3t173L0DhFqJqWbbOKBqlpGMRcVMdkUMvKIbfejAEESJmXo8tZCG5/i6h4+vdxGe5X3uz9Gj5EwG+ETiWaYbFvE68fSmpXPeJw6xoqQQnxOPGXRB4keuyy6/cS44LPDMkJFOzhGHiMVCC8stzIqGSjxFHFZUjfKFjMsK5y3OaqnCGvfkLwzmtOUU12kOI4ZFxJGACBkVbKAECxFaNVJMJGk/6uEfdPwJcsnk2gAjxzzKUCE5fvA/+N2tmZ+ccJOCUaD9xbY/RoDALlCv2vb3sW3XTwD/M3ClNf3lGjDzSXq1qYWPgN5t4OK6qcl7wOUOMPCkS4bkSH6aQj4PvJ/RN2WB/luga9XtrbGP0wcgTV0t3QAHh8BogbLXPN7d2drbv2ca/f0AcCJypllzgSYAAABaSURBVHichY/RCcAgDESfDuMqQpw1ncCZLLhA+tEobSj0wUG4HCEHNwVQYLoO9/ZyABY0VkgBq7XaQkRWSPGTFvHAzPyQgQ7QWtvmY+4AJaV0xifdezX5rHkBA+Q5eLIiGpIAAAAASUVORK5CYII=", "cross" => "iVBORw0KGgoAAAANSUhEUgAAAAwAAAAMCAYAAABWdVznAAAAPElEQVR4nGP8//8/AxYAE2REl2DCphofoL0GFhziGG5H1oDua3TFKPJkOQmn9dhsxGXDf3SnkO0k2msAAAv8CBv+J3ZPAAAAAElFTkSuQmCC", "dark diamond" => "iVBORw0KGgoAAAANSUhEUgAAAAoAAAAKCAYAAACNMs+9AAABhGlDQ1BJQ0MgUHJvZmlsZQAAeJx9kT1Iw0AcxV9TRSkVBwuKOGRonexiRRxLFYtgobQVWnUwufQLmjQkKS6OgmvBwY/FqoOLs64OroIg+AHi6uKk6CIl/i8ptIjx4Lgf7+497t4BQqvGVLMvDqiaZWSSCTFfWBUHXhFAEKOIICYxU09lF3PwHF/38PH1LsqzvM/9OYaUoskAn0gcZ7phEW8Qz25aOud94hCrSArxOfGUQRckfuS67PIb57LDAs8MGbnMPHGIWCz3sNzDrGKoxDPEYUXVKF/Iu6xw3uKs1hqsc0/+wmBRW8lyneYEklhCCmmIkNFAFTVYiNKqkWIiQ/sJD/+440+TSyZXFYwcC6hDheT4wf/gd7dmKTbtJgUTQP+LbX9EgIFdoN207e9j226fAP5n4Err+ustYO6T9GZXCx8Bw9vAxXVXk/eAyx1g7EmXDMmR/DSFUgl4P6NvKgAjt0Bgze2ts4/TByBHXS3fAAeHwGSZstc93j3Y29u/Zzr9/QAHc3LiC+VReAAAAJNJREFUeJyNkDsOAjEMRMdQI9hF3jsgcQMQNbegpsqF01CCQpcWPQoShLIpGMmN5/lr+hGwkrSXlCXdzeyhVsAABCCVCMCmB52B6O7Z3TMQgQuwrpCX6ghkSXzSVDgAk4ATkNz9C9UonRNwWEh6zRaeaylg+mP0UPccgWvnmCPg7eVj5z3b6lsDu6RdefjNzJ7VewNyVrX/e0ljMwAAAABJRU5ErkJggg==", "diamond" => "iVBORw0KGgoAAAANSUhEUgAAAAoAAAAKCAYAAACNMs+9AAAAcklEQVR4nJWQywnEMAxEX1KH+9hCUohRGSlt+8hpzgYfjFEuMqxDWJIBgdA89FuYlYBP5F/gmFx3H1AGakQGUnhTpx1okoqkArSopV8oA83MuofMrAecB7wBVVLxi6JzBbaVF3o8+vExf98zmOVmjduHn8G4YXw9M5RzAAAAAElFTkSuQmCC", "dot" => "iVBORw0KGgoAAAANSUhEUgAAAAgAAAAICAYAAADED76LAAAAZklEQVR4nIXPwQnDQAxE0bfuIBe3YNy4dotwMc41GFyCcogCJiHkg0CMhmHUMhO01mbcvDjxyEzKsGLgqBmYy2zGiIg9i4jYr6YFR35QScvkD1MV2nrv97dY+1Y3v0qu0C5pX2/CE/ZiPhIntsABAAAAAElFTkSuQmCC", "outlined plus" => "iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAVklEQVR4nN2SMQ7AMAgDz1X//2V3qLqkOKXKFm8IdIITIsdDrWromACwjT1yfgA62QBw8radUs4J8JfpFEnrJ4jJCc9mUvlDwO0gddc/sZMNAFlvU+IFejsTGMmz0YEAAAAASUVORK5CYII=", "pinhole" => "iVBORw0KGgoAAAANSUhEUgAAAAoAAAAKCAYAAACNMs+9AAAAbklEQVR4nJWQUQ3DMAwFT9NQhEB4mI0RpBCKJSD82IyG+5NMnaK22knvy6cn27BSRm5pQI60W8nM0swu5Qaku6eklJTuvshlNknKiaRzc3k9LT15Ax9gi4i91vod9N6JCIBtOP8d8yM/SefjlocfG0M/Yk1SZxgAAAAASUVORK5CYII=", "plus" => "iVBORw0KGgoAAAANSUhEUgAAAAoAAAAKCAYAAACNMs+9AAAAK0lEQVR4nGP8//8/AxqACTAiCzKhq8IFqK+QhQHhJnSAIk6SiYxoYoPN1wC5RgcU0AuUbwAAAABJRU5ErkJggg==", "square" => "iVBORw0KGgoAAAANSUhEUgAAAAQAAAAECAYAAACp8Z5+AAAAFklEQVR4nGP8////fwYkwMSABggLAAAGXQQE3kxYjAAAAABJRU5ErkJggg==", "star" => "iVBORw0KGgoAAAANSUhEUgAAAAoAAAAKCAYAAACNMs+9AAAAWElEQVR4XmP8//8/AxpogPJhNASAFCLhkP8IAGLD5ZjQTAtB4iOz4SaCdK9AMg0GQGJgk0FGN2BRgA4a0K3GDaAOJspqZF8juxPExunrNUh2I7MZGIkNcABIp7pB709GGgAAAABJRU5ErkJggg==", _ => null, }; } } internal static class FieldStyle { private static Texture2D icon; public static Color Fill { get { //IL_0039: Unknown result type (might be due to invalid IL or missing references) float num = Mathf.InverseLerp(0.1f, 0.6f, ((Color)(ref Ui.Bg)).grayscale); return new Color(0f, 0f, 0f, Mathf.Lerp(0.38f, 0.14f, num)); } } public static Color EdgeIdle => Ui.Tint(0.2f); public static Color EdgeTyping => Ui.Tint(0.45f); public static Texture2D Icon() { //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_0025: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Expected O, but got Unknown //IL_009c: Unknown result type (might be due to invalid IL or missing references) //IL_00a1: Unknown result type (might be due to invalid IL or missing references) //IL_00a2: 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_00bd: Unknown result type (might be due to invalid IL or missing references) //IL_00c2: 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_00c5: 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_00cb: Unknown result type (might be due to invalid IL or missing references) //IL_00e1: 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_00e6: Unknown result type (might be due to invalid IL or missing references) //IL_00eb: Unknown result type (might be due to invalid IL or missing references) //IL_0139: 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) if ((Object)(object)icon != (Object)null) { return icon; } icon = new Texture2D(64, 64, (TextureFormat)4, false) { filterMode = (FilterMode)1, wrapMode = (TextureWrapMode)1, name = "ST_SearchIcon" }; Color32[] array = (Color32[])(object)new Color32[4096]; Vector2 val = default(Vector2); ((Vector2)(ref val))..ctor(26f, 38f); Vector2 val2 = default(Vector2); ((Vector2)(ref val2))..ctor(38.5f, 25.5f); Vector2 val3 = default(Vector2); ((Vector2)(ref val3))..ctor(56f, 8f); for (int i = 0; i < 64; i++) { for (int j = 0; j < 64; j++) { Vector2 val4 = new Vector2((float)j + 0.5f, (float)i + 0.5f); float num = Mathf.Abs(Vector2.Distance(val4, val) - 17f) - 3.2f; Vector2 val5 = val3 - val2; float num2 = Mathf.Clamp01(Vector2.Dot(val4 - val2, val5) / ((Vector2)(ref val5)).sqrMagnitude); float num3 = Vector2.Distance(val4, val2 + val5 * num2) - 4.2f; float num4 = Mathf.Min(num, num3); array[i * 64 + j] = new Color32(byte.MaxValue, byte.MaxValue, byte.MaxValue, (byte)Mathf.RoundToInt(Mathf.Clamp01(0.5f - num4) * 255f)); } } icon.SetPixels32(array); icon.Apply(false, true); return icon; } } internal static class Blur { private sealed class Follower : MonoBehaviour { public Image Panel; public RawImage Pic; private readonly Vector3[] corners = (Vector3[])(object)new Vector3[4]; private void LateUpdate() { //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Expected O, but got Unknown //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0073: Unknown result type (might be due to invalid IL or missing references) //IL_008c: 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) //IL_0081: Unknown result type (might be due to invalid IL or missing references) //IL_00ab: 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_00a0: 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_00d0: Unknown result type (might be due to invalid IL or missing references) //IL_00bf: Unknown result type (might be due to invalid IL or missing references) //IL_00e9: Unknown result type (might be due to invalid IL or missing references) //IL_00ef: Unknown result type (might be due to invalid IL or missing references) //IL_00de: 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_015c: Unknown result type (might be due to invalid IL or missing references) //IL_0161: Unknown result type (might be due to invalid IL or missing references) //IL_0166: 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_01a0: Unknown result type (might be due to invalid IL or missing references) //IL_01a9: 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_01b9: Unknown result type (might be due to invalid IL or missing references) //IL_01c3: Unknown result type (might be due to invalid IL or missing references) //IL_01ca: Unknown result type (might be due to invalid IL or missing references) //IL_01df: Unknown result type (might be due to invalid IL or missing references) //IL_01e4: Unknown result type (might be due to invalid IL or missing references) //IL_01f3: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)Panel == (Object)null) { Object.Destroy((Object)(object)((Component)this).gameObject); return; } bool flag = ((Behaviour)Panel).isActiveAndEnabled && (Object)(object)Result != (Object)null; if (((Behaviour)Pic).enabled != flag) { ((Behaviour)Pic).enabled = flag; } if (flag) { RectTransform val = (RectTransform)((Component)this).transform; RectTransform rectTransform = ((Graphic)Panel).rectTransform; if (val.anchorMin != rectTransform.anchorMin) { val.anchorMin = rectTransform.anchorMin; } if (val.anchorMax != rectTransform.anchorMax) { val.anchorMax = rectTransform.anchorMax; } if (val.pivot != rectTransform.pivot) { val.pivot = rectTransform.pivot; } if (val.anchoredPosition != rectTransform.anchoredPosition) { val.anchoredPosition = rectTransform.anchoredPosition; } if (val.sizeDelta != rectTransform.sizeDelta) { val.sizeDelta = rectTransform.sizeDelta; } if ((Object)(object)Pic.texture != (Object)(object)Result) { Pic.texture = (Texture)(object)Result; } val.GetWorldCorners(corners); Camera obj = (((Object)(object)glass != (Object)null) ? glass.Cam : null); Vector2 val2 = RectTransformUtility.WorldToScreenPoint(obj, corners[0]); Vector2 val3 = RectTransformUtility.WorldToScreenPoint(obj, corners[2]); float num = Mathf.Max(1f, (float)Screen.width); float num2 = Mathf.Max(1f, (float)Screen.height); Rect val4 = default(Rect); ((Rect)(ref val4))..ctor(val2.x / num, val2.y / num2, (val3.x - val2.x) / num, (val3.y - val2.y) / num2); if (Pic.uvRect != val4) { Pic.uvRect = val4; } } } } private sealed class Glass : MonoBehaviour { public Camera Cam; public Canvas Menu; private RenderTexture grab; private RenderTexture menu; private readonly WaitForEndOfFrame endOfFrame = new WaitForEndOfFrame(); private bool running; public void Run() { if (!running) { ((MonoBehaviour)this).StartCoroutine(Loop()); } } private IEnumerator Loop() { running = true; yield return null; while (((Behaviour)this).enabled && (Object)(object)Menu != (Object)null) { yield return endOfFrame; if ((Object)(object)Menu == (Object)null || !((Behaviour)Menu).isActiveAndEnabled) { continue; } try { int width = Screen.width; int height = Screen.height; if ((Object)(object)grab == (Object)null || ((Texture)grab).width != width || ((Texture)grab).height != height) { if ((Object)(object)grab != (Object)null) { grab.Release(); Object.Destroy((Object)(object)grab); } grab = new RenderTexture(width, height, 0, (RenderTextureFormat)0) { name = "ezCrosshair_ScreenCopy" }; Object.DontDestroyOnLoad((Object)(object)grab); } ScreenCapture.CaptureScreenshotIntoRenderTexture(grab); Process((Texture)(object)grab, SystemInfo.graphicsUVStartsAtTop); if ((Object)(object)menu == (Object)null || ((Texture)menu).width != width || ((Texture)menu).height != height) { if ((Object)(object)menu != (Object)null) { Cam.targetTexture = null; menu.Release(); Object.Destroy((Object)(object)menu); } menu = new RenderTexture(width, height, 24, (RenderTextureFormat)0) { name = "ezCrosshair_MenuPicture" }; Object.DontDestroyOnLoad((Object)(object)menu); } if ((Object)(object)Cam.targetTexture != (Object)(object)menu) { Cam.targetTexture = menu; } Cam.Render(); Graphics.Blit((Texture)(object)menu, (RenderTexture)null, Over()); } catch (Exception ex) { EzCrosshairPlugin.Log.LogWarning((object)("Menu blur: " + ex.Message)); } } running = false; } } public const int MenuLayer = 31; public static RenderTexture Result; private static Glass glass; private static Material mat; private static Material over; private static Material alphaOnly; private static readonly float[] TapAt = new float[5] { 0f, 1.3846f, -1.3846f, 3.2308f, -3.2308f }; private static readonly float[] TapAlpha = MakeAlphas(new float[5] { 0.227f, 0.3162f, 0.3162f, 0.0703f, 0.0703f }); public static Camera MenuCamera() { //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Expected O, but got Unknown //IL_0020: 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_003f: 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) if ((Object)(object)glass == (Object)null) { GameObject val = new GameObject("ezCrosshair MenuCamera"); Object.DontDestroyOnLoad((Object)val); val.transform.position = new Vector3(0f, -6100f, 0f); Camera val2 = val.AddComponent<Camera>(); ((Behaviour)val2).enabled = false; val2.clearFlags = (CameraClearFlags)2; val2.backgroundColor = new Color(0f, 0f, 0f, 0f); val2.cullingMask = int.MinValue; val2.orthographic = true; val2.nearClipPlane = 0.01f; val2.farClipPlane = 20f; val2.useOcclusionCulling = false; val2.allowHDR = false; val2.allowMSAA = false; glass = val.AddComponent<Glass>(); glass.Cam = val2; } return glass.Cam; } public static void DrawMenu(Canvas c) { MenuCamera(); glass.Menu = c; ((Behaviour)glass).enabled = (Object)(object)c != (Object)null; if ((Object)(object)c != (Object)null) { glass.Run(); } } private static Material Over() { //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Expected O, but got Unknown if ((Object)(object)over == (Object)null) { over = new Material(Shader.Find("UI/Default")) { hideFlags = (HideFlags)61 }; } return over; } public static Material AlphaOnly() { //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Expected O, but got Unknown if ((Object)(object)alphaOnly == (Object)null) { alphaOnly = new Material(Shader.Find("UI/Default")) { hideFlags = (HideFlags)61 }; if (alphaOnly.HasProperty("_ColorMask")) { alphaOnly.SetFloat("_ColorMask", 1f); } } return alphaOnly; } public static void Behind(Image panel) { //IL_0050: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)panel == (Object)null)) { RectTransform val = Ui.Node("blur", ((Component)panel).transform.parent); ((Transform)val).SetSiblingIndex(((Component)panel).transform.GetSiblingIndex()); Image obj = ((Component)val).gameObject.AddComponent<Image>(); obj.sprite = panel.sprite; obj.type = (Type)1; ((Graphic)obj).color = Color.white; ((Graphic)obj).raycastTarget = false; ((Component)val).gameObject.AddComponent<Mask>().showMaskGraphic = false; RawImage val2 = ((Component)Ui.Node("picture", (Transform)(object)val)).gameObject.AddComponent<RawImage>(); ((Graphic)val2).raycastTarget = false; Ui.Fill(((Graphic)val2).rectTransform); Follower follower = ((Component)val).gameObject.AddComponent<Follower>(); follower.Panel = panel; follower.Pic = val2; } } private static float[] MakeAlphas(float[] weights) { float[] array = new float[weights.Length]; float num = 0f; for (int i = 0; i < weights.Length; i++) { num += weights[i]; array[i] = weights[i] / num; } return array; } private static bool Ready() { //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Expected O, but got Unknown if ((Object)(object)mat != (Object)null) { return true; } Shader val = Shader.Find("UI/Default"); if ((Object)(object)val == (Object)null) { return false; } mat = new Material(val) { hideFlags = (HideFlags)61 }; if (mat.HasProperty("_ColorMask")) { mat.SetFloat("_ColorMask", 14f); } return true; } private static void Pass(RenderTexture src, RenderTexture dst, bool across) { //IL_00a5: Unknown result type (might be due to invalid IL or missing references) Graphics.Blit((Texture)(object)src, dst); if (Ready()) { RenderTexture active = RenderTexture.active; RenderTexture.active = dst; mat.mainTexture = (Texture)(object)src; GL.PushMatrix(); GL.LoadOrtho(); mat.SetPass(0); float num = 1f / (float)((Texture)src).width; float num2 = 1f / (float)((Texture)src).height; GL.Begin(7); for (int i = 1; i < TapAt.Length; i++) { float num3 = (across ? (TapAt[i] * num) : 0f); float num4 = (across ? 0f : (TapAt[i] * num2)); GL.Color(new Color(1f, 1f, 1f, TapAlpha[i])); GL.TexCoord2(num3, num4); GL.Vertex3(0f, 0f, 0f); GL.TexCoord2(num3, 1f + num4); GL.Vertex3(0f, 1f, 0f); GL.TexCoord2(1f + num3, 1f + num4); GL.Vertex3(1f, 1f, 0f); GL.TexCoord2(1f + num3, num4); GL.Vertex3(1f, 0f, 0f); } GL.End(); GL.PopMatrix(); RenderTexture.active = active; } } private static void Process(Texture src, bool flip) { //IL_006a: 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_0076: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_008d: Expected O, but got Unknown //IL_00fc: 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_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_0115: Unknown result type (might be due to invalid IL or missing references) //IL_0116: Unknown result type (might be due to invalid IL or missing references) //IL_011d: 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) //IL_0120: Unknown result type (might be due to invalid IL or missing references) //IL_0127: 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_012a: Unknown result type (might be due to invalid IL or missing references) //IL_0131: 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_015d: Unknown result type (might be due to invalid IL or missing references) //IL_01a6: Unknown result type (might be due to invalid IL or missing references) int num = Mathf.Max(8, src.width / 4); int num2 = Mathf.Max(8, src.height / 4); if ((Object)(object)Result == (Object)null || ((Texture)Result).width != num || ((Texture)Result).height != num2) { if ((Object)(object)Result != (Object)null) { Result.Release(); Object.Destroy((Object)(object)Result); } Result = new RenderTexture(num, num2, 0, (RenderTextureFormat)0) { filterMode = (FilterMode)1, wrapMode = (TextureWrapMode)1, name = "ezCrosshair_Blur" }; Object.DontDestroyOnLoad((Object)(object)Result); } RenderTexture temporary = RenderTexture.GetTemporary(Mathf.Max(8, src.width / 2), Mathf.Max(8, src.height / 2), 0, (RenderTextureFormat)0); RenderTexture temporary2 = RenderTexture.GetTemporary(num, num2, 0, (RenderTextureFormat)0); RenderTexture temporary3 = RenderTexture.GetTemporary(Mathf.Max(8, num / 2), Mathf.Max(8, num2 / 2), 0, (RenderTextureFormat)0); RenderTexture temporary4 = RenderTexture.GetTemporary(Mathf.Max(8, num / 4), Mathf.Max(8, num2 / 4), 0, (RenderTextureFormat)0); FilterMode filterMode = src.filterMode; FilterMode val = (FilterMode)1; ((Texture)temporary4).filterMode = (FilterMode)1; FilterMode val2 = (((Texture)temporary3).filterMode = val); FilterMode val4 = (((Texture)temporary2).filterMode = val2); FilterMode filterMode2 = (((Texture)temporary).filterMode = val4); src.filterMode = filterMode2; ((Texture)temporary2).wrapMode = (TextureWrapMode)1; if (flip) { Graphics.Blit(src, temporary, new Vector2(1f, -1f), new Vector2(0f, 1f)); } else { Graphics.Blit(src, temporary); } Graphics.Blit((Texture)(object)temporary, Result); Graphics.Blit((Texture)(object)Result, temporary3); Graphics.Blit((Texture)(object)temporary3, temporary4); Graphics.Blit((Texture)(object)temporary4, temporary3); Graphics.Blit((Texture)(object)temporary3, Result); src.filterMode = filterMode; for (int i = 0; i < 5; i++) { Pass(Result, temporary2, across: true); Pass(temporary2, Result, across: false); } RenderTexture.ReleaseTemporary(temporary); RenderTexture.ReleaseTemporary(temporary2); RenderTexture.ReleaseTemporary(temporary3); RenderTexture.ReleaseTemporary(temporary4); } } internal sealed class TextBox : TMP_InputField { public sealed class Options { public string Text = ""; public string Prefix; public bool Icon; public string Placeholder; public int Limit; public Func<char, char> Filter; public Action<string> Changed; public Action<string> Left; public float Size = 18f; public string Key; public bool Focus; } private Image edge; private TextMeshProUGUI hint; private string key; private int pendingCaret = -1; private int caretFrames; private string pendingText; private static string focusKey; private static int focusCaret; private static int focusFrame = -10; private string blinkText; private int blinkPos = -1; private float lastInput; private bool caretShown = true; public static int LastTypingFrame { get; private set; } = -10; public override void OnScroll(PointerEventData e) { if ((Object)(object)((Component)this).transform.parent != (Object)null) { ExecuteEvents.ExecuteHierarchy<IScrollHandler>(((Component)((Component)this).transform.parent).gameObject, (BaseEventData)(object)e, ExecuteEvents.scrollHandler); } } private void Blink() { //IL_006f: Unknown result type (might be due to invalid IL or missing references) //IL_0074: 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) if (((TMP_InputField)this).text != blinkText || ((TMP_InputField)this).stringPosition != blinkPos) { blinkText = ((TMP_InputField)this).text; blinkPos = ((TMP_InputField)this).stringPosition; lastInput = Time.unscaledTime; } bool flag = (Time.unscaledTime - lastInput) % 1.06f < 0.53f; if (flag != caretShown) { caretShown = flag; Color txt = Ui.Txt; txt.a = (flag ? 1f : 0f); ((TMP_InputField)this).caretColor = txt; } } protected override void LateUpdate() { ((TMP_InputField)this).LateUpdate(); if (pendingCaret >= 0 && ((TMP_InputField)this).isFocused) { if (((TMP_InputField)this).text != pendingText || caretFrames <= 0) { pendingCaret = -1; } else { int num = Mathf.Clamp(pendingCaret, 0, ((TMP_InputField)this).text.Length); int num2 = (((TMP_InputField)this).selectionStringFocusPosition = num); int stringPosition = (((TMP_InputField)this).selectionStringAnchorPosition = num2); ((TMP_InputField)this).stringPosition = stringPosition; caretFrames--; } } if (((TMP_InputField)this).isFocused) { Blink(); } if (((TMP_InputField)this).isFocused) { LastTypingFrame = Time.frameCount; if (key != null) { focusKey = key; focusCaret = ((TMP_InputField)this).stringPosition; focusFrame = Time.frameCount; } } } public static TextBox Make(Transform parent, float x, float y, float w, float h, Options o) { //IL_000f: 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_0089: Unknown result type (might be due to invalid IL or missing references) //IL_0189: 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_01a7: 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) //IL_01e6: Unknown result type (might be due to invalid IL or missing references) //IL_0216: Unknown result type (might be due to invalid IL or missing references) //IL_00f9: Unknown result type (might be due to invalid IL or missing references) //IL_012e: 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_0160: Unknown result type (might be due to invalid IL or missing references) //IL_031f: Unknown result type (might be due to invalid IL or missing references) //IL_032d: Unknown result type (might be due to invalid IL or missing references) //IL_0252: Unknown result type (might be due to invalid IL or missing references) //IL_0282: Unknown result type (might be due to invalid IL or missing references) //IL_03fd: Unknown result type (might be due to invalid IL or missing references) //IL_0429: Unknown result type (might be due to invalid IL or missing references) //IL_0433: Unknown result type (might be due to invalid IL or missing references) //IL_03e1: Unknown result type (might be due to invalid IL or missing references) //IL_03eb: Expected O, but got Unknown Image val = Ui.Panel(parent, FieldStyle.Fill, Ui.RoundSmall); ((Graphic)val).raycastTarget = true; Ui.At(((Graphic)val).rectTransform, x, y, w, h); Image val2 = Ui.Edge(val, FieldStyle.EdgeIdle); ((Graphic)val2).raycastTarget = false; float num = 12f; if (o.Icon) { RawImage obj = ((Component)Ui.Node("icon", ((Component)val).transform)).gameObject.AddComponent<RawImage>(); obj.texture = (Texture)(object)FieldStyle.Icon(); ((Graphic)obj).color = Ui.Mix(0.5f); ((Graphic)obj).raycastTarget = false; Ui.At(((Graphic)obj).rectTransform, 12f, (h - 18f) / 2f, 18f, 18f); num = 40f; } if (!string.IsNullOrEmpty(o.Prefix)) { TextMeshProUGUI obj2 = Ui.Label(((Component)val).transform, o.Prefix, o.Size, Ui.Txt, (TextAlignmentOptions)513); ((TMP_Text)obj2).enableWordWrapping = false; ((Graphic)obj2).raycastTarget = false; ((TMP_Text)obj2).characterSpacing = 0f; Ui.Fill(((TMP_Text)obj2).rectTransform); ((TMP_Text)obj2).margin = Vector4.zero; float x2 = ((TMP_Text)obj2).GetPreferredValues(o.Prefix).x; ((TMP_Text)obj2).margin = new Vector4(num, 0f, 0f, 0f); num += x2 + 2f; } RectTransform val3 = Ui.Node("area", ((Component)val).transform); val3.anchorMin = Vector2.zero; val3.anchorMax = Vector2.one; val3.offsetMin = new Vector2(num, 0f); val3.offsetMax = new Vector2(-10f, 0f); ((Component)val3).gameObject.AddComponent<RectMask2D>(); TextMeshProUGUI val4 = Ui.Label((Transform)(object)val3, "", o.Size, Ui.Txt, (TextAlignmentOptions)513); ((TMP_Text)val4).enableWordWrapping = false; ((TMP_Text)val4).richText = false; Ui.Fill(((TMP_Text)val4).rectTransform); ((TMP_Text)val4).margin = Vector4.zero; TextMeshProUGUI val5 = null; if (!string.IsNullOrEmpty(o.Placeholder)) { val5 = Ui.Label((Transform)(object)val3, o.Placeholder, o.Size, Ui.Mix(0.45f), (TextAlignmentOptions)513); ((TMP_Text)val5).enableWordWrapping = false; ((Graphic)val5).raycastTarget = false; Ui.Fill(((TMP_Text)val5).rectTransform); ((TMP_Text)val5).margin = Vector4.zero; } GameObject gameObject = ((Component)val).gameObject; gameObject.SetActive(false); TextBox f = gameObject.AddComponent<TextBox>(); f.edge = val2; f.hint = val5; f.key = o.Key; ((TMP_InputField)f).textViewport = val3; ((TMP_InputField)f).textComponent = (TMP_Text)(object)val4; ((TMP_InputField)f).placeholder = (Graphic)(object)val5; ((Selectable)f).targetGraphic = (Graphic)(object)val; ((Selectable)f).transition = (Transition)0; TextBox textBox = f; Navigation navigation = default(Navigation); ((Navigation)(ref navigation)).mode = (Mode)0; ((Selectable)textBox).navigation = navigation; ((TMP_InputField)f).lineType = (LineType)0; ((TMP_InputField)f).contentType = (ContentType)9; ((TMP_InputField)f).characterValidation = (CharacterValidation)0; ((TMP_InputField)f).characterLimit = o.Limit; ((TMP_InputField)f).richText = false; ((TMP_InputField)f).restoreOriginalTextOnEscape = o.Key == null; ((TMP_InputField)f).onFocusSelectAll = o.Key == null; if (o.Filter != null) { Func<char, char> filter = o.Filter; ((TMP_InputField)f).onValidateInput = (OnValidateInput)((string s, int i, char c) => filter(c)); } ((TMP_InputField)f).customCaretColor = true; ((TMP_InputField)f).caretColor = Ui.Txt; ((TMP_InputField)f).caretWidth = 2; ((TMP_InputField)f).caretBlinkRate = 0f; ((TMP_InputField)f).selectionColor = Ui.A(Ui.Txt, 0.35f); ((TMP_InputField)f).SetTextWithoutNotify(o.Text ?? ""); if (o.Changed != null) { ((UnityEvent<string>)(object)((TMP_InputField)f).onValueChanged).AddListener((UnityAction<string>)delegate(string v) { o.Changed(v); }); } if (o.Left != null) { ((UnityEvent<string>)(object)((TMP_InputField)f).onEndEdit).AddListener((UnityAction<string>)delegate(string v) { o.Left(v); }); } ((UnityEvent<string>)(object)((TMP_InputField)f).onSelect).AddListener((UnityAction<string>)delegate { //IL_000b: Unknown result type (might be due to invalid IL or missing references) ((Graphic)f.edge).color = FieldStyle.EdgeTyping; if ((Object)(object)f.hint != (Object)null) { ((TMP_Text)f.hint).alpha = 0f; } }); ((UnityEvent<string>)(object)((TMP_InputField)f).onDeselect).AddListener((UnityAction<string>)delegate { //IL_000b: Unknown result type (might be due to invalid IL or missing references) ((Graphic)f.edge).color = FieldStyle.EdgeIdle; if ((Object)(object)f.hint != (Object)null) { ((TMP_Text)f.hint).alpha = 1f; } if (o.Left != null) { o.Left(((TMP_InputField)f).text); } }); gameObject.SetActive(true); bool flag = o.Key != null && o.Key == focusKey && Time.frameCount - focusFrame <= 2; if (flag || o.Focus) { f.pendingCaret = (flag ? focusCaret : ((TMP_InputField)f).text.Length); f.pendingText = ((TMP_InputField)f).text; f.caretFrames = 4; ((Selectable)f).Select(); ((TMP_InputField)f).ActivateInputField(); } return f; } } internal sealed class Menu : MonoBehaviour { public static Menu I; private const float W = 748f; private const float H = 636f; private const float Pad = 28f; private const float CapY = 84f; private const float TopY = 108f; private const float ColorCapY = 248f; private const float ColorY = 272f; private const float RowsY = 336f; private const float GridX = 272f; private const float Gap = 8f; private const float TileH = 56f; private const float TileW = 68f; private const int Columns = 6; private static readonly Color32[] Swatches = (Color32[])(object)new Color32[7] { new Color32(byte.MaxValue, byte.MaxValue, byte.MaxValue, byte.MaxValue), new Color32(byte.MaxValue, (byte)0, (byte)0, byte.MaxValue), new Color32(byte.MaxValue, byte.MaxValue, (byte)0, byte.MaxValue), new Color32((byte)0, byte.MaxValue, (byte)0, byte.MaxValue), new Color32((byte)0, byte.MaxValue, byte.MaxValue, byte.MaxValue), new Color32((byte)0, (byte)0, byte.MaxValue, byte.MaxValue), new Color32(byte.MaxValue, (byte)0, byte.MaxValue, byte.MaxValue) }; private bool _open; private bool _pauseBefore; private bool _rebinding; private Canvas _canvas; private RawImage _preview; private TextBox _scaleBox; private RectTransform _tip; private TextMeshProUGUI _tipText; private static int escapeFrame = -10; private static bool escapeHeld; private static Vector2? spot; private static KeyCode[] _allKeys; public static bool IsOpen { get { if ((Object)(object)I != (Object)null) { return I._open; } return false; } } public static bool SwallowEscape { get { if (!escapeHeld) { return false; } if (Time.frameCount - escapeFrame <= 1) { return true; } bool key; try { key = UnityInput.Current.GetKey((KeyCode)27); } catch { key = Input.GetKey((KeyCode)27); } if (!key) { escapeHeld = false; } return key; } } private void Awake() { I = this; } private void Update() { //IL_005e: Unknown result type (might be due to invalid IL or missing references) if (_rebinding) { WaitForKey(); return; } if (escapeHeld) { _ = SwallowEscape; } if (_open && KeyDown((KeyCode)27) && !Typing() && Time.frameCount - TextBox.LastTypingFrame > 1) { escapeFrame = Time.frameCount; escapeHeld = true; Close(); } else if (KeyDown(EzCrosshairPlugin.MenuKey.Value) && !Typing()) { if (_open) { Close(); } else { Open(); } } } private static Vector2 Spot() { //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0073: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Unknown result type (might be due to invalid IL or missing references) if (spot.HasValue) { return spot.Value; } Vector2 zero = Vector2.zero; string[] array = (EzCrosshairPlugin.MenuSpot.Value ?? "").Split(','); if (array.Length == 2) { float.TryParse(array[0], NumberStyles.Float, CultureInfo.InvariantCulture, out zero.x); float.TryParse(array[1], NumberStyles.Float, CultureInfo.InvariantCulture, out zero.y); } spot = zero; return zero; } private static void SaveSpot(Vector2 p) { //IL_0000: 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_002d: Unknown result type (might be due to invalid IL or missing references) spot = p; EzCrosshairPlugin.MenuSpot.Value = Mathf.RoundToInt(p.x).ToString(CultureInfo.InvariantCulture) + "," + Mathf.RoundToInt(p.y).ToString(CultureInfo.InvariantCulture); } private static Vector2 ClampSpot(Vector2 p) { //IL_0046: 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_0062: Unknown result type (might be due to invalid IL or missing references) float num = 1080f * (float)Screen.width / Mathf.Max(1f, (float)Screen.height); float num2 = Mathf.Max(0f, (num - 748f) / 2f); float num3 = Mathf.Max(0f, 222f); return new Vector2(Mathf.Clamp(p.x, 0f - num2, num2), Mathf.Clamp(p.y, 0f - num3, num3)); } private void LateUpdate() { //IL_0009: Unknown result type (might be due to invalid IL or missing references) if (_open) { if ((int)Cursor.lockState != 0) { Cursor.lockState = (CursorLockMode)0; } if (!Cursor.visible) { Cursor.visible = true; } } } public void Open() { if (!_open) { _open = true; PauseManager instance = PauseManager.Instance; _pauseBefore = (Object)(object)instance != (Object)null && instance.pause; if ((Object)(object)instance != (Object)null) { instance.pause = true; } Ui.Prepare(); Ui.EnsureEventSystem(); Ui.LoadColors(); } Build(); } public void Close() { if (_open) { _open = false; _rebinding = false; if ((Object)(object)_canvas != (Object)null) { Object.Destroy((Object)(object)((Component)_canvas).gameObject); } _canvas = null; Blur.DrawMenu(null); PauseManager instance = PauseManager.Instance; if ((Object)(object)instance != (Object)null) { instance.pause = _pauseBefore; } } } private void Rebuild() { if (_open) { Build(); } } private void Build() { //IL_0049: 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_0063: Unknown result type (might be due to invalid IL or missing references) //IL_006e: Expected O, but got Unknown //IL_0080: Unknown result type (might be due to invalid IL or missing references) //IL_0086: Expected O, but got Unknown //IL_00a0: 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_00b7: Unknown result type (might be due to invalid IL or missing references) //IL_00c2: Unknown result type (might be due to invalid IL or missing references) //IL_00c7: Unknown result type (might be due to invalid IL or missing references) //IL_00ec: Unknown result type (might be due to invalid IL or missing references) //IL_0182: Unknown result type (might be due to invalid IL or missing references) //IL_01c2: Unknown result type (might be due to invalid IL or missing references) //IL_01cd: Expected O, but got Unknown //IL_01d3: Unknown result type (might be due to invalid IL or missing references) //IL_01f1: Expected O, but got Unknown //IL_0290: Unknown result type (might be due to invalid IL or missing references) //IL_02ba: Unknown result type (might be due to invalid IL or missing references) //IL_02c4: Unknown result type (might be due to invalid IL or missing references) //IL_02d3: Expected O, but got Unknown //IL_02da: 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_0303: Unknown result type (might be due to invalid IL or missing references) //IL_0304: Unknown result type (might be due to invalid IL or missing references) //IL_030a: Unknown result type (might be due to invalid IL or missing references) //IL_0320: Unknown result type (might be due to invalid IL or missing references) //IL_033b: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)_canvas != (Object)null) { Object.Destroy((Object)(object)((Component)_canvas).gameObject); } _canvas = Ui.MakeCanvas("ezCrosshair Menu", 32001); Blur.DrawMenu(_canvas); RectTransform val = (RectTransform)((Component)_canvas).transform; Image obj = Ui.Panel((Transform)val, new Color(0f, 0f, 0f, 0f)); Ui.Fill(((Graphic)obj).rectTransform); ((Graphic)obj).raycastTarget = true; Image obj2 = Ui.Window((Transform)val); RectTransform rectTransform = ((Graphic)obj2).rectTransform; Vector2 val2 = default(Vector2); ((Vector2)(ref val2))..ctor(0.5f, 0.5f); rectTransform.anchorMax = val2; rectTransform.anchorMin = val2; rectTransform.sizeDelta = new Vector2(748f, 636f); rectTransform.anchoredPosition = ClampSpot(Spot()); ((Graphic)obj2).raycastTarget = true; Image obj3 = Ui.Panel((Transform)(object)rectTransform, new Color(0f, 0f, 0f, 0f)); ((Graphic)obj3).raycastTarget = true; Ui.At(((Graphic)obj3).rectTransform, 0f, 0f, 748f, 72f); WindowDrag windowDrag = ((Component)obj3).gameObject.AddComponent<WindowDrag>(); windowDrag.Window = rectTransform; windowDrag.Clamp = ClampSpot; windowDrag.Moving = delegate(Vector2 p) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) spot = p; }; windowDrag.Moved = SaveSpot; Ui.At(((TMP_Text)Ui.Label((Transform)(object)rectTransform, "ezCrosshair", 26f, Ui.Txt, (TextAlignmentOptions)4097)).rectTransform, 28f, 16f, 400f, 40f); Button obj4 = Ui.Btn((Transform)(object)rectTransform, "x", 20f, new UnityAction(Close)); Ui.At((RectTransform)((Component)obj4).transform, 684f, 16f, 40f, 40f); Ui.Center(obj4); Preview(rectTransform); Pictures(rectTransform); Colors(rectTransform); float y = 336f; Row(rectTransform, ref y, "scale", ScaleControl); Row(rectTransform, ref y, "show while scoped", delegate(RectTransform r) { Switch(r, EzCrosshairPlugin.ShowScoped.Value, delegate(bool v) { EzCrosshairPlugin.ShowScoped.Value = v; }); }); Row(rectTransform, ref y, "use this crosshair", delegate(RectTransform r) { Switch(r, EzCrosshairPlugin.On.Value, delegate(bool v) { EzCrosshairPlugin.On.Value = v; }); }); Row(rectTransform, ref y, "hit color", HitControl); Row(rectTransform, ref y, "menu key", delegate(RectTransform r) { //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Expected O, but got Unknown //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Expected O, but got Unknown Button obj6 = Ui.Btn((Transform)(object)r, _rebinding ? "press a key" : KeyLabel(EzCrosshairPlugin.MenuKey.Value), 20f, (UnityAction)delegate { _rebinding = true; Rebuild(); }, _rebinding); Ui.At((RectTransform)((Component)obj6).transform, 472f, 4f, 220f, 40f); Ui.Center(obj6); }); Image obj5 = Ui.Panel((Transform)(object)rectTransform, Color.white, Ui.Round); ((Graphic)obj5).material = Blur.AlphaOnly(); Ui.Fill(((Graphic)obj5).rectTransform); Image val3 = Ui.Panel((Transform)val, Ui.A(Ui.Mix(0.16f), 0.95f), Ui.RoundSmall); Ui.Edge(val3, Ui.Tint(0.3f)); _tip = ((Graphic)val3).rectTransform; val2 = (_tip.anchorMin = (_tip.anchorMax = Vector2.zero)); _tip.pivot = new Vector2(0f, 1f); _tipText = Ui.Label((Transform)(object)_tip, "", 16f, Ui.Txt, (TextAlignmentOptions)514); ((TMP_Text)_tipText).enableWordWrapping = false; Ui.Fill(((TMP_Text)_tipText).rectTransform); ((Component)_tip).gameObject.SetActive(false); } private void Preview(RectTransform w) { //IL_000b: 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_00b1: Unknown result type (might be due to invalid IL or missing references) //IL_00db: Unknown result type (might be due to invalid IL or missing references) //IL_00e1: 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) Ui.At(((TMP_Text)Ui.Label((Transform)(object)w, "preview", 14f, Ui.Dim, (TextAlignmentOptions)4097)).rectTransform, 28f, 84f, 220f, 20f); Image val = Ui.Panel((Transform)(object)w, Ui.Tint(0.06f), Ui.RoundSmall); Ui.At(((Graphic)val).rectTransform, 28f, 108f, 220f, 204f); Texture2D val2 = EzCrosshair.Pictures.Get(EzCrosshairPlugin.Pick.Value); if (!((Object)(object)val2 == (Object)null)) { RawImage val3 = ((Component)Ui.Node("preview", ((Component)val).transform)).gameObject.AddComponent<RawImage>(); val3.texture = (Texture)(object)val2; ((Graphic)val3).color = EzCrosshairPlugin.Tint.Value; ((Graphic)val3).raycastTarget = false; RectTransform rectTransform = ((Graphic)val3).rectTransform; Vector2 val4 = default(Vector2); ((Vector2)(ref val4))..ctor(0.5f, 0.5f); rectTransform.anchorMax = val4; rectTransform.anchorMin = val4; rectTransform.anchoredPosition = Vector2.zero; _preview = val3; SizePreview(); } } private void SizePreview() { //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Expected O, but got Unknown //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_0074: 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) if (!((Object)(object)_preview == (Object)null) && !((Object)(object)_preview.texture == (Object)null)) { Vector2Int val = Overlay.ScreenSize((Texture2D)_preview.texture, EzCrosshairPlugin.Scale.Value); float num = Mathf.Max(0.01f, (float)Screen.height / 1080f); ((Graphic)_preview).rectTransform.sizeDelta = new Vector2((float)((Vector2Int)(ref val)).x, (float)((Vector2Int)(ref val)).y) / num; } } private void ScaleControl(RectTransform r) { //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Expected O, but got Unknown float num = 692f; Ui.At((RectTransform)((Component)Ui.MakeSlider((Transform)(object)r, 0f, 2f, EzCrosshairPlugin.Scale.Value, delegate(float v) { v = Mathf.Round(v * 20f) / 20f; if (!(Mathf.Abs(v - EzCrosshairPlugin.Scale.Value) < 0.001f)) { EzCrosshairPlugin.Scale.Value = v; if ((Object)(object)_scaleBox != (Object)null && !((TMP_InputField)_scaleBox).isFocused) { ((TMP_InputField)_scaleBox).SetTextWithoutNotify(v.ToString("0.00", CultureInfo.InvariantCulture)); } SizePreview(); } })).transform, num - 360f, 12f, 240f, 24f); string shown = EzCrosshairPlugin.Scale.Value.ToString("0.00", CultureInfo.InvariantCulture); TextBox box = null; box = TextBox.Make((Transform)(object)r, num - 100f, 4f, 92f, 40f, new TextBox.Options { Text = shown, Limit = 4, Filter = delegate(char c) { if (!char.IsDigit(c)) { switch (c) { default: return '\0'; case ',': return '.'; case '.': break; } } return c; }, Left = delegate(string text) { if (float.TryParse(text, NumberStyles.Float, CultureInfo.InvariantCulture, out var result)) { result = Mathf.Clamp(result, 0f, 2f); if (Mathf.Abs(result - EzCrosshairPlugin.Scale.Value) > 0.0001f) { EzCrosshairPlugin.Scale.Value = result; Rebuild(); return; } } if ((Object)(object)box != (Object)null) { ((TMP_InputField)box).SetTextWithoutNotify(shown); } } }); _scaleBox = box; } private void Pictures(RectTransform w) { //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_0049: 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_013f: Expected O, but got Unknown //IL_0148: Unknown result type (might be due to invalid IL or missing references) //IL_0160: Expected O, but got Unknown //IL_01b5: Unknown result type (might be due to invalid IL or missing references) //IL_01da: Unknown result type (might be due to invalid IL or missing references) //IL_01e1: 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) Ui.At(((TMP_Text)Ui.Label((Transform)(object)w, "crosshairs", 14f, Ui.Dim, (TextAlignmentOptions)4097)).rectTransform, 272f, 84f, 300f, 20f); string[] names = EzCrosshairPlugin.Names; Color value = EzCrosshairPlugin.Tint.Value; int num = 1; string[] array = names; for (int i = 0; i < array.Length; i++) { Texture2D val = EzCrosshair.Pictures.Get(array[i]); if ((Object)(object)val != (Object)null) { num = Mathf.Max(num, Mathf.Max(((Texture)val).width, ((Texture)val).height)); } } int num2 = Mathf.Max(1, Mathf.FloorToInt(44f / (float)num)); Vector2 val4 = default(Vector2); for (int j = 0; j < names.Length; j++) { string name = names[j]; bool num3 = name == EzCrosshairPlugin.Pick.Value; float x = 272f + (float)(j % 6) * 76f; float y = 108f + (float)(j / 6) * 64f; if (num3) { Ui.At(((Graphic)Ui.Accent((Transform)(object)w)).rectTransform, x, y, 68f, 56f); } Button val2 = Ui.Btn((Transform)(object)w, null, 0f, (UnityAction)delegate { EzCrosshairPlugin.Pick.Value = name; Rebuild(); }); Ui.At((RectTransform)((Component)val2).transform, x, y, 68f, 56f); ((Component)val2).gameObject.AddComponent<Hover>().Text = name; Texture2D val3 = EzCrosshair.Pictures.Get(name); if (!((Object)(object)val3 == (Object)null)) { RawImage obj = ((Component)Ui.Node("picture", ((Component)val2).transform)).gameObject.AddComponent<RawImage>(); obj.texture = (Texture)(object)val3; ((Graphic)obj).color = value; ((Graphic)obj).raycastTarget = false; RectTransform rectTransform = ((Graphic)obj).rectTransform; ((Vector2)(ref val4))..ctor(0.5f, 0.5f); rectTransform.anchorMax = val4; rectTransform.anchorMin = val4; rectTransform.sizeDelta = new Vector2((float)(((Texture)val3).width * num2), (float)(((Texture)val3).height * num2)); } } } private void Colors(RectTransform w) { //IL_000b: 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_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_0066: 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_007e: 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_0085: 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_0094: 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_00a3: 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_00ed: 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_0134: Unknown result type (might be due to invalid IL or missing references) //IL_0142: Unknown result type (might be due to invalid IL or missing references) //IL_0156: Unknown result type (might be due to invalid IL or missing references) //IL_0160: Expected O, but got Unknown //IL_00b8: Unknown result type (might be due to invalid IL or missing references) Ui.At(((TMP_Text)Ui.Label((Transform)(object)w, "color", 14f, Ui.Dim, (TextAlignmentOptions)4097)).rectTransform, 272f, 248f, 300f, 20f); Color32 val = Color32.op_Implicit(EzCrosshairPlugin.Tint.Value); float num = 272f; float num2 = 272f; Color32[] swatches = Swatches; foreach (Color32 val2 in swatches) { Color32 col = val2; if (val.r == val2.r && val.g == val2.g && val.b == val2.b) { Ui.At(((Graphic)Ui.Panel((Transform)(object)w, Ui.Txt, Ui.RoundSmallRing)).rectTransform, num - 4f, num2 - 4f, 48f, 48f); } Image obj = Ui.Panel((Transform)(object)w, Color32.op_Implicit(col), Ui.RoundSmall); ((Graphic)obj).raycastTarget = true; Ui.At(((Graphic)obj).rectTransform, num, num2, 40f, 40f); Button obj2 = ((Component)obj).gameObject.AddComponent<Button>(); ((Selectable)obj2).targetGraphic = null; Navigation navigation = default(Navigation); ((Navigation)(ref navigation)).mode = (Mode)0; ((Selectable)obj2).navigation = navigation; ((UnityEvent)obj2.onClick).AddListener((UnityAction)delegate { //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) EzCrosshairPlugin.Tint.Value = Color32.op_Implicit(col); Rebuild(); }); num += 48f; } HexBox((Transform)(object)w, num + 8f, num2, 720f - (num + 8f), "crosshair color", EzCrosshairPlugin.Tint); } private void HexBox(Transform parent, float x, float y, float width, string key, ConfigEntry<Color> color) { //IL_001c: Unknown result type (might be due to invalid IL or missing references) string good = ColorUtility.ToHtmlStringRGB(color.Value).ToLowerInvariant(); TextBox hex = null; hex = TextBox.Make(parent, x, y, width, 40f, new TextBox.Options { Text = good, Prefix = "#", Limit = 6, Key = key, Filter = (char c) => Uri.IsHexDigit(c) ? char.ToLowerInvariant(c) : '\0', Changed = delegate(string v) { //IL_0039: Unknown result type (might be due to invalid IL or missing references) Color value = default(Color); if (v.Length == 6 && !(v == good) && ColorUtility.TryParseHtmlString("#" + v, ref value)) { good = v; color.Value = value; Rebuild(); } }, Left = delegate(string v) { if (v.Length != 6 && (Object)(object)hex != (Object)null) { ((TMP_InputField)hex).SetTextWithoutNotify(good); } } }); } private void HitControl(RectTransform r) { //IL_003c: Unknown result type (might be due to invalid IL or missing references) Switch(r, EzCrosshairPlugin.HitOn.Value, delegate(bool v) { EzCrosshairPlugin.HitOn.Value = v; }); float num = 692f; Ui.At(((Graphic)Ui.Panel((Transform)(object)r, EzCrosshairPlugin.HitTint.Value, Ui.RoundSmall)).rectTransform, num - 180f - 8f - 150f - 8f - 40f, 4f, 40f, 40f); HexBox((Transform)(object)r, num - 180f - 8f - 150f, 4f, 150f, "hit color", EzCrosshairPlugin.HitTint); } private static void Row(RectTransform w, ref float y, string label, Action<RectTransform> control) { //IL_0006: 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) Image val = Ui.Panel((Transform)(object)w, Ui.Tint(0.06f), Ui.RoundSmall); Ui.At(((Graphic)val).rectTransform, 28f, y, 692f, 48f); TextMeshProUGUI obj = Ui.Label(((Component)val).transform, label, 22f, Ui.Txt, (TextAlignmentOptions)4097); ((TMP_Text)obj).enableWordWrapping = false; Ui.At(((TMP_Text)obj).rectTransform, 16f, 0f, 400f, 48f); control(((Graphic)val).rectTransform); y += 56f; } private void Switch(RectTransform r, bool on, Action<bool> set) { //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Expected O, but got Unknown //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Expected O, but got Unknown //IL_0078: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Expected O, but got Unknown //IL_0089: Unknown result type (might be due to invalid IL or missing references) //IL_00a9: Expected O, but got Unknown float num = 692f; Button obj = Ui.Btn((Transform)(object)r, "off", 18f, (UnityAction)delegate { set(obj: false); Rebuild(); }, !on); Ui.At((RectTransform)((Component)obj).transform, num - 180f, 4f, 84f, 40f); Ui.Center(obj); Button obj2 = Ui.Btn((Transform)(object)r, "on", 18f, (UnityAction)delegate { set(obj: true); Rebuild(); }, on); Ui.At((RectTransform)((Component)obj2).transform, num - 92f, 4f, 84f, 40f); Ui.Center(obj2); } public void ShowTip(string text, Vector2 at) { //IL_0022: 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_0066: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)_tip == (Object)null)) { ((TMP_Text)_tipText).text = text; float num = ((TMP_Text)_tipText).GetPreferredValues(text).x + 28f; _tip.sizeDelta = new Vector2(num, 32f); ((Component)_tip).gameObject.SetActive(true); ((Transform)_tip).SetAsLastSibling(); MoveTip(at); } } public void MoveTip(Vector2 at) { //IL_002c: 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_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) if (!((Object)(object)_tip == (Object)null)) { float num = Mathf.Max(0.01f, (float)Screen.height / 1080f); _tip.anchoredPosition = at / num + new Vector2(16f, -16f); } } public void HideTip() { if ((Object)(object)_tip != (Object)null) { ((Component)_tip).gameObject.SetActive(false); } } private void WaitForKey() { //IL_0044: 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_0048: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Invalid comparison between Unknown and I4 //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Invalid comparison between Unknown and I4 //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Invalid comparison between Unknown and I4 //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Invalid comparison between Unknown and I4 //IL_0065: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Unknown result type (might be due to invalid IL or missing references) if (KeyDown((KeyCode)27)) { _rebinding = false; Rebuild(); return; } if (_allKeys == null) { _allKeys = (KeyCode[])Enum.GetValues(typeof(KeyCode)); } KeyCode[] allKeys = _allKeys; foreach (KeyCode val in allKeys) { if ((int)val != 0 && (int)val != 27 && ((int)val < 323 || (int)val > 329) && (int)val < 330 && KeyDown(val)) { EzCrosshairPlugin.MenuKey.Value = val; _rebinding = false; Rebuild(); break; } } } private static bool KeyDown(KeyCode k) { //IL_0005: 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) try { return UnityInput.Current.GetKeyDown(k); } catch { return Input.GetKeyDown(k); } } private unsafe static string KeyLabel(KeyCode k) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0003: Invalid comparison between Unknown and I4 //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Invalid comparison between Unknown and I4 //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Invalid comparison between Unknown and I4 //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Invalid comparison between Unknown and I4 //IL_000a: 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_000f: Expected I4, but got Unknown //IL_002c: 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_0034: Expected I4, but got Unknown if ((int)k >= 48 && (int)k <= 57) { return (k - 48).ToString(); } if ((int)k >= 256 && (int)k <= 265) { return "num " + (k - 256); } return ((object)(*(KeyCode*)(&k))/*cast due to .constrained prefix*/).ToString().ToLowerInvariant(); } private static bool Typing() { EventSystem current = EventSystem.current; GameObject val = (((Object)(object)current != (Object)null) ? current.currentSelectedGameObject : null); if ((Object)(object)val != (Object)null) { TMP_InputField component = val.GetComponent<TMP_InputField>(); if ((Object)(object)component != (Object)null && component.isFocused) { return true; } InputField component2 = val.GetComponent<InputField>(); if ((Object)(object)component2 != (Object)null && component2.isFocused) { return true; } } PauseManager instance = PauseManager.Instance; if ((Object)(object)instance != (Object)null && instance.chatting) { return !Overlay.InMainMenu(); } return false; } } internal sealed class Hover : MonoBehaviour, IPointerEnterHandler, IEventSystemHandler, IPointerExitHandler, IPointerMoveHandler { public string Text; public void OnPointerEnter(PointerEventData e) { //IL_0019: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)Menu.I != (Object)null) { Menu.I.ShowTip(Text, e.position); } } public void OnPointerMove(PointerEventData e) { //IL_0013: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)Menu.I != (Object)null) { Menu.I.MoveTip(e.position); } } public void OnPointerExit(PointerEventData e) { if ((Object)(object)Menu.I != (Object)null) { Menu.I.HideTip(); } } } internal sealed class TopRaycaster : GraphicRaycaster { public override int sortOrderPriority => int.MaxValue; public override int renderOrderPriority => int.MaxValue; } internal sealed class WindowDrag : MonoBehaviour, IPointerDownHandler, IEventSystemHandler, IBeginDragHandler, IDragHandler, IEndDragHandler, IPointerClickHandler { public RectTransform Window; public Func<Vector2, Vector2> Clamp; public Action<Vector2> Moving; public Action<Vector2> Moved; private static bool dragged; private static float lastDrag = -10f; public void OnPointerDown(PointerEventData e) { dragged = false; } public void OnBeginDrag(PointerEventData e) { dragged = true; } public void OnDrag(PointerEventData e) { //IL_004c: 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_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_0078: Unknown result type (might be due to invalid IL or missing references) Canvas componentInParent = ((Component)Window).GetComponentInParent<Canvas>(); float num = (((Object)(object)componentInParent != (Object)null && componentInParent.rootCanvas.scaleFactor > 0f) ? componentInParent.rootCanvas.scaleFactor : 1f); Window.anchoredPosition = Clamp(Window.anchoredPosition + e.delta / num); Moving(Window.anchoredPosition); } public void OnEndDrag(PointerEventData e) { //IL_0016: Unknown result type (might be due to invalid IL or missing references) lastDrag = Time.unscaledTime; Moved(Window.anchoredPosition); } public void OnPointerClick(PointerEventData e) { //IL_0029: 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) if (e.clickCount >= 2 && !dragged && !(Time.unscaledTime - lastDrag < 0.5f)) { Window.anchoredPosition = Vector2.zero; Moved(Vector2.zero); } } } internal static class Ui { public static TMP_FontAsset Font; public static FontStyles Style = (FontStyles)3; public static Sprite Round; public static Sprite RoundSmall; public static Sprite RoundRing; public static Sprite RoundSmallRing; public static readonly Color MintTxt = Color32.op_Implicit(new Color32((byte)181, (byte)247, (byte)183, byte.MaxValue)); public static readonly Color MintBg = Color32.op_Implicit(new Color32((byte)21, (byte)22, (byte)16, byte.MaxValue)); public static readonly Color MintGlass = Color32.op_Implicit(new Color32((byte)12, (byte)13, (byte)9, byte.MaxValue)); public static Color Txt = MintTxt; public static Color Bg = MintBg; public static Color GlassColor = MintGlass; public const float GlassAlpha = 0.66f; private const string StrafthConfig = "dorsth.straftat.strafth.cfg"; private static readonly float[] CornerW = new float[4] { 1.14f, 0.86f, 1.21f, 0.93f }; private static readonly float[] CornerH = new float[4] { 0.93f, 1.14f, 0.86f, 1.07f }; private static readonly Dictionary<TMP_FontAsset, Material> CleanMats = new Dictionary<TMP_FontAsset, Material>(); public static Color Dim => Mix(0.66f); public static Color OnFill { get { //IL_0021: 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_0038: Unknown result type (might be due to invalid IL or missing references) if (Mathf.Abs(((Color)(ref Txt)).grayscale - ((Color)(ref Bg)).grayscale) >= 0.35f) { return Bg; } if (!(((Color)(ref Txt)).grayscale < 0.5f)) { return Color.black; } return Color.white; } } public static Color Mix(float k) { //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_000b: Unknown result type (might be due to invalid IL or missing references) return Color.Lerp(Bg, Txt, k); } public static Color A(Color c, float a) { //IL_0008: Unknown result type (might be due to invalid IL or missing references) c.a = a; return c; } public static Color Tint(float k) { //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) return A(Txt, k); } public static void LoadColors() { //IL_00fd: Unknown result type (might be due to invalid IL or missing references) //IL_0102: 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_0136: Unknown result type (might be due to invalid IL or missing references) //IL_013b: Unknown result type (might be due to invalid IL or missing references) //IL_013c: Unknown result type (might be due to invalid IL or missing references) //IL_0141: Unknown result type (might be due to invalid IL or missing references) //IL_0157: 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_0117: Unknown result type (might be due to invalid IL or missing references) //IL_011c: Unknown result type (might be due to invalid IL or missing references) //IL_01be: 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_019a: Unknown result type (might be due to invalid IL or missing references) //IL_01a6: Unknown result type (might be due to invalid IL or missing references) //IL_01b7: Unknown result type (might be due to invalid IL or missing references) //IL_01c3: Unknown result type (might be due to invalid IL or missing references) string text = "B5F7B7"; string text2 = "151610"; try { string path = Path.Combine(Paths.ConfigPath, "dorsth.straftat.strafth.cfg"); if (File.Exists(path)) { string[] array = File.ReadAllLines(path); foreach (string text3 in array) { int num = text3.IndexOf('='); if (num < 0 || text3.TrimStart().StartsWith("#")) { continue; } string text4 = text3.Substring(0, num).Trim(); string text5 = text3.Substring(num + 1).Trim().TrimStart('#'); if (text5.Length == 6) { if (text4 == "Menu color") { text = text5; } else if (text4 == "Menu background") { text2 = text5; } } } } } catch (Exception ex) { EzCrosshairPlugin.WarnOnce("STRAFTH's menu colors were not read: " + ex.Message); } Color mintTxt = default(Color); if (!ColorUtility.TryParseHtmlString("#" + text, ref mintTxt)) { mintTxt = MintTxt; } Color mintBg = default(Color); if (!ColorUtility.TryParseHtmlString("#" + text2, ref mintBg)) { mintBg = MintBg; } mintTxt.a = (mintBg.a = 1f); Txt = mintTxt; Bg = mintBg; GlassColor = (Color)((Mathf.Abs(mintBg.r - MintBg.r) + Mathf.Abs(mintBg.g - MintBg.g) + Mathf.Abs(mintBg.b - MintBg.b) < 0.01f) ? MintGlass : new Color(mintBg.r * 0.6f, mintBg.g * 0.6f, mintBg.b * 0.6f, 1f)); } public static void Prepare() { if ((Object)(object)Round == (Object)null) { Round = RoundSprite(10); } if ((Object)(object)RoundSmall == (Object)null) { RoundSmall = RoundSprite(5); } if ((Object)(object)RoundRing == (Object)null) { RoundRing = RoundSprite(10, 1.5f); } if ((Object)(object)RoundSmallRing == (Object)null) { RoundSmallRing = RoundSprite(5, 1.25f); } FindFont(); } private static void FindFont() { //IL_0106: Unknown result type (might be due to invalid IL or missing references) //IL_0127: 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_012e: Unknown result type (might be due to invalid IL or missing references) //IL_0141: Unknown result type (might be due to invalid IL or missing references) //IL_0147: Unknown result type (might be due to invalid IL or missing references) //IL_0148: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)Font != (Object)null) { return; } TMP_FontAsset[] array; try { array = Resources.FindObjectsOfTypeAll<TMP_FontAsset>(); } catch { array = (TMP_FontAsset[])(object)new TMP_FontAsset[0]; } int num = 0; TMP_FontAsset[] array2 = array; foreach (TMP_FontAsset val in array2) { if (!((Object)(object)val == (Object)null)) { string text = ((Object)val).name.ToLowerInvariant(); int num2 = 0; if (text.Contains("gothic") || text.Contains("century")) { num2 = 2; } if (text.Contains("gothicbi")) { num2 = 5; } else if (num2 > 0 && text.Contains("bold") && text.Contains("italic")) { num2 = 4; } else if (num2 > 0 && (text.Contains("bold") || text.Contains("italic"))) { num2 = 3; } if (num2 > num) { num = num2; Font = val; } } } if ((Object)(object)Font != (Object)null) { string text2 = ((Object)Font).name.ToLowerInvariant(); Style = (FontStyles)0; if (!text2.Contains("gothicbi")) { if (!text2.Contains("italic")) { Style = (FontStyles)(Style | 2); } if (!text2.Contains("bold")) { Style = (FontStyles)(Style | 1); } } } if ((Object)(object)Font == (Object)null) { Font = TMP_Settings.defaultFontAsset; } } private static Sprite RoundSprite(int r, float ring = 0f) { //IL_00b0: 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_00bc: Unknown result type (might be due to invalid IL or missing references) //IL_00c5: Expected O, but got Unknown //IL_0259: 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_0280: Unknown result type (might be due to invalid IL or missing references) //IL_0208: Unknown result type (might be due to invalid IL or missing references) //IL_020d: Unknown result type (might be due to invalid IL or missing references) float num = (float)r * CornerW[0]; float num2 = (float)r * CornerW[1]; float num3 = (float)r * CornerW[2]; float num4 = (float)r * CornerW[3]; float num5 = (float)r * CornerH[0]; float num6 = (float)r * CornerH[1]; float num7 = (float)r * CornerH[2]; float num8 = (float)r * CornerH[3]; int num9 = Mathf.CeilToInt(Mathf.Max(num, num4)); int num10 = Mathf.CeilToInt(Mathf.Max(num2, num3)); int num11 = Mathf.CeilToInt(Mathf.Max(num5, num6)); int num12 = Mathf.CeilToInt(Mathf.Max(num8, num7)); int num13 = num9 + num10 + 4; int num14 = num11 + num12 + 4; Texture2D val = new Texture2D(num13, num14, (TextureFormat)4, false) { wrapMode = (TextureWrapMode)1, filterMode = (FilterMode)1 }; Color32[] array = (Color32[])(object)new Color32[num13 * num14]; for (int i = 0; i < num14; i++) { for (int j = 0; j < num13; j++) { float num15 = (float)j + 0.5f; float num16 = (float)i + 0.5f; float num17 = ((num15 < num && num16 > (float)num14 - num5) ? InEllipse(num15 - num, num16 - ((float)num14 - num5), num, num5) : ((num15 > (float)num13 - num2 && num16 > (float)num14 - num6) ? InEllipse(num15 - ((float)num13 - num2), num16 - ((float)num14 - num6), num2, num6) : ((num15 > (float)num13 - num3 && num16 < num7) ? InEllipse(num15 - ((float)num13 - num3), num16 - num7, num3, num7) : ((!(num15 < num4) || !(num16 < num8)) ? Mathf.Min(Mathf.Min(num15, (float)num13 - num15), Mathf.Min(num16, (float)num14 - num16)) : InEllipse(num15 - num4, num16 - num8, num4, num8))))); float num18 = Mathf.Clamp01(num17 + 0.5f); if (ring > 0f) { num18 *= Mathf.Clamp01(ring - num17 + 0.5f); } array[i * num13 + j] = new Color32(byte.MaxValue, byte.MaxValue, byte.MaxValue, (byte)(num18 * 255f)); } } val.SetPixels32(array); val.Apply(); Object.DontDestroyOnLoad((Object)(object)val); Sprite obj = Sprite.Create(val, new Rect(0f, 0f, (float)num13, (float)num14), new Vector2(0.5f, 0.5f), 100f, 0u, (SpriteMeshType)0, new Vector4((float)num9, (float)num12, (float)num10, (float)num11)); Object.DontDestroyOnLoad((Object)(object)obj); return obj; } private static float InEllipse(float dx, float dy, float rx, float ry) { float num = dx / rx; float num2 = dy / ry; float num3 = Mathf.Sqrt(num * num + num2 * num2); if (num3 < 0.0001f) { return Mathf.Min(rx, ry); } float num4 = Mathf.Sqrt(num * num / (rx * rx) + num2 * num2 / (ry * ry)) / num3; return (1f - num3) / num4; } public static RectTransform Node(string name, Transform parent) { //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Expected O, but got Unknown //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Expected O, but got Unknown GameObject val = new GameObject(name, new Type[1] { typeof(RectTransform) }); val.transform.SetParent(parent, false); if ((Object)(object)parent != (Object)null) { val.layer = ((Component)parent).gameObject.layer; } return (RectTransform)val.transform; } public static RectTransform At(RectTransform rt, float x, float y, float w, float h) { //IL_0013: 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_002a: 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_0046: Unknown result type (might be due to invalid IL or missing references) Vector2 val = default(Vector2); ((Vector2)(ref val))..ctor(0f, 1f); rt.anchorMax = val; rt.anchorMin = val; rt.pivot = new Vector2(0f, 1f); rt.anchoredPosition = new Vector2(x, 0f - y); rt.sizeDelta = new Vector2(w, h); return rt; } public static RectTransform Fill(RectTransform rt) { //IL_0001: 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_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_001e: 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) rt.anchorMin = Vector2.zero; rt.anchorMax = Vector2.one; Vector2 offsetMin = (rt.offsetMax = Vector2.zero); rt.offsetMin = offsetMin; return rt; } public static Image Panel(Transform parent, Color c, Sprite s = null) { //IL_0017: Unknown result type (might be due to invalid IL or missing references) Image val = ((Component)Node("panel", parent)).gameObject.AddComponent<Image>(); ((Graphic)val).color = c; ((Graphic)val).raycastTarget = false; if ((Object)(object)s != (Object)null) { val.sprite = s; val.type = (Type)1; } return val; } public static Image Window(Transform parent) { //IL_002c: 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_0047: Unknown result type (might be due to invalid IL or missing references) float a = 0.66f * Mathf.Lerp(1f, 0.45f, Mathf.Clamp01(((Color)(ref GlassColor)).grayscale * 1.6f)); Image obj = Panel(parent, A(GlassColor, a), Round); Edge(obj, Tint(0.2f), small: false); Blur.Behind(obj); return obj; } public static Slider MakeSlider(Transform parent, float min, float max, float val, UnityAction<float> onChange) { //IL_002b: 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_005a: 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_0083: 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_00b8: Unknown result type (might be due to invalid IL or missing references) //IL_00cd: Unknown result type (might be due to invalid IL or missing references) //IL_00d7: Unknown result type (might be due to invalid IL or missing references) //IL_00e1: Unknown result type (might be due to invalid IL or missing references) //IL_00f7: 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_0133: Unknown result type (might be due to invalid IL or missing references) //IL_013d: Unknown result type (might be due to invalid IL or missing references) //IL_019e: 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_01b4: Unknown result type (might be due to invalid IL or missing references) //IL_01b9: 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) //IL_01dd: Unknown result type (might be due to invalid IL or missing references) //IL_01e9: Unknown result type (might be due to invalid IL or missing references) //IL_01f7: Unknown result type (might be due to invalid IL or missing references) //IL_0202: Unknown result type (might be due to invalid IL or missing references) //IL_020c: Unknown result type (might be due to invalid IL or missing references) //IL_0225: Unknown result type (might be due to invalid IL or missing references) //IL_0234: 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_024f: 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) RectTransform val2 = Node("slider", parent); ((Graphic)((Component)val2).gameObject.AddComponent<Image>()).color = new Color(0f, 0f, 0f, 0f); RectTransform rectTransform = ((Graphic)Panel((Transform)(object)val2, Tint(0.2f), RoundSmall)).rectTransform; rectTransform.anchorMin = new Vector2(0f, 0.5f); rectTransform.anchorMax = new Vector2(1f, 0.5f); rectTransform.sizeDelta = new Vector2(0f, 8f); RectTransform obj = Node("fill area", (Transform)(object)val2); obj.anchorMin = new Vector2(0f, 0.5f); obj.anchorMax = new Vector2(1f, 0.5f); obj.sizeDelta = new Vector2(0f, 8f); Image val3 = Panel((Transform)(object)obj, A(Txt, 0.55f), RoundSmall); ((Graphic)val3).rectTransform.sizeDelta = Vector2.zero; RectTransform obj2 = Node("handle area", (Transform)(object)val2); Fill(obj2); obj2.offsetMin = new Vector2(9f, 0f); obj2.offsetMax = new Vector2(-9f, 0f); Image val4 = Panel((Transform)(object)obj2, Txt, Round); ((Graphic)val4).raycastTarget = true; Slider val5 = ((Component)val2).gameObject.AddComponent<Slider>(); val5.fillRect = ((Graphic)val3).rectTransform; val5.handleRect = ((Graphic)val4).rectTransform; ((Selectable)val5).targetGraphic = (Graphic)(object)val4; val5.direction = (Direction)0; val5.minValue = min; val5.maxValue = max; val5.value = val; Navigation navigation = default(Navigation); ((Navigation)(ref navigation)).mode = (Mode)0; ((Selectable)val5).navigation = navigation; ColorBlock colors = ((Selectable)val5).colors; ((ColorBlock)(ref colors)).normalColor = new Color(1f, 1f, 1f, 0.85f); ((ColorBlock)(ref colors)).highlightedColor = Color.white; ((ColorBlock)(ref colors)).pressedColor = Color.white; ((ColorBlock)(ref colors)).selectedColor = ((ColorBlock)(ref colors)).normalColor; ((Selectable)val5).colors = colors; ((Graphic)val4).CrossFadeColor(((ColorBlock)(ref colors)).normalColor, 0f, true, true); RectTransform rectTransform2 = ((Graphic)val4).rectTransform; rectTransform2.anchorMin = new Vector2(rectTransform2.anchorMin.x, 0.5f); rectTransform2.anchorMax = new Vector2(rectTransform2.anchorMax.x, 0.5f); rectTransform2.sizeDelta = new Vector2(18f, 18f); if (onChange != null) { ((UnityEvent<float>)(object)val5.onValueChanged).AddListener(onChange); } return val5; } public static Image Edge(Image host, Color c, bool small = true) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) Image obj = Panel(((Component)host).transform, c, small ? RoundSmallRing : RoundRing); Fill(((Graphic)obj).rectTransform); return obj; } public static Image Accent(Transform parent) { //IL_0006: 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) Image obj = Panel(parent, Tint(0.15f), RoundSmall); Edge(obj, Tint(0.5f)); return obj; } private static Material CleanMaterial(TMP_FontAsset font) { //IL_003a: 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_005b: Expected O, but got Unknown if ((Object)(object)font == (Object)null || (Object)(object)((TMP_Asset)font).material == (Object)null) { return null; } if (CleanMats.TryGetValue(font, out var value) && (Object)(object)value != (Object)null) { return value; } try { value = new Material(((TMP_Asset)font).material) { name = ((Object)((TMP_Asset)font).material).name + " (crosshairs clean)" }; value.DisableKeyword("OUTLINE_ON"); value.DisableKeyword("UNDERLAY_ON"); value.DisableKeyword("UNDERLAY_INNER"); value.DisableKeyword("GLOW_ON"); string[] array = new string[11] { "_OutlineWidth", "_OutlineSoftness", "_FaceDilate", "_UnderlayOffsetX", "_UnderlayOffsetY", "_UnderlayDilate", "_UnderlaySoftness", "_GlowPower", "_GlowOuter", "_GlowInner", "_GlowOffset" }; foreach (string text in array) { if (value.HasProperty(text)) { value.SetFloat(text, 0f); } } if (value.HasProperty("_Sharpness")) { value.SetFloat("_Sharpness", 0.35f); } ShaderUtilities.GetShaderPropertyIDs(); ShaderUtilities.UpdateShaderRatios(value); Object.DontDestroyOnLoad((Object)(object)value); } catch { value = null; } CleanMats[font] = value; return value; } public static TextMeshProUGUI Label(Transform parent, string text, float size, Color c, TextAlignmentOptions align = (TextAlignmentOptions)4097) { //IL_0065: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_0085: Unknown result type (might be due to invalid IL or missing references) TextMeshProUGUI val = ((Component)Node("text", parent)).gameObject.AddComponent<TextMeshProUGUI>(); if ((Object)(object)Font != (Object)null) { ((TMP_Text)val).font = Font; } Material val2 = CleanMaterial(((TMP_Text)val).font); if ((Object)(object)val2 != (Object)null) { ((TMP_Text)val).fontSharedMaterial = val2; } ((TMP_Text)val).extraPadding = false; if (size <= 18f) { ((TMP_Text)val).characterSpacing = 5f; } ((TMP_Text)val).fontStyle = Style; ((TMP_Text)val).text = text; ((TMP_Text)val).fontSize = size; ((Graphic)val).color = c; ((TMP_Text)val).alignment = align; ((TMP_Text)val).enableWordWrapping = true; ((TMP_Text)val).overflowMode = (TextOverflowModes)1; ((Graphic)val).raycastTarget = false; return val; } public static Button Btn(Transform parent, string text, float size, UnityAction onClick, bool filled = false) { //IL_0011: 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_0035: 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_00a3: 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_00cf: 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_0061: Unknown result type (might be due to invalid IL or missing references) //IL_0081: 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_00f6: Unknown result type (might be due to invalid IL or missing references) //IL_0104: 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_011b: Unknown result type (might be due to invalid IL or missing references) //IL_0151: Unknown result type (might be due to invalid IL or missing references) //IL_014a: 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_019a: Unknown result type (might be due to invalid IL or missing references) Image val = Panel(parent, filled ? Txt : Tint(0.14f), RoundSmall); ((Graphic)val).raycastTarget = true; Button val2 = ((Component)val).gameObject.AddComponent<Button>(); ColorBlock colors = ((Selectable)val2).colors; if (filled) { ((ColorBlock)(ref colors)).normalColor = new Color(1f, 1f, 1f, 0.85f); ((ColorBlock)(ref colors)).highlightedColor = Color.white; ((ColorBlock)(ref colors)).pressedColor = new Color(1f, 1f, 1f, 0.65f); } else { ((ColorBlock)(ref colors)).normalColor = new Color(1f, 1f, 1f, 0f); ((ColorBlock)(ref colors)).highlightedColor = Color.white; ((ColorBlock)(ref colors)).pressedColor = new Color(1f, 1f, 1f, 0.6f); } ((ColorBlock)(ref colors)).selectedColor = ((ColorBlock)(ref colors)).normalColor; ((ColorBlock)(ref colors)).fadeDuration = 0.06f; Navigation navigation = default(Navigation); ((Navigation)(ref navigation)).mode = (Mode)0; ((Selectable)val2).navigation = navigation; ((Selectable)val2).targetGraphic = (Graphic)(object)val; ((Selectable)val2).colors = colors; ((Graphic)val).CrossFadeColor(((ColorBlock)(ref colors)).normalColor, 0f, true, true); if (onClick != null) { ((UnityEvent)val2.onClick).AddListener(onClick); } if (text != null) { TextMeshProUGUI obj = Label(((Component)val).transform, text, size, filled ? OnFill : Txt, (TextAlignmentOptions)(filled ? 514 : 4097)); ((TMP_Text)obj).characterSpacing = 0f; Fill(((TMP_Text)obj).rectTransform); ((TMP_Text)obj).margin = (Vector4)(filled ? Vector4.zero : new Vector4(16f, 0f, 16f, 0f)); } return val2; } public static void Center(Button b) { //IL_001d: Unknown result type (might be due to invalid IL or missing references) TextMeshProUGUI componentInChildren = ((Component)b).GetComponentInChildren<TextMeshProUGUI>(); if (!((Object)(object)componentInChildren == (Object)null)) { ((TMP_Text)componentInChildren).alignment = (TextAlignmentOptions)514; ((TMP_Text)componentInChildren).margin = Vector4.zero; } } public static Canvas MakeCanvas(string name, int order) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Expected O, but got Unknown //IL_000c: 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_0046: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) GameObject val = new GameObject(name); Object.DontDestroyOnLoad((Object)val); val.layer = 31; Canvas val2 = val.AddComponent<Canvas>(); val2.renderMode = (RenderMode)1; val2.worldCamera = Blur.MenuCamera(); val2.planeDistance = 10f; val2.sortingOrder = order; val2.pixelPerfect = true; CanvasScaler obj = val.AddComponent<CanvasScaler>(); obj.uiScaleMode = (ScaleMode)1; obj.referenceResolution = new Vector2(1920f, 1080f); obj.matchWidthOrHeight = 1f; val.AddComponent<TopRaycaster>(); return val2; } public static void EnsureEventSystem() { //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Expected O, but got Unknown //IL_002b: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)EventSystem.current != (Object)null) && !((Object)(object)Object.FindObjectOfType<EventSystem>() != (Object)null)) { GameObject val = new GameObject("ezCrosshair EventSystem"); Object.DontDestroyOnLoad((Object)val); val.AddComponent<EventSystem>(); val.AddComponent<StandaloneInputModule>(); } } } [BepInPlugin("dorsth.straftat.ezcrosshair", "ezCrosshair", "1.3.7")] [BepInDependency(/*Could not decode attribute arguments.*/)] public sealed class EzCrosshairPlugin : BaseUnityPlugin { public const string Guid = "dorsth.straftat.ezcrosshair"; public const string Name = "ezCrosshair"; public const string Version = "1.3.7"; internal const string ModMenuGuid = "kestrel.straftat.modmenu"; internal static readonly string[] Names = new string[12] { "dot", "square", "circle", "diamond", "dark diamond", "pinhole", "plus", "outlined plus", "chunky plus", "cross", "star", "brackets" }; internal static ManualLogSource Log; private static readonly HashSet<string> Said = new HashSet<string>(); internal static ConfigEntry<bool> On; internal static ConfigEntry<string> Pick; internal static ConfigEntry<Color> Tint; internal static ConfigEntry<bool> HitOn; internal static ConfigEntry<Color> HitTint; internal static ConfigEntry<float> Scale; internal static ConfigEntry<bool> ShowScoped; internal static ConfigEntry<KeyCode> MenuKey; internal static ConfigEntry<string> MenuSpot; private static bool _hidGame; internal static bool Ours => On.Value; internal static void WarnOnce(string s) { if (Said.Count < 32 && Said.Add(s)) { Log.LogWarning((object)s); } } private void Awake() { //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Expected O, but got Unknown //IL_0091: Unknown result type (might be due to invalid IL or missing references) //IL_00e9: Unknown result type (might be due to invalid IL or missing references) //IL_012b: Unknown result type (might be due to invalid IL or missing references) //IL_0135: Expected O, but got Unknown //IL_01a7: 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_01d4: Unknown result type (might be due to invalid IL or missing references) //IL_01e1: Expected O, but got Unknown //IL_01e2: Unknown result type (might be due to invalid IL or missing references) //IL_0209: Unknown result type (might be due to invalid IL or missing references) //IL_0217: Expected O, but got Unknown //IL_0218: Unknown result type (might be due to invalid IL or missing references) //IL_023f: Unknown result type (might be due to invalid IL or missing references) //IL_024d: Expected O, but got Unknown //IL_0274: Unknown result type (might be due to invalid IL or missing references) //IL_0282: Expected O, but got Unknown Log = ((BaseUnityPlugin)this).Logger; Log.LogInfo((object)"ezCrosshair 1.3.7 loaded. Dorsth was here."); ((Object)((Component)this).gameObject).hideFlags = (HideFlags)61; On = ((BaseUnityPlugin)this).Config.Bind<bool>("Crosshair", "Enabled", true, "Shows your crosshair instead of the game's."); Pick = ((BaseUnityPlugin)this).Config.Bind<string>("Crosshair", "Crosshair", Names[0], new ConfigDescription("Which crosshair.", (AcceptableValueBase)(object)new AcceptableValueList<string>(Names), Array.Empty<object>())); Tint = ((BaseUnityPlugin)this).Config.Bind<Color>("Crosshair", "Color", Color.white, "Color of the crosshair. White keeps its own colors; the dark outline stays dark."); HitOn = ((BaseUnityPlugin)this).Config.Bind<bool>("Crosshair", "Hit Color", false, "The crosshair turns the hit color for a moment when you hit someone."); HitTint = ((BaseUnityPlugin)this).Config.Bind<Color>("Crosshair", "Hit Color Value", new Color(1f, 0.25f, 0.25f, 1f), "The color the crosshair turns when you hit someone."); Scale = ((BaseUnityPlugin)this).Config.Bind<float>("Crosshair", "Scale", 1f, new ConfigDescription("Size of the crosshair: 1 is its own size on a 1080p screen.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 2f), Array.Empty<object>())); ShowScoped = ((BaseUnityPlugin)this).Config.Bind<bool>("Crosshair", "Show While Scoped", false, "Keeps the crosshair on while you look through a scope."); MenuKey = ((BaseUnityPlugin)this).Config.Bind<KeyCode>("Keys", "Menu", (KeyCode)283, "Opens the crosshair menu."); MenuSpot = ((BaseUnityPlugin)this).Config.Bind<string>("Keys", "Menu Window", "0,0", "Where the menu window is, from the middle of the screen. Drag its top bar to move it, double-click the bar to center it."); try { Harmony val = new Harmony("dorsth.straftat.ezcrosshair"); val.Patch((MethodBase)AccessTools.Method(typeof(Crosshair), "Update", (Type[])null, (Type[])null), (HarmonyMethod)null, new HarmonyMethod(typeof(EzCrosshairPlugin), "GameCrosshairPostfix", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); val.Patch((MethodBase)AccessTools.Method(typeof(PauseManager), "Update", (Type[])null, (Type[])null), new HarmonyMethod(typeof(EzCrosshairPlugin), "PauseUpdatePrefix", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); val.Patch((MethodBase)AccessTools.Method(typeof(PauseManager), "Menu", (Type[])null, (Type[])null), new HarmonyMethod(typeof(EzCrosshairPlugin), "EscapePrefix", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); val.Patch((MethodBase)AccessTools.Method(typeof(WindowPositionTween), "Update", (Type[])null, (Type[])null), new HarmonyMethod(typeof(EzCrosshairPlugin), "EscapePrefix", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); } catch (Exception ex) { Log.LogError((object)("Couldn't hide the game's crosshair: " + ex)); } ((BaseUnityPlugin)this).Config.SettingChanged += delegate { Overlay.Dirty = true; }; ((Component)this).gameObject.AddComponent<Overlay>(); ((Component)this).gameObject.AddComponent<Menu>(); if (Chainloader.PluginInfos.ContainsKey("kestrel.straftat.modmenu")) { try { ModMenuPage(((BaseUnityPlugin)this).Config); } catch (Exception ex2) { Log.LogWarning((object)("Mod Menu page failed: " + ex2.Message)); } } } [MethodImpl(MethodImplOptions.NoInlining)] private static void ModMenuPage(ConfigFile config) { List<ConfigEntryBase> list = new List<ConfigEntryBase>(); foreach (KeyValuePair<ConfigDefinition, ConfigEntryBase> item in config) { if ((object)item.Value != MenuKey) { list.Add(item.Value); } } ModMenuCustomisation.HideEntries((IEnumerable<ConfigEntryBase>)list); } private static bool PauseUpdatePrefix(PauseManager __instance) { //IL_0010: Unknown result type (might be due to invalid IL or missing references) if (!Menu.IsOpen) { return true; } __instance.pause = true; if ((int)Cursor.lockState != 0) { Cursor.lockState = (CursorLockMode)0; } if (!Cursor.visible) { Cursor.visible = true; } return false; } private static bool EscapePrefix() { if (!Menu.IsOpen) { return !Menu.SwallowEscape; } return false; } private static void GameCrosshairPostfix(Crosshair __instance) { Image image = __instance.image; if ((Object)(object)image == (Object)null) { return; } CanvasRenderer canvasRenderer = ((Graphic)image).canvasRenderer; if (Ours) {