oni-priority-ux/mod/Patches/PlanScreen.cs

36 lines
1.3 KiB
C#

using System.Reflection;
using HarmonyLib;
namespace PriorityUX {
[HarmonyPatch(typeof(PlanScreen))]
static class PlanScreenPatches {
[HarmonyPatch("OnKeyDown")]
[HarmonyPrefix]
public static bool OnKeyDown_Prefix(KButtonEvent e, PlanScreen __instance) {
// Debug.Log("PlanScreen OnKeyDown " + e.GetAction());
// Debug.Log("__instance.ProductInfoScreen: " + __instance.ProductInfoScreen);
// Debug.Log("ProductInfoScreen Active: " + __instance.ProductInfoScreen.gameObject.activeSelf);
if (__instance.ProductInfoScreen.gameObject.activeSelf) {
MaterialSelectionPanelPatches.OnKeyDown(e, __instance.ProductInfoScreen.materialSelectionPanel);
return false;
}
return true;
}
[HarmonyPatch("OnKeyUp")]
[HarmonyPrefix]
public static bool OnKeyUp_Prefix(KButtonEvent e, PlanScreen __instance) {
// Debug.Log("PlanScreen OnKeyUp " + e.GetAction());
// Debug.Log("__instance.ProductInfoScreen: " + __instance.ProductInfoScreen);
// Debug.Log("ProductInfoScreen Active: " + __instance.ProductInfoScreen.gameObject.activeSelf);
if (__instance.ProductInfoScreen.gameObject.activeSelf) {
MaterialSelectionPanelPatches.OnKeyUp(e, __instance.ProductInfoScreen.materialSelectionPanel);
return false;
}
return true;
}
}
}