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 BepInEx;
using BepInEx.Logging;
using CG.Client.Player.HUD;
using CG.Client.UI;
using CG.Game.Player;
using CG.GameLoopStateMachine.GameStates;
using CG.Input;
using CG.Ship.Object;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using UnityEngine;
using UnityEngine.Events;
using UnityEngine.UIElements;
using VoidManager;
using VoidManager.MPModChecks;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: AssemblyCompany("LoadingScreenSkip")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyDescription("Template")]
[assembly: AssemblyFileVersion("0.0.3.0")]
[assembly: AssemblyInformationalVersion("0.0.3")]
[assembly: AssemblyProduct("LoadingScreenSkip")]
[assembly: AssemblyTitle("LoadingScreenSkip")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("0.0.3.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
internal sealed class EmbeddedAttribute : Attribute
{
}
}
namespace System.Runtime.CompilerServices
{
[CompilerGenerated]
[Microsoft.CodeAnalysis.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 LoadingScreenSkip
{
[BepInPlugin("LoadingScreenSkip", "LoadingScreenSkip", "0.0.3")]
[BepInProcess("Void Crew.exe")]
[BepInDependency(/*Could not decode attribute arguments.*/)]
public class BepinPlugin : BaseUnityPlugin
{
internal static ManualLogSource Log;
public static BepinPlugin Instance { get; private set; }
private void Awake()
{
Log = ((BaseUnityPlugin)this).Logger;
Instance = this;
Harmony.CreateAndPatchAll(Assembly.GetExecutingAssembly(), "LoadingScreenSkip");
((BaseUnityPlugin)this).Logger.LogInfo((object)"LoadingScreenSkip loaded");
}
}
[HarmonyPatch(typeof(CursorUtility), "ShowCursor")]
internal class CursorUtilityPatch
{
private static readonly FieldInfo mainMenuField = AccessTools.Field(typeof(EscapeMenu), "_mainMenu");
private static readonly FieldInfo respawnButtonField = AccessTools.Field(typeof(MainMenu), "_forceRespawnButton");
private static readonly FieldInfo cloneTubesField = AccessTools.Field(typeof(SpawnSystem), "clonetubes");
private static void Postfix(IShowCursorSource source, bool show)
{
//IL_009b: Unknown result type (might be due to invalid IL or missing references)
//IL_00a1: Expected O, but got Unknown
//IL_00ac: Unknown result type (might be due to invalid IL or missing references)
//IL_00b2: Expected O, but got Unknown
MenuScreenController val = (MenuScreenController)(object)((source is MenuScreenController) ? source : null);
if ((Object)(object)val == (Object)null || !show || (Object)(object)SpawnSystem.Instance == (Object)null)
{
return;
}
foreach (CloneTube item in (List<CloneTube>)cloneTubesField.GetValue(SpawnSystem.Instance))
{
if ((Object)(object)item.GetOccupant() == (Object)(object)LocalPlayer.Instance)
{
return;
}
}
EscapeMenu obj = val.FindScreen<EscapeMenu>();
MainMenu obj2 = (MainMenu)mainMenuField.GetValue(obj);
Button val2 = (Button)respawnButtonField.GetValue(obj2);
((VisualElement)val2).SetEnabled(true);
}
}
[HarmonyPatch(typeof(FadeController), "FadeToClear")]
internal class FadeToClearPatch
{
[HarmonyPrefix]
private static void DurationReplacement(ref float duration)
{
duration = 0f;
}
}
[HarmonyPatch(typeof(FadeController), "FadeToClearDelayed")]
internal class FadeToClearDelayedPatch
{
[HarmonyPrefix]
private static void DurationReplacement(ref float delay, ref float duration)
{
delay = 0f;
duration = 0f;
}
}
[HarmonyPatch(typeof(GSIntro), "OnEnter")]
internal class GSIntroPatch
{
private static void Postfix(ref float ____timer)
{
____timer = 0f;
}
}
[HarmonyPatch(typeof(HUD_BootSequence), "OnLifeformStateChanged")]
internal class HUD_BootSequencePatch
{
private static readonly MethodInfo bootSequenceComplete = AccessTools.Method(typeof(HUD_BootSequence), "OnBootSequenceComplete", (Type[])null, (Type[])null);
private static bool Prefix(HUD_BootSequence __instance, ILifeform lifeform, UnityEvent ___OnAlive, ref bool ____isFirstTime, ref float ___backgroundFadeDelay)
{
if (lifeform != LocalPlayer.Instance)
{
return true;
}
if (____isFirstTime)
{
___OnAlive.Invoke();
____isFirstTime = false;
___backgroundFadeDelay = 0f;
bootSequenceComplete.Invoke(__instance, new object[0]);
return false;
}
return true;
}
public static void Nop()
{
}
}
[HarmonyPatch(typeof(MainMenuTimelineController), "Update")]
internal class MainMenuTimelineControllerPatch
{
private static void Prefix(ref bool ____skipIntro)
{
____skipIntro = true;
}
}
public class VoidManagerPlugin : VoidPlugin
{
public override MultiplayerType MPType => (MultiplayerType)3;
public override string Author => "18107, Dragon";
public override string Description => "Skips various loading screens.";
}
public static class MyPluginInfo
{
public const string PLUGIN_GUID = "LoadingScreenSkip";
public const string PLUGIN_NAME = "LoadingScreenSkip";
public const string PLUGIN_VERSION = "0.0.3";
}
}