public static void Postfix(ref bool __result, FloatMenuOption __instance) { if (!Ad2Mod.settings.useRightClickMenu || !PatchFloatMenu.IsTracked(__instance)) { return; } if (!__result || Event.current.button != 1) { return; } __result = false; var recipe = Ad2.GetRecipeByLabel(__instance.Label); if (recipe == null || !Ad2.IsSrcRecipe(recipe)) { return; } var nlst = Ad2.GetNewRecipesList(recipe); if (nlst == null) { return; } Find.WindowStack.Add(new FloatMenu(RecipeOptionsMaker(nlst))); }
public static bool Prefix(FloatMenuOption __instance) { if (Ad2Mod.settings.useRightClickMenu && Event.current.button == 1 && PatchFloatMenu.IsTracked(__instance)) { return(false); } return(true); }
public static void Postfix(bool __result, Window window) { if (!(window is FloatMenu fm) || __result == false) { return; } if (!PatchFloatMenu.IsTracked(fm)) { return; } var fmos = (List <FloatMenuOption>)Traverse.Create(fm).Field("options").GetValue(); PatchFloatMenu.Untrack(fm); foreach (var opt in fmos) { PatchFloatMenu.Untrack(opt); } //Log.Message($"WindowStack.TryRemove {PatchFloatMenu.trackedFM.Count} {PatchFloatMenu.trackedFMO.Count}"); }