using System;
using HarmonyLib;
namespace undead_universal_patch.Patches
{
[HarmonyPatch(typeof(UnityEngine.Resources), nameof(UnityEngine.Resources.Load), [ typeof(string), typeof(Type) ])]
class Resource
{
static bool Ran = false;
[HarmonyPostfix]
static void Postfix(ref string path)
{
//Plugin.Log.LogInfo($"Resource loading '{path}'");
if (path.Contains("PhotonServerSettings") && PhotonConfig.PatchPhotonIds.Value && PhotonConfig.PatchEvent.Value == "Load")
{
if (Ran) return; // Photon.Patch calls Resources.Load, which may result in a loop if not handled properly
Ran = true;
Photon.Patch();
}
}
}
}