using System; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using Aggro.Core.Networking; using BepInEx; using BepInEx.Configuration; using HarmonyLib; using TMPro; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("DoubleTimeMod")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("DoubleTimeMod")] [assembly: AssemblyTitle("DoubleTimeMod")] [assembly: AssemblyVersion("1.0.0.0")] namespace DoubleTimeMod; [BepInPlugin("bilibili.hualidexiaoningmenga.supermod", "哔哩哔哩-华丽的小柠檬啊_超级整合包MOD", "1.1.0")] public class Plugin : BaseUnityPlugin { public static ConfigEntry TimeMultiplierConfig; public static ConfigEntry EnableCountdownNumbersConfig; private void Awake() { TimeMultiplierConfig = ((BaseUnityPlugin)this).Config.Bind("时间设置", "TimeMultiplier", 2f, "卡车等待时间和准备时间的放大倍数 (默认2倍)"); EnableCountdownNumbersConfig = ((BaseUnityPlugin)this).Config.Bind("UI设置", "EnableCountdownNumbers", true, "是否在游戏中显示数字倒计时 (true为开启,false为关闭)"); ((BaseUnityPlugin)this).Logger.LogInfo((object)"[哔哩哔哩-华丽的小柠檬啊_超级整合包MOD] 插件已成功加载!"); ((BaseUnityPlugin)this).Logger.LogInfo((object)$"读取配置:时间倍率={TimeMultiplierConfig.Value}, UI倒计时={EnableCountdownNumbersConfig.Value}"); Harmony.CreateAndPatchAll(typeof(ShiftManagerPatch), (string)null); Harmony.CreateAndPatchAll(typeof(TruckTimerPatch), (string)null); ((BaseUnityPlugin)this).Logger.LogInfo((object)"[哔哩哔哩-华丽的小柠檬啊_超级整合包MOD] 所有功能注入完毕。"); } private void OnGUI() { //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Expected O, but got Unknown //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_008f: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Expected O, but got Unknown //IL_009d: 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_0107: Unknown result type (might be due to invalid IL or missing references) //IL_0145: Unknown result type (might be due to invalid IL or missing references) //IL_0183: Unknown result type (might be due to invalid IL or missing references) //IL_019f: Unknown result type (might be due to invalid IL or missing references) try { if (EnableCountdownNumbersConfig.Value && (Object)(object)NetworkAggroManagerBase.instance != (Object)null) { ShiftManager instance = NetworkAggroManagerBase.instance; if ((int)instance.GetShiftPhase() == 2) { int secondsRemainingInt = instance.secondsRemainingInt; GUIStyle val = new GUIStyle(); val.fontSize = 40; val.normal.textColor = Color.yellow; val.alignment = (TextAnchor)1; val.fontStyle = (FontStyle)1; Rect val2 = default(Rect); ((Rect)(ref val2))..ctor((float)Screen.width / 2f - 100f, 80f, 200f, 100f); GUIStyle val3 = new GUIStyle(val); val3.normal.textColor = Color.black; GUI.Label(new Rect(((Rect)(ref val2)).x - 2f, ((Rect)(ref val2)).y, ((Rect)(ref val2)).width, ((Rect)(ref val2)).height), $"准备时间: {secondsRemainingInt}s", val3); GUI.Label(new Rect(((Rect)(ref val2)).x + 2f, ((Rect)(ref val2)).y, ((Rect)(ref val2)).width, ((Rect)(ref val2)).height), $"准备时间: {secondsRemainingInt}s", val3); GUI.Label(new Rect(((Rect)(ref val2)).x, ((Rect)(ref val2)).y - 2f, ((Rect)(ref val2)).width, ((Rect)(ref val2)).height), $"准备时间: {secondsRemainingInt}s", val3); GUI.Label(new Rect(((Rect)(ref val2)).x, ((Rect)(ref val2)).y + 2f, ((Rect)(ref val2)).width, ((Rect)(ref val2)).height), $"准备时间: {secondsRemainingInt}s", val3); GUI.Label(val2, $"准备时间: {secondsRemainingInt}s", val); } } } catch (Exception) { } } } public class ShiftManagerPatch { [HarmonyPatch(typeof(ShiftManager), "ServerGetStrikeOutDuration")] [HarmonyPostfix] public static void DoubleStrikeOutDuration(ref float __result) { __result *= Plugin.TimeMultiplierConfig.Value; } [HarmonyPatch(typeof(ShiftManager), "OnEntityCreated")] [HarmonyPostfix] public static void DoubleOrganizationalDuration(ShiftManager __instance) { __instance.organizationalDuration *= Plugin.TimeMultiplierConfig.Value; } } public class TruckTimerPatch { [HarmonyPatch(typeof(TruckTimerFloaterUI), "OnUpdatePresentationEarly")] [HarmonyPostfix] public static void AddNumbersToTruckTimer(TruckTimerFloaterUI __instance) { if (Plugin.EnableCountdownNumbersConfig.Value && (Object)(object)__instance.bayNumberText != (Object)null && (Object)(object)__instance.assignedOutboundBay != (Object)null) { int secondsRemainingInt = __instance.assignedOutboundBay.secondsRemainingInt; ((TMP_Text)__instance.bayNumberText).enableAutoSizing = true; ((TMP_Text)__instance.bayNumberText).fontSizeMin = 10f; ((TMP_Text)__instance.bayNumberText).fontSizeMax = 60f; ((TMP_Text)__instance.bayNumberText).text = $"{__instance.assignedOutboundBay.bayID}\n{secondsRemainingInt}"; } } }