using System; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using BepInEx; using GameNetcodeStuff; using HarmonyLib; using TMPro; using UnityEngine; using UnityEngine.UI; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: AssemblyTitle("TerminalCreditDisplay")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("TerminalCreditDisplay")] [assembly: AssemblyCopyright("Copyright © 2026")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("50a6f437-685f-41c3-95e7-ccc802a0ecad")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")] [assembly: AssemblyVersion("1.0.0.0")] namespace TerminalCreditDisplay; [BepInPlugin("azumi.terminalcreditdisplay", "TerminalCreditDisplay", "1.0.0")] public class Plugin : BaseUnityPlugin { internal static Plugin Instance; private Harmony harmony; private void Awake() { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Expected O, but got Unknown Instance = this; harmony = new Harmony("azumi.terminalcreditdisplay"); harmony.PatchAll(); ((BaseUnityPlugin)this).Logger.LogInfo((object)"TerminalCreditDisplay loaded"); } } [HarmonyPatch(typeof(HUDManager))] internal class HUDManagerPatch { [HarmonyPostfix] [HarmonyPatch("Start")] private static void StartPatch() { CreditsHud.Reset(); } [HarmonyPostfix] [HarmonyPatch("Update")] private static void UpdatePatch() { CreditsHud.Update(); } } [HarmonyPatch(typeof(GameNetworkManager))] internal class DisconnectPatch { [HarmonyPostfix] [HarmonyPatch("StartDisconnect")] private static void OnDisconnect() { CreditsHud.Reset(); } } internal static class CreditsHud { private static GameObject counterObject; private static TextMeshProUGUI textObject; private static Terminal terminal; private static bool initialized; public static void Update() { if ((Object)(object)counterObject == (Object)null || (Object)(object)textObject == (Object)null) { counterObject = null; textObject = null; initialized = false; } if (!initialized) { Initialize(); } if ((Object)(object)counterObject == (Object)null || (Object)(object)textObject == (Object)null) { return; } if ((Object)(object)terminal == (Object)null) { terminal = Object.FindObjectOfType(); } if (!((Object)(object)terminal == (Object)null)) { PlayerControllerB val = GameNetworkManager.Instance?.localPlayerController; bool flag = (Object)(object)val != (Object)null && val.isInHangarShipRoom; bool flag2 = (Object)(object)StartOfRound.Instance != (Object)null && (Object)(object)StartOfRound.Instance.currentLevel != (Object)null && StartOfRound.Instance.currentLevel.sceneName == "CompanyBuilding"; bool flag3 = flag || flag2; counterObject.SetActive(flag3); if (flag3) { ((TMP_Text)textObject).text = $"CREDITS: ${terminal.groupCredits}"; } } } private static void Initialize() { //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0077: Expected O, but got Unknown //IL_00bf: 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_00eb: Unknown result type (might be due to invalid IL or missing references) //IL_0101: Unknown result type (might be due to invalid IL or missing references) //IL_0117: Unknown result type (might be due to invalid IL or missing references) GameObject val = GameObject.Find("/Systems/UI/Canvas/IngamePlayerHUD"); if ((Object)(object)val == (Object)null) { return; } GameObject val2 = GameObject.Find("/Systems/UI/Canvas/IngamePlayerHUD/BottomMiddle/ValueCounter"); if (!((Object)(object)val2 == (Object)null)) { TextMeshProUGUI componentInChildren = val2.GetComponentInChildren(true); if (!((Object)(object)componentInChildren == (Object)null)) { counterObject = new GameObject("ShipCreditsCounter", new Type[1] { typeof(RectTransform) }); counterObject.transform.SetParent(val.transform, false); textObject = counterObject.AddComponent(); CopyStyle(componentInChildren, textObject); RectTransform component = counterObject.GetComponent(); component.anchorMin = new Vector2(1f, 1f); component.anchorMax = new Vector2(1f, 1f); component.pivot = new Vector2(1f, 1f); component.anchoredPosition = new Vector2(-30f, -30f); component.sizeDelta = new Vector2(350f, 40f); counterObject.SetActive(false); initialized = true; } } } private static void CopyStyle(TextMeshProUGUI source, TextMeshProUGUI target) { //IL_002a: 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) //IL_0051: Unknown result type (might be due to invalid IL or missing references) ((TMP_Text)target).font = ((TMP_Text)source).font; ((TMP_Text)target).fontSharedMaterial = ((TMP_Text)source).fontSharedMaterial; ((TMP_Text)target).spriteAsset = ((TMP_Text)source).spriteAsset; ((Graphic)target).color = ((Graphic)source).color; ((TMP_Text)target).outlineColor = ((TMP_Text)source).outlineColor; ((TMP_Text)target).outlineWidth = ((TMP_Text)source).outlineWidth; ((TMP_Text)target).fontStyle = ((TMP_Text)source).fontStyle; ((TMP_Text)target).fontSize = 20f; ((TMP_Text)target).alignment = (TextAlignmentOptions)260; ((TMP_Text)target).enableWordWrapping = false; ((Graphic)target).raycastTarget = false; ((TMP_Text)target).text = "CREDITS: $0"; } public static void Reset() { if ((Object)(object)counterObject != (Object)null) { Object.Destroy((Object)(object)counterObject); } counterObject = null; textObject = null; terminal = null; initialized = false; } }