Decompiled source of BetterDisplay v0.4.3
Mods/BetterDisplay.dll
Decompiled 3 days ago
The result has been truncated due to the large size, download it to view full contents!
using System; using System.Collections.Generic; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BetterDisplay; using FishNet.Connection; using FishNet.Object; using HarmonyLib; using MelonLoader; using MelonLoader.Preferences; using Microsoft.CodeAnalysis; using TMPro; using UnityEngine; using UnityEngine.Events; using UnityEngine.InputSystem; using UnityEngine.InputSystem.Controls; using UnityEngine.UI; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: MelonInfo(typeof(BetterDisplayMod), "更好的显示", "0.4.3", "YourName", null)] [assembly: MelonColor(255, 43, 214, 255)] [assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")] [assembly: AssemblyCompany("BetterDisplay")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("0.4.3.0")] [assembly: AssemblyInformationalVersion("0.4.3")] [assembly: AssemblyProduct("BetterDisplay")] [assembly: AssemblyTitle("BetterDisplay")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("0.4.3.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace BetterDisplay { [HarmonyPatch(typeof(Weapon), "Shoot")] internal static class WeaponShootCenterAimPatch { private sealed class AimState { internal readonly Transform FirePoint; internal readonly Quaternion OriginalRotation; internal AimState(Transform firePoint, Quaternion originalRotation) { //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) FirePoint = firePoint; OriginalRotation = originalRotation; } } private const float AimDistance = 10000f; [HarmonyPrefix] private static void Prefix(Weapon __instance, ref AimState __state) { //IL_0081: 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 (!BetterDisplayConfig.BallisticCorrectionEnabled || (Object)(object)__instance == (Object)null) { return; } Player holder = ((Item)__instance).Holder; if (!((Object)(object)holder == (Object)null) && !(((NetworkBehaviour)holder).Owner == (NetworkConnection)null) && ((NetworkBehaviour)holder).Owner.IsLocalClient) { Camera curCam = holder.CurCam; Attachments attachments = __instance.Attachments; Transform val = (((Object)(object)attachments != (Object)null) ? attachments.FirePoint : null); if (!((Object)(object)curCam == (Object)null) && !((Object)(object)val == (Object)null) && TryGetCenterAimDirection(holder, curCam, val, out var direction)) { __state = new AimState(val, val.rotation); val.forward = direction; } } } [HarmonyPostfix] private static void Postfix(AimState __state) { Restore(__state); } [HarmonyFinalizer] private static Exception Finalizer(Exception __exception, AimState __state) { Restore(__state); return __exception; } private static void Restore(AimState state) { //IL_0019: Unknown result type (might be due to invalid IL or missing references) if (state != null && !((Object)(object)state.FirePoint == (Object)null)) { state.FirePoint.rotation = state.OriginalRotation; } } private static bool TryGetCenterAimDirection(Player holder, Camera camera, Transform firePoint, out Vector3 direction) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_004c: 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_005b: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Unknown result type (might be due to invalid IL or missing references) //IL_0067: 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_00d5: Unknown result type (might be due to invalid IL or missing references) //IL_00d7: Unknown result type (might be due to invalid IL or missing references) //IL_00dc: Unknown result type (might be due to invalid IL or missing references) //IL_00e1: Unknown result type (might be due to invalid IL or missing references) //IL_00f6: Unknown result type (might be due to invalid IL or missing references) //IL_00fb: Unknown result type (might be due to invalid IL or missing references) //IL_00c2: Unknown result type (might be due to invalid IL or missing references) //IL_00c7: Unknown result type (might be due to invalid IL or missing references) direction = Vector3.zero; if ((Object)(object)holder == (Object)null || (Object)(object)camera == (Object)null || (Object)(object)firePoint == (Object)null) { return false; } Ray val = camera.ViewportPointToRay(new Vector3(0.5f, 0.5f, 0f)); Vector3 val2 = ((Ray)(ref val)).origin + ((Ray)(ref val)).direction * 10000f; int aimLayerMask = GetAimLayerMask(); RaycastHit[] array = Physics.RaycastAll(val, 10000f, aimLayerMask); float num = float.MaxValue; for (int i = 0; i < array.Length; i++) { RaycastHit val3 = array[i]; Transform transform = ((RaycastHit)(ref val3)).transform; if (!((Object)(object)transform == (Object)null) && !transform.IsChildOf(((Component)holder).transform) && ((RaycastHit)(ref val3)).distance < num) { num = ((RaycastHit)(ref val3)).distance; val2 = ((RaycastHit)(ref val3)).point; } } Vector3 val4 = val2 - firePoint.position; if (((Vector3)(ref val4)).sqrMagnitude < 0.0001f) { return false; } direction = ((Vector3)(ref val4)).normalized; return true; } private static int GetAimLayerMask() { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) return LayerMask.op_Implicit(GameInfo.LevelLayer) | LayerMask.op_Implicit(GameInfo.PlayerLayer) | LayerMask.op_Implicit(GameInfo.ItemLayer) | LayerMask.op_Implicit(GameInfo.NpcLayer); } } internal static class BetterDisplayBossIndicator { private const float HorizontalEdgeOffset = 72f; private const float TopEdgeOffset = 72f; private const float BottomSafeOffset = 165f; private const float MinimumBossDistance = 5f; private const float MaximumBossDistance = 250f; private const float MinimumIconSize = 40f; private const float MaximumIconSize = 82f; private static readonly FieldInfo PlayerUiInstanceField = AccessTools.Field(typeof(PlayerUI), "_instance"); private static GameObject _root; private static RectTransform _rootRect; private static RectTransform _indicatorRect; private static Image _indicatorImage; private static Transform _hudParent; private static Creature _lastBoss; private static Renderer[] _bossRenderers; private static Sprite _fallbackSprite; private static Texture2D _fallbackTexture; internal static void Update() { //IL_00cf: Unknown result type (might be due to invalid IL or missing references) //IL_00d4: Unknown result type (might be due to invalid IL or missing references) //IL_00d7: Unknown result type (might be due to invalid IL or missing references) //IL_00d9: Unknown result type (might be due to invalid IL or missing references) //IL_00de: Unknown result type (might be due to invalid IL or missing references) //IL_00e0: Unknown result type (might be due to invalid IL or missing references) //IL_010b: Unknown result type (might be due to invalid IL or missing references) //IL_0110: Unknown result type (might be due to invalid IL or missing references) //IL_0114: 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_00f7: Unknown result type (might be due to invalid IL or missing references) //IL_01a3: 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_01ca: Unknown result type (might be due to invalid IL or missing references) //IL_01cf: Unknown result type (might be due to invalid IL or missing references) //IL_01d1: Unknown result type (might be due to invalid IL or missing references) //IL_01d6: Unknown result type (might be due to invalid IL or missing references) //IL_0120: Unknown result type (might be due to invalid IL or missing references) //IL_0147: Unknown result type (might be due to invalid IL or missing references) //IL_0152: Unknown result type (might be due to invalid IL or missing references) //IL_016b: Unknown result type (might be due to invalid IL or missing references) //IL_0170: 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_01ec: Unknown result type (might be due to invalid IL or missing references) //IL_01ee: Unknown result type (might be due to invalid IL or missing references) //IL_01f0: Unknown result type (might be due to invalid IL or missing references) //IL_01f2: 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_01ff: Unknown result type (might be due to invalid IL or missing references) //IL_0204: Unknown result type (might be due to invalid IL or missing references) //IL_0242: Unknown result type (might be due to invalid IL or missing references) //IL_025b: Unknown result type (might be due to invalid IL or missing references) //IL_0274: Unknown result type (might be due to invalid IL or missing references) //IL_0283: Unknown result type (might be due to invalid IL or missing references) //IL_0293: 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_02b3: Unknown result type (might be due to invalid IL or missing references) //IL_02d6: Unknown result type (might be due to invalid IL or missing references) Player localPlayer = Player.LocalPlayer; if ((Object)(object)localPlayer == (Object)null) { Hide(); return; } if ((Object)(object)GetPlayerUi() == (Object)null || (Object)(object)PlayerUI.FXCanvasTrans == (Object)null || PlayerUI.UIDisabled) { Hide(); return; } Creature activeBoss = GetActiveBoss(); Camera curCam = localPlayer.CurCam; if ((Object)(object)activeBoss == (Object)null || (Object)(object)curCam == (Object)null) { Hide(); return; } Transform fXCanvasTrans = PlayerUI.FXCanvasTrans; if ((Object)(object)_root == (Object)null || (Object)(object)_hudParent != (Object)(object)fXCanvasTrans) { Recreate(fXCanvasTrans); } if ((Object)(object)_indicatorImage == (Object)null || (Object)(object)_indicatorRect == (Object)null || (Object)(object)_rootRect == (Object)null) { return; } if ((Object)(object)_lastBoss != (Object)(object)activeBoss) { _lastBoss = activeBoss; _bossRenderers = ((Component)activeBoss).GetComponentsInChildren<Renderer>(true); } Vector3 bossVisualPosition = GetBossVisualPosition(activeBoss); Vector3 val = curCam.WorldToViewportPoint(bossVisualPosition); bool flag = val.z <= 0f; if (!flag && IsInsideViewport(val)) { Hide(); return; } Rect rect = _rootRect.rect; Vector2 center = ((Rect)(ref rect)).center; Vector2 direction; Vector2 anchoredPosition = default(Vector2); if (flag) { float rearHorizontal = GetRearHorizontal(curCam, bossVisualPosition); float num = ((Rect)(ref rect)).xMin + 72f; float num2 = ((Rect)(ref rect)).xMax - 72f; float num3 = center.x + rearHorizontal * (num2 - center.x); Vector2 val2 = new Vector2(rearHorizontal * 0.65f, -1f); direction = ((Vector2)(ref val2)).normalized; ((Vector2)(ref anchoredPosition))..ctor(Mathf.Clamp(num3, num, num2), ((Rect)(ref rect)).yMin + 165f); } else { direction = new Vector2(((Rect)(ref rect)).xMin + val.x * ((Rect)(ref rect)).width, ((Rect)(ref rect)).yMin + val.y * ((Rect)(ref rect)).height) - center; if (((Vector2)(ref direction)).sqrMagnitude < 0.0001f) { Hide(); return; } anchoredPosition = ProjectToSafeEdge(center, direction, rect); } float num4 = Vector3.Distance(((Component)curCam).transform.position, bossVisualPosition); float num5 = Mathf.InverseLerp(250f, 5f, num4); float num6 = Mathf.Lerp(40f, 82f, num5); _indicatorRect.anchorMin = new Vector2(0.5f, 0.5f); _indicatorRect.anchorMax = new Vector2(0.5f, 0.5f); _indicatorRect.pivot = new Vector2(0.5f, 0.5f); _indicatorRect.anchoredPosition = anchoredPosition; _indicatorRect.sizeDelta = new Vector2(num6, num6); ((Transform)_indicatorRect).localRotation = Quaternion.Euler(0f, 0f, DirectionToRotation(direction)); ((Graphic)_indicatorImage).color = new Color(1f, 0.035f, 0.035f, 1f); ((Component)_indicatorImage).gameObject.SetActive(true); } internal static void Close() { if ((Object)(object)_root != (Object)null) { Object.Destroy((Object)(object)_root); } if ((Object)(object)_fallbackSprite != (Object)null) { Object.Destroy((Object)(object)_fallbackSprite); } if ((Object)(object)_fallbackTexture != (Object)null) { Object.Destroy((Object)(object)_fallbackTexture); } _root = null; _rootRect = null; _indicatorRect = null; _indicatorImage = null; _hudParent = null; _lastBoss = null; _bossRenderers = null; _fallbackSprite = null; _fallbackTexture = null; } private static PlayerUI GetPlayerUi() { if (PlayerUiInstanceField == null) { return null; } object? value = PlayerUiInstanceField.GetValue(null); return (PlayerUI)((value is PlayerUI) ? value : null); } private static Creature GetActiveBoss() { Creature boss = BossManager.Boss; if (!((Object)(object)boss == (Object)null) && !boss.IsDead) { return boss; } return null; } private static Vector3 GetBossVisualPosition(Creature boss) { //IL_0015: 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_0074: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Unknown result type (might be due to invalid IL or missing references) if (_bossRenderers == null || _bossRenderers.Length == 0) { return ((Component)boss).transform.position; } Bounds val = default(Bounds); bool flag = false; for (int i = 0; i < _bossRenderers.Length; i++) { Renderer val2 = _bossRenderers[i]; if (!((Object)(object)val2 == (Object)null)) { if (!flag) { val = val2.bounds; flag = true; } else { ((Bounds)(ref val)).Encapsulate(val2.bounds); } } } if (!flag) { return ((Component)boss).transform.position; } return ((Bounds)(ref val)).center; } private static bool IsInsideViewport(Vector3 viewport) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) if (viewport.x >= 0f && viewport.x <= 1f && viewport.y >= 0f) { return viewport.y <= 1f; } return false; } private static float GetRearHorizontal(Camera camera, Vector3 bossPosition) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) Vector3 val = ((Component)camera).transform.InverseTransformDirection(bossPosition - ((Component)camera).transform.position); float num = Mathf.Max(0f - val.z, 0.001f); return Mathf.Clamp(Mathf.Atan2(val.x, num) / ((float)Math.PI / 2f), -1f, 1f); } private static Vector2 ProjectToSafeEdge(Vector2 center, Vector2 direction, Rect rootBounds) { //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Unknown result type (might be due to invalid IL or missing references) //IL_004f: 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_008b: Unknown result type (might be due to invalid IL or missing references) //IL_0076: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_00b2: 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_00a2: Unknown result type (might be due to invalid IL or missing references) //IL_00c2: Unknown result type (might be due to invalid IL or missing references) //IL_00c9: Unknown result type (might be due to invalid IL or missing references) //IL_00e9: Unknown result type (might be due to invalid IL or missing references) //IL_00eb: Unknown result type (might be due to invalid IL or missing references) //IL_00ec: Unknown result type (might be due to invalid IL or missing references) //IL_00ef: Unknown result type (might be due to invalid IL or missing references) //IL_00f4: Unknown result type (might be due to invalid IL or missing references) float num = ((Rect)(ref rootBounds)).xMin + 72f; float num2 = ((Rect)(ref rootBounds)).xMax - 72f; float num3 = ((Rect)(ref rootBounds)).yMin + 165f; float num4 = ((Rect)(ref rootBounds)).yMax - 72f; float num5 = float.MaxValue; if (direction.x > 0f) { num5 = Mathf.Min(num5, (num2 - center.x) / direction.x); } else if (direction.x < 0f) { num5 = Mathf.Min(num5, (num - center.x) / direction.x); } if (direction.y > 0f) { num5 = Mathf.Min(num5, (num4 - center.y) / direction.y); } else if (direction.y < 0f) { num5 = Mathf.Min(num5, (num3 - center.y) / direction.y); } if (num5 == float.MaxValue || num5 < 0f) { return center; } return center + direction * num5; } private static float DirectionToRotation(Vector2 direction) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) return Mathf.Atan2(direction.y, direction.x) * 57.29578f - 90f; } private static void Recreate(Transform hudParent) { //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Expected O, but got Unknown //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_00a9: 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) //IL_00cd: 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) //IL_012b: Unknown result type (might be due to invalid IL or missing references) //IL_0146: Unknown result type (might be due to invalid IL or missing references) //IL_015b: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)_root != (Object)null) { Object.Destroy((Object)(object)_root); } _hudParent = hudParent; _root = new GameObject("BetterDisplayBossIndicator", new Type[1] { typeof(RectTransform) }); _root.transform.SetParent(hudParent, false); _rootRect = _root.GetComponent<RectTransform>(); SetFullStretch(_rootRect); GameObject val = new GameObject("BossDirectionMarker", new Type[2] { typeof(RectTransform), typeof(Image) }); val.transform.SetParent(_root.transform, false); _indicatorRect = val.GetComponent<RectTransform>(); _indicatorRect.sizeDelta = new Vector2(40f, 40f); _indicatorImage = val.GetComponent<Image>(); _indicatorImage.sprite = GetFallbackSprite(); ((Graphic)_indicatorImage).color = new Color(1f, 0.035f, 0.035f, 1f); _indicatorImage.type = (Type)0; _indicatorImage.preserveAspect = true; ((Graphic)_indicatorImage).raycastTarget = false; Outline obj = val.AddComponent<Outline>(); ((Shadow)obj).effectColor = new Color(0.02f, 0f, 0f, 0.95f); ((Shadow)obj).effectDistance = new Vector2(2f, 2f); ((Shadow)obj).useGraphicAlpha = true; val.SetActive(false); } private static Sprite GetFallbackSprite() { //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Expected O, but got Unknown //IL_0171: Unknown result type (might be due to invalid IL or missing references) //IL_0180: Unknown result type (might be due to invalid IL or missing references) //IL_011f: Unknown result type (might be due to invalid IL or missing references) //IL_010a: Unknown result type (might be due to invalid IL or missing references) //IL_0124: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)_fallbackSprite != (Object)null) { return _fallbackSprite; } _fallbackTexture = new Texture2D(64, 64, (TextureFormat)4, false); ((Object)_fallbackTexture).name = "BetterDisplayBossDropTexture"; ((Texture)_fallbackTexture).wrapMode = (TextureWrapMode)1; ((Texture)_fallbackTexture).filterMode = (FilterMode)1; Color32[] array = (Color32[])(object)new Color32[4096]; for (int i = 0; i < 64; i++) { for (int j = 0; j < 64; j++) { float num = ((float)j + 0.5f) / 64f * 2f - 1f; float num2 = ((float)i + 0.5f) / 64f * 2f - 1f; bool flag = num * num + (num2 + 0.22f) * (num2 + 0.22f) <= 0.33639997f; bool flag2 = num2 >= -0.1f && num2 <= 0.92f && Mathf.Abs(num) <= 0.58f * (1f - Mathf.InverseLerp(-0.1f, 0.92f, num2)); array[i * 64 + j] = ((flag || flag2) ? new Color32(byte.MaxValue, (byte)9, (byte)9, byte.MaxValue) : new Color32((byte)0, (byte)0, (byte)0, (byte)0)); } } _fallbackTexture.SetPixels32(array); _fallbackTexture.Apply(false, false); _fallbackSprite = Sprite.Create(_fallbackTexture, new Rect(0f, 0f, 64f, 64f), new Vector2(0.5f, 0.5f), 64f); ((Object)_fallbackSprite).name = "BetterDisplayBossDrop"; return _fallbackSprite; } private static void Hide() { if ((Object)(object)_indicatorImage != (Object)null) { ((Component)_indicatorImage).gameObject.SetActive(false); } } private static void SetFullStretch(RectTransform rect) { //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_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Unknown result type (might be due to invalid IL or missing references) rect.anchorMin = Vector2.zero; rect.anchorMax = Vector2.one; rect.pivot = new Vector2(0.5f, 0.5f); rect.offsetMin = Vector2.zero; rect.offsetMax = Vector2.zero; } } internal static class BetterDisplayGunStabilizer { private static readonly FieldInfo LookRotField = AccessTools.Field(typeof(PlayerToolMovement), "_lookRot"); private static readonly FieldInfo ToolSwayTargetField = AccessTools.Field(typeof(PlayerToolMovement), "_toolSwayTarget"); internal static bool IsLocalWeapon(PlayerToolMovement movement) { if ((Object)(object)movement == (Object)null) { return false; } Tool currentTool = movement.CurrentTool; Weapon val = (((Object)(object)currentTool != (Object)null) ? ((Item)currentTool).Weapon : null); Player val2 = (((Object)(object)val != (Object)null) ? ((Item)val).Holder : null); if ((Object)(object)val2 != (Object)null && ((NetworkBehaviour)val2).Owner != (NetworkConnection)null) { return ((NetworkBehaviour)val2).Owner.IsLocalClient; } return false; } internal static void ClearLookAround(PlayerToolMovement movement) { //IL_001d: 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) if ((Object)(object)movement == (Object)null) { return; } if (LookRotField != null) { LookRotField.SetValue(movement, Vector3.zero); } if (!(ToolSwayTargetField == null)) { object? value = ToolSwayTargetField.GetValue(movement); Transform val = (Transform)((value is Transform) ? value : null); if ((Object)(object)val != (Object)null && (Object)(object)val.parent != (Object)null) { val.parent.localEulerAngles = Vector3.zero; } } } } [HarmonyPatch(typeof(PlayerToolMovement), "LookAround")] internal static class PlayerToolMovementLookAroundPatch { [HarmonyPrefix] private static bool Prefix(PlayerToolMovement __instance) { if (!BetterDisplayConfig.BallisticCorrectionEnabled || !BetterDisplayGunStabilizer.IsLocalWeapon(__instance)) { return true; } BetterDisplayGunStabilizer.ClearLookAround(__instance); return false; } } [HarmonyPatch(typeof(PlayerToolMovement), "SetTool")] internal static class PlayerToolMovementSetToolPatch { [HarmonyPostfix] private static void Postfix(PlayerToolMovement __instance) { if (BetterDisplayConfig.BallisticCorrectionEnabled && BetterDisplayGunStabilizer.IsLocalWeapon(__instance)) { BetterDisplayGunStabilizer.ClearLookAround(__instance); } } } internal static class BetterDisplayHud { private static readonly FieldInfo PlayerUiInstanceField = AccessTools.Field(typeof(PlayerUI), "_instance"); private static readonly FieldInfo WeaponUiField = AccessTools.Field(typeof(PlayerUI), "weaponUI"); private static readonly FieldInfo SniperUiVisibleField = AccessTools.Field(typeof(WeaponUI), "_isShowingSniperUI"); private static readonly FieldInfo VitalsUiField = AccessTools.Field(typeof(PlayerUI), "_vitalsUI"); private static readonly FieldInfo HealthImageField = AccessTools.Field(typeof(VitalsUI), "_healthImage"); private static readonly FieldInfo FullnessImageField = AccessTools.Field(typeof(VitalsUI), "_fullnessImage"); private static readonly FieldInfo MaxHealthField = AccessTools.Field(typeof(PlayerVitals), "_maxHealth"); private static readonly FieldInfo MaxFullnessField = AccessTools.Field(typeof(PlayerVitals), "_maxFullness"); private static PlayerUI _playerUi; private static Transform _hudParent; private static GameObject _root; private static GameObject _crosshair; private static TextMeshProUGUI _foodText; private static TextMeshProUGUI _ammoText; private static TextMeshProUGUI _healthValueText; private static TextMeshProUGUI _fullnessValueText; internal static void Update() { Player localPlayer = Player.LocalPlayer; if ((Object)(object)localPlayer == (Object)null) { HideHud(); return; } PlayerUI playerUi = GetPlayerUi(); if ((Object)(object)playerUi == (Object)null || (Object)(object)PlayerUI.FXCanvasTrans == (Object)null) { HideHud(); return; } Transform fXCanvasTrans = PlayerUI.FXCanvasTrans; if ((Object)(object)_root == (Object)null || (Object)(object)_hudParent != (Object)(object)fXCanvasTrans || (Object)(object)_playerUi != (Object)(object)playerUi) { RecreateHud(playerUi, fXCanvasTrans); } if ((Object)(object)_root == (Object)null) { return; } Item val = (((Object)(object)localPlayer.Holding != (Object)null) ? localPlayer.Holding.HeldItem : null); Weapon val2 = (((Object)(object)val != (Object)null) ? val.Weapon : null); Creature val3 = (((Object)(object)val != (Object)null) ? val.Creature : null); bool flag = !PlayerUI.UIDisabled; bool flag2 = (Object)(object)val2 != (Object)null; bool flag3 = IsSniperUiVisible(playerUi); bool active = flag && flag2 && !flag3; _crosshair.SetActive(active); bool flag4 = flag && BetterDisplayConfig.AmmoDisplayEnabled && flag2 && (Object)(object)val2.Attachments != (Object)null; if (flag4) { int ammoPerMag = val2.Attachments.AmmoPerMag; flag4 = ammoPerMag > 0; if (flag4) { ((TMP_Text)_ammoText).text = $"{val2.Ammo}/{ammoPerMag}"; } } ((Component)_ammoText).gameObject.SetActive(flag4); bool flag5 = flag && BetterDisplayConfig.FoodInfoEnabled && (Object)(object)val3 != (Object)null && (val3.HpToRestore != 0 || val3.FullnessToRestore != 0); if (flag5) { int effectiveFoodValue = GetEffectiveFoodValue(val3.HpToRestore, val); int effectiveFoodValue2 = GetEffectiveFoodValue(val3.FullnessToRestore, val); ((TMP_Text)_foodText).text = $"<color=#FF8C82>生命 {FormatSigned(effectiveFoodValue)}</color> <color=#FFE27A>饥饿 {FormatSigned(effectiveFoodValue2)}</color>"; } ((Component)_foodText).gameObject.SetActive(flag5); UpdateVitals(playerUi, localPlayer, flag && BetterDisplayConfig.VitalsDisplayEnabled); } internal static void Close() { if ((Object)(object)_root != (Object)null) { Object.Destroy((Object)(object)_root); } HideHud(); _root = null; _crosshair = null; _foodText = null; _ammoText = null; _healthValueText = null; _fullnessValueText = null; _hudParent = null; _playerUi = null; } private static PlayerUI GetPlayerUi() { if (PlayerUiInstanceField != null) { object? value = PlayerUiInstanceField.GetValue(null); return (PlayerUI)((value is PlayerUI) ? value : null); } return null; } private static bool IsSniperUiVisible(PlayerUI playerUi) { if (WeaponUiField == null || SniperUiVisibleField == null) { return false; } object? value = WeaponUiField.GetValue(playerUi); WeaponUI val = (WeaponUI)((value is WeaponUI) ? value : null); if ((Object)(object)val != (Object)null) { return (bool)SniperUiVisibleField.GetValue(val); } return false; } private static void RecreateHud(PlayerUI playerUi, Transform hudParent) { //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Expected O, but got Unknown //IL_009c: Unknown result type (might be due to invalid IL or missing references) //IL_00d8: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)_root != (Object)null) { Object.Destroy((Object)(object)_root); } _playerUi = playerUi; _hudParent = hudParent; _root = new GameObject("BetterDisplayHud", new Type[1] { typeof(RectTransform) }); _root.transform.SetParent(hudParent, false); SetFullStretch(_root.GetComponent<RectTransform>()); _crosshair = CreateCrosshair(_root.transform); _foodText = CreateStatusText(_root.transform, "FoodRestoreText", 330f, 40f, new Vector2(-50f, 112f), 20f, (TextAlignmentOptions)1028); _ammoText = CreateStatusText(_root.transform, "AmmoText", 245f, 48f, new Vector2(-50f, 62f), 27f, (TextAlignmentOptions)1028); _healthValueText = CreateVitalValueText(_root.transform, "HealthValueText"); _fullnessValueText = CreateVitalValueText(_root.transform, "FullnessValueText"); ((Component)_foodText).gameObject.SetActive(false); ((Component)_ammoText).gameObject.SetActive(false); ((Component)_healthValueText).gameObject.SetActive(false); ((Component)_fullnessValueText).gameObject.SetActive(false); } private static void UpdateVitals(PlayerUI playerUi, Player localPlayer, bool uiVisible) { //IL_0157: 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_0162: Unknown result type (might be due to invalid IL or missing references) //IL_0171: Unknown result type (might be due to invalid IL or missing references) if (!uiVisible || (Object)(object)playerUi == (Object)null || (Object)(object)localPlayer.Vitals == (Object)null || VitalsUiField == null) { ((Component)_healthValueText).gameObject.SetActive(false); ((Component)_fullnessValueText).gameObject.SetActive(false); return; } object? value = VitalsUiField.GetValue(playerUi); VitalsUI val = (VitalsUI)((value is VitalsUI) ? value : null); Image val2 = (Image)((HealthImageField != null && (Object)(object)val != (Object)null) ? /*isinst with value type is only supported in some contexts*/: null); Image val3 = (Image)((FullnessImageField != null && (Object)(object)val != (Object)null) ? /*isinst with value type is only supported in some contexts*/: null); int privateInt = GetPrivateInt(MaxHealthField, localPlayer.Vitals); int privateInt2 = GetPrivateInt(MaxFullnessField, localPlayer.Vitals); ((TMP_Text)_healthValueText).text = FormatVitalValue(localPlayer.Vitals.Health, privateInt); ((TMP_Text)_fullnessValueText).text = FormatVitalValue(localPlayer.Vitals.Fullness, privateInt2); bool flag = (Object)(object)val2 != (Object)null && PlaceValueUnderIcon(_healthValueText, val2); bool flag2 = (Object)(object)val3 != (Object)null && PlaceValueUnderIcon(_fullnessValueText, val3); if (flag && flag2) { RectTransform component = ((Component)_healthValueText).GetComponent<RectTransform>(); RectTransform component2 = ((Component)_fullnessValueText).GetComponent<RectTransform>(); Vector2 anchoredPosition = component2.anchoredPosition; anchoredPosition.y = component.anchoredPosition.y; component2.anchoredPosition = anchoredPosition; } ((Component)_healthValueText).gameObject.SetActive(flag); ((Component)_fullnessValueText).gameObject.SetActive(flag2); } private static string FormatVitalValue(int current, int maximum) { if (maximum <= 0) { return current.ToString(); } return $"{current}/{maximum}"; } private static int GetPrivateInt(FieldInfo field, object instance) { if (field == null || instance == null) { return 0; } return (int)field.GetValue(instance); } private static TextMeshProUGUI CreateVitalValueText(Transform parent, string name) { //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_0033: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_0059: 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_0082: 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_0105: Unknown result type (might be due to invalid IL or missing references) //IL_010a: Unknown result type (might be due to invalid IL or missing references) GameObject val = new GameObject(name, new Type[2] { typeof(RectTransform), typeof(TextMeshProUGUI) }); val.transform.SetParent(parent, false); RectTransform component = val.GetComponent<RectTransform>(); component.anchorMin = new Vector2(0.5f, 0.5f); component.anchorMax = new Vector2(0.5f, 0.5f); component.pivot = new Vector2(0.5f, 1f); component.sizeDelta = new Vector2(120f, 30f); TextMeshProUGUI component2 = val.GetComponent<TextMeshProUGUI>(); TMP_FontAsset gameFont = GetGameFont(); if ((Object)(object)gameFont != (Object)null) { ((TMP_Text)component2).font = gameFont; } ((TMP_Text)component2).fontSize = 17f; ((Graphic)component2).color = Color.white; ((TMP_Text)component2).alignment = (TextAlignmentOptions)514; ((TMP_Text)component2).textWrappingMode = (TextWrappingModes)0; ((TMP_Text)component2).overflowMode = (TextOverflowModes)1; ((TMP_Text)component2).enableAutoSizing = false; ((Graphic)component2).raycastTarget = false; ((TMP_Text)component2).outlineWidth = 0.24f; ((TMP_Text)component2).outlineColor = Color32.op_Implicit(new Color(0f, 0f, 0f, 0.95f)); return component2; } private static bool PlaceValueUnderIcon(TextMeshProUGUI text, Image icon) { //IL_0072: 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_007e: 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) //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_00ad: Unknown result type (might be due to invalid IL or missing references) //IL_00af: 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_00b7: Unknown result type (might be due to invalid IL or missing references) //IL_00cc: Unknown result type (might be due to invalid IL or missing references) //IL_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) if ((Object)(object)text == (Object)null || (Object)(object)icon == (Object)null || (Object)(object)_root == (Object)null) { return false; } RectTransform component = ((Component)icon).GetComponent<RectTransform>(); RectTransform component2 = _root.GetComponent<RectTransform>(); Canvas val = (((Object)(object)_hudParent != (Object)null) ? ((Component)_hudParent).GetComponentInParent<Canvas>() : null); if ((Object)(object)component == (Object)null || (Object)(object)component2 == (Object)null) { return false; } Vector3[] array = (Vector3[])(object)new Vector3[4]; component.GetWorldCorners(array); Vector3 val2 = (array[0] + array[3]) * 0.5f; Camera val3 = (((Object)(object)val != (Object)null && (int)val.renderMode != 0) ? val.worldCamera : null); Vector2 val4 = RectTransformUtility.WorldToScreenPoint(val3, val2); Vector2 val5 = default(Vector2); if (!RectTransformUtility.ScreenPointToLocalPointInRectangle(component2, val4, val3, ref val5)) { return false; } ((Component)text).GetComponent<RectTransform>().anchoredPosition = val5 + new Vector2(0f, -5f); return true; } private static GameObject CreateCrosshair(Transform parent) { //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_002a: 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_004a: 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_0069: Unknown result type (might be due to invalid IL or missing references) //IL_0073: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_0093: Expected O, but got Unknown GameObject val = new GameObject("Crosshair", new Type[1] { typeof(RectTransform) }); val.transform.SetParent(parent, false); SetFullStretch(val.GetComponent<RectTransform>()); CreateCrosshairLine(val.transform, "Horizontal", new Vector2(26f, 1.8f)); CreateCrosshairLine(val.transform, "Vertical", new Vector2(1.8f, 26f)); CreateCrosshairLine(val.transform, "Center", new Vector2(3.2f, 3.2f)); return val; } private static void CreateCrosshairLine(Transform parent, string name, Vector2 size) { //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_0033: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_0059: 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_0079: 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_0089: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: Unknown result type (might be due to invalid IL or missing references) //IL_00ce: 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) GameObject val = new GameObject(name, new Type[2] { typeof(RectTransform), typeof(Image) }); val.transform.SetParent(parent, false); RectTransform component = val.GetComponent<RectTransform>(); component.anchorMin = new Vector2(0.5f, 0.5f); component.anchorMax = new Vector2(0.5f, 0.5f); component.pivot = new Vector2(0.5f, 0.5f); component.anchoredPosition = Vector2.zero; component.sizeDelta = size; Image component2 = val.GetComponent<Image>(); ((Graphic)component2).color = new Color(1f, 1f, 1f, 0.96f); ((Graphic)component2).raycastTarget = false; Outline obj = val.AddComponent<Outline>(); ((Shadow)obj).effectColor = new Color(0f, 0f, 0f, 0.9f); ((Shadow)obj).effectDistance = new Vector2(0.85f, 0.85f); ((Shadow)obj).useGraphicAlpha = true; } private static TextMeshProUGUI CreateStatusText(Transform parent, string name, float width, float height, Vector2 position, float fontSize, TextAlignmentOptions alignment) { //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_0033: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_0059: 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_0079: Unknown result type (might be due to invalid IL or missing references) //IL_0082: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: 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_0106: Unknown result type (might be due to invalid IL or missing references) //IL_010b: Unknown result type (might be due to invalid IL or missing references) GameObject val = new GameObject(name, new Type[2] { typeof(RectTransform), typeof(TextMeshProUGUI) }); val.transform.SetParent(parent, false); RectTransform component = val.GetComponent<RectTransform>(); component.anchorMin = new Vector2(1f, 0f); component.anchorMax = new Vector2(1f, 0f); component.pivot = new Vector2(1f, 0f); component.anchoredPosition = position; component.sizeDelta = new Vector2(width, height); TextMeshProUGUI component2 = val.GetComponent<TextMeshProUGUI>(); TMP_FontAsset gameFont = GetGameFont(); if ((Object)(object)gameFont != (Object)null) { ((TMP_Text)component2).font = gameFont; } ((TMP_Text)component2).fontSize = fontSize; ((Graphic)component2).color = Color.white; ((TMP_Text)component2).alignment = alignment; ((TMP_Text)component2).textWrappingMode = (TextWrappingModes)0; ((TMP_Text)component2).overflowMode = (TextOverflowModes)1; ((TMP_Text)component2).enableAutoSizing = false; ((TMP_Text)component2).richText = true; ((Graphic)component2).raycastTarget = false; ((TMP_Text)component2).outlineWidth = 0.22f; ((TMP_Text)component2).outlineColor = Color32.op_Implicit(new Color(0f, 0f, 0f, 0.95f)); return component2; } private static TMP_FontAsset GetGameFont() { if ((Object)(object)PlayerUI.CanvasTextPrefab != (Object)null) { return ((TMP_Text)PlayerUI.CanvasTextPrefab).font; } TextMeshProUGUI val = Object.FindAnyObjectByType<TextMeshProUGUI>(); if (!((Object)(object)val != (Object)null)) { return null; } return ((TMP_Text)val).font; } private static string FormatSigned(int value) { if (value < 0) { return value.ToString(); } return "+" + value; } private static int GetEffectiveFoodValue(int baseValue, Item foodItem) { if ((Object)(object)foodItem == (Object)null || GameInfo.CooknessEatCurve == null) { return baseValue; } float num = GameInfo.CooknessEatCurve.Evaluate(foodItem.Cookness); return (int)((float)baseValue * num); } private static void HideHud() { if ((Object)(object)_crosshair != (Object)null) { _crosshair.SetActive(false); } if ((Object)(object)_foodText != (Object)null) { ((Component)_foodText).gameObject.SetActive(false); } if ((Object)(object)_ammoText != (Object)null) { ((Component)_ammoText).gameObject.SetActive(false); } if ((Object)(object)_healthValueText != (Object)null) { ((Component)_healthValueText).gameObject.SetActive(false); } if ((Object)(object)_fullnessValueText != (Object)null) { ((Component)_fullnessValueText).gameObject.SetActive(false); } } private static void SetFullStretch(RectTransform rect) { //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_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Unknown result type (might be due to invalid IL or missing references) rect.anchorMin = Vector2.zero; rect.anchorMax = Vector2.one; rect.pivot = new Vector2(0.5f, 0.5f); rect.offsetMin = Vector2.zero; rect.offsetMax = Vector2.zero; } } internal static class BetterDisplayMenu { [HarmonyPatch(typeof(ButtonManager), "SetupUI")] internal static class ButtonManagerSetupUiPatch { [HarmonyPostfix] private static void Postfix(ButtonManager __instance) { AttachToSettings(__instance); } } private sealed class CategoryView { internal readonly MarkerCategory Category; internal readonly List<SwatchView> Swatches = new List<SwatchView>(); internal CategoryView(MarkerCategory category) { Category = category; } } private sealed class SwatchView { internal readonly ColorPreset Preset; internal readonly Outline Selection; internal SwatchView(ColorPreset preset, Outline selection) { Preset = preset; Selection = selection; } } private sealed class ColorPreset { internal readonly string Name; internal readonly Color Color; internal readonly bool UseOriginal; internal ColorPreset(string name, Color color, bool useOriginal) { //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) Name = name; Color = color; UseOriginal = useOriginal; } } [CompilerGenerated] private static class <>O { public static UnityAction <0>__Open; public static UnityAction <1>__ToggleEnabled; public static UnityAction <2>__TogglePulse; public static UnityAction <3>__ToggleBallisticCorrection; public static UnityAction <4>__ToggleAmmoDisplay; public static UnityAction <5>__ToggleFoodInfo; public static UnityAction <6>__ToggleVitalsDisplay; public static UnityAction <7>__ResetAllColors; public static UnityAction <8>__Close; } private const float PanelWidth = 970f; private const float PanelHeight = 585f; private static readonly FieldInfo ItemDotsToggleField = AccessTools.Field(typeof(ButtonManager), "_itemDotsToggle"); private static readonly Color BorderColor = new Color(0.94f, 0.95f, 0.98f, 0.92f); private static readonly Color PanelColor = new Color(0.035f, 0.055f, 0.095f, 0.95f); private static readonly Color RowColor = new Color(0.08f, 0.11f, 0.17f, 0.58f); private static readonly Color ButtonColor = new Color(0.1f, 0.14f, 0.21f, 0.9f); private static readonly Color TextColor = new Color(0.94f, 0.95f, 0.98f, 1f); private static readonly Color MutedTextColor = new Color(0.72f, 0.76f, 0.83f, 1f); private static readonly Color SelectedColor = new Color(1f, 0.79f, 0.27f, 1f); private static readonly ColorPreset[] Presets = new ColorPreset[7] { new ColorPreset("原版", new Color(0.56f, 0.6f, 0.67f, 1f), useOriginal: true), new ColorPreset("红色", new Color(1f, 0.302f, 0.302f, 1f), useOriginal: false), new ColorPreset("青蓝", new Color(0.302f, 0.733f, 1f, 1f), useOriginal: false), new ColorPreset("亮黄", new Color(1f, 0.831f, 0.278f, 1f), useOriginal: false), new ColorPreset("洋红", new Color(1f, 0.1686f, 0.8392f, 1f), useOriginal: false), new ColorPreset("绿色", new Color(0.404f, 0.902f, 0.404f, 1f), useOriginal: false), new ColorPreset("白色", Color.white, useOriginal: false) }; private static readonly List<CategoryView> CategoryViews = new List<CategoryView>(); private static Canvas _canvas; private static Button _openButton; private static GameObject _panel; private static TextMeshProUGUI _enabledLabel; private static TextMeshProUGUI _pulseLabel; private static TextMeshProUGUI _ballisticCorrectionLabel; private static TextMeshProUGUI _ammoDisplayLabel; private static TextMeshProUGUI _foodInfoLabel; private static TextMeshProUGUI _vitalsDisplayLabel; private static TMP_FontAsset _font; internal static void AttachToSettings(ButtonManager manager) { //IL_0098: Unknown result type (might be due to invalid IL or missing references) //IL_009d: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Expected O, but got Unknown if ((Object)(object)manager == (Object)null) { return; } object? value = ItemDotsToggleField.GetValue(manager); Toggle val = (Toggle)((value is Toggle) ? value : null); if ((Object)(object)val == (Object)null) { return; } Canvas componentInParent = ((Component)val).GetComponentInParent<Canvas>(); if ((Object)(object)componentInParent == (Object)null) { return; } SwitchCanvas(componentInParent); EnsurePanel(componentInParent); if ((Object)(object)_openButton == (Object)null) { Transform obj = FindButtonParent(((Component)val).transform); _openButton = CreateVanillaButton(obj, "BetterDisplayOpenButton", "更好的显示", 190f, 42f, 17f); ButtonClickedEvent onClick = _openButton.onClick; object obj2 = <>O.<0>__Open; if (obj2 == null) { UnityAction val2 = Open; <>O.<0>__Open = val2; obj2 = (object)val2; } ((UnityEvent)onClick).AddListener((UnityAction)obj2); if ((Object)(object)((Component)obj).GetComponent<LayoutGroup>() == (Object)null) { PositionBesideToggle(((Component)_openButton).GetComponent<RectTransform>(), val); } } } internal static void Update() { if (Keyboard.current != null && ((ButtonControl)Keyboard.current.f8Key).wasPressedThisFrame) { Toggle(); } } internal static void Open() { if ((Object)(object)_panel == (Object)null) { ButtonManager val = Object.FindAnyObjectByType<ButtonManager>(); if ((Object)(object)val != (Object)null) { AttachToSettings(val); } } if ((Object)(object)_panel == (Object)null) { Canvas val2 = Object.FindAnyObjectByType<Canvas>(); if ((Object)(object)val2 != (Object)null) { SwitchCanvas(val2); EnsurePanel(val2); } } if (!((Object)(object)_panel == (Object)null)) { _panel.SetActive(true); _panel.transform.SetAsLastSibling(); Refresh(); } } internal static void Close() { if ((Object)(object)_panel != (Object)null) { _panel.SetActive(false); } } private static void Toggle() { if ((Object)(object)_panel != (Object)null && _panel.activeSelf) { Close(); } else { Open(); } } private static void SwitchCanvas(Canvas canvas) { if ((Object)(object)_canvas != (Object)null && (Object)(object)_canvas != (Object)(object)canvas) { ResetForNewCanvas(); } _canvas = canvas; } private static void ResetForNewCanvas() { Close(); _openButton = null; _panel = null; _canvas = null; _font = null; CategoryViews.Clear(); _enabledLabel = null; _pulseLabel = null; _ballisticCorrectionLabel = null; _ammoDisplayLabel = null; _foodInfoLabel = null; _vitalsDisplayLabel = null; } private static void EnsurePanel(Canvas canvas) { //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Expected O, but got Unknown //IL_00b5: Unknown result type (might be due to invalid IL or missing references) //IL_00ea: Unknown result type (might be due to invalid IL or missing references) //IL_00ff: Unknown result type (might be due to invalid IL or missing references) //IL_0114: Unknown result type (might be due to invalid IL or missing references) //IL_011f: Unknown result type (might be due to invalid IL or missing references) //IL_0133: Unknown result type (might be due to invalid IL or missing references) //IL_013e: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)_panel != (Object)null)) { CategoryViews.Clear(); _enabledLabel = null; _pulseLabel = null; _ballisticCorrectionLabel = null; _ammoDisplayLabel = null; _foodInfoLabel = null; _vitalsDisplayLabel = null; FindFont(canvas); _panel = new GameObject("BetterDisplaySettingsPanel", new Type[2] { typeof(RectTransform), typeof(Image) }); _panel.transform.SetParent(((Component)canvas).transform, false); SetFullStretch(_panel.GetComponent<RectTransform>()); Image component = _panel.GetComponent<Image>(); ((Graphic)component).color = new Color(0f, 0f, 0f, 0.52f); ((Graphic)component).raycastTarget = true; GameObject obj = CreateUiObject(_panel.transform, "Content"); RectTransform component2 = obj.GetComponent<RectTransform>(); component2.anchorMin = new Vector2(0.5f, 0.5f); component2.anchorMax = new Vector2(0.5f, 0.5f); component2.pivot = new Vector2(0.5f, 0.5f); component2.anchoredPosition = Vector2.zero; component2.sizeDelta = new Vector2(970f, 585f); AddBackground(obj, PanelColor, addBorder: true); CreateHeader(obj.transform, 242f); CreateHint(obj.transform, 196f); CreateDivider(obj.transform, 174f); CreateGlobalSettings(obj.transform, 136f); CreateInfoSettings(obj.transform, 84f); CreateCategoryRow(obj.transform, MarkerCategory.Enemy, "敌对生物", "活着的生物", 12f); CreateCategoryRow(obj.transform, MarkerCategory.Player, "玩家标记", "死亡玩家的物品", -77f); CreateCategoryRow(obj.transform, MarkerCategory.Pickup, "可拾取物品", "普通物品与死亡生物", -166f); CreateFooter(obj.transform, -244f); _panel.SetActive(false); } } private static void CreateHeader(Transform parent, float y) { //IL_002a: Unknown result type (might be due to invalid IL or missing references) ((TMP_Text)CreateText(CreatePositionedBlock(parent, "Header", 914f, 54f, y).transform, "Title", "更好的显示", 30f, TextColor, (TextAlignmentOptions)514)).fontStyle = (FontStyles)0; } private static void CreateHint(Transform parent, float y) { //IL_002a: Unknown result type (might be due to invalid IL or missing references) TextMeshProUGUI obj = CreateText(CreatePositionedBlock(parent, "Hint", 914f, 28f, y).transform, "HintText", "选择颜色以覆盖原版;选择“原版”可还原该类别。按 F8 可打开或关闭本菜单。", 15f, MutedTextColor, (TextAlignmentOptions)514); ((TMP_Text)obj).textWrappingMode = (TextWrappingModes)0; ((TMP_Text)obj).overflowMode = (TextOverflowModes)1; } private static void CreateDivider(Transform parent, float y) { //IL_003f: Unknown result type (might be due to invalid IL or missing references) Image obj = CreatePositionedBlock(parent, "Divider", 914f, 1f, y).AddComponent<Image>(); ((Graphic)obj).color = new Color(BorderColor.r, BorderColor.g, BorderColor.b, 0.52f); ((Graphic)obj).raycastTarget = false; } private static void CreateGlobalSettings(Transform parent, float y) { //IL_002b: 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_004e: 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_009c: Unknown result type (might be due to invalid IL or missing references) //IL_010a: Unknown result type (might be due to invalid IL or missing references) //IL_00c6: Unknown result type (might be due to invalid IL or missing references) //IL_00cb: Unknown result type (might be due to invalid IL or missing references) //IL_00d1: Expected O, but got Unknown //IL_0177: Unknown result type (might be due to invalid IL or missing references) //IL_0134: Unknown result type (might be due to invalid IL or missing references) //IL_0139: Unknown result type (might be due to invalid IL or missing references) //IL_013f: Expected O, but got Unknown //IL_01a1: Unknown result type (might be due to invalid IL or missing references) //IL_01a6: Unknown result type (might be due to invalid IL or missing references) //IL_01ac: Expected O, but got Unknown GameObject obj = CreatePositionedBlock(parent, "GlobalSettings", 914f, 48f, y); CreateTextAt(obj.transform, "GlobalLabel", "显示效果", 20f, TextColor, (TextAlignmentOptions)4097, new Vector2(0f, 0.5f), new Vector2(250f, 38f), new Vector2(12f, 0f)); Button obj2 = CreateVanillaButton(obj.transform, "EnabledButton", string.Empty, 170f, 38f, 16f); SetAt(((Component)obj2).GetComponent<RectTransform>(), new Vector2(-90f, 0f)); _enabledLabel = GetButtonLabel(obj2); ButtonClickedEvent onClick = obj2.onClick; object obj3 = <>O.<1>__ToggleEnabled; if (obj3 == null) { UnityAction val = ToggleEnabled; <>O.<1>__ToggleEnabled = val; obj3 = (object)val; } ((UnityEvent)onClick).AddListener((UnityAction)obj3); Button obj4 = CreateVanillaButton(obj.transform, "PulseButton", string.Empty, 170f, 38f, 16f); SetAt(((Component)obj4).GetComponent<RectTransform>(), new Vector2(95f, 0f)); _pulseLabel = GetButtonLabel(obj4); ButtonClickedEvent onClick2 = obj4.onClick; object obj5 = <>O.<2>__TogglePulse; if (obj5 == null) { UnityAction val2 = TogglePulse; <>O.<2>__TogglePulse = val2; obj5 = (object)val2; } ((UnityEvent)onClick2).AddListener((UnityAction)obj5); Button obj6 = CreateVanillaButton(obj.transform, "CenterAimButton", string.Empty, 170f, 38f, 16f); SetAt(((Component)obj6).GetComponent<RectTransform>(), new Vector2(280f, 0f)); _ballisticCorrectionLabel = GetButtonLabel(obj6); ButtonClickedEvent onClick3 = obj6.onClick; object obj7 = <>O.<3>__ToggleBallisticCorrection; if (obj7 == null) { UnityAction val3 = ToggleBallisticCorrection; <>O.<3>__ToggleBallisticCorrection = val3; obj7 = (object)val3; } ((UnityEvent)onClick3).AddListener((UnityAction)obj7); } private static void CreateInfoSettings(Transform parent, float y) { //IL_002b: 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_004e: 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_009c: Unknown result type (might be due to invalid IL or missing references) //IL_010a: Unknown result type (might be due to invalid IL or missing references) //IL_00c6: Unknown result type (might be due to invalid IL or missing references) //IL_00cb: Unknown result type (might be due to invalid IL or missing references) //IL_00d1: Expected O, but got Unknown //IL_0177: Unknown result type (might be due to invalid IL or missing references) //IL_0134: Unknown result type (might be due to invalid IL or missing references) //IL_0139: Unknown result type (might be due to invalid IL or missing references) //IL_013f: Expected O, but got Unknown //IL_01a1: Unknown result type (might be due to invalid IL or missing references) //IL_01a6: Unknown result type (might be due to invalid IL or missing references) //IL_01ac: Expected O, but got Unknown GameObject obj = CreatePositionedBlock(parent, "InfoSettings", 914f, 48f, y); CreateTextAt(obj.transform, "InfoLabel", "附加显示", 20f, TextColor, (TextAlignmentOptions)4097, new Vector2(0f, 0.5f), new Vector2(250f, 38f), new Vector2(12f, 0f)); Button obj2 = CreateVanillaButton(obj.transform, "AmmoDisplayButton", string.Empty, 170f, 38f, 16f); SetAt(((Component)obj2).GetComponent<RectTransform>(), new Vector2(-90f, 0f)); _ammoDisplayLabel = GetButtonLabel(obj2); ButtonClickedEvent onClick = obj2.onClick; object obj3 = <>O.<4>__ToggleAmmoDisplay; if (obj3 == null) { UnityAction val = ToggleAmmoDisplay; <>O.<4>__ToggleAmmoDisplay = val; obj3 = (object)val; } ((UnityEvent)onClick).AddListener((UnityAction)obj3); Button obj4 = CreateVanillaButton(obj.transform, "FoodInfoButton", string.Empty, 170f, 38f, 16f); SetAt(((Component)obj4).GetComponent<RectTransform>(), new Vector2(95f, 0f)); _foodInfoLabel = GetButtonLabel(obj4); ButtonClickedEvent onClick2 = obj4.onClick; object obj5 = <>O.<5>__ToggleFoodInfo; if (obj5 == null) { UnityAction val2 = ToggleFoodInfo; <>O.<5>__ToggleFoodInfo = val2; obj5 = (object)val2; } ((UnityEvent)onClick2).AddListener((UnityAction)obj5); Button obj6 = CreateVanillaButton(obj.transform, "VitalsDisplayButton", string.Empty, 170f, 38f, 16f); SetAt(((Component)obj6).GetComponent<RectTransform>(), new Vector2(280f, 0f)); _vitalsDisplayLabel = GetButtonLabel(obj6); ButtonClickedEvent onClick3 = obj6.onClick; object obj7 = <>O.<6>__ToggleVitalsDisplay; if (obj7 == null) { UnityAction val3 = ToggleVitalsDisplay; <>O.<6>__ToggleVitalsDisplay = val3; obj7 = (object)val3; } ((UnityEvent)onClick3).AddListener((UnityAction)obj7); } private static void CreateCategoryRow(Transform parent, MarkerCategory category, string title, string subtitle, float y) { //IL_001e: 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_004f: 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_006d: 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_00a2: 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_00f1: 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_011b: Unknown result type (might be due to invalid IL or missing references) //IL_012f: Unknown result type (might be due to invalid IL or missing references) //IL_01c7: Unknown result type (might be due to invalid IL or missing references) //IL_01dd: Unknown result type (might be due to invalid IL or missing references) //IL_0212: Unknown result type (might be due to invalid IL or missing references) //IL_021c: Expected O, but got Unknown GameObject obj = CreatePositionedBlock(parent, title + "Row", 914f, 80f, y); AddBackground(obj, RowColor, addBorder: false); ((TMP_Text)CreateTextAt(obj.transform, "CategoryTitle", title, 19f, TextColor, (TextAlignmentOptions)4097, new Vector2(0f, 0.5f), new Vector2(185f, 28f), new Vector2(16f, 13f))).textWrappingMode = (TextWrappingModes)0; ((TMP_Text)CreateTextAt(obj.transform, "CategorySubtitle", subtitle, 14f, MutedTextColor, (TextAlignmentOptions)4097, new Vector2(0f, 0.5f), new Vector2(185f, 22f), new Vector2(16f, -15f))).textWrappingMode = (TextWrappingModes)0; GameObject val = CreateUiObject(obj.transform, "Swatches"); RectTransform component = val.GetComponent<RectTransform>(); component.anchorMin = new Vector2(0f, 0f); component.anchorMax = new Vector2(1f, 1f); component.offsetMin = new Vector2(212f, 14f); component.offsetMax = new Vector2(-12f, -14f); HorizontalLayoutGroup obj2 = val.AddComponent<HorizontalLayoutGroup>(); ((HorizontalOrVerticalLayoutGroup)obj2).spacing = 8f; ((LayoutGroup)obj2).childAlignment = (TextAnchor)3; ((HorizontalOrVerticalLayoutGroup)obj2).childControlWidth = false; ((HorizontalOrVerticalLayoutGroup)obj2).childControlHeight = false; ((HorizontalOrVerticalLayoutGroup)obj2).childForceExpandWidth = false; ((HorizontalOrVerticalLayoutGroup)obj2).childForceExpandHeight = false; CategoryView categoryView = new CategoryView(category); CategoryViews.Add(categoryView); for (int i = 0; i < Presets.Length; i++) { ColorPreset colorPreset = Presets[i]; Button obj3 = CreateColorButton(val.transform, title + "_" + colorPreset.Name, colorPreset, 91f); Outline val2 = ((Component)obj3).gameObject.AddComponent<Outline>(); ((Shadow)val2).effectColor = SelectedColor; ((Shadow)val2).effectDistance = new Vector2(2.2f, 2.2f); ((Shadow)val2).useGraphicAlpha = false; ((Behaviour)val2).enabled = false; ColorPreset capturedPreset = colorPreset; MarkerCategory capturedCategory = category; ((UnityEvent)obj3.onClick).AddListener((UnityAction)delegate { //IL_0026: Unknown result type (might be due to invalid IL or missing references) if (capturedPreset.UseOriginal) { BetterDisplayConfig.ResetColor(capturedCategory); } else { BetterDisplayConfig.SetCustomColor(capturedCategory, capturedPreset.Color); } Refresh(); }); categoryView.Swatches.Add(new SwatchView(colorPreset, val2)); } } private static void CreateFooter(Transform parent, float y) { //IL_004a: 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_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_0074: Expected O, but got Unknown //IL_00cb: Unknown result type (might be due to invalid IL or missing references) //IL_00d0: Unknown result type (might be due to invalid IL or missing references) //IL_00d6: Expected O, but got Unknown GameObject obj = CreatePositionedBlock(parent, "Footer", 914f, 46f, y); Button obj2 = CreateVanillaButton(obj.transform, "ResetButton", "恢复全部原版颜色", 240f, 40f, 16f); SetAt(((Component)obj2).GetComponent<RectTransform>(), new Vector2(-134f, 0f)); ButtonClickedEvent onClick = obj2.onClick; object obj3 = <>O.<7>__ResetAllColors; if (obj3 == null) { UnityAction val = ResetAllColors; <>O.<7>__ResetAllColors = val; obj3 = (object)val; } ((UnityEvent)onClick).AddListener((UnityAction)obj3); Button obj4 = CreateVanillaButton(obj.transform, "CloseButton", "关闭", 150f, 40f, 16f); SetAt(((Component)obj4).GetComponent<RectTransform>(), new Vector2(76f, 0f)); ButtonClickedEvent onClick2 = obj4.onClick; object obj5 = <>O.<8>__Close; if (obj5 == null) { UnityAction val2 = Close; <>O.<8>__Close = val2; obj5 = (object)val2; } ((UnityEvent)onClick2).AddListener((UnityAction)obj5); } private static GameObject CreatePositionedBlock(Transform parent, string name, float width, float height, float y) { //IL_0018: 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_0042: 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_0060: Unknown result type (might be due to invalid IL or missing references) GameObject obj = CreateUiObject(parent, name); RectTransform component = obj.GetComponent<RectTransform>(); component.anchorMin = new Vector2(0.5f, 0.5f); component.anchorMax = new Vector2(0.5f, 0.5f); component.pivot = new Vector2(0.5f, 0.5f); component.anchoredPosition = new Vector2(0f, y); component.sizeDelta = new Vector2(width, height); return obj; } private static Button CreateVanillaButton(Transform parent, string name, string text, float width, float height, float fontSize) { //IL_0011: 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_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_0061: Unknown result type (might be due to invalid IL or missing references) //IL_0081: Unknown result type (might be due to invalid IL or missing references) //IL_00a1: Unknown result type (might be due to invalid IL or missing references) //IL_00af: Unknown result type (might be due to invalid IL or missing references) //IL_00cf: Unknown result type (might be due to invalid IL or missing references) //IL_00f2: 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) GameObject val = CreateUiObject(parent, name); val.GetComponent<RectTransform>().sizeDelta = new Vector2(width, height); LayoutElement obj = val.AddComponent<LayoutElement>(); obj.preferredWidth = width; obj.minWidth = width; obj.preferredHeight = height; obj.minHeight = height; Image targetGraphic = AddBackground(val, ButtonColor, addBorder: true); Button obj2 = val.AddComponent<Button>(); ((Selectable)obj2).targetGraphic = (Graphic)(object)targetGraphic; ColorBlock colors = ((Selectable)obj2).colors; ((ColorBlock)(ref colors)).normalColor = Color.white; ((ColorBlock)(ref colors)).highlightedColor = new Color(1f, 1f, 1f, 1f); ((ColorBlock)(ref colors)).pressedColor = new Color(0.7f, 0.74f, 0.82f, 1f); ((ColorBlock)(ref colors)).selectedColor = ((ColorBlock)(ref colors)).highlightedColor; ((ColorBlock)(ref colors)).disabledColor = new Color(1f, 1f, 1f, 0.48f); ((ColorBlock)(ref colors)).colorMultiplier = 1f; ((ColorBlock)(ref colors)).fadeDuration = 0.08f; ((Selectable)obj2).colors = colors; TextMeshProUGUI obj3 = CreateText(val.transform, "Label", text, fontSize, TextColor, (TextAlignmentOptions)514); ((TMP_Text)obj3).textWrappingMode = (TextWrappingModes)0; ((TMP_Text)obj3).overflowMode = (TextOverflowModes)1; return obj2; } private static Button CreateColorButton(Transform parent, string name, ColorPreset preset, float width) { //IL_002f: 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_0078: 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_00a2: 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_00cb: 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_0107: Unknown result type (might be due to invalid IL or missing references) //IL_011c: Unknown result type (might be due to invalid IL or missing references) Button obj = CreateVanillaButton(parent, name, preset.Name, width, 48f, 15f); TextMeshProUGUI buttonLabel = GetButtonLabel(obj); RectTransform component = ((Component)buttonLabel).GetComponent<RectTransform>(); component.offsetMin = new Vector2(29f, 0f); component.offsetMax = new Vector2(-4f, 0f); ((TMP_Text)buttonLabel).alignment = (TextAlignmentOptions)514; GameObject obj2 = CreateUiObject(((Component)obj).transform, "ColorChip"); RectTransform component2 = obj2.GetComponent<RectTransform>(); component2.anchorMin = new Vector2(0f, 0.5f); component2.anchorMax = new Vector2(0f, 0.5f); component2.pivot = new Vector2(0.5f, 0.5f); component2.anchoredPosition = new Vector2(16f, 0f); component2.sizeDelta = new Vector2(14f, 14f); Image obj3 = obj2.AddComponent<Image>(); ((Graphic)obj3).color = preset.Color; ((Graphic)obj3).raycastTarget = false; Outline obj4 = obj2.AddComponent<Outline>(); ((Shadow)obj4).effectColor = new Color(0f, 0f, 0f, 0.8f); ((Shadow)obj4).effectDistance = new Vector2(1f, 1f); ((Shadow)obj4).useGraphicAlpha = false; return obj; } private static Image AddBackground(GameObject target, Color color, bool addBorder) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Unknown result type (might be due to invalid IL or missing references) Image obj = target.AddComponent<Image>(); ((Graphic)obj).color = color; ((Graphic)obj).raycastTarget = true; if (addBorder) { Outline obj2 = target.AddComponent<Outline>(); ((Shadow)obj2).effectColor = BorderColor; ((Shadow)obj2).effectDistance = new Vector2(1.15f, 1.15f); ((Shadow)obj2).useGraphicAlpha = false; } return obj; } private static TextMeshProUGUI CreateText(Transform parent, string name, string text, float fontSize, Color color, TextAlignmentOptions alignment) { //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Unknown result type (might be due to invalid IL or missing references) GameObject obj = CreateUiObject(parent, name); SetFullStretch(obj.GetComponent<RectTransform>()); TextMeshProUGUI val = obj.AddComponent<TextMeshProUGUI>(); if ((Object)(object)_font != (Object)null) { ((TMP_Text)val).font = _font; } ((TMP_Text)val).text = text; ((TMP_Text)val).fontSize = fontSize; ((Graphic)val).color = color; ((TMP_Text)val).alignment = alignment; ((Graphic)val).raycastTarget = false; ((TMP_Text)val).enableAutoSizing = false; ((TMP_Text)val).textWrappingMode = (TextWrappingModes)0; return val; } private static TextMeshProUGUI CreateTextAt(Transform parent, string name, string text, float fontSize, Color color, TextAlignmentOptions alignment, Vector2 anchor, Vector2 size, Vector2 position) { //IL_0004: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_002e: 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_0040: Unknown result type (might be due to invalid IL or missing references) TextMeshProUGUI obj = CreateText(parent, name, text, fontSize, color, alignment); RectTransform component = ((Component)obj).GetComponent<RectTransform>(); component.anchorMin = anchor; component.anchorMax = anchor; component.pivot = new Vector2(0f, 0.5f); component.sizeDelta = size; component.anchoredPosition = position; return obj; } private static TextMeshProUGUI GetButtonLabel(Button button) { return ((Component)button).GetComponentInChildren<TextMeshProUGUI>(true); } private static GameObject CreateUiObject(Transform parent, string name) { //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Expected O, but got Unknown GameObject val = new GameObject(name, new Type[1] { typeof(RectTransform) }); val.transform.SetParent(parent, false); return val; } private static void SetFullStretch(RectTransform rect) { //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_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Unknown result type (might be due to invalid IL or missing references) rect.anchorMin = Vector2.zero; rect.anchorMax = Vector2.one; rect.pivot = new Vector2(0.5f, 0.5f); rect.offsetMin = Vector2.zero; rect.offsetMax = Vector2.zero; } private static void SetAt(RectTransform rect, Vector2 position) { //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0035: 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) rect.anchorMin = new Vector2(0.5f, 0.5f); rect.anchorMax = new Vector2(0.5f, 0.5f); rect.pivot = new Vector2(0.5f, 0.5f); rect.anchoredPosition = position; } private static Transform FindButtonParent(Transform itemDotsToggle) { Transform parent = itemDotsToggle.parent; int num = 0; while ((Object)(object)parent != (Object)null && num < 4) { if ((Object)(object)((Component)parent).GetComponent<HorizontalLayoutGroup>() != (Object)null || (Object)(object)((Component)parent).GetComponent<VerticalLayoutGroup>() != (Object)null) { return parent; } parent = parent.parent; num++; } if (!((Object)(object)itemDotsToggle.parent != (Object)null)) { return itemDotsToggle; } return itemDotsToggle.parent; } private static void PositionBesideToggle(RectTransform buttonRect, Toggle itemDotsToggle) { //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_0015: 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_002d: 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) RectTransform component = ((Component)itemDotsToggle).GetComponent<RectTransform>(); buttonRect.anchorMin = component.anchorMin; buttonRect.anchorMax = component.anchorMax; buttonRect.pivot = component.pivot; buttonRect.anchoredPosition = component.anchoredPosition + new Vector2(210f, 0f); } private static void FindFont(Canvas canvas) { TextMeshProUGUI componentInChildren = ((Component)canvas).GetComponentInChildren<TextMeshProUGUI>(true); if ((Object)(object)componentInChildren != (Object)null && (Object)(object)((TMP_Text)componentInChildren).font != (Object)null) { _font = ((TMP_Text)componentInChildren).font; return; } TextMeshProUGUI[] array = Object.FindObjectsByType<TextMeshProUGUI>((FindObjectsInactive)1); for (int i = 0; i < array.Length; i++) { if ((Object)(object)array[i] != (Object)null && (Object)(object)((TMP_Text)array[i]).font != (Object)null) { _font = ((TMP_Text)array[i]).font; break; } } } private static void Refresh() { //IL_0121: Unknown result type (might be due to invalid IL or missing references) //IL_0126: Unknown result type (might be due to invalid IL or missing references) //IL_014c: 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) if ((Object)(object)_enabledLabel != (Object)null) { ((TMP_Text)_enabledLabel).text = (BetterDisplayConfig.Enabled ? "圆点增强:开启" : "圆点增强:关闭"); } if ((Object)(object)_pulseLabel != (Object)null) { ((TMP_Text)_pulseLabel).text = (BetterDisplayConfig.PulseEnabled ? "呼吸效果:开启" : "呼吸效果:关闭"); } if ((Object)(object)_ballisticCorrectionLabel != (Object)null) { ((TMP_Text)_ballisticCorrectionLabel).text = (BetterDisplayConfig.BallisticCorrectionEnabled ? "弹道校正:开启" : "弹道校正:关闭"); } if ((Object)(object)_ammoDisplayLabel != (Object)null) { ((TMP_Text)_ammoDisplayLabel).text = (BetterDisplayConfig.AmmoDisplayEnabled ? "弹药显示:开启" : "弹药显示:关闭"); } if ((Object)(object)_foodInfoLabel != (Object)null) { ((TMP_Text)_foodInfoLabel).text = (BetterDisplayConfig.FoodInfoEnabled ? "食物信息:开启" : "食物信息:关闭"); } if ((Object)(object)_vitalsDisplayLabel != (Object)null) { ((TMP_Text)_vitalsDisplayLabel).text = (BetterDisplayConfig.VitalsDisplayEnabled ? "状态值显示:开启" : "状态值显示:关闭"); } for (int i = 0; i < CategoryViews.Count; i++) { CategoryView categoryView = CategoryViews[i]; bool flag = BetterDisplayConfig.IsCustomColor(categoryView.Category); Color configuredColor = BetterDisplayConfig.GetConfiguredColor(categoryView.Category); for (int j = 0; j < categoryView.Swatches.Count; j++) { SwatchView swatchView = categoryView.Swatches[j]; bool enabled = (swatchView.Preset.UseOriginal ? (!flag) : (flag && ColorsEqual(configuredColor, swatchView.Preset.Color))); ((Behaviour)swatchView.Selection).enabled = enabled; } } } private static void ToggleEnabled() { BetterDisplayConfig.SetEnabled(!BetterDisplayConfig.Enabled); Refresh(); } private static void TogglePulse() { BetterDisplayConfig.SetPulseEnabled(!BetterDisplayConfig.PulseEnabled); Refresh(); } private static void ToggleBallisticCorrection() { BetterDisplayConfig.SetBallisticCorrectionEnabled(!BetterDisplayConfig.BallisticCorrectionEnabled); Refresh(); } private static void ToggleAmmoDisplay() { BetterDisplayConfig.SetAmmoDisplayEnabled(!BetterDisplayConfig.AmmoDisplayEnabled); Refresh(); } private static void ToggleFoodInfo() { BetterDisplayConfig.SetFoodInfoEnabled(!BetterDisplayConfig.FoodInfoEnabled); Refresh(); } private static void ToggleVitalsDisplay() { BetterDisplayConfig.SetVitalsDisplayEnabled(!BetterDisplayConfig.VitalsDisplayEnabled); Refresh(); } private static void ResetAllColors() { BetterDisplayConfig.ResetColor(MarkerCategory.Enemy); BetterDisplayConfig.ResetColor(MarkerCategory.Player); BetterDisplayConfig.ResetColor(MarkerCategory.Pickup); Refresh(); } private static bool ColorsEqual(Color left, Color right) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_001f: 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) if (Mathf.Abs(left.r - right.r) < 0.002f && Mathf.Abs(left.g - right.g) < 0.002f) { return Mathf.Abs(left.b - right.b) < 0.002f; } return false; } } internal enum MarkerCategory { Enemy, Player, Pickup } public sealed class BetterDisplayMod : MelonMod { private const string HarmonyId = "HowToFish.BetterDisplay"; private Harmony _harmony; public override void OnInitializeMelon() { //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Expected O, but got Unknown BetterDisplayConfig.Initialize(); _harmony = new Harmony("HowToFish.BetterDisplay"); _harmony.PatchAll(typeof(BetterDisplayMod).Assembly); MelonLogger.Msg("更好的显示 v0.4.3 loaded."); } public override void OnDeinitializeMelon() { if (_harmony != null) { _harmony.UnpatchSelf(); _harmony = null; } BetterDisplayMenu.Close(); BetterDisplayHud.Close(); BetterDisplayBossIndicator.Close(); BetterDisplayDotState.ResetAll(); } public override void OnUpdate() { BetterDisplayMenu.Update(); BetterDisplayHud.Update(); BetterDisplayBossIndicator.Update(); } } internal static class BetterDisplayConfig { private const string CategoryId = "BetterDisplay"; private const string DefaultMarkerColor = "#FF2BD6"; private const string DefaultEnemyColor = "#FF4D4D"; private const string DefaultPlayerColor = "#4DBBFF"; private const string DefaultPickupColor = "#FFD447"; internal static bool Enabled { get; private set; } internal static bool PulseEnabled { get; private set; } internal static bool BallisticCorrectionEnabled { get; private set; } internal static bool AmmoDisplayEnabled { get; private set; } internal static bool FoodInfoEnabled { get; private set; } internal static bool VitalsDisplayEnabled { get; private set; } internal static bool UseGameColors { get; private set; } internal static Color MarkerColor { get; private set; } internal static bool EnemyCustomColor { get; private set; } internal static bool PlayerCustomColor { get; private set; } internal static bool PickupCustomColor { get; private set; } internal static Color EnemyColor { get; private set; } internal static Color PlayerColor { get; private set; } internal static Color PickupColor { get; private set; } internal static float DotScale { get; private set; } internal static float PulseSpeed { get; private set; } internal static void Initialize() { //IL_0321: Unknown result type (might be due to invalid IL or missing references) //IL_0326: Unknown result type (might be due to invalid IL or missing references) //IL_038f: Unknown result type (might be due to invalid IL or missing references) //IL_0394: Unknown result type (might be due to invalid IL or missing references) //IL_03c1: Unknown result type (might be due to invalid IL or missing references) //IL_03c6: Unknown result type (might be due to invalid IL or missing references) //IL_03f3: Unknown result type (might be due to invalid IL or missing references) //IL_03f8: Unknown result type (might be due to invalid IL or missing references) //IL_041d: Unknown result type (might be due to invalid IL or missing references) //IL_0427: Unknown result type (might be due to invalid IL or missing references) //IL_0431: Unknown result type (might be due to invalid IL or missing references) MelonPreferences.CreateEntry<bool>("BetterDisplay", "Enabled", true, "启用更好的物品显示", "保留游戏原有物品筛选规则,只增强物品圆点显示。", false, false, (ValueValidator)null); MelonPreferences.CreateEntry<bool>("BetterDisplay", "PulseEnabled", true, "启用脉冲效果", "让可见物品圆点轻微呼吸闪烁。", false, false, (ValueValidator)null); MelonPreferences.CreateEntry<bool>("BetterDisplay", "CenterAimEnabled", true, "启用弹道校正", "让本地枪械模型保持正对视角,并让弹道穿过屏幕中心,同时保留武器原有散布范围。", false, false, (ValueValidator)null); MelonPreferences.CreateEntry<bool>("BetterDisplay", "AmmoDisplayEnabled", true, "显示弹药数量", "持有枪械时,在右下角显示当前子弹数与弹夹容量。", false, false, (ValueValidator)null); MelonPreferences.CreateEntry<bool>("BetterDisplay", "FoodInfoEnabled", true, "显示食物信息", "持有食物时,显示食物提供的生命值与饥饿值。", false, false, (ValueValidator)null); MelonPreferences.CreateEntry<bool>("BetterDisplay", "VitalsDisplayEnabled", true, "显示状态值", "在原版血量与饥饿图标下显示当前数值。", false, false, (ValueValidator)null); MelonPreferences.CreateEntry<bool>("BetterDisplay", "UseGameColors", true, "保留游戏原始颜色", "保留敌对生物、玩家和普通物品在原版中的颜色区别。关闭后统一使用 MarkerColor。", true, false, (ValueValidator)null); bool num = MelonPreferences.HasEntry("BetterDisplay", "EnemyCustomColor") || MelonPreferences.HasEntry("BetterDisplay", "PlayerCustomColor") || MelonPreferences.HasEntry("BetterDisplay", "PickupCustomColor"); MelonPreferences.CreateEntry<string>("BetterDisplay", "MarkerColor", "#FF2BD6", "圆点颜色", "支持 Unity HTML 颜色格式,例如 #FF2BD6。", true, false, (ValueValidator)null); MelonPreferences.CreateEntry<bool>("BetterDisplay", "EnemyCustomColor", false, "自定义敌对生物颜色", "关闭时使用游戏原版颜色。", false, false, (ValueValidator)null); MelonPreferences.CreateEntry<string>("BetterDisplay", "EnemyColor", "#FF4D4D", "敌对生物颜色", "设置敌对生物圆点的颜色。", false, false, (ValueValidator)null); MelonPreferences.CreateEntry<bool>("BetterDisplay", "PlayerCustomColor", false, "自定义玩家颜色", "关闭时使用游戏原版颜色。", false, false, (ValueValidator)null); MelonPreferences.CreateEntry<string>("BetterDisplay", "PlayerColor", "#4DBBFF", "玩家颜色", "设置玩家圆点的颜色。", false, false, (ValueValidator)null); MelonPreferences.CreateEntry<bool>("BetterDisplay", "PickupCustomColor", false, "自定义可拾取物品颜色", "关闭时使用游戏原版颜色。", false, false, (ValueValidator)null); MelonPreferences.CreateEntry<string>("BetterDisplay", "PickupColor", "#FFD447", "可拾取物品颜色", "设置可拾取物品圆点的颜色。", false, false, (ValueValidator)null); MelonPreferences.CreateEntry<float>("BetterDisplay", "DotScale", 1.25f, "圆点大小", "相对于游戏原始圆点的倍率。", false, false, (ValueValidator)null); MelonPreferences.CreateEntry<float>("BetterDisplay", "PulseSpeed", 2f, "脉冲速度", "每秒脉冲周期数。", false, false, (ValueValidator)null); Enabled = MelonPreferences.GetEntryValue<bool>("BetterDisplay", "Enabled"); PulseEnabled = MelonPreferences.GetEntryValue<bool>("BetterDisplay", "PulseEnabled"); BallisticCorrectionEnabled = MelonPreferences.GetEntryValue<bool>("BetterDisplay", "CenterAimEnabled"); AmmoDisplayEnabled = MelonPreferences.GetEntryValue<bool>("BetterDisplay", "AmmoDisplayEnabled"); FoodInfoEnabled = MelonPreferences.GetEntryValue<bool>("BetterDisplay", "FoodInfoEnabled"); VitalsDisplayEnabled = MelonPreferences.GetEntryValue<bool>("BetterDisplay", "VitalsDisplayEnabled"); UseGameColors = MelonPreferences.GetEntryValue<bool>("BetterDisplay", "UseGameColors"); DotScale = Mathf.Clamp(MelonPreferences.GetEntryValue<float>("BetterDisplay", "DotScale"), 0.75f, 3f); PulseSpeed = Mathf.Clamp(MelonPreferences.GetEntryValue<float>("BetterDisplay", "PulseSpeed"), 0.1f, 8f); MarkerColor = ParseColor(MelonPreferences.GetEntryValue<string>("BetterDisplay", "MarkerColor"), new Color(1f, 0.1686f, 0.8392f, 1f)); EnemyCustomColor = MelonPreferences.GetEntryValue<bool>("BetterDisplay", "EnemyCustomColor"); PlayerCustomColor = MelonPreferences.GetEntryValue<bool>("BetterDisplay", "PlayerCustomColor"); PickupCustomColor = MelonPreferences.GetEntryValue<bool>("BetterDisplay", "PickupCustomColor"); EnemyColor = ParseColor(MelonPreferences.GetEntryValue<string>("BetterDisplay", "EnemyColor"), new Color(1f, 0.302f, 0.302f, 1f)); PlayerColor = ParseColor(MelonPreferences.GetEntryValue<string>("BetterDisplay", "PlayerColor"), new Color(0.302f, 0.733f, 1f, 1f)); PickupColor = ParseColor(MelonPreferences.GetEntryValue<string>("BetterDisplay", "PickupColor"), new Color(1f, 0.831f, 0.278f, 1f)); if (!num && !UseGameColors) { EnemyCustomColor = true; PlayerCustomColor = true; PickupCustomColor = true; EnemyColor = MarkerColor; PlayerColor = MarkerColor; PickupColor = MarkerColor; SaveColorSettings(); } } private static Color ParseColor(string value, Color fallback) { //IL_001e: 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) Color result = default(Color); if (!string.IsNullOrEmpty(value) && ColorUtility.TryParseHtmlString(value, ref result)) { return result; } MelonLogger.Warning("BetterDisplay: invalid MarkerColor; using the default high-contrast color."); return fallback; } internal static Color GetMarkerColor(Item item, Color originalColor) { //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_0031: 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_0040: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)item == (Object)null) { return originalColor; } switch (GetCategory(item)) { case MarkerCategory.Enemy: if (!EnemyCustomColor) { return originalColor; } return EnemyColor; case MarkerCategory.Player: if (!PlayerCustomColor) { return originalColor; } return PlayerColor; default: if (!PickupCustomColor) { return originalColor; } return PickupColor; } } internal static MarkerCategory GetCategory(Item item) { if ((Object)(object)item != (Object)null && (Object)(object)item.Creature != (Object)null && !item.Creature.IsDead) { return MarkerCategory.Enemy; } if ((Object)(object)item != (Object)null && (Object)(object)item.DeadPlayer != (Object)null) { return MarkerCategory.Player; } return MarkerCategory.Pickup; } internal static bool IsCustomColor(MarkerCategory category) { return category switch { MarkerCategory.Enemy => EnemyCustomColor, MarkerCategory.Player => PlayerCustomColor, _ => PickupCustomColor, }; } internal static Color GetConfiguredColor(MarkerCategory category) { //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) return (Color)(category switch { MarkerCategory.Enemy => EnemyColor, MarkerCategory.Player => PlayerColor, _ => PickupColor, }); } internal static void SetEnabled(bool value) { Enabled = value; MelonPreferences.SetEntryValue<bool>("BetterDisplay", "Enabled", value); MelonPreferences.Save(); } internal static void SetPulseEnabled(bool value) { PulseEnabled = value; MelonPreferences.SetEntryValue<bool>("BetterDisplay", "PulseEnabled", value); MelonPreferences.Save(); } internal static void SetBallisticCorrectionEnabled(bool value) { BallisticCorrectionEnabled = value; MelonPreferences.SetEntryValue<bool>("BetterDisplay", "CenterAimEnabled", value); MelonPreferences.Save(); } internal static void SetAmmoDisplayEnabled(bool value) { AmmoDisplayEnabled = value; MelonPreferences.SetEntryValue<bool>("BetterDisplay", "AmmoDisplayEnabled", value); MelonPreferences.Save(); } internal static void SetFoodInfoEnabled(bool value) { FoodInfoEnabled = value; MelonPreferences.SetEntryValue<bool>("BetterDisplay", "FoodInfoEnabled", value); MelonPreferences.Save(); } internal static void SetVitalsDisplayEnabled(bool value) { VitalsDisplayEnabled = value; MelonPreferences.SetEntryValue<bool>("BetterDisplay", "VitalsDisplayEnabled", value); MelonPreferences.Save(); } internal static void SetCustomColor(MarkerCategory category, Color color) { //IL_000c: 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_0050: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Unknown result type (might be due to invalid IL or missing references) color.a = 1f; string text = ToHex(color); switch (category) { case MarkerCategory.Enemy: EnemyCustomColor = true; EnemyColor = color; MelonPreferences.SetEntryValue<bool>("BetterDisplay", "EnemyCustomColor", true); MelonPreferences.SetEntryValue<string>("BetterDisplay", "EnemyColor", text); break; case MarkerCategory.Player: PlayerCustomColor = true; PlayerColor = color; MelonPreferences.SetEntryValue<bool>("BetterDisplay", "PlayerCustomColor", true); MelonPreferences.SetEntryValue<string>("BetterDisplay", "PlayerColor", text); break; default: PickupCustomColor = true; PickupColor = color; MelonPreferences.SetEntryValue<bool>("BetterDisplay", "PickupCustomColor", true); MelonPreferences.SetEntryValue<string>("BetterDisplay", "PickupColor", text); break; } SaveColorSettings(); } internal static void ResetColor(MarkerCategory category) { switch (category) { case MarkerCategory.Enemy: EnemyCustomColor = false; MelonPreferences.SetEntryValue<bool>("BetterDisplay", "EnemyCustomColor", false); break; case MarkerCategory.Player: PlayerCustomColor = false; MelonPreferences.SetEntryValue<bool>("BetterDisplay", "PlayerCustomColor", false); break; default: PickupCustomColor = false; MelonPreferences.SetEntryValue<bool>("BetterDisplay", "PickupCustomColor", false); break; } SaveColorSettings(); } private static void SaveColorSettings() { MelonPreferences.Save(); } private static string ToHex(Color color) { //IL_0000: Unknown result type (migh