using System;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using Events;
using Events.GameLogic;
using Events.SteamWorkshop;
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("Distance.SplashSkip")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Distance.SplashSkip")]
[assembly: AssemblyCopyright("Copyright © Robert Jordan 2022")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("7bcb2908-b003-45d9-be68-50cba5217603")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
namespace Distance.SplashSkip
{
[BepInPlugin("Distance.SplashSkip", "Splash Skip", "1.0.0")]
public sealed class Mod : BaseUnityPlugin
{
private const string modGUID = "Distance.SplashSkip";
private const string modName = "Splash Skip";
private const string modVersion = "1.0.0";
public static string SkipSplashKey = "Skip Splash Animation";
public static string SkipWorkshopKey = "Skip Workshop Subscriptions";
public static string SkipIdleKey = "Skip Idle Menu";
private static readonly Harmony harmony = new Harmony("Distance.SplashSkip");
public static ManualLogSource Log = new ManualLogSource("Splash Skip");
public static Mod Instance;
public static ConfigEntry<bool> SkipSplashAnimation { get; set; }
public static ConfigEntry<bool> SkipWorkshopSubscriptions { get; set; }
public static ConfigEntry<bool> SkipIdleMenu { get; set; }
public void Awake()
{
//IL_0044: Unknown result type (might be due to invalid IL or missing references)
//IL_004e: Expected O, but got Unknown
//IL_0071: Unknown result type (might be due to invalid IL or missing references)
//IL_007b: Expected O, but got Unknown
//IL_009e: Unknown result type (might be due to invalid IL or missing references)
//IL_00a8: Expected O, but got Unknown
if ((Object)(object)Instance == (Object)null)
{
Instance = this;
}
Log = Logger.CreateLogSource("Distance.SplashSkip");
SkipSplashAnimation = ((BaseUnityPlugin)this).Config.Bind<bool>("General", SkipSplashKey, true, new ConfigDescription("Skip the REFRACT splash screen animation.", (AcceptableValueBase)null, new object[0]));
SkipWorkshopSubscriptions = ((BaseUnityPlugin)this).Config.Bind<bool>("General", SkipWorkshopKey, true, new ConfigDescription("Skip startup checks for newly-subscribed/unsubscribed Steam Workshop levels.", (AcceptableValueBase)null, new object[0]));
SkipIdleMenu = ((BaseUnityPlugin)this).Config.Bind<bool>("General", SkipIdleKey, true, new ConfigDescription("Skip the 'press-any-key' Idle menu and boot into the Main Menu.", (AcceptableValueBase)null, new object[0]));
Log.LogInfo((object)"Splash Skip: Initializing...");
harmony.PatchAll();
Log.LogInfo((object)"Splash Skip: Initialized!");
}
}
}
namespace Distance.SplashSkip.Patches
{
[HarmonyPatch(typeof(SplashScreenLogic), "OnEventSteamWorkshopUpdateComplete")]
internal static class SplashScreenLogic__OnEventSteamWorkshopUpdateComplete
{
internal static bool Prefix(SplashScreenLogic __instance, Data data)
{
__instance.fadeTimer_ = 0f;
if (!Mod.SkipSplashAnimation.Value)
{
PlayCrossplatformMovie component = ((Component)__instance.foregroundPanel_).GetComponent<PlayCrossplatformMovie>();
component.Play();
((UIWidget)((Component)__instance.foregroundPanel_).GetComponentInChildren<UITexture>()).mainTexture = (Texture)(object)component.GetTexture();
}
__instance.waitingForSteamWorshop_ = false;
return false;
}
}
[HarmonyPatch(typeof(SplashScreenLogic), "Update")]
internal static class SplashScreenLogic__Update
{
internal static bool Prefix(SplashScreenLogic __instance)
{
//IL_0033: Unknown result type (might be due to invalid IL or missing references)
//IL_003a: Invalid comparison between Unknown and I4
//IL_004f: Unknown result type (might be due to invalid IL or missing references)
//IL_008a: Unknown result type (might be due to invalid IL or missing references)
if (__instance.dontUpdate_ || __instance.waitingForSteamWorshop_)
{
return false;
}
if (Mod.SkipIdleMenu.Value && (int)G.Sys.GameManager_.openOnMainMenuInit_ == 9)
{
G.Sys.GameManager_.openOnMainMenuInit_ = (OpenOnMainMenuInit)0;
}
if (Mod.SkipSplashAnimation.Value)
{
__instance.allowSkip_ = true;
__instance.fadeTimer_ = 0f;
__instance.currentIndex_ = __instance.splashScreens_.Length - 1;
__instance.currentState_ = (FadeState)2;
return true;
}
return true;
}
}
[HarmonyPatch(typeof(SteamworksUGC), "OnEnable")]
internal static class SteamworksUGC__OnEnable
{
internal static bool Prefix(SteamworksUGC __instance)
{
if (!SteamworksManager.IsSteamBuild_)
{
return false;
}
__instance.storedPublishedFileIDs_ = WorkshopLevelInfos.LoadOrCreate();
StaticEvent<Data>.Subscribe((Delegate<Data>)__instance.OnEventSkip);
if (!Mod.SkipWorkshopSubscriptions.Value && SteamworksUGC.IsOnline_ && ApplicationEx.LoadedLevelName_ == "SplashScreens")
{
ComponentEx.DoNextFrame((MonoBehaviour)(object)__instance, (Action)delegate
{
__instance.UpdateSubscribedWorkshopLevels();
});
}
else
{
ComponentEx.DoNextFrame((MonoBehaviour)(object)__instance, (Action)__instance.MarkWorkshopLevelsUpdateAsFinished);
ComponentEx.DoNextFrame((MonoBehaviour)(object)__instance, (Action)__instance.BroadcastWorkshopUpdateComplete);
}
return false;
}
}
}