Please disclose if any significant portion of your mod was created using AI tools by adding the 'AI Generated' category. Failing to do so may result in the mod being removed from Thunderstore.
Decompiled source of EnemyTracker v2.3.0
EnemyTracker.dll
Decompiled 2 hours agousing System; using System.Collections.Generic; using System.Globalization; using System.IO; using System.Reflection; using System.Runtime.CompilerServices; using System.Text; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using ExitGames.Client.Photon; using Photon.Pun; using Photon.Realtime; using TMPro; using UnityEngine; using UnityEngine.TextCore.LowLevel; using UnityEngine.UI; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: AssemblyVersion("0.0.0.0")] namespace EnemyTracker; [BepInPlugin("lakerok.repo.enemytracker", "EnemyTracker", "2.3.0")] public class Plugin : BaseUnityPlugin { internal static ConfigEntry<KeyboardShortcut> ToggleKey; internal static ConfigEntry<bool> RevealAll; internal static ConfigEntry<float> Scale; internal static ConfigEntry<int> TilesPerRow; internal static ConfigEntry<string> FontName; internal static ConfigEntry<bool> HideUnusedUpgrades; internal static ConfigEntry<string> Language; internal static ManualLogSource Log; internal static string IconDir; private void Awake() { //IL_0026: 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_0109: Expected O, but got Unknown //IL_0161: Unknown result type (might be due to invalid IL or missing references) //IL_0167: Expected O, but got Unknown Log = ((BaseUnityPlugin)this).Logger; ToggleKey = ((BaseUnityPlugin)this).Config.Bind<KeyboardShortcut>("General", "ToggleKey", new KeyboardShortcut((KeyCode)291, (KeyCode[])(object)new KeyCode[0]), "Клавиша, чтобы показать/скрыть оверлей"); RevealAll = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "RevealAll", false, "Показывать всех мобов сразу (без механики обнаружения)"); Scale = ((BaseUnityPlugin)this).Config.Bind<float>("Display", "Scale", 1f, "Масштаб оверлея (0.5 - 3)"); TilesPerRow = ((BaseUnityPlugin)this).Config.Bind<int>("Display", "TilesPerRow", 8, "Сколько мобов в одном ряду"); FontName = ((BaseUnityPlugin)this).Config.Bind<string>("Display", "FontName", "", "Пусто = встроенный жирный шрифт Rubik. Иначе имя TMP-шрифта игры (список в LogOutput.log)"); Language = ((BaseUnityPlugin)this).Config.Bind<string>("Display", "Language", "ru", new ConfigDescription("Overlay language / Язык оверлея", (AcceptableValueBase)(object)new AcceptableValueList<string>(new string[2] { "ru", "en" }), new object[0])); HideUnusedUpgrades = ((BaseUnityPlugin)this).Config.Bind<bool>("Display", "HideUnusedUpgrades", true, "Не показывать апгрейды, которых 0"); IconDir = Path.Combine(Path.Combine(Paths.ConfigPath, "EnemyTracker"), "icons"); try { Directory.CreateDirectory(IconDir); } catch { } GameObject val = new GameObject("EnemyTrackerOverlay"); ((Object)val).hideFlags = (HideFlags)61; Object.DontDestroyOnLoad((Object)(object)val); val.AddComponent<Overlay>(); Log.LogInfo((object)"EnemyTracker 2.3 загружен (F10 — показать/скрыть)"); } } internal class MobInfo { public string Name; public int Strength; public MobInfo(string n, int s) { Name = n; Strength = s; } } internal static class MobDb { private static readonly Dictionary<string, MobInfo> byKey; private static void Add(string name, int strength, params string[] aliases) { MobInfo value = new MobInfo(name, strength); byKey[Norm(name)] = value; foreach (string s in aliases) { byKey[Norm(s)] = value; } } static MobDb() { byKey = new Dictionary<string, MobInfo>(); Add("Apex Predator", -1, "Duck"); Add("Bella", 9); Add("Birthday Boy", 4, "Birthdayboy", "Balloon"); Add("Elsa", -1); Add("Gnome", 0); Add("Peeper", -1, "Ceiling Eye"); Add("Shadow Child", 9, "Thin Man"); Add("Spewer", 4, "Slow Mouth"); Add("Tick", 0); Add("Animal", 4); Add("Banger", 0, "Bang"); Add("Bowtie", 7); Add("Chef", 9, "Tumbler"); Add("Gambit", 9); Add("Headgrab", 4); Add("Heart Hugger", 9); Add("Hidden", 4); Add("Mentalist", 4, "Floater"); Add("Oogly", 9); Add("Rugrat", 4, "Valuable Thrower"); Add("Upscream", 4); Add("Cleanup Crew", 13); Add("Clown", 13, "Beamer"); Add("Headman", 13, "Head"); Add("Huntsman", 9, "Hunter"); Add("Loom", 13); Add("Pony", 9); Add("Reaper", 9, "Runner"); Add("Robe", 13); Add("Trudge", 13, "Slow Walker"); } public static string Norm(string s) { if (s == null) { return ""; } s = s.ToLowerInvariant().Replace("(clone)", "").Replace("enemy -", "") .Replace("enemy-", ""); StringBuilder stringBuilder = new StringBuilder(); string text = s; foreach (char c in text) { if (char.IsLetterOrDigit(c)) { stringBuilder.Append(c); } } return stringBuilder.ToString(); } public static MobInfo Find(string enemyName, string objName) { if (byKey.TryGetValue(Norm(enemyName), out var value)) { return value; } if (byKey.TryGetValue(Norm(objName), out value)) { return value; } string text = Norm(objName); foreach (KeyValuePair<string, MobInfo> item in byKey) { if (item.Key.Length >= 4 && text.Contains(item.Key)) { return item.Value; } } return null; } } internal static class R { private const BindingFlags F = BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic; private const BindingFlags FS = BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic; public static readonly FieldInfo ParentSpawned = typeof(EnemyParent).GetField("Spawned", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); public static readonly FieldInfo ParentEnemy = typeof(EnemyParent).GetField("Enemy", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); public static readonly FieldInfo ParentPlayerVeryClose = typeof(EnemyParent).GetField("playerVeryClose", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); public static readonly FieldInfo EnemyHasHealth = typeof(Enemy).GetField("HasHealth", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); public static readonly FieldInfo EnemyHealthF = typeof(Enemy).GetField("Health", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); public static readonly FieldInfo EnemyHasOnScreen = typeof(Enemy).GetField("HasOnScreen", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); public static readonly FieldInfo EnemyOnScreenF = typeof(Enemy).GetField("OnScreen", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); public static readonly FieldInfo HealthCurrent = typeof(EnemyHealth).GetField("healthCurrent", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); public static readonly FieldInfo HealthDead = typeof(EnemyHealth).GetField("dead", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); public static readonly FieldInfo OnScreenAny = typeof(EnemyOnScreen).GetField("OnScreenAny", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); public static readonly FieldInfo OnScreenLocal = typeof(EnemyOnScreen).GetField("OnScreenLocal", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); public static readonly FieldInfo EyeTarget = typeof(EnemyCeilingEye).GetField("targetPlayer", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); public static readonly FieldInfo ShadowTarget = typeof(EnemyShadow).GetField("playerTarget", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); public static readonly FieldInfo ShadowActualTarget = typeof(EnemyShadow).GetField("actualPlayerTarget", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); public static readonly FieldInfo HealthUIInstance = typeof(HealthUI).GetField("instance", BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic); public static readonly FieldInfo HealthUIText = typeof(HealthUI).GetField("Text", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); public static T Get<T>(FieldInfo f, object o, T def) { if (f == null) { return def; } try { object value = f.GetValue(o); return (value is T) ? ((T)value) : def; } catch { return def; } } } internal class Track { public string Name; public MobInfo Info; public int Difficulty; public bool Discovered; public bool Spawned; public bool Killed; public int Hp; public float Respawn; public float RespawnTotal; public bool Seen; public int SortIndex; public bool CompsLooked; public EnemyCeilingEye Eye; public EnemyShadow Shadow; public float LosTime; public int ViewId; public bool LocalDiscovered; public bool Reported; } internal static class Gfx { public static Sprite Fill; public static Sprite Ring; public static Sprite Glow; public static Sprite Flex; public static readonly Dictionary<string, Sprite> Mobs = new Dictionary<string, Sprite>(); public static readonly Dictionary<string, Sprite> Ups = new Dictionary<string, Sprite>(); private static float RoundedSdf(float px, float py, float half, float r) { float num = Mathf.Abs(px) - (half - r); float num2 = Mathf.Abs(py) - (half - r); float num3 = Mathf.Max(num, 0f); float num4 = Mathf.Max(num2, 0f); return Mathf.Sqrt(num3 * num3 + num4 * num4) + Mathf.Min(Mathf.Max(num, num2), 0f) - r; } private static Sprite Make(int size, float radius, float ring, float glow, int border) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Expected O, but got Unknown //IL_0140: 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_0167: Unknown result type (might be due to invalid IL or missing references) //IL_00fe: Unknown result type (might be due to invalid IL or missing references) //IL_0103: Unknown result type (might be due to invalid IL or missing references) Texture2D val = new Texture2D(size, size, (TextureFormat)4, false); ((Object)val).hideFlags = (HideFlags)61; ((Texture)val).wrapMode = (TextureWrapMode)1; ((Texture)val).filterMode = (FilterMode)1; float half = (float)size / 2f - glow; Color[] array = (Color[])(object)new Color[size * size]; for (int i = 0; i < size; i++) { for (int j = 0; j < size; j++) { float num = RoundedSdf((float)j + 0.5f - (float)size / 2f, (float)i + 0.5f - (float)size / 2f, half, radius); float num2 = ((!(glow > 0f)) ? ((!(ring > 0f)) ? Mathf.Clamp01(0.5f - num) : (Mathf.Clamp01(0.5f - num) * Mathf.Clamp01(0.5f + num + ring))) : ((num <= 0f) ? 1f : Mathf.Pow(Mathf.Clamp01(1f - num / glow), 2.2f))); ref Color reference = ref array[i * size + j]; reference = new Color(1f, 1f, 1f, num2); } } val.SetPixels(array); val.Apply(); return Sprite.Create(val, new Rect(0f, 0f, (float)size, (float)size), new Vector2(0.5f, 0.5f), 100f, 0u, (SpriteMeshType)0, new Vector4((float)border, (float)border, (float)border, (float)border)); } private static Texture2D LoadPng(byte[] data) { //IL_0004: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Expected O, but got Unknown Texture2D val = new Texture2D(2, 2, (TextureFormat)4, false); ((Object)val).hideFlags = (HideFlags)61; if (!ImageConversion.LoadImage(val, data)) { return null; } ((Texture)val).wrapMode = (TextureWrapMode)1; return val; } private static Sprite ToSprite(Texture2D tex, bool squareCrop) { //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_006a: Unknown result type (might be due to invalid IL or missing references) Rect val = default(Rect); ((Rect)(ref val))..ctor(0f, 0f, (float)((Texture)tex).width, (float)((Texture)tex).height); if (squareCrop && ((Texture)tex).height > ((Texture)tex).width) { ((Rect)(ref val))..ctor(0f, (float)(((Texture)tex).height - ((Texture)tex).width) * 0.45f, (float)((Texture)tex).width, (float)((Texture)tex).width); } return Sprite.Create(tex, val, new Vector2(0.5f, 0.5f), 100f); } public static void Init() { Fill = Make(64, 14f, 0f, 0f, 20); Ring = Make(64, 14f, 3.5f, 0f, 20); Glow = Make(96, 26f, 0f, 16f, 40); Assembly executingAssembly = Assembly.GetExecutingAssembly(); string[] manifestResourceNames = executingAssembly.GetManifestResourceNames(); foreach (string text in manifestResourceNames) { bool flag = text.StartsWith("mob."); bool flag2 = text.StartsWith("up."); bool flag3 = text.StartsWith("ui."); if (!flag && !flag2 && !flag3) { continue; } using Stream stream = executingAssembly.GetManifestResourceStream(text); byte[] array = new byte[stream.Length]; int num; for (int j = 0; j < array.Length; j += num) { num = stream.Read(array, j, array.Length - j); if (num <= 0) { break; } } Texture2D val = LoadPng(array); if ((Object)(object)val == (Object)null) { continue; } string text2 = text.Substring(flag ? 4 : 3); text2 = text2.Substring(0, text2.Length - 4); if (flag) { Mobs[MobDb.Norm(text2)] = ToSprite(val, squareCrop: false); } else if (flag3) { if (text2 == "flex") { Flex = ToSprite(val, squareCrop: false); } } else { Ups[text2] = ToSprite(val, squareCrop: false); } } try { string[] files = Directory.GetFiles(Plugin.IconDir, "*.png"); foreach (string path in files) { Texture2D val2 = LoadPng(File.ReadAllBytes(path)); if ((Object)(object)val2 != (Object)null) { Mobs[MobDb.Norm(Path.GetFileNameWithoutExtension(path))] = ToSprite(val2, squareCrop: false); } } } catch { } Plugin.Log.LogInfo((object)("Картинок мобов: " + Mobs.Count + ", апгрейдов: " + Ups.Count)); } public static Sprite Mob(Track t) { if (Mobs.TryGetValue(MobDb.Norm(t.Name), out var value)) { return value; } if (t.Info != null && Mobs.TryGetValue(MobDb.Norm(t.Info.Name), out value)) { return value; } return null; } public static Color LevelColor(int difficulty) { //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_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_0055: 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) return (Color)(difficulty switch { 0 => Color32.op_Implicit(new Color32((byte)84, (byte)214, (byte)92, byte.MaxValue)), 1 => Color32.op_Implicit(new Color32((byte)64, (byte)150, byte.MaxValue, byte.MaxValue)), _ => Color32.op_Implicit(new Color32((byte)240, (byte)72, (byte)64, byte.MaxValue)), }); } } internal static class UI { public static TMP_FontAsset Font; public static RectTransform Node(string name, Transform parent) { //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Expected O, but got Unknown //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Expected O, but got Unknown //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Unknown result type (might be due to invalid IL or missing references) GameObject val = new GameObject(name, new Type[1] { typeof(RectTransform) }); val.transform.SetParent(parent, false); RectTransform val2 = (RectTransform)val.transform; Vector2 anchorMin = (val2.anchorMax = Vector2.zero); val2.anchorMin = anchorMin; val2.pivot = Vector2.zero; return val2; } public static void Place(RectTransform rt, float x, float y, float w, float h) { //IL_0003: 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) rt.anchoredPosition = new Vector2(x, y); rt.sizeDelta = new Vector2(w, h); } public static void Stretch(RectTransform rt, float inset) { //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_0021: 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) rt.anchorMin = Vector2.zero; rt.anchorMax = Vector2.one; rt.pivot = new Vector2(0.5f, 0.5f); rt.offsetMin = new Vector2(inset, inset); rt.offsetMax = new Vector2(0f - inset, 0f - inset); } public static Image Img(string name, Transform parent, Sprite sprite, Color color, bool sliced) { //IL_001c: Unknown result type (might be due to invalid IL or missing references) RectTransform val = Node(name, parent); Image val2 = ((Component)val).gameObject.AddComponent<Image>(); val2.sprite = sprite; ((Graphic)val2).color = color; ((Graphic)val2).raycastTarget = false; if (sliced) { val2.type = (Type)1; val2.pixelsPerUnitMultiplier = 1f; } return val2; } public static TextMeshProUGUI Text(string name, Transform parent, float size, Color color, TextAlignmentOptions align) { //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_0079: Unknown result type (might be due to invalid IL or missing references) RectTransform val = Node(name, parent); TextMeshProUGUI val2 = ((Component)val).gameObject.AddComponent<TextMeshProUGUI>(); if ((Object)(object)Font != (Object)null) { ((TMP_Text)val2).font = Font; } ((TMP_Text)val2).fontSize = size; ((Graphic)val2).color = color; ((TMP_Text)val2).alignment = align; ((TMP_Text)val2).fontStyle = (FontStyles)1; ((TMP_Text)val2).enableWordWrapping = false; ((TMP_Text)val2).overflowMode = (TextOverflowModes)0; ((Graphic)val2).raycastTarget = false; ((TMP_Text)val2).richText = true; try { ((TMP_Text)val2).outlineWidth = 0.22f; ((TMP_Text)val2).outlineColor = new Color32((byte)0, (byte)0, (byte)0, (byte)220); } catch { } return val2; } } internal class TileView { public const float T = 84f; public const float PillW = 56f; public const float PillH = 26f; public RectTransform Root; public Image Glow; public Image Fill; public Image Portrait; public Image Clock; public Image Hand; public Image Border; public Image PillBg; public Image PillIcon; public TextMeshProUGUI Question; public TextMeshProUGUI Timer; public TextMeshProUGUI PillText; public RectTransform Tile; public RectTransform Pill; public TileView(Transform parent) { //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_0077: 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_00bd: 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_0145: Unknown result type (might be due to invalid IL or missing references) //IL_01bb: Unknown result type (might be due to invalid IL or missing references) //IL_01e3: Unknown result type (might be due to invalid IL or missing references) //IL_01e8: 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_01ef: Unknown result type (might be due to invalid IL or missing references) //IL_0200: Unknown result type (might be due to invalid IL or missing references) //IL_020b: Unknown result type (might be due to invalid IL or missing references) //IL_0220: Unknown result type (might be due to invalid IL or missing references) //IL_023b: 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_02bb: Unknown result type (might be due to invalid IL or missing references) //IL_02f9: Unknown result type (might be due to invalid IL or missing references) //IL_0354: Unknown result type (might be due to invalid IL or missing references) //IL_0359: Unknown result type (might be due to invalid IL or missing references) //IL_039b: Unknown result type (might be due to invalid IL or missing references) //IL_03ec: Unknown result type (might be due to invalid IL or missing references) Root = UI.Node("Mob", parent); Root.sizeDelta = new Vector2(84f, 97f); Tile = UI.Node("Tile", (Transform)(object)Root); UI.Place(Tile, 0f, 13f, 84f, 84f); Glow = UI.Img("Glow", (Transform)(object)Tile, Gfx.Glow, Color.white, sliced: true); UI.Stretch(((Graphic)Glow).rectTransform, -16f); Fill = UI.Img("Fill", (Transform)(object)Tile, Gfx.Fill, Color32.op_Implicit(new Color32((byte)17, (byte)24, (byte)36, (byte)235)), sliced: true); UI.Stretch(((Graphic)Fill).rectTransform, 0f); Portrait = UI.Img("Portrait", (Transform)(object)Tile, null, Color.white, sliced: false); Portrait.preserveAspect = true; UI.Stretch(((Graphic)Portrait).rectTransform, 7f); Clock = UI.Img("Clock", (Transform)(object)Tile, Gfx.Fill, new Color(0f, 0f, 0f, 0.74f), sliced: false); Clock.type = (Type)3; Clock.fillMethod = (FillMethod)4; Clock.fillOrigin = 2; Clock.fillClockwise = false; UI.Stretch(((Graphic)Clock).rectTransform, 3f); Hand = UI.Img("Hand", (Transform)(object)Tile, null, new Color(1f, 1f, 1f, 0.85f), sliced: false); RectTransform rectTransform = ((Graphic)Hand).rectTransform; rectTransform.anchorMin = (rectTransform.anchorMax = new Vector2(0.5f, 0.5f)); rectTransform.pivot = new Vector2(0.5f, 0f); rectTransform.anchoredPosition = Vector2.zero; rectTransform.sizeDelta = new Vector2(1f, 39f); Border = UI.Img("Border", (Transform)(object)Tile, Gfx.Ring, Color.white, sliced: true); UI.Stretch(((Graphic)Border).rectTransform, 0f); Question = UI.Text("Q", (Transform)(object)Tile, 54f, Color.white, (TextAlignmentOptions)514); UI.Stretch(((TMP_Text)Question).rectTransform, 0f); ((TMP_Text)Question).text = "?"; Timer = UI.Text("Timer", (Transform)(object)Tile, 21f, Color.white, (TextAlignmentOptions)258); UI.Stretch(((TMP_Text)Timer).rectTransform, 4f); ((TMP_Text)Timer).rectTransform.offsetMax = new Vector2(-4f, -13f); Pill = UI.Node("Pill", (Transform)(object)Root); UI.Place(Pill, 14f, 0f, 56f, 26f); PillBg = UI.Img("Bg", (Transform)(object)Pill, Gfx.Fill, Color32.op_Implicit(new Color32((byte)22, (byte)28, (byte)40, (byte)245)), sliced: true); PillBg.pixelsPerUnitMultiplier = 1.6f; UI.Stretch(((Graphic)PillBg).rectTransform, 0f); PillIcon = UI.Img("Icon", (Transform)(object)Pill, null, Color.white, sliced: false); PillIcon.preserveAspect = true; UI.Place(((Graphic)PillIcon).rectTransform, 5f, 3f, 20f, 20f); PillText = UI.Text("N", (Transform)(object)Pill, 18f, Color.white, (TextAlignmentOptions)514); UI.Place(((TMP_Text)PillText).rectTransform, 24f, 0f, 28f, 26f); } public void Set(Track t, int myStrength, bool reveal) { //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0034: 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_011a: Unknown result type (might be due to invalid IL or missing references) //IL_0184: Unknown result type (might be due to invalid IL or missing references) //IL_01aa: Unknown result type (might be due to invalid IL or missing references) //IL_0237: 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_0276: Unknown result type (might be due to invalid IL or missing references) //IL_02c3: Unknown result type (might be due to invalid IL or missing references) //IL_02ad: Unknown result type (might be due to invalid IL or missing references) bool flag = t.Discovered || reveal; bool flag2 = t.Spawned && !t.Killed; Color color = Gfx.LevelColor(t.Difficulty); ((Graphic)Border).color = color; ((Graphic)Glow).color = new Color(color.r, color.g, color.b, 0.45f); Sprite val = (flag ? Gfx.Mob(t) : null); Portrait.sprite = val; ((Behaviour)Portrait).enabled = (Object)(object)val != (Object)null; ((Behaviour)Question).enabled = !flag || (Object)(object)val == (Object)null; ((TMP_Text)Question).text = (flag ? Initials(t.Name) : "?"); ((TMP_Text)Question).fontSize = (flag ? 30f : 54f); bool flag3 = flag && !flag2; ((Behaviour)Clock).enabled = flag3; ((Behaviour)Hand).enabled = flag3; ((Behaviour)Timer).enabled = flag3; ((Graphic)Portrait).color = Color.white; if (flag3) { float num = ((t.RespawnTotal > 0f) ? Mathf.Clamp01(t.Respawn / t.RespawnTotal) : 0f); Clock.fillAmount = num; ((Transform)((Graphic)Hand).rectTransform).localEulerAngles = new Vector3(0f, 0f, (0f - (1f - num)) * 360f); ((TMP_Text)Timer).text = Fmt(t.Respawn); ((Graphic)Timer).color = Color.white; } bool flag4 = flag; ((Component)Pill).gameObject.SetActive(flag4); if (flag4) { PillIcon.sprite = Gfx.Flex; ((Behaviour)PillIcon).enabled = (Object)(object)PillIcon.sprite != (Object)null; int num2 = ((t.Info != null) ? t.Info.Strength : int.MinValue); if (num2 == int.MinValue) { ((TMP_Text)PillText).text = "?"; ((Graphic)PillText).color = Color.white; } else if (num2 < 0) { ((TMP_Text)PillText).text = "X"; ((Graphic)PillText).color = Color32.op_Implicit(new Color32((byte)150, (byte)150, (byte)160, byte.MaxValue)); } else { ((TMP_Text)PillText).text = num2.ToString(); ((Graphic)PillText).color = ((myStrength >= num2) ? new Color(0.35f, 0.92f, 0.39f) : new Color(1f, 0.36f, 0.31f)); } } } private static string Initials(string name) { string[] array = name.Split(new char[3] { ' ', '-', '_' }, StringSplitOptions.RemoveEmptyEntries); if (array.Length >= 2) { return (array[0].Substring(0, 1) + array[1].Substring(0, 1)).ToUpper(); } if (name.Length < 2) { return name.ToUpper(); } return name.Substring(0, 2).ToUpper(); } public static string Fmt(float sec) { if (sec < 0f) { sec = 0f; } int num = Mathf.CeilToInt(sec); return $"{num / 60}:{num % 60:00}"; } } internal class ChipView { public const float W = 58f; public const float H = 32f; public RectTransform Root; public Image Bg; public Image Icon; public TextMeshProUGUI Num; public ChipView(Transform parent, Sprite icon) { //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_0094: Unknown result type (might be due to invalid IL or missing references) //IL_00e5: Unknown result type (might be due to invalid IL or missing references) Root = UI.Node("Chip", parent); Root.sizeDelta = new Vector2(58f, 32f); Bg = UI.Img("Bg", (Transform)(object)Root, Gfx.Fill, Color32.op_Implicit(new Color32((byte)22, (byte)28, (byte)40, (byte)240)), sliced: true); Bg.pixelsPerUnitMultiplier = 2f; UI.Stretch(((Graphic)Bg).rectTransform, 0f); Icon = UI.Img("Icon", (Transform)(object)Root, icon, Color.white, sliced: false); Icon.preserveAspect = true; UI.Place(((Graphic)Icon).rectTransform, 6f, 2f, 20f, 28f); Num = UI.Text("N", (Transform)(object)Root, 20f, Color.white, (TextAlignmentOptions)514); UI.Place(((TMP_Text)Num).rectTransform, 28f, 0f, 28f, 32f); } } public class Overlay : MonoBehaviour { private class HostEntry { public bool Discovered; public bool Spawned; public bool Killed; public float Respawn; public float Total; public double SentAt; } private const string PropKey = "ET_state"; private const byte EvDiscovered = 177; private bool visible = true; private readonly Dictionary<int, Track> tracks = new Dictionary<int, Track>(); private readonly List<Track> order = new List<Track>(); private EnemyDirector lastDirector; private float levelStart; private double netLevelStart = -1.0; private bool eventHooked; private readonly HashSet<int> pendingDiscover = new HashSet<int>(); private string lastSentStruct = ""; private float lastSendTime = -100f; private string lastParsedRaw; private readonly Dictionary<int, HostEntry> hostState = new Dictionary<int, HostEntry>(); private double hostLevelStart = -1.0; private float refreshTimer; private bool loggedFonts; private Canvas canvas; private RectTransform root; private RectTransform header; private RectTransform chipsRow; private RectTransform tilesRow; private Image badgeBg; private Image badgeBorder; private TextMeshProUGUI badgeText; private TextMeshProUGUI timeText; private readonly List<TileView> tiles = new List<TileView>(); private readonly List<ChipView> chips = new List<ChipView>(); private static readonly string[] UpKeys = new string[5] { "Strength", "Range", "TumbleLaunch", "TumbleWings", "ExtraJump" }; private readonly int[] upValues = new int[5]; private static readonly CultureInfo Inv = CultureInfo.InvariantCulture; private int losMask; private void Start() { try { Gfx.Init(); } catch (Exception ex) { Plugin.Log.LogError((object)ex); } } private void Update() { //IL_0005: 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) try { KeyboardShortcut value = Plugin.ToggleKey.Value; if (((KeyboardShortcut)(ref value)).IsDown()) { visible = !visible; } } catch { } refreshTimer -= Time.unscaledDeltaTime; if (refreshTimer > 0f) { return; } refreshTimer = 0.1f; try { Refresh(); if (order.Count > 0 && EnsureCanvas()) { Draw(); } bool flag = false; try { flag = (Object)(object)Map.Instance != (Object)null && Map.Instance.Active; } catch { } if ((Object)(object)canvas != (Object)null) { ((Component)canvas).gameObject.SetActive(visible && !flag && order.Count > 0 && (Object)(object)UI.Font != (Object)null); } } catch (Exception ex) { Plugin.Log.LogWarning((object)ex); refreshTimer = 2f; } } private void Refresh() { //IL_01d1: Unknown result type (might be due to invalid IL or missing references) //IL_01db: Expected I4, but got Unknown EnemyDirector instance = EnemyDirector.instance; if ((Object)(object)instance == (Object)null || instance.enemiesSpawned == null || (Object)(object)LevelGenerator.Instance == (Object)null || !LevelGenerator.Instance.Generated) { order.Clear(); return; } if ((Object)(object)instance != (Object)(object)lastDirector) { lastDirector = instance; tracks.Clear(); order.Clear(); levelStart = Time.time; netLevelStart = -1.0; pendingDiscover.Clear(); lastSentStruct = ""; } bool flag = false; bool flag2 = true; try { flag = SemiFunc.IsMultiplayer() && PhotonNetwork.InRoom; flag2 = !flag || PhotonNetwork.IsMasterClient; } catch { } HookEvents(); bool flag3 = !flag2 && ReadHostState(); foreach (Track item in order) { item.Seen = false; } foreach (EnemyParent item2 in instance.enemiesSpawned) { if ((Object)(object)item2 == (Object)null) { continue; } int instanceID = ((Object)item2).GetInstanceID(); if (!tracks.TryGetValue(instanceID, out var value)) { value = new Track(); value.Info = MobDb.Find(item2.enemyName, ((Object)item2).name); value.Name = ((value.Info != null) ? value.Info.Name : (string.IsNullOrEmpty(item2.enemyName) ? ((Object)item2).name.Replace("(Clone)", "").Replace("Enemy - ", "").Trim() : item2.enemyName)); value.Difficulty = (int)item2.difficulty; tracks[instanceID] = value; order.Add(value); if (value.Info == null) { Plugin.Log.LogInfo((object)("Неизвестный моб (нет в вики-таблице): " + item2.enemyName + " / " + ((Object)item2).name)); } } value.Seen = true; if (value.ViewId == 0) { try { if ((Object)(object)((MonoBehaviourPun)item2).photonView != (Object)null) { value.ViewId = ((MonoBehaviourPun)item2).photonView.ViewID; } } catch { } } bool flag4 = R.Get(R.ParentSpawned, item2, def: false); float despawnedTimer = item2.DespawnedTimer; if (flag4 && !value.Spawned) { value.Killed = false; } if (!flag4 && (value.Spawned || value.RespawnTotal <= 0f || despawnedTimer > value.RespawnTotal + 0.5f)) { value.RespawnTotal = Mathf.Max(despawnedTimer, 1f); } value.Spawned = flag4; value.Respawn = despawnedTimer; Enemy val = R.Get<Enemy>(R.ParentEnemy, item2, null); EnemyHealth val2 = null; if ((Object)(object)val != (Object)null && R.Get(R.EnemyHasHealth, val, def: false)) { val2 = R.Get<EnemyHealth>(R.EnemyHealthF, val, null); } if ((Object)(object)val2 != (Object)null) { value.Hp = R.Get(R.HealthCurrent, val2, 0); if (R.Get(R.HealthDead, val2, def: false) || (value.Hp <= 0 && val2.health > 0)) { value.Killed = true; } } if (value.Spawned && value.Hp > 0) { value.Killed = false; } if (value.Killed) { value.Discovered = true; } if (flag4 && (Object)(object)val != (Object)null && !value.LocalDiscovered && IsEncountered(item2, val, value)) { value.LocalDiscovered = true; } if (value.Killed) { value.LocalDiscovered = true; } if (flag2) { if (value.LocalDiscovered || (value.ViewId != 0 && pendingDiscover.Contains(value.ViewId))) { value.Discovered = true; } continue; } if (value.LocalDiscovered && !value.Reported && value.ViewId != 0) { value.Reported = SendDiscovered(value.ViewId); } if (flag3 && value.ViewId != 0 && hostState.TryGetValue(value.ViewId, out var value2)) { value.Discovered = value2.Discovered || value.LocalDiscovered; value.Spawned = value2.Spawned; value.Killed = value2.Killed; value.RespawnTotal = value2.Total; float num = 0f; try { num = (float)(PhotonNetwork.Time - value2.SentAt); } catch { } if (num < 0f || num > 600f) { num = 0f; } value.Respawn = (value2.Spawned ? value2.Respawn : Mathf.Max(0f, value2.Respawn - num)); } else { value.Discovered = value.LocalDiscovered; } } order.RemoveAll((Track t) => !t.Seen); List<Track> list = new List<Track>(order); for (int num2 = 0; num2 < list.Count; num2++) { list[num2].SortIndex = num2; } list.Sort(delegate(Track a, Track b) { int num3 = a.Difficulty.CompareTo(b.Difficulty); return (num3 == 0) ? a.SortIndex.CompareTo(b.SortIndex) : num3; }); order.Clear(); order.AddRange(list); if (flag && flag2) { if (netLevelStart < 0.0) { try { netLevelStart = PhotonNetwork.Time; } catch { } } Publish(); } else if (flag && flag3 && hostLevelStart >= 0.0) { netLevelStart = hostLevelStart; } ReadUpgrades(); } private void HookEvents() { if (eventHooked) { return; } try { if (PhotonNetwork.NetworkingClient != null) { PhotonNetwork.NetworkingClient.EventReceived += OnPhotonEvent; eventHooked = true; } } catch { } } private void OnPhotonEvent(EventData ev) { try { if (ev.Code == 177 && PhotonNetwork.IsMasterClient && ev.CustomData is int) { pendingDiscover.Add((int)ev.CustomData); } } catch { } } private bool SendDiscovered(int viewId) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Expected O, but got Unknown //IL_0008: 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) try { RaiseEventOptions val = new RaiseEventOptions(); val.Receivers = (ReceiverGroup)2; return PhotonNetwork.RaiseEvent((byte)177, (object)viewId, val, SendOptions.SendReliable); } catch { return false; } } private void Publish() { //IL_0190: Unknown result type (might be due to invalid IL or missing references) //IL_0197: Expected O, but got Unknown try { Room currentRoom = PhotonNetwork.CurrentRoom; if (currentRoom == null) { return; } StringBuilder stringBuilder = new StringBuilder(); StringBuilder stringBuilder2 = new StringBuilder(); double time = PhotonNetwork.Time; stringBuilder2.Append(netLevelStart.ToString("R", Inv)).Append(';').Append(time.ToString("R", Inv)); foreach (Track item in order) { if (item.ViewId != 0) { int value = (item.Discovered ? 1 : 0) | (item.Spawned ? 2 : 0) | (item.Killed ? 4 : 0); stringBuilder.Append(item.ViewId).Append(',').Append(value) .Append('|'); stringBuilder2.Append('|').Append(item.ViewId).Append(',') .Append(value) .Append(',') .Append(item.Respawn.ToString("0.0", Inv)) .Append(',') .Append(item.RespawnTotal.ToString("0.0", Inv)); } } string text = stringBuilder.ToString(); if (!(text == lastSentStruct) || !(Time.unscaledTime - lastSendTime < 3f)) { lastSentStruct = text; lastSendTime = Time.unscaledTime; Hashtable val = new Hashtable(); val[(object)"ET_state"] = stringBuilder2.ToString(); currentRoom.SetCustomProperties(val, (Hashtable)null, (WebFlags)null); } } catch (Exception ex) { Plugin.Log.LogDebug((object)ex); } } private bool ReadHostState() { try { Room currentRoom = PhotonNetwork.CurrentRoom; if (currentRoom == null || ((RoomInfo)currentRoom).CustomProperties == null) { return false; } if (!((Dictionary<object, object>)(object)((RoomInfo)currentRoom).CustomProperties).TryGetValue((object)"ET_state", out object value)) { return false; } string text = value as string; if (string.IsNullOrEmpty(text)) { return false; } if (text == lastParsedRaw) { return hostState.Count > 0 || hostLevelStart >= 0.0; } lastParsedRaw = text; hostState.Clear(); string[] array = text.Split('|'); string[] array2 = array[0].Split(';'); hostLevelStart = double.Parse(array2[0], Inv); double sentAt = double.Parse(array2[1], Inv); for (int i = 1; i < array.Length; i++) { string[] array3 = array[i].Split(','); if (array3.Length >= 4) { HostEntry hostEntry = new HostEntry(); int num = int.Parse(array3[1], Inv); hostEntry.Discovered = (num & 1) != 0; hostEntry.Spawned = (num & 2) != 0; hostEntry.Killed = (num & 4) != 0; hostEntry.Respawn = float.Parse(array3[2], Inv); hostEntry.Total = float.Parse(array3[3], Inv); hostEntry.SentAt = sentAt; hostState[int.Parse(array3[0], Inv)] = hostEntry; } } return true; } catch { return false; } } private int LosMask() { if (losMask != 0) { return losMask; } int num = -5; for (int i = 0; i < 32; i++) { string text = LayerMask.LayerToName(i); if (!string.IsNullOrEmpty(text)) { string text2 = text.ToLowerInvariant(); if (text2.Contains("player") || text2.Contains("trigger") || text2.Contains("ignore") || text2.Contains("enemy") || text2.Contains("water") || text2 == "ui") { num &= ~(1 << i); } } } losMask = num; return num; } private bool IsEncountered(EnemyParent p, Enemy e, Track t) { //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_00af: Unknown result type (might be due to invalid IL or missing references) //IL_00b5: Invalid comparison between Unknown and I4 //IL_00e6: Unknown result type (might be due to invalid IL or missing references) //IL_00f3: Unknown result type (might be due to invalid IL or missing references) //IL_00f9: Invalid comparison between Unknown and I4 //IL_015f: Unknown result type (might be due to invalid IL or missing references) //IL_0164: Unknown result type (might be due to invalid IL or missing references) //IL_0167: Unknown result type (might be due to invalid IL or missing references) //IL_0169: 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_01dc: 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_01e3: Unknown result type (might be due to invalid IL or missing references) //IL_01e5: Unknown result type (might be due to invalid IL or missing references) //IL_01e7: Unknown result type (might be due to invalid IL or missing references) //IL_01ec: 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_01f9: Unknown result type (might be due to invalid IL or missing references) //IL_01fd: Unknown result type (might be due to invalid IL or missing references) if (R.Get(R.ParentPlayerVeryClose, p, def: false)) { return true; } if (R.Get(R.EnemyHasOnScreen, e, def: false)) { EnemyOnScreen val = R.Get<EnemyOnScreen>(R.EnemyOnScreenF, e, null); if ((Object)(object)val != (Object)null && (R.Get(R.OnScreenAny, val, def: false) || R.Get(R.OnScreenLocal, val, def: false))) { return true; } } string text = ((object)e.CurrentState).ToString(); if (text.Contains("Chase")) { return true; } if (!t.CompsLooked) { t.CompsLooked = true; t.Eye = ((Component)p).GetComponentInChildren<EnemyCeilingEye>(true); t.Shadow = ((Component)p).GetComponentInChildren<EnemyShadow>(true); } if ((Object)(object)t.Eye != (Object)null && ((int)t.Eye.currentState == 3 || (Object)(object)R.Get<PlayerAvatar>(R.EyeTarget, t.Eye, null) != (Object)null)) { return true; } if ((Object)(object)t.Shadow != (Object)null && (int)t.Shadow.currentState != 0 && (int)t.Shadow.currentState != 2 && ((Object)(object)R.Get<PlayerAvatar>(R.ShadowTarget, t.Shadow, null) != (Object)null || (Object)(object)R.Get<PlayerAvatar>(R.ShadowActualTarget, t.Shadow, null) != (Object)null)) { return true; } Camera main = Camera.main; if ((Object)(object)main != (Object)null) { Transform val2 = (((Object)(object)e.CenterTransform != (Object)null) ? e.CenterTransform : ((Component)e).transform); Vector3 position = val2.position; Vector3 val3 = main.WorldToViewportPoint(position); if (val3.z > 0.2f && val3.z < 30f && val3.x > 0.02f && val3.x < 0.98f && val3.y > 0.02f && val3.y < 0.98f) { Vector3 position2 = ((Component)main).transform.position; Vector3 val4 = position - position2; float magnitude = ((Vector3)(ref val4)).magnitude; RaycastHit val5 = default(RaycastHit); if (!Physics.Raycast(position2, val4 / magnitude, ref val5, magnitude - 0.3f, LosMask(), (QueryTriggerInteraction)1)) { t.LosTime += 0.1f; if (t.LosTime >= 0.4f) { return true; } } else { if ((Object)(object)((RaycastHit)(ref val5)).transform != (Object)null && ((RaycastHit)(ref val5)).transform.IsChildOf(((Component)p).transform)) { return true; } t.LosTime = 0f; } } else { t.LosTime = 0f; } } return false; } private void ReadUpgrades() { for (int i = 0; i < upValues.Length; i++) { upValues[i] = 0; } StatsManager instance = StatsManager.instance; if ((Object)(object)instance == (Object)null) { return; } string text = null; try { text = SemiFunc.PlayerGetSteamID(SemiFunc.PlayerAvatarLocal()); } catch { } Dictionary<string, int>[] array = new Dictionary<string, int>[5] { instance.playerUpgradeStrength, instance.playerUpgradeRange, instance.playerUpgradeLaunch, instance.playerUpgradeTumbleWings, instance.playerUpgradeExtraJump }; for (int j = 0; j < array.Length; j++) { Dictionary<string, int> dictionary = array[j]; if (dictionary == null) { continue; } if (text != null && dictionary.TryGetValue(text, out var value)) { upValues[j] = value; } else { if (text != null || dictionary.Count != 1) { continue; } foreach (int value2 in dictionary.Values) { upValues[j] = value2; } } } } private static TMP_FontAsset LoadBuiltinFont() { try { Assembly executingAssembly = Assembly.GetExecutingAssembly(); using Stream stream = executingAssembly.GetManifestResourceStream("font.Rubik-ExtraBold.ttf"); if (stream == null) { return null; } string text = Path.Combine(Paths.CachePath, "EnemyTracker"); Directory.CreateDirectory(text); string text2 = Path.Combine(text, "Rubik-ExtraBold.ttf"); byte[] array = new byte[stream.Length]; int num; for (int i = 0; i < array.Length; i += num) { num = stream.Read(array, i, array.Length - i); if (num <= 0) { break; } } if (!File.Exists(text2) || new FileInfo(text2).Length != array.Length) { File.WriteAllBytes(text2, array); } TMP_FontAsset val = TMP_FontAsset.CreateFontAsset(text2, 0, 90, 9, (GlyphRenderMode)4165, 1024, 1024); if ((Object)(object)val != (Object)null) { ((Object)val).name = "EnemyTracker Rubik ExtraBold"; } return val; } catch (Exception ex) { Plugin.Log.LogWarning((object)("Шрифт Rubik не загрузился: " + ex.Message)); return null; } } private TMP_FontAsset FindFont() { TMP_FontAsset[] array = Resources.FindObjectsOfTypeAll<TMP_FontAsset>(); if (!loggedFonts && array.Length > 0) { loggedFonts = true; List<string> list = new List<string>(); TMP_FontAsset[] array2 = array; foreach (TMP_FontAsset val in array2) { list.Add(((Object)val).name); } Plugin.Log.LogInfo((object)("Доступные шрифты: " + string.Join(", ", list.ToArray()))); } string value = Plugin.FontName.Value; if (!string.IsNullOrEmpty(value)) { TMP_FontAsset[] array3 = array; foreach (TMP_FontAsset val2 in array3) { if (((Object)val2).name == value) { return val2; } } } TMP_FontAsset val3 = LoadBuiltinFont(); if ((Object)(object)val3 != (Object)null) { return val3; } object o = ((R.HealthUIInstance != null) ? R.HealthUIInstance.GetValue(null) : null); TextMeshProUGUI val4 = R.Get<TextMeshProUGUI>(R.HealthUIText, o, null); if ((Object)(object)val4 != (Object)null && (Object)(object)((TMP_Text)val4).font != (Object)null) { return ((TMP_Text)val4).font; } return null; } private bool EnsureCanvas() { //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Expected O, but got Unknown //IL_00a4: 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_0132: Unknown result type (might be due to invalid IL or missing references) //IL_0169: 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_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_020b: Unknown result type (might be due to invalid IL or missing references) //IL_0210: Unknown result type (might be due to invalid IL or missing references) //IL_0226: Unknown result type (might be due to invalid IL or missing references) //IL_022b: Unknown result type (might be due to invalid IL or missing references) //IL_0241: Unknown result type (might be due to invalid IL or missing references) //IL_0246: Unknown result type (might be due to invalid IL or missing references) //IL_025c: Unknown result type (might be due to invalid IL or missing references) //IL_0261: Unknown result type (might be due to invalid IL or missing references) //IL_0266: Unknown result type (might be due to invalid IL or missing references) //IL_0276: Unknown result type (might be due to invalid IL or missing references) //IL_0291: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)UI.Font == (Object)null) { UI.Font = FindFont(); if ((Object)(object)UI.Font == (Object)null) { return false; } Plugin.Log.LogInfo((object)("Шрифт оверлея: " + ((Object)UI.Font).name)); } if ((Object)(object)canvas != (Object)null) { return true; } GameObject val = new GameObject("EnemyTrackerCanvas"); Object.DontDestroyOnLoad((Object)(object)val); canvas = val.AddComponent<Canvas>(); canvas.renderMode = (RenderMode)0; canvas.sortingOrder = 50; CanvasScaler val2 = val.AddComponent<CanvasScaler>(); val2.uiScaleMode = (ScaleMode)1; val2.referenceResolution = new Vector2(1920f, 1080f); val2.matchWidthOrHeight = 1f; root = UI.Node("Root", val.transform); header = UI.Node("Header", (Transform)(object)root); chipsRow = UI.Node("Upgrades", (Transform)(object)root); tilesRow = UI.Node("Mobs", (Transform)(object)root); badgeBg = UI.Img("Badge", (Transform)(object)header, Gfx.Fill, Color32.op_Implicit(new Color32((byte)96, (byte)58, (byte)12, (byte)240)), sliced: true); badgeBorder = UI.Img("BadgeBorder", ((Component)badgeBg).transform, Gfx.Ring, Color32.op_Implicit(new Color32(byte.MaxValue, (byte)170, (byte)40, byte.MaxValue)), sliced: true); UI.Stretch(((Graphic)badgeBorder).rectTransform, 0f); badgeText = UI.Text("BadgeText", ((Component)badgeBg).transform, 22f, Color32.op_Implicit(new Color32(byte.MaxValue, (byte)186, (byte)48, byte.MaxValue)), (TextAlignmentOptions)514); UI.Stretch(((TMP_Text)badgeText).rectTransform, 0f); ((TMP_Text)badgeText).enableVertexGradient = true; ((TMP_Text)badgeText).colorGradient = new VertexGradient(Color32.op_Implicit(new Color32(byte.MaxValue, (byte)214, (byte)90, byte.MaxValue)), Color32.op_Implicit(new Color32(byte.MaxValue, (byte)214, (byte)90, byte.MaxValue)), Color32.op_Implicit(new Color32(byte.MaxValue, (byte)140, (byte)20, byte.MaxValue)), Color32.op_Implicit(new Color32(byte.MaxValue, (byte)140, (byte)20, byte.MaxValue))); ((Graphic)badgeText).color = Color.white; timeText = UI.Text("Time", (Transform)(object)header, 26f, Color.white, (TextAlignmentOptions)513); for (int i = 0; i < UpKeys.Length; i++) { Gfx.Ups.TryGetValue(UpKeys[i], out var value); chips.Add(new ChipView((Transform)(object)chipsRow, value)); } return true; } private void Draw() { //IL_0027: 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_03fe: 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_0195: Unknown result type (might be due to invalid IL or missing references) //IL_028e: Unknown result type (might be due to invalid IL or missing references) //IL_0232: Unknown result type (might be due to invalid IL or missing references) float num = Mathf.Clamp(Plugin.Scale.Value, 0.5f, 3f); ((Transform)root).localScale = new Vector3(num, num, 1f); root.anchoredPosition = new Vector2(20f, 20f); int myStrength = upValues[0]; bool value = Plugin.RevealAll.Value; while (tiles.Count < order.Count) { tiles.Add(new TileView((Transform)(object)tilesRow)); } for (int i = 0; i < tiles.Count; i++) { ((Component)tiles[i].Root).gameObject.SetActive(i < order.Count); } int num2 = Mathf.Max(1, Plugin.TilesPerRow.Value); int num3 = (order.Count + num2 - 1) / num2; float num4 = 97f; for (int j = 0; j < order.Count; j++) { int num5 = j / num2; int num6 = j % num2; tiles[j].Root.anchoredPosition = new Vector2((float)num6 * 96f, (float)(num3 - 1 - num5) * (num4 + 14f)); tiles[j].Set(order[j], myStrength, value); } float num7 = (float)num3 * num4 + (float)(num3 - 1) * 14f; tilesRow.anchoredPosition = Vector2.zero; float num8 = 0f; for (int k = 0; k < chips.Count; k++) { bool flag = !Plugin.HideUnusedUpgrades.Value || upValues[k] != 0; ((Component)chips[k].Root).gameObject.SetActive(flag); if (flag) { ((TMP_Text)chips[k].Num).text = upValues[k].ToString(); chips[k].Root.anchoredPosition = new Vector2(num8, 0f); num8 += 66f; } } bool flag2 = num8 > 0f; ((Component)chipsRow).gameObject.SetActive(flag2); chipsRow.anchoredPosition = new Vector2(0f, num7 + 12f); int num9 = 1; try { num9 = SemiFunc.RunGetLevelsCompleted() + 1; } catch { } string text = ((Plugin.Language.Value == "en") ? "LEVEL" : "УРОВЕНЬ"); ((TMP_Text)badgeText).text = text + " <size=150%>" + num9 + "</size>"; float num10 = ((TMP_Text)badgeText).preferredWidth + 28f; UI.Place(((Graphic)badgeBg).rectTransform, 0f, 0f, num10, 46f); float num11 = Time.time - levelStart; if (netLevelStart >= 0.0) { try { num11 = (float)(PhotonNetwork.Time - netLevelStart); } catch { } if (num11 < 0f) { num11 = 0f; } } int num12 = Mathf.FloorToInt(num11); ((TMP_Text)timeText).text = $"{num12 / 60:00}:{num12 % 60:00}"; UI.Place(((TMP_Text)timeText).rectTransform, num10 + 14f, 0f, 120f, 46f); header.anchoredPosition = new Vector2(0f, num7 + 12f + (flag2 ? 42f : 0f)); } }