using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using HarmonyLib;
using MelonLoader;
using Photon.Pun;
using RemoveMapDelay;
using UnityEngine;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: MelonInfo(typeof(RemoveMapDelayMod), "RemoveMapDelay", "1.0.0", "rf5860", null)]
[assembly: MelonGame("Alvios", "Vellum")]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: AssemblyVersion("0.0.0.0")]
namespace RemoveMapDelay;
public class RemoveMapDelayMod : MelonMod
{
public override void OnInitializeMelon()
{
((MelonBase)this).LoggerInstance.Msg("Remove Chapter Transitions Mod Loaded!");
}
}
[HarmonyPatch(typeof(PostFXManager), "Awake")]
public static class PostFXManager_Awake_Patch
{
public static void Postfix(PostFXManager __instance)
{
__instance.SketchTransitionDuration = 0f;
}
}
[HarmonyPatch(typeof(PostFXManager), "ActivateSketch")]
public static class PostFXManager_ActivateSketch_Patch
{
public static bool Prefix(PostFXManager __instance, bool useSFX, bool save)
{
FieldInfo fieldInfo = AccessTools.Field(typeof(PostFXManager), "IsInSketch");
if ((bool)fieldInfo.GetValue(__instance))
{
return false;
}
fieldInfo.SetValue(__instance, true);
PostFXManager.UpdateSketch(1f);
if (save && (Object)(object)PageFlip.instance != (Object)null)
{
PageFlip.instance.Save();
}
return false;
}
}
[HarmonyPatch(typeof(PostFXManager), "ReleaseSketch")]
public static class PostFXManager_ReleaseSketch_Patch
{
public static bool Prefix(PostFXManager __instance)
{
FieldInfo fieldInfo = AccessTools.Field(typeof(PostFXManager), "IsInSketch");
if (!(bool)fieldInfo.GetValue(__instance))
{
return false;
}
PostFXManager.UpdateSketch(0f);
MapManager.OnMapChangeFinished?.Invoke();
((Component)PostFXManager.instance.SketchVolume).gameObject.SetActive(false);
fieldInfo.SetValue(__instance, false);
return false;
}
}
[HarmonyPatch(typeof(MapManager), "LoadSceneDelayed")]
public static class MapManager_LoadSceneDelayed_Patch
{
public static bool Prefix(MapManager __instance, string scene, float delay)
{
PhotonNetwork.LoadLevel(scene);
return false;
}
}
[HarmonyPatch(typeof(VignetteInfoDisplay), "FadeOut")]
public static class VignetteInfoDisplay_FadeOut_Patch
{
public static bool Prefix(VignetteInfoDisplay __instance)
{
CanvasGroup fader = __instance.Fader;
if ((Object)(object)fader != (Object)null)
{
fader.alpha = 0f;
}
return false;
}
}
[HarmonyPatch(typeof(UITransitionHelper), "Update")]
public static class UITransitionHelper_Update_Patch
{
public static void Postfix(UITransitionHelper __instance)
{
FieldInfo fieldInfo = AccessTools.Field(typeof(UITransitionHelper), "canvasGroup");
object? value = fieldInfo.GetValue(__instance);
CanvasGroup val = (CanvasGroup)((value is CanvasGroup) ? value : null);
FieldInfo fieldInfo2 = AccessTools.Field(typeof(UITransitionHelper), "wantVisibleTime");
float num = (float)fieldInfo2.GetValue(__instance);
if ((Object)(object)val != (Object)null)
{
val.alpha = ((num > 0f) ? 1f : 0f);
}
}
}