using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Logging;
using GameNetcodeStuff;
using HarmonyLib;
using UnityEngine;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTitle("ClockTimeWhenDead")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("ClockTimeWhenDead")]
[assembly: AssemblyCopyright("Copyright © 2024")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("ea9fd4b0-19bf-4905-a3bb-d13323f43078")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace ClockTimeWhenDead
{
[BepInPlugin("Supergike.clockTimeWhenDead", "Clock_Time_When_Dead", "1.0.2")]
public class ClockTimeWhenDeadBase : BaseUnityPlugin
{
private const string modGUID = "Supergike.clockTimeWhenDead";
private const string modName = "Clock_Time_When_Dead";
private const string modVersion = "1.0.2";
private readonly Harmony harmony = new Harmony("Supergike.clockTimeWhenDead");
public static ClockTimeWhenDeadBase Instance;
internal ManualLogSource mls;
private void Awake()
{
if ((Object)(object)Instance == (Object)null)
{
Instance = this;
}
mls = Logger.CreateLogSource("Supergike.clockTimeWhenDead");
harmony.PatchAll(Assembly.GetExecutingAssembly());
mls.LogInfo((object)"Applying Harmony patches");
int num = 0;
foreach (MethodBase patchedMethod in harmony.GetPatchedMethods())
{
mls.LogInfo((object)("Patched " + patchedMethod.DeclaringType.Name + "." + patchedMethod.Name));
num++;
}
mls.LogInfo((object)(num + " patches applied"));
}
}
}
namespace ClockTimeWhenDead.Patches
{
[HarmonyPatch(typeof(HUDManager))]
[HarmonyPriority(800)]
internal static class ClockPatch
{
[HarmonyPrefix]
[HarmonyPatch("SetClockVisible")]
public static bool PrefixVisible(ref HUDManager __instance, bool visible)
{
//IL_000a: Unknown result type (might be due to invalid IL or missing references)
//IL_0015: Expected O, but got Unknown
//IL_0023: Unknown result type (might be due to invalid IL or missing references)
//IL_002e: Expected O, but got Unknown
GameNetworkManager instance = GameNetworkManager.Instance;
PlayerControllerB val = null;
if ((Object)instance != (Object)null)
{
val = instance.localPlayerController;
}
if ((Object)val != (Object)null)
{
if (val.isInsideFactory)
{
__instance.Clock.targetAlpha = 0f;
return false;
}
if (val.isInHangarShipRoom)
{
__instance.Clock.targetAlpha = 1f;
return false;
}
if (val.isPlayerDead)
{
__instance.HUDAnimator.SetTrigger("revealHud");
__instance.Clock.targetAlpha = 1f;
__instance.Inventory.targetAlpha = 0f;
__instance.PlayerInfo.targetAlpha = 0f;
return false;
}
}
if (visible)
{
__instance.Clock.targetAlpha = 1f;
}
else
{
__instance.Clock.targetAlpha = 0f;
}
return false;
}
}
}