BgMgrPatcher.cs 699 B

123456789101112131415161718192021222324
  1. using System;
  2. using HarmonyLib;
  3. namespace MeidoPhotoStudio.Plugin;
  4. public static class BgMgrPatcher
  5. {
  6. public static event EventHandler ChangeBgBegin;
  7. public static event EventHandler ChangeBgEnd;
  8. [HarmonyPatch(typeof(BgMgr), nameof(BgMgr.ChangeBg))]
  9. [HarmonyPatch(typeof(BgMgr), nameof(BgMgr.ChangeBgMyRoom))]
  10. [HarmonyPrefix]
  11. private static void NotifyBeginChangeBg() =>
  12. ChangeBgBegin?.Invoke(null, EventArgs.Empty);
  13. [HarmonyPatch(typeof(BgMgr), nameof(BgMgr.ChangeBg))]
  14. [HarmonyPatch(typeof(BgMgr), nameof(BgMgr.ChangeBgMyRoom))]
  15. [HarmonyPostfix]
  16. private static void NotifyEndChangeBg() =>
  17. ChangeBgEnd?.Invoke(null, EventArgs.Empty);
  18. }