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 HarmonyLib; using Il2CppFemur; using Il2CppInterop.Runtime.InteropTypes.Arrays; using MelonLoader; using Microsoft.CodeAnalysis; using StatusBarMod; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: MelonInfo(typeof(StatusBar), "StatusBar", "1.0.0", "Zooks", null)] [assembly: MelonGame(null, null)] [assembly: TargetFramework(".NETCoreApp,Version=v6.0", FrameworkDisplayName = ".NET 6.0")] [assembly: AssemblyCompany("StatusBar")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyDescription("mod for Gang Beasts")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("StatusBar")] [assembly: AssemblyTitle("StatusBar")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.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 StatusBarMod { public class StatusBar : MelonMod { private readonly List cachedHandlers = new List(); private float searchTimer; private const float SearchInterval = 3f; public override void OnSceneWasLoaded(int buildIndex, string sceneName) { cachedHandlers.Clear(); FindAndCacheHandlers(); } public override void OnUpdate() { searchTimer += Time.deltaTime; if (searchTimer >= 3f) { searchTimer = 0f; FindAndCacheHandlers(); } for (int num = cachedHandlers.Count - 1; num >= 0; num--) { StatusHandeler val = cachedHandlers[num]; if ((Object)(object)val == (Object)null) { cachedHandlers.RemoveAt(num); } else if (!((Behaviour)val).enabled) { ((Behaviour)val).enabled = true; } } } private void FindAndCacheHandlers() { StatusHandeler[] array = Il2CppArrayBase.op_Implicit(Object.FindObjectsOfType(true)); if (array == null) { return; } StatusHandeler[] array2 = array; foreach (StatusHandeler val in array2) { if ((Object)(object)val != (Object)null && !cachedHandlers.Contains(val)) { cachedHandlers.Add(val); } } } } [HarmonyPatch(typeof(StatusHandeler), "Start")] public static class StatusHandelerStartPatch { [HarmonyPrefix] public static void Prefix(StatusHandeler __instance) { if (!((Object)(object)__instance == (Object)null)) { ((Behaviour)__instance).enabled = true; __instance.showStatusBar = true; __instance.displayTimer = 9999f; } } } [HarmonyPatch(typeof(StatusHandeler), "Update")] public static class StatusHandelerUpdatePatch { [HarmonyPostfix] public static void Postfix(StatusHandeler __instance) { if ((Object)(object)__instance == (Object)null) { return; } ((Behaviour)__instance).enabled = true; __instance.showStatusBar = true; __instance.displayTimer = 9999f; Actor actor = __instance.actor; if ((Object)(object)actor != (Object)null) { if ((Object)(object)actor.TrackingCanvas != (Object)null && !actor.TrackingCanvas.activeSelf) { actor.TrackingCanvas.SetActive(true); } if ((Object)(object)actor.TrackerObject != (Object)null && !actor.TrackerObject.activeSelf) { actor.TrackerObject.SetActive(true); } } if ((Object)(object)__instance.statusBarTransform != (Object)null && !((Component)__instance.statusBarTransform).gameObject.activeSelf) { ((Component)__instance.statusBarTransform).gameObject.SetActive(true); } } } [HarmonyPatch(typeof(StatusHandeler), "UpdateBars")] public static class StatusHandelerUpdateBarsPatch { [HarmonyPostfix] public static void Postfix(StatusHandeler __instance) { if (!((Object)(object)__instance == (Object)null) && (Object)(object)__instance.statusBarTransform != (Object)null && !((Component)__instance.statusBarTransform).gameObject.activeSelf) { ((Component)__instance.statusBarTransform).gameObject.SetActive(true); } } } }