BgMgrPatcher.cs 742 B

123456789101112131415161718192021
  1. using System;
  2. using HarmonyLib;
  3. namespace COM3D2.MeidoPhotoStudio.Plugin
  4. {
  5. public static class BgMgrPatcher
  6. {
  7. public static event EventHandler ChangeBgBegin;
  8. public static event EventHandler ChangeBgEnd;
  9. [HarmonyPatch(typeof(BgMgr), nameof(BgMgr.ChangeBg))]
  10. [HarmonyPatch(typeof(BgMgr), nameof(BgMgr.ChangeBgMyRoom))]
  11. [HarmonyPrefix]
  12. private static void NotifyBeginChangeBg() => 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() => ChangeBgEnd?.Invoke(null, EventArgs.Empty);
  17. }
  18. }