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 REPO Nearby Health v1.6.7
plugins/NearbyHealth.dll
Decompiled an hour agousing System; using System.Collections.Generic; using System.Globalization; using System.IO; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Text; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using UnityEngine; using UnityEngine.SceneManagement; using UnityEngine.UI; [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: TargetFramework(".NETStandard,Version=v2.1")] [assembly: CompilationRelaxations(8)] [assembly: AssemblyVersion("1.6.7.0")] namespace NearbyHealth; [DefaultExecutionOrder(10000)] [BepInPlugin("com.stickyslimy.repo.nearbyhealth", "REPO Nearby Health", "1.6.7")] [BepInProcess("REPO.exe")] public sealed class Plugin : BaseUnityPlugin { private enum Sight { Clear, Item, Wall } public const string Guid = "com.stickyslimy.repo.nearbyhealth"; public const string Version = "1.6.7"; private readonly Dictionary<PlayerAvatar, Nameplate> plates = new Dictionary<PlayerAvatar, Nameplate>(); private readonly List<PlayerAvatar> removed = new List<PlayerAvatar>(); private readonly RaycastHit[] hits = (RaycastHit[])(object)new RaycastHit[64]; private Settings settings; private GameBindings bindings; private Canvas canvas; private Font font; private SkinAssets skins; private AppearanceMenu appearanceMenu; private bool ready; private int worldOcclusionLayers; private int looseObjectLayers; private float nextScan; private float nextError; private void Awake() { //IL_001d: 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_00d8: Expected O, but got Unknown try { settings = new Settings(((BaseUnityPlugin)this).Config); bindings = new GameBindings(); worldOcclusionLayers = LayerMask.op_Implicit(SemiFunc.LayerMaskGetVisionObstruct()) & ~LayerMask.GetMask(new string[1] { "Player" }); looseObjectLayers = LayerMask.GetMask(new string[3] { "PhysGrabObject", "PhysGrabObjectCart", "PhysGrabObjectHinge" }); font = Resources.GetBuiltinResource<Font>("LegacyRuntime.ttf"); if (!Object.op_Implicit((Object)(object)font)) { throw new InvalidOperationException("Unity LegacyRuntime.ttf is unavailable."); } skins = new SkinAssets(((BaseUnityPlugin)this).Logger); GameObject val = new GameObject("NearbyHealth.LocalUI", new Type[2] { typeof(RectTransform), typeof(Canvas) }); val.transform.SetParent(((Component)this).transform, false); canvas = val.GetComponent<Canvas>(); canvas.renderMode = (RenderMode)0; canvas.sortingOrder = 15; appearanceMenu = new AppearanceMenu(((Component)this).transform, font, skins, settings, ((BaseUnityPlugin)this).Config); SceneManager.activeSceneChanged += OnSceneChanged; ready = true; ((BaseUnityPlugin)this).Logger.LogInfo((object)("Nearby Health 1.6.7 loaded; local UI. Unity " + Application.unityVersion)); } catch (Exception ex) { ((BaseUnityPlugin)this).Logger.LogError((object)("Nearby Health disabled: " + ex)); ((Behaviour)this).enabled = false; } } private void Update() { //IL_00d8: 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_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_0110: 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_0088: Unknown result type (might be due to invalid IL or missing references) //IL_008d: Unknown result type (might be due to invalid IL or missing references) if (!ready) { return; } if (bindings.MenuOpen()) { if (appearanceMenu.IsOpen) { appearanceMenu.Close(); } return; } KeyboardShortcut designMenuKey = settings.DesignMenuKey; if (((KeyboardShortcut)(ref designMenuKey)).IsDown()) { if (appearanceMenu.IsOpen) { appearanceMenu.Close(); } else { appearanceMenu.Open(); } return; } if (appearanceMenu.IsOpen) { appearanceMenu.HandleInput(); return; } KeyboardShortcut reloadKey = settings.ReloadKey; if (((KeyboardShortcut)(ref reloadKey)).IsDown()) { try { ((BaseUnityPlugin)this).Config.Reload(); ((BaseUnityPlugin)this).Logger.LogInfo((object)"Configuration reloaded."); } catch (Exception ex) { ((BaseUnityPlugin)this).Logger.LogWarning((object)("Config reload failed: " + ex.Message)); } } KeyboardShortcut toggleKey = settings.ToggleKey; if (((KeyboardShortcut)(ref toggleKey)).IsDown()) { settings.Enabled.Value = !settings.Enabled.Value; } KeyboardShortcut nameOnlyKey = settings.NameOnlyKey; if (((KeyboardShortcut)(ref nameOnlyKey)).IsDown()) { settings.NameOnly.Value = !settings.NameOnly.Value; } } private void LateUpdate() { if (!ready) { return; } try { Refresh(); } catch (Exception ex) { HideAll(); if (Time.unscaledTime >= nextError) { ((BaseUnityPlugin)this).Logger.LogError((object)("Nearby Health update failed; hiding UI: " + ex)); nextError = Time.unscaledTime + 30f; } } } private void Refresh() { //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Invalid comparison between Unknown and I4 //IL_00dd: 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_0220: 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_0227: Unknown result type (might be due to invalid IL or missing references) //IL_0228: Unknown result type (might be due to invalid IL or missing references) //IL_0231: Unknown result type (might be due to invalid IL or missing references) //IL_0233: Unknown result type (might be due to invalid IL or missing references) //IL_023a: 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_0244: 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_0249: Unknown result type (might be due to invalid IL or missing references) //IL_024e: Unknown result type (might be due to invalid IL or missing references) //IL_02ac: Unknown result type (might be due to invalid IL or missing references) //IL_02a6: Unknown result type (might be due to invalid IL or missing references) //IL_02b1: Unknown result type (might be due to invalid IL or missing references) //IL_02b4: Unknown result type (might be due to invalid IL or missing references) //IL_02b5: Unknown result type (might be due to invalid IL or missing references) //IL_02b7: Unknown result type (might be due to invalid IL or missing references) //IL_02bf: Unknown result type (might be due to invalid IL or missing references) //IL_02ca: Unknown result type (might be due to invalid IL or missing references) //IL_03e6: Unknown result type (might be due to invalid IL or missing references) PlayerAvatar instance = PlayerAvatar.instance; GameDirector instance2 = GameDirector.instance; if (!settings.Enabled.Value || !Object.op_Implicit((Object)(object)instance) || !Object.op_Implicit((Object)(object)instance2) || !Object.op_Implicit((Object)(object)RunManager.instance) || SemiFunc.MenuLevel() || bindings.Unavailable(instance) || (int)instance2.currentState != 2 || (settings.HideInMenus.Value && Object.op_Implicit((Object)(object)MenuPageEsc.instance) && ((Component)MenuPageEsc.instance).gameObject.activeInHierarchy)) { HideAll(); return; } Camera mainCamera = instance2.MainCamera; if (!Object.op_Implicit((Object)(object)mainCamera) || !((Behaviour)mainCamera).isActiveAndEnabled) { HideAll(); return; } if (Time.unscaledTime >= nextScan) { SyncPlayers(instance2.PlayerList, instance); nextScan = Time.unscaledTime + 0.5f; } Vector3 position = ((Component)mainCamera).transform.position; float range = settings.Range; float num = (float)Screen.height / 1080f * settings.Scale; bool value = settings.NameOnly.Value; float height = settings.Height; foreach (KeyValuePair<PlayerAvatar, Nameplate> plate in plates) { PlayerAvatar key = plate.Key; Nameplate value2 = plate.Value; if (!Object.op_Implicit((Object)(object)key) || !((Behaviour)key).isActiveAndEnabled || bindings.IsLocal(key) || bindings.Unavailable(key) || !Object.op_Implicit((Object)(object)key.playerHealth) || key.playerHealth.isMenuAvatar || !Object.op_Implicit((Object)(object)key.playerAvatarVisuals) || !((Component)key.playerAvatarVisuals).gameObject.activeInHierarchy) { value2.Hide(); continue; } bool flag = bindings.HasHealth(key.playerHealth); if (!flag && !value) { value2.Hide(); continue; } PlayerAvatarVisuals playerAvatarVisuals = key.playerAvatarVisuals; Transform headLookAtTransform = playerAvatarVisuals.headLookAtTransform; if (!Object.op_Implicit((Object)(object)headLookAtTransform)) { value2.Hide(); continue; } Vector3 position2 = headLookAtTransform.position; float num2 = Vector3.Distance(position, position2); Vector3 val = position2 + Vector3.up * height; Vector3 val2 = mainCamera.WorldToViewportPoint(val); if (!HealthRules.InView(num2, range, val2.x, val2.y, val2.z, mainCamera.nearClipPlane)) { value2.Hide(); continue; } if (settings.RequireLineOfSight.Value) { Transform bodyTopUpTransform = playerAvatarVisuals.bodyTopUpTransform; Vector3 torso = (Object.op_Implicit((Object)(object)bodyTopUpTransform) ? bodyTopUpTransform.position : position2); Sight sight = GetSight(position, position2, torso, ((Component)mainCamera).transform.right, ((Component)mainCamera).transform.up); float unscaledTime = Time.unscaledTime; if (sight == Sight.Clear) { value2.LastClearSight = unscaledTime; } if (sight == Sight.Wall || (sight == Sight.Item && !HealthRules.KeepDuringItemOcclusion(unscaledTime, value2.LastClearSight))) { value2.Hide(); continue; } } else { value2.LastClearSight = float.NegativeInfinity; } int current2 = 0; int maximum = 0; if (flag) { bindings.ReadHealth(key.playerHealth, out current2, out maximum); if (maximum <= 0 || current2 <= 0) { value2.Hide(); continue; } } float alpha = settings.Opacity * HealthRules.Fade(num2, range, settings.FadeDistance); float num3 = 1f; if (settings.DistanceScaling.Value) { num3 = (value ? Mathf.Clamp(5f / Mathf.Max(num2, 0.1f), 0.8f, 1.1f) : HealthRules.HealthPlateDistanceScale(num2, settings.FarHealthScale)); } value2.Draw(new Vector2(val2.x * (float)Screen.width, val2.y * (float)Screen.height), num * num3, alpha, bindings.PlayerName(key), current2, maximum, settings); value2.ReplaceNativeName(bindings.NativeNameGraphic(key)); } } private void SyncPlayers(List<PlayerAvatar> players, PlayerAvatar local) { removed.Clear(); foreach (KeyValuePair<PlayerAvatar, Nameplate> plate in plates) { if (!Object.op_Implicit((Object)(object)plate.Key) || !players.Contains(plate.Key) || (Object)(object)plate.Key == (Object)(object)local) { removed.Add(plate.Key); } } foreach (PlayerAvatar item in removed) { plates[item].Dispose(); plates.Remove(item); } foreach (PlayerAvatar player in players) { if (Object.op_Implicit((Object)(object)player) && (Object)(object)player != (Object)(object)local && !bindings.IsLocal(player) && !plates.ContainsKey(player)) { plates.Add(player, new Nameplate(((Component)canvas).transform, font, skins)); } } } private Sight GetSight(Vector3 origin, Vector3 head, Vector3 torso, Vector3 cameraRight, Vector3 cameraUp) { //IL_0019: 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_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0036: 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_0040: 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_0042: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_0054: 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_0056: 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_0067: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_0069: Unknown result type (might be due to invalid IL or missing references) //IL_0079: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_007b: 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_008d: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Unknown result type (might be due to invalid IL or missing references) //IL_008f: 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_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_00a6: Unknown result type (might be due to invalid IL or missing references) //IL_00b2: Unknown result type (might be due to invalid IL or missing references) //IL_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00b4: 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_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_00c7: Unknown result type (might be due to invalid IL or missing references) //IL_00c8: Unknown result type (might be due to invalid IL or missing references) int mask = worldOcclusionLayers & settings.OcclusionMask.Value; Sight best = TraceSight(origin, head, mask); Vector3 val = cameraRight * 0.1f; Vector3 val2 = cameraUp * 0.08f; if (best == Sight.Clear || Sample(origin, head - val, mask, ref best) || Sample(origin, head + val, mask, ref best) || Sample(origin, head - val2, mask, ref best) || Sample(origin, head + val2, mask, ref best)) { return Sight.Clear; } Vector3 val3 = torso - head; if (((Vector3)(ref val3)).sqrMagnitude > 0.01f && (Sample(origin, torso, mask, ref best) || Sample(origin, torso - val, mask, ref best) || Sample(origin, torso + val, mask, ref best))) { return Sight.Clear; } return best; } private bool Sample(Vector3 origin, Vector3 target, int mask, ref Sight best) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Unknown result type (might be due to invalid IL or missing references) Sight sight = TraceSight(origin, target, mask); if (sight < best) { best = sight; } return sight == Sight.Clear; } private Sight TraceSight(Vector3 origin, Vector3 target, int mask) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0007: 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_001b: 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_003e: 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_0041: Unknown result type (might be due to invalid IL or missing references) Vector3 val = target - origin; float magnitude = ((Vector3)(ref val)).magnitude; if (magnitude < 0.01f) { return Sight.Clear; } int num = Physics.RaycastNonAlloc(origin, val / magnitude, hits, magnitude, mask, (QueryTriggerInteraction)1); RaycastHit[] array = hits; if (num == array.Length) { array = Physics.RaycastAll(origin, val / magnitude, magnitude, mask, (QueryTriggerInteraction)1); num = array.Length; } Sight result = Sight.Clear; for (int i = 0; i < num; i++) { switch (Obstruction(((RaycastHit)(ref array[i])).collider)) { case Sight.Wall: return Sight.Wall; case Sight.Item: result = Sight.Item; break; } } return result; } private Sight Obstruction(Collider collider) { if (!Object.op_Implicit((Object)(object)collider) || Object.op_Implicit((Object)(object)((Component)collider).GetComponentInParent<PlayerPhysPusher>()) || Object.op_Implicit((Object)(object)((Component)collider).GetComponentInParent<PlayerAvatar>()) || Object.op_Implicit((Object)(object)((Component)collider).GetComponentInParent<PlayerTumble>())) { return Sight.Clear; } if (((Component)collider).CompareTag("Wall") || Object.op_Implicit((Object)(object)((Component)collider).GetComponentInParent<BreakableWall>()) || Object.op_Implicit((Object)(object)((Component)collider).GetComponentInParent<BreakableFloor>())) { return Sight.Wall; } if ((looseObjectLayers & (1 << ((Component)collider).gameObject.layer)) != 0 || Object.op_Implicit((Object)(object)((Component)collider).GetComponentInParent<PhysGrabObject>()) || ((Component)collider).CompareTag("Phys Grab Object")) { return Sight.Item; } return Sight.Wall; } private void HideAll() { foreach (Nameplate value in plates.Values) { value.Hide(); } } private void Clear() { foreach (Nameplate value in plates.Values) { value.Dispose(); } plates.Clear(); nextScan = 0f; } private void OnSceneChanged(Scene previous, Scene next) { if (appearanceMenu != null) { appearanceMenu.Close(); } Clear(); } private void OnDisable() { if (appearanceMenu != null) { appearanceMenu.Close(); } HideAll(); } private void OnDestroy() { SceneManager.activeSceneChanged -= OnSceneChanged; Clear(); if (Object.op_Implicit((Object)(object)canvas)) { Object.Destroy((Object)(object)((Component)canvas).gameObject); } if (appearanceMenu != null) { appearanceMenu.Dispose(); } if (skins != null) { skins.Dispose(); } } } internal sealed class GameBindings { private readonly FieldInfo health = Field(typeof(PlayerHealth), "health", typeof(int)); private readonly FieldInfo maxHealth = Field(typeof(PlayerHealth), "maxHealth", typeof(int)); private readonly FieldInfo healthSet = Field(typeof(PlayerHealth), "healthSet", typeof(bool)); private readonly FieldInfo isLocal = Field(typeof(PlayerAvatar), "isLocal", typeof(bool)); private readonly FieldInfo isDisabled = Field(typeof(PlayerAvatar), "isDisabled", typeof(bool)); private readonly FieldInfo deadSet = Field(typeof(PlayerAvatar), "deadSet", typeof(bool)); private readonly FieldInfo playerName = Field(typeof(PlayerAvatar), "playerName", typeof(string)); private readonly FieldInfo worldSpaceName = Field(typeof(PlayerAvatar), "worldSpaceUIPlayerName", typeof(WorldSpaceUIPlayerName)); private readonly FieldInfo currentMenuPage = Field(typeof(MenuManager), "currentMenuPage", typeof(MenuPage)); private static FieldInfo Field(Type owner, string name, Type expected) { FieldInfo field = owner.GetField(name, BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); if (field == null || field.FieldType != expected) { throw new MissingFieldException(owner.FullName, name + " (expected " + expected.Name + ")"); } return field; } public bool IsLocal(PlayerAvatar player) { return (bool)isLocal.GetValue(player); } public bool Unavailable(PlayerAvatar player) { if (!(bool)isDisabled.GetValue(player)) { return (bool)deadSet.GetValue(player); } return true; } public bool HasHealth(PlayerHealth value) { return (bool)healthSet.GetValue(value); } public bool MenuOpen() { //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Expected O, but got Unknown MenuManager instance = MenuManager.instance; if (Object.op_Implicit((Object)(object)instance)) { return Object.op_Implicit((Object)(MenuPage)currentMenuPage.GetValue(instance)); } return false; } public void ReadHealth(PlayerHealth value, out int current, out int maximum) { current = (int)health.GetValue(value); maximum = (int)maxHealth.GetValue(value); } public string PlayerName(PlayerAvatar player) { if (Object.op_Implicit((Object)(object)player.photonView) && player.photonView.Owner != null && !string.IsNullOrEmpty(player.photonView.Owner.NickName)) { return player.photonView.Owner.NickName; } return ((string)playerName.GetValue(player)) ?? "Mitspieler"; } public Graphic NativeNameGraphic(PlayerAvatar player) { //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Expected O, but got Unknown WorldSpaceUIPlayerName val = (WorldSpaceUIPlayerName)worldSpaceName.GetValue(player); if (!Object.op_Implicit((Object)(object)val)) { return null; } return (Graphic)(object)val.text; } } internal enum HealthBand { Green, Yellow, Red } internal static class HealthRules { public static HealthBand Band(int current) { if (current <= 25) { return HealthBand.Red; } if (current >= 50) { return HealthBand.Green; } return HealthBand.Yellow; } public static bool KeepDuringItemOcclusion(float now, float lastClearSight) { return now - lastClearSight < 0.08f; } public static float Bounded(float value, float minimum, float maximum, float fallback) { if (!float.IsNaN(value) && !float.IsInfinity(value)) { return Math.Max(minimum, Math.Min(maximum, value)); } return fallback; } public static float Fraction(int current, int maximum) { if (maximum > 0) { return Bounded((float)current / (float)maximum, 0f, 1f, 0f); } return 0f; } public static float HealthPlateDistanceScale(float distance, float farScale) { if (distance <= 5f) { return Math.Min(1.1f, 5f / Math.Max(distance, 0.1f)); } float num = Math.Min(1f, (distance - 5f) / 7f); return 1f - num + num * farScale; } public static bool InView(float distance, float range, float x, float y, float z, float near) { if (distance >= 0f && distance < range && x >= 0f && x <= 1f && y >= 0f && y <= 1f) { return z > near; } return false; } public static float Fade(float distance, float range, float width) { if (distance >= range) { return 0f; } if (!(width <= 0f)) { return Bounded((range - distance) / Math.Min(width, range), 0f, 1f, 0f); } return 1f; } public static string SafeName(string input) { if (string.IsNullOrWhiteSpace(input)) { return "Mitspieler"; } StringBuilder stringBuilder = new StringBuilder(); foreach (char c in input) { if (!char.IsControl(c) && CharUnicodeInfo.GetUnicodeCategory(c) != UnicodeCategory.Format) { stringBuilder.Append(c); } } string text = stringBuilder.ToString().Trim(); if (text.Length == 0) { return "Mitspieler"; } StringInfo stringInfo = new StringInfo(text); if (stringInfo.LengthInTextElements <= 22) { return text; } return stringInfo.SubstringByTextElements(0, 21) + "…"; } } internal sealed class Settings { public readonly ConfigEntry<bool> Enabled; public readonly ConfigEntry<bool> RequireLineOfSight; public readonly ConfigEntry<bool> NameOnly; public readonly ConfigEntry<bool> ShowNumbers; public readonly ConfigEntry<bool> ShowName; public readonly ConfigEntry<bool> DistanceScaling; public readonly ConfigEntry<bool> HideInMenus; public readonly ConfigEntry<bool> HealthNumbersInsideBar; public readonly ConfigEntry<bool> AnimateWarningLights; public readonly ConfigEntry<int> OcclusionMask; public readonly ConfigEntry<int> NameFontSize; public readonly ConfigEntry<int> HealthNumberFontSize; public readonly ConfigEntry<int> HealthBarWidth; public readonly ConfigEntry<int> HealthBarHeight; public readonly ConfigEntry<string> FrameSkin; public readonly ConfigEntry<string> NameFont; private readonly ConfigEntry<float> range; private readonly ConfigEntry<float> scale; private readonly ConfigEntry<float> height; private readonly ConfigEntry<float> farHealthScale; private readonly ConfigEntry<float> opacity; private readonly ConfigEntry<float> fadeDistance; public KeyboardShortcut ToggleKey { get; private set; } public KeyboardShortcut ReloadKey { get; private set; } public KeyboardShortcut NameOnlyKey { get; private set; } public KeyboardShortcut DesignMenuKey { get; private set; } public float Range => HealthRules.Bounded(range.Value, 1f, 100f, 10f); public float Scale => HealthRules.Bounded(scale.Value, 0.5f, 2.5f, 1f); public float Height => HealthRules.Bounded(height.Value, 0.1f, 1.5f, 0.4f); public float FarHealthScale => HealthRules.Bounded(farHealthScale.Value, 0.4f, 1f, 0.58f); public float Opacity => HealthRules.Bounded(opacity.Value, 0.1f, 1f, 0.85f); public float FadeDistance => HealthRules.Bounded(fadeDistance.Value, 0f, 10f, 1f); public Settings(ConfigFile config) { Enabled = config.Bind<bool>("General", "Enabled", true, "Anzeige aktivieren."); Action<KeyboardShortcut> update = delegate(KeyboardShortcut key) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) ToggleKey = key; }; BindShortcut(config, "ToggleKey", "F6", "Anzeige ein- oder ausblenden.", update); BindShortcut(config, "ReloadKey", "F10", "Config von der Festplatte neu laden.", delegate(KeyboardShortcut key) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) ReloadKey = key; }); BindShortcut(config, "NameOnlyKey", "F11", "Zwischen Lebensbalken und Nur-Name-Anzeige wechseln.", delegate(KeyboardShortcut key) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) NameOnlyKey = key; }); BindShortcut(config, "DesignMenuKey", "F5 + LeftShift", "Schnellmenue fuer Rahmen und Namensschrift oeffnen.", delegate(KeyboardShortcut key) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) DesignMenuKey = key; }); range = Number(config, "Visibility", "MaxDistance", 10f, 1f, 100f, "Maximale Entfernung von der Kamera zum Kopf in Metern."); RequireLineOfSight = config.Bind<bool>("Visibility", "RequireLineOfSight", true, "Ausblenden, wenn Waende oder Items Kopf und Oberkoerper verdecken."); HideInMenus = config.Bind<bool>("Visibility", "HideInMenus", true, "Bei geoeffnetem Escape-Menue verstecken."); fadeDistance = Number(config, "Visibility", "FadeDistance", 1f, 0f, 10f, "Auf den letzten Metern vor MaxDistance ausblenden. 0 = abrupt."); OcclusionMask = config.Bind<int>("Visibility", "OcclusionLayerMask", -5, "Zusaetzlicher Filter fuer die Sichtblocker des Spiels. -5 = Standard. Spieler und Trigger werden ignoriert."); NameOnly = config.Bind<bool>("Appearance", "NameOnly", false, "Nur den groesseren Namen zeigen, ohne Balken und HP-Zahlen."); ShowName = config.Bind<bool>("Appearance", "ShowName", true, "Spielernamen im normalen Modus anzeigen."); ShowNumbers = config.Bind<bool>("Appearance", "ShowNumbers", true, "Aktuelle / maximale HP anzeigen."); FrameSkin = Choice(config, "FrameSkin", "Rahmen des Lebensbalkens.", "Standard", "Cyberpunk", "Mittelalter", "Aquarium", "Galaxy", "Schrottplatz", "Kristallmine"); NameFont = Choice(config, "NameFont", "Schrift des Spielernamens. Gilt auch im Nur-Namen-Modus.", "Standard", "Xirod", "Steinmetz", "Glasbuchstaben", "Astron Boy", "Schablone", "Kristallschliff"); AnimateWarningLights = config.Bind<bool>("Appearance", "AnimateWarningLights", true, "Animiert Schrottplatz-Lampen, wachsende oder heilende Kristallrisse und schwebende Splitter. Aus = fester Effekt."); HealthNumbersInsideBar = config.Bind<bool>("Appearance", "HealthNumbersInsideBar", false, "HP-Zahlen mittig im Balken statt darunter anzeigen. Gilt, wenn ShowNumbers aktiv ist."); DistanceScaling = config.Bind<bool>("Appearance", "DistanceScaling", true, "Anzeige mit Entfernung moderat verkleinern."); scale = Number(config, "Appearance", "Scale", 1f, 0.5f, 2.5f, "Groesse; automatisch an Bildschirmhoehe angepasst."); height = Number(config, "Appearance", "HeadOffset", 0.4f, 0.1f, 1.5f, "Hoehe der gesamten Anzeige ueber dem animierten Kopf in Metern. Gilt fuer beide Ansichten.", "REPOConfigStep=0.01"); farHealthScale = Number(config, "Appearance", "FarHealthScale", 0.58f, 0.4f, 1f, "Groessenfaktor ab 12 m in der Ansicht mit Lebensbalken. Gilt bei aktivem DistanceScaling.", "REPOConfigStep=0.01"); NameFontSize = Size(config, "NameFontSize", 20, 10, 42, "Schriftgroesse des Spielernamens in beiden Ansichten."); HealthNumberFontSize = Size(config, "HealthNumberFontSize", 16, 8, 32, "Schriftgroesse der HP-Zahlen."); HealthBarWidth = Size(config, "HealthBarWidth", 144, 48, 280, "Breite des Lebensbalkens."); HealthBarHeight = Size(config, "HealthBarHeight", 8, 3, 24, "Dicke des Lebensbalkens."); opacity = Number(config, "Appearance", "Opacity", 0.85f, 0.1f, 1f, "Deckkraft."); } private static ConfigEntry<float> Number(ConfigFile config, string section, string key, float value, float min, float max, string description, params object[] tags) { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Expected O, but got Unknown return config.Bind<float>(section, key, value, new ConfigDescription(description, (AcceptableValueBase)(object)new AcceptableValueRange<float>(min, max), tags)); } private static ConfigEntry<int> Size(ConfigFile config, string key, int value, int min, int max, string description) { //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Expected O, but got Unknown return config.Bind<int>("Appearance", key, value, new ConfigDescription(description, (AcceptableValueBase)(object)new AcceptableValueRange<int>(min, max), new object[0])); } private static ConfigEntry<string> Choice(ConfigFile config, string key, string description, params string[] choices) { //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Expected O, but got Unknown return config.Bind<string>("Appearance", key, choices[0], new ConfigDescription(description, (AcceptableValueBase)(object)new AcceptableValueList<string>(choices), new object[0])); } private static void BindShortcut(ConfigFile config, string name, string defaultKey, string description, Action<KeyboardShortcut> update) { //IL_003d: Unknown result type (might be due to invalid IL or missing references) ConfigEntry<string> entry = config.Bind<string>("General", name, defaultKey, description + " Beispiele: F6 oder F6 + LeftShift. None = aus."); update(ParseShortcut(entry.Value)); entry.SettingChanged += delegate { //IL_0011: Unknown result type (might be due to invalid IL or missing references) update(ParseShortcut(entry.Value)); }; } internal static KeyboardShortcut ParseShortcut(string text) { //IL_0008: 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_009a: 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) if (string.IsNullOrWhiteSpace(text)) { return KeyboardShortcut.Empty; } string[] array = text.Split(new char[5] { ' ', '+', ',', ';', '|' }, StringSplitOptions.RemoveEmptyEntries); if (array.Length == 0) { return KeyboardShortcut.Empty; } KeyCode[] array2 = (KeyCode[])(object)new KeyCode[array.Length]; for (int i = 0; i < array.Length; i++) { if (!Enum.TryParse<KeyCode>(array[i], ignoreCase: true, out array2[i]) || !Enum.IsDefined(typeof(KeyCode), array2[i]) || (int)array2[i] == 0) { return KeyboardShortcut.Empty; } } KeyCode[] array3 = (KeyCode[])(object)new KeyCode[array2.Length - 1]; Array.Copy(array2, 1, array3, 0, array3.Length); return new KeyboardShortcut(array2[0], array3); } } internal sealed class Nameplate { private const float BarBorder = 2f; private const float NameOnlyY = 14f; private static readonly Color Green = new Color(0.28f, 0.84f, 0.48f); private static readonly Color Yellow = new Color(1f, 0.81f, 0.2f); private static readonly Color Red = new Color(0.96f, 0.25f, 0.28f); private readonly GameObject root; private readonly RectTransform rect; private readonly CanvasGroup group; private readonly Text nameText; private readonly StyledName styledName; private readonly Text numbers; private readonly Outline numberOutline; private readonly SkinAssets skins; private readonly Image border; private readonly Image trackImage; private readonly FrameGraphic frame; private FrameGraphic beacons; private Graphic hiddenNativeName; private readonly RectTransform bar; private readonly RectTransform track; private readonly Image fill; private FrameSkin activeFrame; private HealthBand activeBand; private float crystalDamage; private float crystalTarget = -1f; private float crystalUpdatedAt; private float nameWidth; private string lastName; private int lastCurrent = int.MinValue; private int lastMaximum = int.MinValue; public float LastClearSight = float.NegativeInfinity; public Nameplate(Transform parent, Font font) : this(parent, font, null) { } public Nameplate(Transform parent, Font font, SkinAssets skins) { //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Expected O, but got Unknown //IL_0095: 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_009b: 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_00b7: 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_0148: Unknown result type (might be due to invalid IL or missing references) //IL_014d: 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_0154: Unknown result type (might be due to invalid IL or missing references) //IL_016f: Unknown result type (might be due to invalid IL or missing references) //IL_0199: Unknown result type (might be due to invalid IL or missing references) //IL_01ea: Unknown result type (might be due to invalid IL or missing references) //IL_0216: Unknown result type (might be due to invalid IL or missing references) //IL_0245: Unknown result type (might be due to invalid IL or missing references) //IL_024a: Unknown result type (might be due to invalid IL or missing references) //IL_024b: Unknown result type (might be due to invalid IL or missing references) //IL_0251: Unknown result type (might be due to invalid IL or missing references) //IL_026c: Unknown result type (might be due to invalid IL or missing references) //IL_02b8: Unknown result type (might be due to invalid IL or missing references) //IL_02c8: Unknown result type (might be due to invalid IL or missing references) this.skins = skins; root = new GameObject("NearbyHealth.Nameplate", new Type[2] { typeof(RectTransform), typeof(CanvasGroup) }); rect = root.GetComponent<RectTransform>(); ((Transform)rect).SetParent(parent, false); rect.anchorMin = (rect.anchorMax = Vector2.zero); rect.pivot = new Vector2(0.5f, 0f); group = root.GetComponent<CanvasGroup>(); group.blocksRaycasts = false; group.interactable = false; nameText = Label("Name", font); styledName = Graphic<StyledName>("StyledName", (Transform)(object)rect); ((Graphic)styledName).color = ((Graphic)nameText).color; ((Graphic)styledName).rectTransform.anchorMin = (((Graphic)styledName).rectTransform.anchorMax = new Vector2(0.5f, 0f)); ((Graphic)styledName).rectTransform.pivot = new Vector2(0.5f, 0f); border = Box("Border", (Transform)(object)rect, new Color(0.03f, 0.04f, 0.04f, 0.95f)); bar = ((Graphic)border).rectTransform; frame = FrameLayer("Frame"); trackImage = Box("MissingHealth", (Transform)(object)bar, new Color(0.27f, 0.1f, 0.12f, 1f)); track = ((Graphic)trackImage).rectTransform; fill = Box("Health", (Transform)(object)bar, Color.green); ((Graphic)fill).rectTransform.anchorMin = (((Graphic)fill).rectTransform.anchorMax = new Vector2(0f, 0f)); ((Graphic)fill).rectTransform.pivot = new Vector2(0f, 0.5f); numbers = Label("HP", font); numberOutline = ((Component)numbers).gameObject.AddComponent<Outline>(); ((Shadow)numberOutline).effectColor = new Color(0f, 0f, 0f, 0.95f); ((Shadow)numberOutline).effectDistance = Vector2.one; ((Behaviour)numberOutline).enabled = false; Hide(); } private FrameGraphic FrameLayer(string name) { //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0039: 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_003f: 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) FrameGraphic frameGraphic = Graphic<FrameGraphic>(name, (Transform)(object)bar); ((Graphic)frameGraphic).rectTransform.anchorMin = Vector2.zero; ((Graphic)frameGraphic).rectTransform.anchorMax = Vector2.one; RectTransform rectTransform = ((Graphic)frameGraphic).rectTransform; Vector2 offsetMin = (((Graphic)frameGraphic).rectTransform.offsetMax = Vector2.zero); rectTransform.offsetMin = offsetMin; return frameGraphic; } private static T Graphic<T>(string name, Transform parent) where T : SkinGraphic { //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Expected O, but got Unknown GameObject val = new GameObject(name, new Type[3] { typeof(RectTransform), typeof(CanvasRenderer), typeof(T) }); val.transform.SetParent(parent, false); T component = val.GetComponent<T>(); ((Graphic)component).raycastTarget = false; ((Behaviour)component).enabled = false; return component; } private Text Label(string name, Font font) { //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Expected O, but got Unknown //IL_0069: Unknown result type (might be due to invalid IL or missing references) //IL_006e: 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_0088: Unknown result type (might be due to invalid IL or missing references) //IL_0093: Unknown result type (might be due to invalid IL or missing references) //IL_00e3: Unknown result type (might be due to invalid IL or missing references) //IL_0109: 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) GameObject val = new GameObject(name, new Type[4] { typeof(RectTransform), typeof(CanvasRenderer), typeof(Text), typeof(Shadow) }); RectTransform component = val.GetComponent<RectTransform>(); ((Transform)component).SetParent((Transform)(object)rect, false); Vector2 anchorMin = (component.anchorMax = new Vector2(0.5f, 0f)); component.anchorMin = anchorMin; component.pivot = new Vector2(0.5f, 0f); component.anchoredPosition = Vector2.zero; Text component2 = val.GetComponent<Text>(); component2.font = font; component2.alignment = (TextAnchor)4; component2.supportRichText = false; ((Graphic)component2).raycastTarget = false; component2.horizontalOverflow = (HorizontalWrapMode)1; component2.verticalOverflow = (VerticalWrapMode)0; ((Graphic)component2).color = new Color(0.92f, 0.96f, 0.94f, 1f); Shadow component3 = val.GetComponent<Shadow>(); component3.effectColor = new Color(0f, 0f, 0f, 0.95f); component3.effectDistance = new Vector2(1f, -1f); return component2; } private static Image Box(string name, Transform parent, Color color) { //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Expected O, but got Unknown //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Unknown result type (might be due to invalid IL or missing references) //IL_0057: 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) //IL_0070: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Unknown result type (might be due to invalid IL or missing references) //IL_008d: Unknown result type (might be due to invalid IL or missing references) GameObject val = new GameObject(name, new Type[3] { typeof(RectTransform), typeof(CanvasRenderer), typeof(Image) }); RectTransform component = val.GetComponent<RectTransform>(); ((Transform)component).SetParent(parent, false); Vector2 anchorMin = (component.anchorMax = new Vector2(0.5f, 0f)); component.anchorMin = anchorMin; component.pivot = new Vector2(0.5f, 0.5f); component.anchoredPosition = Vector2.zero; Image component2 = val.GetComponent<Image>(); ((Graphic)component2).color = color; ((Graphic)component2).raycastTarget = false; return component2; } private void UpdateLayout(Settings settings, bool nameOnly, bool showNumbers, string frameStyle) { //IL_0144: 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_013d: 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_00e2: Unknown result type (might be due to invalid IL or missing references) //IL_0153: 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_0199: Unknown result type (might be due to invalid IL or missing references) //IL_0305: Unknown result type (might be due to invalid IL or missing references) //IL_0321: Unknown result type (might be due to invalid IL or missing references) //IL_0340: Unknown result type (might be due to invalid IL or missing references) //IL_0360: Unknown result type (might be due to invalid IL or missing references) //IL_037d: Unknown result type (might be due to invalid IL or missing references) //IL_03ac: Unknown result type (might be due to invalid IL or missing references) //IL_03de: Unknown result type (might be due to invalid IL or missing references) //IL_040e: Unknown result type (might be due to invalid IL or missing references) //IL_0422: Unknown result type (might be due to invalid IL or missing references) //IL_0449: Unknown result type (might be due to invalid IL or missing references) //IL_0459: Unknown result type (might be due to invalid IL or missing references) //IL_0474: Unknown result type (might be due to invalid IL or missing references) int value = settings.NameFontSize.Value; int value2 = settings.HealthNumberFontSize.Value; FrameSkin frameSkin = ((nameOnly || skins == null) ? null : skins.Frame(frameStyle)); bool flag = showNumbers && settings.HealthNumbersInsideBar.Value; float num = (float)value2 + 4f; Vector2 val = default(Vector2); ((Vector2)(ref val))..ctor((float)settings.HealthBarWidth.Value, (float)settings.HealthBarHeight.Value); if (flag) { val.x = Mathf.Max(val.x, (float)value2 * 8f); val.y = Mathf.Max(val.y, num + 2f); } if (((Component)bar).gameObject.activeSelf != nameOnly && nameText.fontSize == value && numbers.fontSize == value2 && track.sizeDelta == val && ((Behaviour)numberOutline).enabled == flag && frameSkin == activeFrame) { return; } ((Component)bar).gameObject.SetActive(!nameOnly); if (frameSkin != activeFrame) { crystalTarget = -1f; } activeFrame = frameSkin; Vector4 newEdges = frameSkin?.Edges(val.y) ?? (Vector4.one * 2f); frame.Apply(frameSkin, newEdges); if (frameSkin != null && Object.op_Implicit((Object)(object)frameSkin.WarningLights)) { if (!Object.op_Implicit((Object)(object)beacons)) { beacons = FrameLayer("Warning lights"); } beacons.Apply(frameSkin, newEdges, frameSkin.WarningLights); } else if (Object.op_Implicit((Object)(object)beacons)) { ((Behaviour)beacons).enabled = false; } Image obj = border; bool enabled = (((Behaviour)trackImage).enabled = frameSkin == null); ((Behaviour)obj).enabled = enabled; fill.sprite = frameSkin?.Fill; fill.type = (Type)(frameSkin != null); nameText.fontSize = value; numbers.fontSize = value2; ((Behaviour)numberOutline).enabled = flag; numbers.resizeTextForBestFit = flag; numbers.resizeTextMinSize = 8; numbers.resizeTextMaxSize = value2; float num2 = val.y / 2f + newEdges.z; float num3 = val.x + newEdges.x + newEdges.y; float num4 = val.y + newEdges.z + newEdges.w; float num5 = (flag ? 0f : num); float num6 = (nameOnly ? 14f : (num5 + num4 + 2f)); float num7 = (float)value + 8f; nameWidth = (nameOnly ? ((float)value * 10f) : Mathf.Max(num3, (float)value * 5f)); rect.sizeDelta = new Vector2(Mathf.Max((float)value * 10f, num3), num6 + num7); ((Graphic)nameText).rectTransform.anchoredPosition = new Vector2(0f, num6); ((Graphic)nameText).rectTransform.sizeDelta = new Vector2((float)value * 10f, num7); ((Graphic)styledName).rectTransform.anchoredPosition = ((Graphic)nameText).rectTransform.anchoredPosition; ((Graphic)styledName).rectTransform.sizeDelta = new Vector2(nameWidth, num7); ((Graphic)numbers).rectTransform.anchoredPosition = new Vector2(0f, flag ? (num2 - num / 2f) : 0f); ((Graphic)numbers).rectTransform.sizeDelta = new Vector2(flag ? val.x : Mathf.Max((float)value2 * 9f, num3), num); bar.anchoredPosition = new Vector2((newEdges.y - newEdges.x) / 2f, num5 + num4 / 2f); bar.sizeDelta = new Vector2(num3, num4); track.anchoredPosition = new Vector2((newEdges.x - newEdges.y) / 2f, num2); track.sizeDelta = val; ((Graphic)fill).rectTransform.anchoredPosition = new Vector2(newEdges.x, num2); } public void Draw(Vector2 position, float scale, float alpha, string playerName, int current, int maximum, Settings settings) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) Render(position, scale, alpha, playerName, current, maximum, settings, settings.FrameSkin.Value, settings.NameFont.Value, preview: false); } public void DrawPreview(Vector2 center, Vector2 available, Settings settings, string frameStyle, string fontStyle) { //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0059: 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) //IL_0093: Unknown result type (might be due to invalid IL or missing references) //IL_0099: 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_00aa: Unknown result type (might be due to invalid IL or missing references) //IL_00be: Unknown result type (might be due to invalid IL or missing references) //IL_00c3: Unknown result type (might be due to invalid IL or missing references) FrameSkin frameSkin = ((skins == null) ? null : skins.Frame(frameStyle)); int current = ((frameSkin != null && Object.op_Implicit((Object)(object)frameSkin.WarningLights)) ? 25 : 78); Render(Vector2.zero, 1f, 1f, "Mitspieler", current, 100, settings, frameStyle, fontStyle, preview: true); Vector2 sizeDelta = rect.sizeDelta; float num = Mathf.Min(1.45f, Mathf.Min(available.x / sizeDelta.x, available.y / sizeDelta.y)); ((Transform)rect).localScale = Vector3.one * num; rect.anchoredPosition = center - Vector2.up * (sizeDelta.y * num / 2f); } private void Render(Vector2 position, float scale, float alpha, string playerName, int current, int maximum, Settings settings, string frameStyle, string fontStyle, bool preview) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_0181: Unknown result type (might be due to invalid IL or missing references) //IL_0194: 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_01c2: Unknown result type (might be due to invalid IL or missing references) rect.anchoredPosition = position; ((Transform)rect).localScale = Vector3.one * scale; group.alpha = alpha; bool flag = !preview && settings.NameOnly.Value; bool flag2 = !flag && (preview || settings.ShowNumbers.Value); UpdateLayout(settings, flag, flag2, frameStyle); bool flag3 = preview || flag || settings.ShowName.Value; ((Behaviour)numbers).enabled = flag2; if (lastName != playerName) { nameText.text = HealthRules.SafeName(playerName); lastName = playerName; } NameFont requestedFont = ((flag3 && skins != null) ? skins.Font(fontStyle) : null); bool flag4 = styledName.Apply(requestedFont, nameText.text, settings.NameFontSize.Value, nameWidth); ((Behaviour)nameText).enabled = flag3 && !flag4; if (!flag) { if (lastCurrent != current || lastMaximum != maximum) { numbers.text = Mathf.Max(0, current) + " / " + maximum; lastCurrent = current; lastMaximum = maximum; } float num = HealthRules.Fraction(current, maximum); ((Graphic)fill).rectTransform.sizeDelta = new Vector2(track.sizeDelta.x * num, track.sizeDelta.y); activeBand = HealthRules.Band(current); ((Graphic)fill).color = FillColor(activeBand); UpdateWarningEffect(settings.AnimateWarningLights.Value); } if (!root.activeSelf) { root.SetActive(true); } } private Color FillColor(HealthBand band) { //IL_0004: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Unknown result type (might be due to invalid IL or missing references) switch (band) { case HealthBand.Red: return Red; case HealthBand.Yellow: return Yellow; default: if (activeFrame != null) { return activeFrame.HealthyColor; } return Green; } } public void UpdateWarningEffect(bool animate) { if (!Object.op_Implicit((Object)(object)beacons) || activeFrame == null || !Object.op_Implicit((Object)(object)activeFrame.WarningLights)) { return; } if (activeFrame.HasCrystalDecay) { UpdateCrystalDecay(animate, Time.unscaledTime); return; } ((Behaviour)beacons).enabled = activeBand == HealthBand.Red; if (((Behaviour)beacons).enabled) { float num = (animate ? (0.5f - 0.5f * Mathf.Cos(Time.unscaledTime * 5.2359877f)) : 0f); ((Graphic)beacons).canvasRenderer.SetAlpha(animate ? (0.25f + 0.75f * num * num) : 0.8f); } } private void UpdateCrystalDecay(bool animate, float now) { float num = (float)activeBand; if (!animate || crystalTarget < 0f) { crystalDamage = num; } else { crystalDamage = Mathf.MoveTowards(crystalDamage, crystalTarget, Mathf.Max(0f, now - crystalUpdatedAt) / 0.48f); } crystalTarget = num; crystalUpdatedAt = now; int num2 = Mathf.RoundToInt(crystalDamage * 8f); ((Behaviour)beacons).enabled = num2 > 0; if (((Behaviour)beacons).enabled) { int shards = (animate ? (Mathf.FloorToInt(now * 10f) % 24) : 24); byte opacity = (byte)Mathf.RoundToInt(Mathf.Clamp01(crystalDamage - 1f) * 255f); beacons.ShowCrystalDecay(24 + num2, shards, opacity); } } public void ReplaceNativeName(Graphic label) { if ((Object)(object)hiddenNativeName != (Object)(object)label) { RestoreNativeName(); } if (Object.op_Implicit((Object)(object)label) && ((Behaviour)label).enabled) { hiddenNativeName = label; ((Behaviour)label).enabled = false; } } private void RestoreNativeName() { if (Object.op_Implicit((Object)(object)hiddenNativeName)) { ((Behaviour)hiddenNativeName).enabled = true; } hiddenNativeName = null; } public void Hide() { LastClearSight = float.NegativeInfinity; crystalTarget = -1f; if (Object.op_Implicit((Object)(object)root) && root.activeSelf) { root.SetActive(false); } RestoreNativeName(); } public void Dispose() { RestoreNativeName(); if (Object.op_Implicit((Object)(object)root)) { Object.Destroy((Object)(object)root); } } } internal sealed class SkinAssets : IDisposable { private readonly List<Object> texturesAndSprites = new List<Object>(); private readonly FrameSkin cyberpunk; private readonly FrameSkin medieval; private readonly FrameSkin aquarium; private readonly FrameSkin galaxy; private readonly FrameSkin scrapyard; private readonly FrameSkin crystalMine; private readonly NameFont xirod; private readonly NameFont steinmetz; private readonly NameFont glassLetters; private readonly NameFont astronBoy; private readonly NameFont stencil; private readonly NameFont crystalCut; public SkinAssets(ManualLogSource logger) { Func<FrameSkin> load = () => LoadFrame("Cyberpunk", new Rect(280f, 152f, 988f, 92f), 1536, 408, new Color(0.24f, 1f, 0.78f)); cyberpunk = TryLoad(logger, "Cyberpunk", load); medieval = TryLoad(logger, "Mittelalter", () => LoadFrame("Mittelalter", new Rect(299f, 163f, 938f, 93f), 1536, 416, new Color(0.56f, 1f, 0.28f))); aquarium = TryLoad(logger, "Aquarium", () => LoadFrame("Aquarium", new Rect(280f, 152f, 988f, 92f), 1536, 408, new Color(0.18f, 1f, 0.64f))); galaxy = TryLoad(logger, "Galaxy", () => LoadFrame("Galaxy", new Rect(184f, 176f, 988f, 92f), 1348, 408, new Color(0.2f, 1f, 0.78f))); Texture2D warningLights = TryLoad(logger, "Schrottplatz-Warnlampen", () => LoadTexture("SchrottplatzLights")); scrapyard = TryLoad(logger, "Schrottplatz", () => LoadFrame("Schrottplatz", new Rect(274f, 158f, 988f, 92f), 1536, 408, new Color(0.34f, 0.94f, 0.52f), warningLights)); Texture2D crystalDecay = TryLoad(logger, "Kristallverfall", () => LoadTexture("KristallmineDecay")); crystalMine = TryLoad(logger, "Kristallmine", () => LoadFrame("Kristallmine", new Rect(274f, 158f, 988f, 92f), 1536, 408, new Color(0.44f, 0.92f, 0.56f), crystalDecay, hasCrystalDecay: true)); xirod = TryLoad(logger, "Xirod", () => LoadFont("Xirod")); steinmetz = TryLoad(logger, "Steinmetz", () => LoadFont("Steinmetz")); glassLetters = TryLoad(logger, "Glasbuchstaben", () => LoadFont("Glasbuchstaben")); astronBoy = TryLoad(logger, "Astron Boy", () => LoadFont("AstronBoy")); stencil = TryLoad(logger, "Schablone", () => LoadFont("Schablone")); crystalCut = TryLoad(logger, "Kristallschliff", () => LoadFont("Kristallschliff")); } public FrameSkin Frame(string name) { return name switch { "Cyberpunk" => cyberpunk, "Mittelalter" => medieval, "Aquarium" => aquarium, "Galaxy" => galaxy, "Schrottplatz" => scrapyard, "Kristallmine" => crystalMine, _ => null, }; } public NameFont Font(string name) { return name switch { "Xirod" => xirod, "Steinmetz" => steinmetz, "Glasbuchstaben" => glassLetters, "Astron Boy" => astronBoy, "Schablone" => stencil, "Kristallschliff" => crystalCut, _ => null, }; } private static T TryLoad<T>(ManualLogSource logger, string name, Func<T> load) where T : class { try { return load(); } catch (Exception ex) { logger.LogWarning((object)("Nearby Health asset " + name + " unavailable: " + ex.Message)); return null; } } private FrameSkin LoadFrame(string name, Rect openingFromTop, int width, int height, Color healthy, Texture2D warningLights = null, bool hasCrystalDecay = false) { //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_0042: 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_00b8: Unknown result type (might be due to invalid IL or missing references) //IL_00ba: Unknown result type (might be due to invalid IL or missing references) Texture2D texture = LoadTexture(name); Texture2D val = LoadTexture(name + "Fill"); Sprite val2 = Sprite.Create(val, new Rect(0f, 0f, (float)((Texture)val).width, (float)((Texture)val).height), Vector2.one * 0.5f, 100f, 0u, (SpriteMeshType)0, new Vector4(4f, 4f, 4f, 4f)); ((Object)val2).name = "NearbyHealth." + name + "Fill"; texturesAndSprites.Add((Object)(object)val2); Rect opening = default(Rect); ((Rect)(ref opening))..ctor(((Rect)(ref openingFromTop)).x, (float)height - ((Rect)(ref openingFromTop)).yMax, ((Rect)(ref openingFromTop)).width, ((Rect)(ref openingFromTop)).height); return new FrameSkin(texture, val2, healthy, opening, width, height, warningLights, hasCrystalDecay); } private NameFont LoadFont(string name) { //IL_00d0: Unknown result type (might be due to invalid IL or missing references) //IL_00d5: Unknown result type (might be due to invalid IL or missing references) Texture2D val = LoadTexture(name); Dictionary<char, NameGlyph> dictionary = new Dictionary<char, NameGlyph>(); using StreamReader streamReader = new StreamReader(Open(name + ".tsv")); float em = ReadFloat(streamReader.ReadLine()); string text; Rect uv = default(Rect); while ((text = streamReader.ReadLine()) != null) { string[] array = text.Split('\t'); float num = ReadFloat(array[1]); float num2 = ReadFloat(array[2]); float num3 = ReadFloat(array[3]); float num4 = ReadFloat(array[4]); ((Rect)(ref uv))..ctor(num / (float)((Texture)val).width, ((float)((Texture)val).height - num2 - num4) / (float)((Texture)val).height, num3 / (float)((Texture)val).width, num4 / (float)((Texture)val).height); dictionary.Add((char)int.Parse(array[0], CultureInfo.InvariantCulture), new NameGlyph(new Rect(ReadFloat(array[6]), ReadFloat(array[7]) - num4, num3, num4), uv, ReadFloat(array[5]))); } return new NameFont(val, em, dictionary); } private static float ReadFloat(string value) { return float.Parse(value, CultureInfo.InvariantCulture); } private static Stream Open(string filename) { Stream manifestResourceStream = typeof(SkinAssets).Assembly.GetManifestResourceStream("NearbyHealth.Assets." + filename); if (manifestResourceStream == null) { throw new FileNotFoundException(filename); } return manifestResourceStream; } private Texture2D LoadTexture(string name) { //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Expected O, but got Unknown byte[] array; using (Stream stream = Open(name + ".png")) { using MemoryStream memoryStream = new MemoryStream(); stream.CopyTo(memoryStream); array = memoryStream.ToArray(); } Texture2D val = new Texture2D(2, 2, (TextureFormat)4, false); texturesAndSprites.Add((Object)(object)val); if (!ImageConversion.LoadImage(val, array, true)) { throw new InvalidDataException(name + ".png"); } ((Object)val).name = "NearbyHealth." + name; ((Texture)val).wrapMode = (TextureWrapMode)1; ((Texture)val).filterMode = (FilterMode)1; return val; } public void Dispose() { for (int num = texturesAndSprites.Count - 1; num >= 0; num--) { Object.Destroy(texturesAndSprites[num]); } texturesAndSprites.Clear(); } } internal sealed class FrameSkin { public const int ShardFrames = 24; public const int CrackStepsPerBand = 8; public const int CrystalAtlasColumns = 4; public const int CrystalAtlasRows = 11; public readonly Texture2D Texture; public readonly Texture2D WarningLights; public readonly bool HasCrystalDecay; public readonly Sprite Fill; public readonly Color HealthyColor; public readonly Rect OpeningUV; private readonly Vector4 margins; private readonly float apertureHeight; public FrameSkin(Texture2D texture, Sprite fill, Color color, Rect opening, int width, int height, Texture2D warningLights, bool hasCrystalDecay) { //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_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_0087: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Unknown result type (might be due to invalid IL or missing references) Texture = texture; WarningLights = warningLights; HasCrystalDecay = hasCrystalDecay; Fill = fill; HealthyColor = color; OpeningUV = new Rect(((Rect)(ref opening)).x / (float)width, ((Rect)(ref opening)).y / (float)height, ((Rect)(ref opening)).width / (float)width, ((Rect)(ref opening)).height / (float)height); margins = new Vector4(((Rect)(ref opening)).xMin, (float)width - ((Rect)(ref opening)).xMax, ((Rect)(ref opening)).yMin, (float)height - ((Rect)(ref opening)).yMax); apertureHeight = ((Rect)(ref opening)).height; } public Vector4 Edges(float trackHeight) { //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Unknown result type (might be due to invalid IL or missing references) float num = Mathf.Clamp(trackHeight / apertureHeight, 0.07f, 0.13f); if (HasCrystalDecay) { num *= 1.55f; } return margins * num; } } internal sealed class NameFont { public readonly Texture2D Texture; public readonly float Em; public readonly Dictionary<char, NameGlyph> Glyphs; public NameFont(Texture2D texture, float em, Dictionary<char, NameGlyph> glyphs) { Texture = texture; Em = em; Glyphs = glyphs; } } internal struct NameGlyph { public readonly Rect Bounds; public readonly Rect UV; public readonly float Advance; public NameGlyph(Rect bounds, Rect uv, float advance) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Unknown result type (might be due to invalid IL or missing references) Bounds = bounds; UV = uv; Advance = advance; } } internal abstract class SkinGraphic : MaskableGraphic { protected static void Quad(VertexHelper mesh, Rect bounds, Rect uv, Color32 tint) { //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_005c: 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_007a: Unknown result type (might be due to invalid IL or missing references) //IL_007f: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Unknown result type (might be due to invalid IL or missing references) //IL_0093: Unknown result type (might be due to invalid IL or missing references) //IL_00ac: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: Unknown result type (might be due to invalid IL or missing references) //IL_00c0: 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) int currentVertCount = mesh.currentVertCount; mesh.AddVert(new Vector3(((Rect)(ref bounds)).xMin, ((Rect)(ref bounds)).yMin), tint, Vector4.op_Implicit(new Vector2(((Rect)(ref uv)).xMin, ((Rect)(ref uv)).yMin))); mesh.AddVert(new Vector3(((Rect)(ref bounds)).xMin, ((Rect)(ref bounds)).yMax), tint, Vector4.op_Implicit(new Vector2(((Rect)(ref uv)).xMin, ((Rect)(ref uv)).yMax))); mesh.AddVert(new Vector3(((Rect)(ref bounds)).xMax, ((Rect)(ref bounds)).yMax), tint, Vector4.op_Implicit(new Vector2(((Rect)(ref uv)).xMax, ((Rect)(ref uv)).yMax))); mesh.AddVert(new Vector3(((Rect)(ref bounds)).xMax, ((Rect)(ref bounds)).yMin), tint, Vector4.op_Implicit(new Vector2(((Rect)(ref uv)).xMax, ((Rect)(ref uv)).yMin))); mesh.AddTriangle(currentVertCount, currentVertCount + 1, currentVertCount + 2); mesh.AddTriangle(currentVertCount + 2, currentVertCount + 3, currentVertCount); } } internal sealed class FrameGraphic : SkinGraphic { private FrameSkin skin; private Texture2D texture; private bool sideOverlay; private int crackFrame; private int shardFrame; private byte shardOpacity; private Vector4 edges; private readonly float[] xs = new float[4]; private readonly float[] ys = new float[4]; private readonly float[] us = new float[4]; private readonly float[] vs = new float[4]; public override Texture mainTexture { get { if (!Object.op_Implicit((Object)(object)texture)) { return ((Graphic)this).mainTexture; } return (Texture)(object)texture; } } public void Apply(FrameSkin newSkin, Vector4 newEdges, Texture2D overlay = null) { //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) skin = newSkin; sideOverlay = Object.op_Implicit((Object)(object)overlay); Texture2D val = (sideOverlay ? overlay : ((skin == null) ? null : skin.Texture)); bool flag = (Object)(object)texture != (Object)(object)val; texture = val; edges = newEdges; ((Behaviour)this).enabled = skin != null; if (flag) { crackFrame = (shardFrame = 0); shardOpacity = 0; if (sideOverlay) { ((Graphic)this).canvasRenderer.SetAlpha(1f); } ((Graphic)this).SetMaterialDirty(); } ((Graphic)this).SetVerticesDirty(); } public void ShowCrystalDecay(int cracks, int shards, byte opacity) { if (crackFrame != cracks || shardOpacity != opacity || (opacity != 0 && shardFrame != shards)) { crackFrame = cracks; shardFrame = shards; shardOpacity = opacity; ((Graphic)this).SetVerticesDirty(); } } protected override void OnPopulateMesh(VertexHelper mesh) { //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_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_0116: Unknown result type (might be due to invalid IL or missing references) //IL_0119: Unknown result type (might be due to invalid IL or missing references) //IL_011e: Unknown result type (might be due to invalid IL or missing references) //IL_00bc: 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_00c9: 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_00e2: Unknown result type (might be due to invalid IL or missing references) //IL_00e7: Unknown result type (might be due to invalid IL or missing references) //IL_0106: Unknown result type (might be due to invalid IL or missing references) //IL_010d: Unknown result type (might be due to invalid IL or missing references) mesh.Clear(); if (skin == null) { return; } Rect rect = ((Graphic)this).rectTransform.rect; Rect openingUV = skin.OpeningUV; Split(xs, ((Rect)(ref rect)).xMin, ((Rect)(ref rect)).xMin + edges.x, ((Rect)(ref rect)).xMax - edges.y, ((Rect)(ref rect)).xMax); Split(ys, ((Rect)(ref rect)).yMin, ((Rect)(ref rect)).yMin + edges.z, ((Rect)(ref rect)).yMax - edges.w, ((Rect)(ref rect)).yMax); if (sideOverlay && skin.HasCrystalDecay) { DrawFrame(mesh, openingUV, crackFrame, Color32.op_Implicit(((Graphic)this).color)); if (shardOpacity > 0) { Color32 tint = Color32.op_Implicit(((Graphic)this).color); tint.a = (byte)(tint.a * shardOpacity / 255); DrawFrame(mesh, openingUV, shardFrame, tint); } } else { DrawFrame(mesh, openingUV, -1, Color32.op_Implicit(((Graphic)this).color)); } } private void DrawFrame(VertexHelper mesh, Rect inner, int atlasFrame, Color32 tint) { //IL_00d0: Unknown result type (might be due to invalid IL or missing references) //IL_00fb: Unknown result type (might be due to invalid IL or missing references) //IL_0100: Unknown result type (might be due to invalid IL or missing references) Split(us, 0f, ((Rect)(ref inner)).xMin, ((Rect)(ref inner)).xMax, 1f); Split(vs, 0f, ((Rect)(ref inner)).yMin, ((Rect)(ref inner)).yMax, 1f); if (atlasFrame >= 0) { int num = atlasFrame % 4; int num2 = 10 - atlasFrame / 4; for (int i = 0; i < 4; i++) { us[i] = ((float)num + us[i]) / 4f; vs[i] = ((float)num2 + vs[i]) / 11f; } } for (int j = 0; j < 3; j++) { for (int k = 0; k < 3; k++) { if (!sideOverlay || k != 1) { SkinGraphic.Quad(mesh, Rect.MinMaxRect(xs[k], ys[j], xs[k + 1], ys[j + 1]), Rect.MinMaxRect(us[k], vs[j], us[k + 1], vs[j + 1]), tint); } } } } private static void Split(float[] axis, float first, float second, float third, float fourth) { axis[0] = first; axis[1] = second; axis[2] = third; axis[3] = fourth; } } internal sealed class StyledName : SkinGraphic { private NameFont font; private string caption; private float size; private float maxWidth; public override Texture mainTexture { get { if (font == null) { return ((Graphic)this).mainTexture; } return (Texture)(object)font.Texture; } } public bool Apply(NameFont requestedFont, string name, float fontSize, float width) { if (font == requestedFont && caption == name && size == fontSize && maxWidth == width) { return ((Behaviour)this).enabled; } bool flag = font != requestedFont; font = requestedFont; caption = name; size = fontSize; maxWidth = width; ((Behaviour)this).enabled = CanDrawName(); if (flag) { ((Graphic)this).SetMaterialDirty(); } ((Graphic)this).SetVerticesDirty(); return ((Behaviour)this).enabled; } private bool CanDrawName() { if (font == null || string.IsNullOrEmpty(caption)) { return false; } string text = caption; foreach (char key in text) { if (!font.Glyphs.ContainsKey(key)) { return false; } } return true; } protected override void OnPopulateMesh(VertexHelper mesh) { //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_0071: 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_0088: Unknown result type (might be due to invalid IL or missing references) //IL_0123: Unknown result type (might be due to invalid IL or missing references) //IL_0128: Unknown result type (might be due to invalid IL or missing references) //IL_0155: Unknown result type (might be due to invalid IL or missing references) //IL_016d: Unknown result type (might be due to invalid IL or missing references) //IL_0174: Unknown result type (might be due to invalid IL or missing references) //IL_0179: Unknown result type (might be due to invalid IL or missing references) //IL_017e: Unknown result type (might be due to invalid IL or missing references) //IL_0182: 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_0193: Unknown result type (might be due to invalid IL or missing references) //IL_01ae: Unknown result type (might be due to invalid IL or missing references) //IL_01b3: 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_01c4: Unknown result type (might be due to invalid IL or missing references) //IL_01c9: Unknown result type (might be due to invalid IL or missing references) //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_00b5: Unknown result type (might be due to invalid IL or missing references) //IL_00ba: Unknown result type (might be due to invalid IL or missing references) //IL_00cd: 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_00e5: 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) mesh.Clear(); if (font == null || string.IsNullOrEmpty(caption)) { return; } float num = 0f; float num2 = float.PositiveInfinity; float num3 = float.PositiveInfinity; float num4 = float.NegativeInfinity; float num5 = float.NegativeInfinity; string text = caption; foreach (char key in text) { NameGlyph nameGlyph = font.Glyphs[key]; Rect bounds = nameGlyph.Bounds; if (((Rect)(ref bounds)).width > 0f) { Rect bounds2 = nameGlyph.Bounds; if (((Rect)(ref bounds2)).height > 0f) { float num6 = num2; float num7 = num; Rect bounds3 = nameGlyph.Bounds; num2 = Mathf.Min(num6, num7 + ((Rect)(ref bounds3)).xMin); float num8 = num4; float num9 = num; Rect bounds4 = nameGlyph.Bounds; num4 = Mathf.Max(num8, num9 + ((Rect)(ref bounds4)).xMax); float num10 = num3; Rect bounds5 = nameGlyph.Bounds; num3 = Mathf.Min(num10, ((Rect)(ref bounds5)).yMin); float num11 = num5; Rect bounds6 = nameGlyph.Bounds; num5 = Mathf.Max(num11, ((Rect)(ref bounds6)).yMax); } } num += nameGlyph.Advance; } if (!(num4 <= num2)) { Rect rect = ((Graphic)this).rectTransform.rect; float num12 = Mathf.Min(size / font.Em, (maxWidth - 2f) / (num4 - num2)); Vector2 val = ((Rect)(ref rect)).center - new Vector2((num2 + num4) * 0.5f, (num3 + num5) * 0.5f) * num12; DrawLetters(mesh, val + new Vector2(1f, -1f), num12, Color32.op_Implicit(new Color(0f, 0f, 0f, 0.95f))); DrawLetters(mesh, val, num12, Color32.op_Implicit(((Graphic)this).color)); } } private void DrawLetters(VertexHelper mesh, Vector2 origin, float scale, Color32 tint) { //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_008d: 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_0099: Unknown result type (might be due to invalid IL or missing references) float num = 0f; string text = caption; foreach (char key in text) { NameGlyph nameGlyph = font.Glyphs[key]; Rect bounds = nameGlyph.Bounds; if (((Rect)(ref bounds)).width > 0f && ((Rect)(ref bounds)).height > 0f) { SkinGraphic.Quad(mesh, new Rect(origin.x + (num + ((Rect)(ref bounds)).x) * scale, origin.y + ((Rect)(ref bounds)).y * scale, ((Rect)(ref bounds)).width * scale, ((Rect)(ref bounds)).height * scale), nameGlyph.UV, tint); } num += nameGlyph.Advance; } } } internal sealed class AppearanceMenu { private const float Width = 396f; private const float Height = 342f; private static readonly Color Background = new Color(0.055f, 0.074f, 0.085f, 0.98f); private static readonly Color Surface = new Color(0.082f, 0.107f, 0.119f, 1f); private static readonly Color Selected = new Color(0.13f, 0.25f, 0.25f, 1f); private static readonly Color Accent = new Color(0.53f, 0.96f, 0.83f, 1f); private static readonly Color Ink = new Color(0.94f, 0.97f, 0.97f, 1f); private static readonly Color Quiet = new Color(0.71f, 0.78f, 0.8f, 1f); private readonly ConfigFile config; private readonly Settings settings; private readonly Canvas canvas; private readonly RectTransform panel; private readonly Nameplate preview; private readonly ConfigEntry<string>[] entries; private readonly string[][] choices; private readonly int[] draft = new int[2]; private readonly Image[] backgrounds = (Image[])(object)new Image[2]; private readonly Image[] markers = (Image[])(object)new Image[2]; private readonly Text[] values = (Text[])(object)new Text[2]; private readonly Text status; private int row; public bool IsOpen => ((Component)panel).gameObject.activeSelf; public AppearanceMenu(Transform parent, Font font, SkinAssets skins, Settings settings, ConfigFile config) { //IL_00bd: Unknown result type (might be due to invalid IL or missing references) //IL_00c3: Expected O, but got Unknown //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_0142: 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) //IL_0144: 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_0158: Unknown result type (might be due to invalid IL or missing references) //IL_0187: 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_0209: Unknown result type (might be due to invalid IL or missing references) //IL_0236: Unknown result type (might be due to invalid IL or missing references) //IL_0278: Unknown result type (might be due to invalid IL or missing references) //IL_02a8: Unknown result type (might be due to invalid IL or missing references) this.settings = settings; this.config = config; entries = new ConfigEntry<string>[2] { settings.FrameSkin, settings.NameFont }; choices = Array.ConvertAll(entries, (ConfigEntry<string> entry) => ((AcceptableValueList<string>)(object)((ConfigEntryBase)entry).Description.AcceptableValues).AcceptableValues); GameObject val = new GameObject("NearbyHealth.Designs", new Type[2] { typeof(RectTransform), typeof(Canvas) }); val.transform.SetParent(parent, false); canvas = val.GetComponent<Canvas>(); canvas.renderMode = (RenderMode)0; canvas.sortingOrder = 25; panel = Rect("Design menu", ((Component)canvas).transform, 0f, 0f, 396f, 342f); panel.anchorMin = (panel.anchorMax = (panel.pivot = Vector2.one)); ImageFor(panel, Background); ImageFor(Rect("Top rule", (Transform)(object)panel, 0f, 340f, 396f, 2f), Accent); Label((Transform)(object)panel, font, "Designs", 18f, 287f, 360f, 36f, 25, Ink, (TextAnchor)3, (FontStyle)1); BuildRow(0, font, "Rahmen", 237f); BuildRow(1, font, "Namensschrift", 187f); ImageFor(Rect("Preview area", (Transform)(object)panel, 18f, 57f, 360f, 119f), Surface); Label((Transform)(object)panel, font, "Vorschau", 30f, 147f, 160f, 23f, 14, Quiet, (TextAnchor)3, (FontStyle)0); preview = new Nameplate((Transform)(object)panel, font, skins); Label((Transform)(object)panel, font, "↑ ↓ Zeile ← → Stil", 18f, 31f, 360f, 23f, 15, Quiet, (TextAnchor)3, (FontStyle)0); status = Label((Transform)(object)panel, font, "Enter Speichern Rücktaste Schließen", 18f, 7f, 360f, 23f, 15, Ink, (TextAnchor)3, (FontStyle)0); Close(); } private void BuildRow(int index, Font font, string label, float y) { //IL_0024: 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_007d: Unknown result type (might be due to invalid IL or missing references) //IL_00b0: Unknown result type (might be due to invalid IL or missing references) backgrounds[index] = ImageFor(Rect(label, (Transform)(object)panel, 18f, y, 360f, 42f), Surface); markers[index] = ImageFor(Rect("Selected", (Transform)(object)panel, 18f, y, 3f, 42f), Accent); Label((Transform)(object)panel, font, label, 31f, y, 121f, 42f, 17, Ink, (TextAnchor)3, (FontStyle)0); values[index] = Label((Transform)(object)panel, font, "", 147f, y, 216f, 42f, 17, Ink, (TextAnchor)5, (FontStyle)0); } public void Open() { for (int i = 0; i < draft.Length; i++) { draft[i] = Mathf.Max(0, Array.IndexOf(choices[i], entries[i].Value)); } row = 0; status.text = "Enter Speichern Rücktaste Schließen"; ((Component)panel).gameObject.SetActive(true); Resize(); Refresh(); } public void Close() { ((Component)panel).gameObject.SetActive(false); ((Behaviour)canvas).enabled = false; } public void Dispose() { if (Object.op_Implicit((Object)(object)canvas)) { Object.Destroy((Object)(object)((Component)canvas).gameObject); } } public void HandleInput() { Resize(); preview.UpdateWarningEffect(settings.AnimateWarningLights.Value); if (Input.GetKeyDown((KeyCode)8) || Input.GetKeyDown((KeyCode)27)) { Close(); return; } if (Input.GetKeyDown((KeyCode)273) || Input.GetKeyDown((KeyCode)274)) { SelectOtherRow(); } if (Input.GetKeyDown((KeyCode)276)) { Cycle(-1); } else if (Input.GetKeyDown((KeyCode)275)) { Cycle(1); } if (Input.GetKeyDown((KeyCode)13) || Input.GetKeyDown((KeyCode)271)) { Apply(); } } private void SelectOtherRow() { row = 1 - row; Refresh(); } private void Cycle(int direction) { int num = choices[row].Length; draft[row] = (draft[row] + direction + num) % num; Refresh(); } private void Apply() { string text = choices[0][draft[0]]; string text2 = choices[1][draft[1]]; string value = entries[0].Value; string value2 = entries[1].Value; if (text != value || text2 != value2) { bool saveOnConfigSet = config.SaveOnConfigSet; config.SaveOnConfigSet = false; try { entries[0].Value = text; entries[1].Value = text2; config.Save(); } catch (Exception) { entries[0].Value = value; entries[1].Value = value2; status.text = "Speichern fehlgeschlagen · erneut Enter drücken"; return; } finally { config.SaveOnConfigSet = saveOnConfigSet; } } Close(); } private void Resize() { //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Unknown result type (might be due to invalid IL or missing references) float num = Mathf.Clamp(Mathf.Min((float)Screen.height / 840f, (float)Screen.width / 460f), 0.15f, 1.6f); ((Transform)panel).localScale = Vector3.one * num; panel.anchoredPosition = new Vector2(-26f, -34f) * num; ((Behaviour)canvas).enabled = IsOpen; } private void Refresh() { //IL_00a6: 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_0031: 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_004d: 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) for (int i = 0; i < draft.Length; i++) { bool flag = i == row; ((Behaviour)markers[i]).enabled = flag; ((Graphic)backgrounds[i]).color = (flag ? Selected : Surface); ((Graphic)values[i]).color = (flag ? Accent : Ink); values[i].text = "‹ " + choices[i][draft[i]] + " ›"; } preview.DrawPreview(new Vector2(198f, 105f), new Vector2(328f, 83f), settings, choices[0][draft[0]], choices[1][draft[1]]); } private static RectTransform Rect(string name, Transform parent, float x, float y, float width, float height) { //IL_0016: 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_0031: 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_0038: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_0040: 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_0058: Unknown result type (might be due to invalid IL or missing references) RectTransform component = new GameObject(name, new Type[1] { typeof(RectTransform) }).GetComponent<RectTransform>(); ((Transform)component).SetParent(parent, false); Vector2 val = (component.pivot = Vector2.zero); Vector2 anchorMin = (component.anchorMax = val); component.anchorMin = anchorMin; component.anchoredPosition = new Vector2(x, y); component.sizeDelta = new Vector2(width, height); return component; } private static Image ImageFor(RectTransform rect, Color fill) { //IL_000d: Unknown result type (might be due to invalid IL or missing references) Image val = ((Component)rect).gameObject.AddComponent<Image>(); ((Graphic)val).color = fill; ((Graphic)val).raycastTarget = false; return val; } private static Text Label(Transform parent, Font font, string label, float x, float y, float width, float height, int size, Color color, TextAnchor alignment = (TextAnchor)3, FontStyle style = (FontStyle)0) { //IL_0030: 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_0040: Unknown result type (might be due to invalid IL or missing references) Text val = ((Component)Rect(label, parent, x, y, width, height)).gameObject.AddComponent<Text>(); val.font = font; val.text = label; val.fontSize = size; val.fontStyle = style; ((Graphic)val).color = color; val.alignment = alignment; val.supportRichText = false; ((Graphic)val).raycastTarget = false; return val; } }