Skip to content

Commit

Permalink
Added Hotreload button injection check
Browse files Browse the repository at this point in the history
  • Loading branch information
Flowaria committed Jan 18, 2022
1 parent ca44e41 commit b9c9bbc
Showing 1 changed file with 6 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,13 @@ namespace EECustom.Utils.Integrations.Inject
[HarmonyPatch(typeof(CM_PageRundown_New), nameof(CM_PageRundown_New.OnEnable))]
internal static class Inject_CM_PageRundown_New
{
private static bool _isInjected = false;

public static void Postfix()
{
if (_isInjected)
return;

object hotreloader = MTFOUtil.HotReloaderField?.GetValue(null) ?? null;
if (hotreloader is null)
return;
Expand All @@ -22,6 +27,7 @@ public static void Postfix()

var button = (CM_Item)buttonField.GetValue(hotreloader);
button.add_OnBtnPressCallback((Action<int>)MTFOUtil.OnHotReloaded);
_isInjected = true;
}
}
}

0 comments on commit b9c9bbc

Please sign in to comment.