Initial commit

This commit is contained in:
2022-12-30 00:58:33 +01:00
commit 3f1075e67f
176 changed files with 25715 additions and 0 deletions

View File

@@ -0,0 +1,45 @@
using HarmonyLib;
namespace PriorityUX {
[HarmonyPatch(typeof(MaterialSelectionPanel))]
public class MaterialSelectionPanelPatches {
[HarmonyPatch(nameof(MaterialSelectionPanel.RefreshSelectors))]
[HarmonyPostfix]
static void RefreshSelectorsPostfix(PriorityScreen ___priorityScreen) {
Debug.Log("RefreshSelectors");
Debug.Log("___priorityScreen.gameObject.activeSelf: " + ___priorityScreen.gameObject.activeSelf);
// if (___priorityScreen.gameObject.activeSelf)
Utils.refreshPriorityScreen(___priorityScreen);
}
public static void OnKeyDown(KButtonEvent e, MaterialSelectionPanel panel) {
Debug.Log("MaterialSelectionPanelPatches OnKeyDown " + e.GetAction());
if (!Options.Instance.enableKeysForBuilding)
return;
Action action = e.GetAction();
// Repurpose GotoUserNav1 keys (default: Shift+1/2/3/etc.)
// if (Action.GotoUserNav1 <= action && action <= Action.GotoUserNav10 && e.TryConsume(action)) {
// int num = (int)(action - 25 + 1);
if (Action.Plan1 <= action && action <= Action.Plan10 && e.TryConsume(action)) {
int num = (int)(action - 36 + 1);
if (num <= 9) {
panel.PriorityScreen.SetScreenPriority(new PrioritySetting(PriorityScreen.PriorityClass.basic, num), play_sound: true);
} else {
panel.PriorityScreen.SetScreenPriority(new PrioritySetting(PriorityScreen.PriorityClass.topPriority, 1), play_sound: true);
}
}
}
public static void OnKeyUp(KButtonEvent e, MaterialSelectionPanel panel) {
if (!Options.Instance.enableKeysForBuilding)
return;
Action action = e.GetAction();
if (Action.GotoUserNav1 <= action && action <= Action.GotoUserNav10) {
e.TryConsume(action);
}
}
}
}