Please disclose if any significant portion of your mod was created using AI tools by adding the 'AI Generated' category. Failing to do so may result in the mod being removed from Thunderstore.
Decompiled source of ShyHUD v1.0.0
plugins/ShyHUD.dll
Decompiled 2 years agousing System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Logging; using GameNetcodeStuff; using HarmonyLib; using TMPro; using Unity.Netcode; using UnityEngine; using UnityEngine.UI; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = "")] [assembly: AssemblyCompany("ShyHUD")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyDescription("Hide HUD items when they're not being useful.")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("ShyHUD")] [assembly: AssemblyTitle("ShyHUD")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] namespace ShyHUD; [BepInPlugin("ShyHUD", "ShyHUD", "1.0.0")] public class Plugin : BaseUnityPlugin { public static ManualLogSource PluginLogger; private void Awake() { //IL_0020: Unknown result type (might be due to invalid IL or missing references) PluginLogger = ((BaseUnityPlugin)this).Logger; ((BaseUnityPlugin)this).Logger.LogInfo((object)"Plugin ShyHUD is loaded!"); new Harmony("ShyHUD").PatchAll(); } } [HarmonyPatch(typeof(PlayerControllerB))] public class PlayerUIPatch { private static float? LastSprintMeter; private static int? LastHealth; private static float? LastCarryWeight; [HarmonyPatch("LateUpdate")] [HarmonyPostfix] private static void HideStaminaHealthUIWhenFull(ref PlayerControllerB __instance) { if (!((NetworkBehaviour)__instance).IsOwner || (((NetworkBehaviour)__instance).IsServer && !__instance.isHostPlayerObject) || !__instance.isPlayerControlled || __instance.isPlayerDead) { return; } if (LastSprintMeter != __instance.sprintMeter) { if (__instance.sprintMeter == 1f) { ((Graphic)__instance.sprintMeterUI).CrossFadeAlpha(0f, 5f, false); } else { ((Graphic)__instance.sprintMeterUI).CrossFadeAlpha(1f, 0.5f, false); } } LastSprintMeter = __instance.sprintMeter; if (LastHealth != __instance.health) { if (__instance.health == 100) { ((Graphic)GameObject.Find("Systems/UI/Canvas/IngamePlayerHUD/TopLeftCorner/Self").GetComponent<Image>()).CrossFadeAlpha(0f, 5f, false); } else { ((Graphic)GameObject.Find("Systems/UI/Canvas/IngamePlayerHUD/TopLeftCorner/Self").GetComponent<Image>()).CrossFadeAlpha(1f, 0f, false); } } LastHealth = __instance.health; } [HarmonyPatch("LateUpdate")] [HarmonyPostfix] private static void HideWeightIfEmpty(ref PlayerControllerB __instance) { if (((NetworkBehaviour)__instance).IsOwner && (!((NetworkBehaviour)__instance).IsServer || __instance.isHostPlayerObject) && __instance.isPlayerControlled && !__instance.isPlayerDead && LastCarryWeight != __instance.carryWeight) { if (__instance.carryWeight == 1f) { ((Graphic)GameObject.Find("Systems/UI/Canvas/IngamePlayerHUD/TopLeftCorner/WeightUI/Weight").GetComponent<TextMeshProUGUI>()).CrossFadeAlpha(0f, 5f, false); } else { ((Graphic)GameObject.Find("Systems/UI/Canvas/IngamePlayerHUD/TopLeftCorner/WeightUI/Weight").GetComponent<TextMeshProUGUI>()).CrossFadeAlpha(1f, 0f, false); } LastCarryWeight = __instance.carryWeight; Plugin.PluginLogger.LogInfo((object)$"new weight: {__instance.carryWeight}"); } } [HarmonyPatch("Awake")] [HarmonyPostfix] private static void MoveWeight() { //IL_0019: Unknown result type (might be due to invalid IL or missing references) GameObject.Find("Systems/UI/Canvas/IngamePlayerHUD/TopLeftCorner/WeightUI").GetComponent<RectTransform>().offsetMin = new Vector2(-180f, -100f); } } [HarmonyPatch(typeof(HUDManager))] public class HideChatPatch { [HarmonyPatch("OpenMenu_performed")] [HarmonyPatch("SubmitChat_performed")] [HarmonyPatch("AddChatMessage")] [HarmonyPostfix] private static void FullyHideChat2(ref HUDManager __instance) { __instance.PingHUDElement(__instance.Chat, 5f, 1f, 0f); } } public static class PluginInfo { public const string PLUGIN_GUID = "ShyHUD"; public const string PLUGIN_NAME = "ShyHUD"; public const string PLUGIN_VERSION = "1.0.0"; }