using System; using System.Collections.Generic; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Logging; using HarmonyLib; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: AssemblyMetadata("AI_Assisted_Creation", "This assembly was partially created with the assistance of generative AI for packaging, refactoring, and documentation.")] [assembly: AssemblyMetadata("AI_Model_Vendor", "Anthropic/OpenAI")] [assembly: TargetFramework(".NETFramework,Version=v4.6", FrameworkDisplayName = ".NET Framework 4.6")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("0.10.14.0")] [module: UnverifiableCode] namespace Cinnamon { [HarmonyPatch(typeof(TabletStatsScreen), "UpdateStats")] internal static class TabletStatsVersionPatch { private static void Postfix(TabletStatsScreen __instance) { if ((Object)(object)__instance.VersionNumber != (Object)null) { TabletTextLabel versionNumber = __instance.VersionNumber; versionNumber.text = versionNumber.text + "\nCinnamon v" + Plugin.VersionString; } } } [HarmonyPatch(typeof(GameState), "OnGUI")] internal static class GameStateVersionPatch { private static GUIStyle _style; private static void Postfix() { //IL_0098: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Expected O, but got Unknown //IL_007a: Unknown result type (might be due to invalid IL or missing references) if (ControllerMonitor.Instance.IsMainControllerSet && PlayerManager.GetInstance().FirstUserLoggedIn && !StatTracker.Instance.GetSaveFileDataForMainUser().HideVersion) { if (_style == null) { _style = new GUIStyle { font = GameSettings.GetInstance().onlineBetaMessageFont, fontSize = 11, alignment = (TextAnchor)6 }; _style.normal.textColor = new Color(1f, 1f, 1f, 0.3f); } GUI.Label(new Rect(5f, 20f, 200f, 16f), "Cin v" + Plugin.VersionString, _style); } } } [BepInPlugin("com.osqat.cinnamon", "Cinnamon", "0.10.14")] public class Plugin : BaseUnityPlugin { internal static ManualLogSource Log; internal static string VersionString => Assembly.GetExecutingAssembly().GetName().Version.ToString(3) + " (Thunderstore)"; private void Awake() { //IL_002e: Unknown result type (might be due to invalid IL or missing references) Log = ((BaseUnityPlugin)this).Logger; Log.LogInfo((object)("[Cinnamon] loaded v" + VersionString + ".")); new Harmony("com.osqat.cinnamon").PatchAll(); } } } namespace Cinnamon.UI { public static class CursorOverlay { public static bool DebugLogging { get { return CursorOverlayHost.EnsureExists().DebugLogging; } set { CursorOverlayHost.EnsureExists().DebugLogging = value; } } public static bool IsReady => CursorOverlayHost.EnsureExists().IsCursorReady(); public static void EnsureHost() { CursorOverlayHost.EnsureExists(); } public static void Request() { CursorOverlayHost.EnsureExists().Request(); } } internal class CursorOverlayHost : MonoBehaviour { private static CursorOverlayHost _instance; private Transform _cursorRoot; private Camera _cursorCam; private int _refsFrame = -1; private int _requestedFrame = -999; private bool _loggedOnce; private bool _active; private SpriteRenderer _hiddenSr; private Color _hiddenSrOriginalColor; private Sprite _activeSprite; private Texture2D _activeTex; private readonly Dictionary _extractedCache = new Dictionary(); public bool DebugLogging { get; set; } public static CursorOverlayHost EnsureExists() { //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_0023: Expected O, but got Unknown if ((Object)(object)_instance != (Object)null) { return _instance; } GameObject val = new GameObject("Cinnamon.CursorOverlay"); Object.DontDestroyOnLoad((Object)val); _instance = val.AddComponent(); return _instance; } public bool IsCursorReady() { EnsureCursorRefs(forLogPass: false); if ((Object)(object)_cursorRoot != (Object)null) { return (Object)(object)((Component)_cursorRoot).GetComponentInChildren(false) != (Object)null; } return false; } public void Request() { _requestedFrame = Time.frameCount; } private void LateUpdate() { bool flag = _requestedFrame >= Time.frameCount - 1; if (_active && (Object)(object)_hiddenSr == (Object)null) { ExitActive(); } else if (flag) { EnterOrUpdateActive(); } else if (_active) { ExitActive(); } } private void EnterOrUpdateActive() { //IL_00ea: Unknown result type (might be due to invalid IL or missing references) //IL_00ef: Unknown result type (might be due to invalid IL or missing references) //IL_01ba: Unknown result type (might be due to invalid IL or missing references) //IL_01bf: Unknown result type (might be due to invalid IL or missing references) //IL_01cd: Unknown result type (might be due to invalid IL or missing references) //IL_01af: 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_019c: Unknown result type (might be due to invalid IL or missing references) //IL_014f: Unknown result type (might be due to invalid IL or missing references) //IL_0162: Unknown result type (might be due to invalid IL or missing references) //IL_02b6: Unknown result type (might be due to invalid IL or missing references) //IL_02bb: Unknown result type (might be due to invalid IL or missing references) //IL_033c: Unknown result type (might be due to invalid IL or missing references) //IL_0375: Unknown result type (might be due to invalid IL or missing references) EnsureCursorRefs(DebugLogging && !_loggedOnce); SpriteRenderer val = null; if ((Object)(object)_cursorRoot != (Object)null) { SpriteRenderer[] componentsInChildren = ((Component)_cursorRoot).GetComponentsInChildren(false); int num = int.MinValue; SpriteRenderer[] array = componentsInChildren; foreach (SpriteRenderer val2 in array) { if (!((Object)(object)val2 == (Object)null) && !((Object)(object)val2.sprite == (Object)null) && ((Renderer)val2).enabled && ((Renderer)val2).sortingOrder >= num) { num = ((Renderer)val2).sortingOrder; val = val2; } } } if ((Object)(object)val == (Object)null) { if (DebugLogging && !_loggedOnce) { _loggedOnce = true; ManualLogSource log = Plugin.Log; if (log != null) { log.LogInfo((object)"[Cinnamon] activate bail: no usable SpriteRenderer on selected cursor root"); } } if (_active) { ExitActive(); } return; } if (!_active) { _hiddenSr = val; _hiddenSrOriginalColor = val.color; _active = true; if (DebugLogging) { ManualLogSource log2 = Plugin.Log; if (log2 != null) { object[] obj = new object[4] { ((Object)val.sprite).name, null, null, null }; Texture2D texture = val.sprite.texture; obj[1] = ((texture != null) ? ((Object)texture).name : null); obj[2] = val.sprite.pivot; obj[3] = val.sprite.textureRect; log2.LogInfo((object)string.Format("[Cinnamon] enter Active: sprite='{0}' tex='{1}' pivot={2} rect={3}", obj)); } } } else if ((Object)(object)_hiddenSr != (Object)(object)val) { if ((Object)(object)_hiddenSr != (Object)null) { _hiddenSr.color = _hiddenSrOriginalColor; } _hiddenSr = val; _hiddenSrOriginalColor = val.color; } Color hiddenSrOriginalColor = _hiddenSrOriginalColor; hiddenSrOriginalColor.a = 0f; val.color = hiddenSrOriginalColor; Cursor.visible = false; Sprite sprite = val.sprite; if ((Object)(object)sprite == (Object)null) { return; } ComputeOnScreenSize(val, out var w, out var h); Texture2D orExtract = GetOrExtract(val, w, h); if ((Object)(object)orExtract == (Object)null) { if (DebugLogging && !_loggedOnce) { _loggedOnce = true; ManualLogSource log3 = Plugin.Log; if (log3 != null) { string[] obj2 = new string[5] { "[Cinnamon] extract failed: sprite='", ((Object)sprite).name, "' tex='", null, null }; Texture2D texture2 = sprite.texture; obj2[3] = ((texture2 != null) ? ((Object)texture2).name : null); obj2[4] = "'"; log3.LogInfo((object)string.Concat(obj2)); } } } else { if (sprite == _activeSprite && orExtract == _activeTex) { return; } _activeSprite = sprite; _activeTex = orExtract; if (DebugLogging && !_loggedOnce) { _loggedOnce = true; Rect textureRect = sprite.textureRect; ManualLogSource log4 = Plugin.Log; if (log4 != null) { object[] obj3 = new object[10] { ((Object)sprite).name, ((Rect)(ref textureRect)).width, ((Rect)(ref textureRect)).height, ((Texture)orExtract).width, ((Texture)orExtract).height, val.flipX, val.flipY, _cursorRoot.lossyScale, null, null }; Texture2D texture3 = sprite.texture; obj3[8] = ((texture3 != null) ? ((Object)texture3).name : null); Texture2D texture4 = sprite.texture; obj3[9] = ((texture4 != null) ? new TextureFormat?(texture4.format) : null); log4.LogInfo((object)string.Format("[Cinnamon] DrawCursor: sprite='{0}' src={1:F0}x{2:F0} target={3}x{4} flipX={5} flipY={6} lossy={7} src_tex='{8}' fmt={9}", obj3)); } } } } private Vector2 FindTipHotspot(Texture2D tex) { //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_0149: Unknown result type (might be due to invalid IL or missing references) //IL_0095: Unknown result type (might be due to invalid IL or missing references) //IL_0143: Unknown result type (might be due to invalid IL or missing references) int width = ((Texture)tex).width; int height = ((Texture)tex).height; Color32[] pixels; try { pixels = tex.GetPixels32(); } catch { return new Vector2((float)(width - 1), 0f); } long num = 0L; long num2 = 0L; int num3 = 0; for (int i = 0; i < height; i++) { int num4 = i * width; for (int j = 0; j < width; j++) { if (pixels[num4 + j].a > 128) { num += j; num2 += i; num3++; } } } if (num3 == 0) { return new Vector2((float)(width - 1), 0f); } float num5 = (float)num / (float)num3; float num6 = (float)num2 / (float)num3; float num7 = float.MinValue; int num8 = width - 1; int num9 = height - 1; float num10 = 1f / (float)width; float num11 = 1f / (float)height; for (int k = 0; k < height; k++) { int num12 = k * width; for (int l = 0; l < width; l++) { if (pixels[num12 + l].a > 128) { float num13 = ((float)l - num5) * num10 + ((float)k - num6) * num11; if (num13 > num7) { num7 = num13; num8 = l; num9 = k; } } } } int num14 = height - 1 - num9; return new Vector2((float)num8, (float)num14); } private void ComputeOnScreenSize(SpriteRenderer sr, out int w, out int h) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_0070: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Unknown result type (might be due to invalid IL or missing references) //IL_0086: 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_0090: 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_00a0: Unknown result type (might be due to invalid IL or missing references) //IL_00ac: Unknown result type (might be due to invalid IL or missing references) //IL_00b6: 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_00c0: 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_00de: Unknown result type (might be due to invalid IL or missing references) Rect textureRect = sr.sprite.textureRect; w = Mathf.Max(1, Mathf.RoundToInt(((Rect)(ref textureRect)).width)); h = Mathf.Max(1, Mathf.RoundToInt(((Rect)(ref textureRect)).height)); Camera val = (((Object)(object)_cursorCam != (Object)null) ? _cursorCam : Camera.main); if (!((Object)(object)val == (Object)null)) { Bounds bounds = ((Renderer)sr).bounds; Vector3 val2 = val.WorldToScreenPoint(new Vector3(((Bounds)(ref bounds)).min.x, ((Bounds)(ref bounds)).min.y, ((Bounds)(ref bounds)).center.z)); Vector3 val3 = val.WorldToScreenPoint(new Vector3(((Bounds)(ref bounds)).max.x, ((Bounds)(ref bounds)).max.y, ((Bounds)(ref bounds)).center.z)); int num = Mathf.RoundToInt(Mathf.Abs(val3.x - val2.x)); int num2 = Mathf.RoundToInt(Mathf.Abs(val3.y - val2.y)); if (num >= 8 && num2 >= 8) { w = num; h = num2; } } } private void ExitActive() { //IL_0015: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)_hiddenSr != (Object)null) { _hiddenSr.color = _hiddenSrOriginalColor; _hiddenSr = null; } Cursor.visible = false; _activeSprite = null; _activeTex = null; _active = false; if (DebugLogging) { ManualLogSource log = Plugin.Log; if (log != null) { log.LogInfo((object)"[Cinnamon] exit Active"); } } } private Texture2D GetOrExtract(SpriteRenderer source, int targetW, int targetH) { Sprite sprite = source.sprite; if ((Object)(object)sprite == (Object)null) { return null; } int num = Mathf.Max(1, targetW); int num2 = Mathf.Max(1, targetH); if (_extractedCache.TryGetValue(sprite, out var value) && (Object)(object)value != (Object)null) { if (((Texture)value).width == num && ((Texture)value).height == num2) { return value; } Object.Destroy((Object)(object)value); _extractedCache.Remove(sprite); } Texture2D val = RenderSpriteViaCamera(source, num, num2); if ((Object)(object)val != (Object)null) { _extractedCache[sprite] = val; } return val; } private Texture2D RenderSpriteViaCamera(SpriteRenderer source, int w, int h) { //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Expected O, but got Unknown //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_005f: 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_00ca: Unknown result type (might be due to invalid IL or missing references) //IL_00cf: Unknown result type (might be due to invalid IL or missing references) //IL_00d8: Unknown result type (might be due to invalid IL or missing references) //IL_00f1: Unknown result type (might be due to invalid IL or missing references) //IL_010b: Unknown result type (might be due to invalid IL or missing references) //IL_0117: 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_012f: Expected O, but got Unknown //IL_013f: Unknown result type (might be due to invalid IL or missing references) //IL_014b: 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_0167: Unknown result type (might be due to invalid IL or missing references) //IL_0177: Unknown result type (might be due to invalid IL or missing references) //IL_01c5: Unknown result type (might be due to invalid IL or missing references) //IL_021a: Unknown result type (might be due to invalid IL or missing references) //IL_0221: Expected O, but got Unknown //IL_0231: Unknown result type (might be due to invalid IL or missing references) GameObject val = null; GameObject val2 = null; RenderTexture val3 = null; RenderTexture active = RenderTexture.active; Texture2D val4 = null; try { val = new GameObject("Cinnamon.CursorExtract.Sprite"); ((Object)val).hideFlags = (HideFlags)61; val.layer = 31; val.transform.position = new Vector3(50000f, 50000f, 0f); val.transform.rotation = Quaternion.identity; val.transform.localScale = Vector3.one; SpriteRenderer val5 = val.AddComponent(); val5.sprite = source.sprite; val5.color = _hiddenSrOriginalColor; val5.flipX = source.flipX; val5.flipY = source.flipY; ((Renderer)val5).sortingOrder = 0; if ((Object)(object)((Renderer)source).sharedMaterial != (Object)null) { ((Renderer)val5).sharedMaterial = ((Renderer)source).sharedMaterial; } Bounds bounds = ((Renderer)val5).bounds; float orthographicSize = Mathf.Max(0.001f, ((Bounds)(ref bounds)).size.y * 0.5f); float aspect = ((((Bounds)(ref bounds)).size.x > 0f) ? (((Bounds)(ref bounds)).size.x / ((Bounds)(ref bounds)).size.y) : 1f); val2 = new GameObject("Cinnamon.CursorExtract.Cam"); ((Object)val2).hideFlags = (HideFlags)61; val2.transform.position = new Vector3(((Bounds)(ref bounds)).center.x, ((Bounds)(ref bounds)).center.y, ((Bounds)(ref bounds)).center.z - 1f); val2.transform.rotation = Quaternion.identity; Camera obj = val2.AddComponent(); obj.orthographic = true; obj.orthographicSize = orthographicSize; obj.aspect = aspect; obj.cullingMask = int.MinValue; obj.clearFlags = (CameraClearFlags)2; obj.backgroundColor = new Color(0f, 0f, 0f, 0f); obj.nearClipPlane = 0.01f; obj.farClipPlane = 100f; ((Behaviour)obj).enabled = false; obj.allowHDR = false; obj.allowMSAA = false; val3 = (obj.targetTexture = RenderTexture.GetTemporary(w, h, 0, (RenderTextureFormat)0)); obj.Render(); RenderTexture.active = val3; val4 = new Texture2D(w, h, (TextureFormat)4, false); val4.ReadPixels(new Rect(0f, 0f, (float)w, (float)h), 0, 0); val4.Apply(); ((Object)val4).hideFlags = (HideFlags)61; Color32[] pixels = val4.GetPixels32(); for (int i = 0; i < pixels.Length; i++) { byte a = pixels[i].a; if (a != 0 && a != byte.MaxValue) { float num = 255f / (float)(int)a; pixels[i].r = (byte)Mathf.Min(255, Mathf.RoundToInt((float)(int)pixels[i].r * num)); pixels[i].g = (byte)Mathf.Min(255, Mathf.RoundToInt((float)(int)pixels[i].g * num)); pixels[i].b = (byte)Mathf.Min(255, Mathf.RoundToInt((float)(int)pixels[i].b * num)); } } val4.SetPixels32(pixels); val4.Apply(); } catch (Exception ex) { if (DebugLogging) { ManualLogSource log = Plugin.Log; if (log != null) { log.LogInfo((object)("[Cinnamon] camera extract exception: " + ex.Message)); } } if ((Object)(object)val4 != (Object)null) { Object.Destroy((Object)(object)val4); val4 = null; } } finally { RenderTexture.active = active; if ((Object)(object)val3 != (Object)null) { RenderTexture.ReleaseTemporary(val3); } if ((Object)(object)val != (Object)null) { Object.Destroy((Object)(object)val); } if ((Object)(object)val2 != (Object)null) { Object.Destroy((Object)(object)val2); } } return val4; } private void EnsureCursorRefs(bool forLogPass) { //IL_0029: 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_00d6: Unknown result type (might be due to invalid IL or missing references) //IL_0242: Unknown result type (might be due to invalid IL or missing references) //IL_0247: Unknown result type (might be due to invalid IL or missing references) //IL_024b: Unknown result type (might be due to invalid IL or missing references) //IL_0250: Unknown result type (might be due to invalid IL or missing references) //IL_0255: Unknown result type (might be due to invalid IL or missing references) //IL_025b: Unknown result type (might be due to invalid IL or missing references) //IL_0262: Unknown result type (might be due to invalid IL or missing references) //IL_026a: Unknown result type (might be due to invalid IL or missing references) //IL_0271: Unknown result type (might be due to invalid IL or missing references) //IL_0279: Unknown result type (might be due to invalid IL or missing references) //IL_027e: Unknown result type (might be due to invalid IL or missing references) //IL_02d2: Unknown result type (might be due to invalid IL or missing references) //IL_02d7: Unknown result type (might be due to invalid IL or missing references) //IL_02db: Unknown result type (might be due to invalid IL or missing references) //IL_02e0: Unknown result type (might be due to invalid IL or missing references) //IL_02e5: Unknown result type (might be due to invalid IL or missing references) //IL_02e7: Unknown result type (might be due to invalid IL or missing references) //IL_02f5: Unknown result type (might be due to invalid IL or missing references) //IL_02fc: 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_0308: Unknown result type (might be due to invalid IL or missing references) //IL_030f: Unknown result type (might be due to invalid IL or missing references) //IL_0316: Unknown result type (might be due to invalid IL or missing references) //IL_031b: 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) if (_refsFrame == Time.frameCount) { return; } _refsFrame = Time.frameCount; Transform val = null; Camera cursorCam = null; int num = int.MinValue; float num2 = float.MaxValue; Vector3 mousePosition = Input.mousePosition; Cursor[] array = Object.FindObjectsOfType(); if (forLogPass) { ManualLogSource log = Plugin.Log; if (log != null) { log.LogInfo((object)$"[Cinnamon] candidates: {array.Length} Cursor object(s)"); } } Cursor[] array2 = array; foreach (Cursor val2 in array2) { if ((Object)(object)val2 == (Object)null) { continue; } Transform transform = ((Component)val2).transform; bool activeInHierarchy = ((Component)transform).gameObject.activeInHierarchy; SpriteRenderer componentInChildren = ((Component)transform).GetComponentInChildren(false); bool flag = (Object)(object)componentInChildren != (Object)null && ((Renderer)componentInChildren).enabled && (Object)(object)componentInChildren.sprite != (Object)null; float num3 = (((Object)(object)componentInChildren != (Object)null) ? componentInChildren.color.a : 0f); Camera useCamera = val2.UseCamera; if (forLogPass) { ManualLogSource log2 = Plugin.Log; if (log2 != null) { log2.LogInfo((object)string.Format("[Cinnamon] '{0}' active={1} useCam={2} srOk={3} alpha={4:F2} sortOrder={5} sprite={6}", ((Object)transform).name, activeInHierarchy, Object.op_Implicit((Object)(object)useCamera) ? ((Object)useCamera).name : "null", flag, num3, Object.op_Implicit((Object)(object)componentInChildren) ? ((Renderer)componentInChildren).sortingOrder : 0, (Object.op_Implicit((Object)(object)componentInChildren) && Object.op_Implicit((Object)(object)componentInChildren.sprite)) ? ((Object)componentInChildren.sprite).name : "null")); } } if (!activeInHierarchy) { if (forLogPass) { ManualLogSource log3 = Plugin.Log; if (log3 != null) { log3.LogInfo((object)("[Cinnamon] reject '" + ((Object)transform).name + "': !active")); } } continue; } if (!flag) { if (forLogPass) { ManualLogSource log4 = Plugin.Log; if (log4 != null) { log4.LogInfo((object)("[Cinnamon] reject '" + ((Object)transform).name + "': srOk=false")); } } continue; } int num4 = 1 << ((Component)componentInChildren).gameObject.layer; Camera val3 = null; float num5 = float.MaxValue; Bounds bounds; Vector2 val5; if ((Object)(object)useCamera != (Object)null && ((Behaviour)useCamera).enabled) { bounds = ((Renderer)componentInChildren).bounds; Vector3 val4 = useCamera.WorldToScreenPoint(((Bounds)(ref bounds)).center); val3 = useCamera; val5 = new Vector2(val4.x - mousePosition.x, val4.y - mousePosition.y); num5 = ((Vector2)(ref val5)).sqrMagnitude; } if ((Object)(object)val3 == (Object)null) { Camera[] allCameras = Camera.allCameras; foreach (Camera val6 in allCameras) { if ((Object)(object)val6 == (Object)null || !((Behaviour)val6).enabled || (val6.cullingMask & num4) == 0) { continue; } bounds = ((Renderer)componentInChildren).bounds; Vector3 val7 = val6.WorldToScreenPoint(((Bounds)(ref bounds)).center); if (!(val7.z <= 0f)) { val5 = new Vector2(val7.x, val7.y) - new Vector2(mousePosition.x, mousePosition.y); float sqrMagnitude = ((Vector2)(ref val5)).sqrMagnitude; if (sqrMagnitude < num5) { num5 = sqrMagnitude; val3 = val6; } } } } if ((Object)(object)val3 == (Object)null) { if (forLogPass) { ManualLogSource log5 = Plugin.Log; if (log5 != null) { log5.LogInfo((object)("[Cinnamon] reject '" + ((Object)transform).name + "': no camera passed")); } } continue; } bool num6 = ((Renderer)componentInChildren).sortingOrder > num; bool flag2 = ((Renderer)componentInChildren).sortingOrder == num && num5 < num2; if (num6 || flag2) { num = ((Renderer)componentInChildren).sortingOrder; num2 = num5; val = transform; cursorCam = val3; } } if ((Object)(object)val != (Object)null) { _cursorRoot = val; _cursorCam = cursorCam; } else if ((Object)(object)_cursorRoot != (Object)null && !((Component)_cursorRoot).gameObject.activeInHierarchy) { _cursorRoot = null; _cursorCam = null; } } private void OnGUI() { //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Unknown result type (might be due to invalid IL or missing references) //IL_0067: 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_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0082: Unknown result type (might be due to invalid IL or missing references) //IL_0087: 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_0097: 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_00ad: Unknown result type (might be due to invalid IL or missing references) //IL_00b2: 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_00b8: 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_00cc: Unknown result type (might be due to invalid IL or missing references) //IL_00d2: 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_00dc: 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_00e4: Unknown result type (might be due to invalid IL or missing references) //IL_00ea: Unknown result type (might be due to invalid IL or missing references) //IL_00ef: Unknown result type (might be due to invalid IL or missing references) //IL_00f4: 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_00ff: Unknown result type (might be due to invalid IL or missing references) //IL_0108: Unknown result type (might be due to invalid IL or missing references) //IL_010f: Unknown result type (might be due to invalid IL or missing references) //IL_0119: Unknown result type (might be due to invalid IL or missing references) //IL_0120: Unknown result type (might be due to invalid IL or missing references) //IL_014f: Unknown result type (might be due to invalid IL or missing references) if (!_active || (Object)(object)_activeTex == (Object)null || (Object)(object)_hiddenSr == (Object)null) { return; } Camera val = (((Object)(object)_cursorCam != (Object)null) ? _cursorCam : Camera.main); if ((Object)(object)val == (Object)null) { return; } Bounds bounds = ((Renderer)_hiddenSr).bounds; Vector3 val2 = val.WorldToScreenPoint(new Vector3(((Bounds)(ref bounds)).min.x, ((Bounds)(ref bounds)).min.y, ((Bounds)(ref bounds)).center.z)); Vector3 val3 = val.WorldToScreenPoint(new Vector3(((Bounds)(ref bounds)).max.x, ((Bounds)(ref bounds)).max.y, ((Bounds)(ref bounds)).center.z)); if (!(val2.z < 0f)) { Vector2 val4 = GUIUtility.ScreenToGUIPoint(new Vector2(val2.x, val2.y)); Vector2 val5 = GUIUtility.ScreenToGUIPoint(new Vector2(val3.x, val3.y)); float x = val4.x; float y = val5.y; float num = val5.x - val4.x; float num2 = val4.y - val5.y; if (!(num <= 0f) && !(num2 <= 0f)) { GUI.depth = -32000; GUI.DrawTexture(new Rect(x, y, num, num2), (Texture)(object)_activeTex); } } } private void OnDestroy() { if (_active) { ExitActive(); } foreach (KeyValuePair item in _extractedCache) { if ((Object)(object)item.Value != (Object)null) { Object.Destroy((Object)(object)item.Value); } } _extractedCache.Clear(); if ((Object)(object)_instance == (Object)(object)this) { _instance = null; } } } }