Merge Patcher into PatchEntryPoint

This commit is contained in:
Terry Hearst 2023-08-26 22:16:35 -04:00
parent 3b204b3a07
commit 0f7b985c5e
2 changed files with 17 additions and 31 deletions

View file

@ -1,12 +1,27 @@
using System;
using HarmonyLib;
using System;
using UnityEngine.SceneManagement;
namespace DiamondTimeViewer
{
public static class PatchEntryPoint
{
private static bool IsPatched;
public static void Start()
{
Patcher.OnStartup();
SceneManager.sceneLoaded += beginPatch;
Config.Init();
}
private static void beginPatch(Scene scene, LoadSceneMode loadSceneMode)
{
if (!IsPatched)
{
new Harmony("com.thearst3rd.diamondtimeviewer").PatchAll();
IsPatched = true;
SceneManager.sceneLoaded -= beginPatch;
}
}
}
}

View file

@ -1,29 +0,0 @@
using System;
using System.Collections.Generic;
using System.Text;
using HarmonyLib;
using UnityEngine.SceneManagement;
namespace DiamondTimeViewer
{
public static class Patcher
{
private static bool IsPatched;
public static void OnStartup()
{
SceneManager.sceneLoaded += beginPatch;
Config.Init();
}
private static void beginPatch(Scene scene, LoadSceneMode loadSceneMode)
{
if (!IsPatched)
{
new Harmony("com.thearst3rd.diamondviewer").PatchAll();
IsPatched = true;
SceneManager.sceneLoaded -= beginPatch;
}
}
}
}