public static void Push(IInputHandler parent, IInputHandler child) { KInputHandler inputHandler = GetInputHandler(parent); KInputHandler inputHandler2 = GetInputHandler(child); inputHandler.PushInputHandler(inputHandler2); }
public static void Remove(IInputHandler parent, IInputHandler child) { KInputHandler inputHandler = GetInputHandler(parent); KInputHandler inputHandler2 = GetInputHandler(child); inputHandler.RemoveInputHandler(inputHandler2); }
private static void PostloadHandler(HarmonyInstance instance) { if (DebugNotIncludedOptions.Instance?.PowerUserMode ?? false) { instance.Patch(typeof(ModsScreen), "BuildDisplay", new HarmonyMethod(typeof(DebugNotIncludedPatches), nameof(HidePopups)), new HarmonyMethod(typeof(DebugNotIncludedPatches), nameof(BuildDisplay))); } KInputHandler.Add(Global.Instance.GetInputManager().GetDefaultController(), new UISnapshotHandler(), 1024); // New postload architecture requires going back a little ways var st = new System.Diagnostics.StackTrace(6); Assembly assembly = null; if (st.FrameCount > 0) { assembly = st.GetFrame(0).GetMethod()?.DeclaringType?.Assembly; } PUtil.LogDebug(assembly?.FullName ?? "none"); RunningPLibAssembly = assembly ?? Assembly.GetCallingAssembly(); // Log which mod is running PLib var latest = ModDebugRegistry.Instance.OwnerOfAssembly(RunningPLibAssembly); if (latest != null) { DebugLogger.LogDebug("Executing version of PLib is from: " + latest.ModName); } HarmonyPatchInspector.Check(); }
public static void Add(IInputHandler parent, IInputHandler child, int priority = 0) { KInputHandler inputHandler = GetInputHandler(parent); KInputHandler inputHandler2 = GetInputHandler(child); inputHandler.AddInputHandler(inputHandler2, priority); }
/// <summary> /// Runs the required postload patches after all other mods load. /// </summary> /// <param name="instance">The Harmony instance to execute patches.</param> private static void PostloadHandler(HarmonyInstance instance) { if (DebugNotIncludedOptions.Instance?.PowerUserMode ?? false) { instance.Patch(typeof(ModsScreen), "BuildDisplay", postfix: new HarmonyMethod(typeof(DebugNotIncludedPatches), nameof(BuildDisplay))); } KInputHandler.Add(Global.Instance.GetInputManager().GetDefaultController(), new UISnapshotHandler(), 1024); }
public KInputController(bool is_gamepad) { mBindings = new List <KInputBinding>(); mEvents = new List <KInputEvent>(); mDirtyBindings = false; IsGamepad = is_gamepad; mAxis = new float[4]; mActiveModifiers = Modifier.None; mActionState = new bool[247]; mScrollState = new bool[2]; inputHandler = new KInputHandler(this, this); }
public void PushInputHandler(KInputHandler handler) { if (mChildren == null) { mChildren = new List <HandlerInfo>(); } handler.SetController(mController); mChildren.Insert(0, new HandlerInfo { priority = 2147483647, handler = handler }); }
public void AddInputHandler(KInputHandler handler, int priority) { if (mChildren == null) { mChildren = new List <HandlerInfo>(); } handler.SetController(mController); mChildren.Add(new HandlerInfo { priority = priority, handler = handler }); mChildren.Sort((HandlerInfo a, HandlerInfo b) => b.priority.CompareTo(a.priority)); }
private void Awake() { GameInputManager inputManager = Global.Instance.GetInputManager(); for (int i = 0; i < inputManager.GetControllerCount(); i++) { KInputController controller = inputManager.GetController(i); if (controller.IsGamepad) { KInputHandler.Add(controller, base.gameObject); } } KInputHandler.Add(inputManager.GetDefaultController(), KScreenManager.Instance, 10); DebugHandler child = new DebugHandler(); KInputHandler.Add(inputManager.GetDefaultController(), child, -1); }
/// <summary> /// Runs the required postload patches after all other mods load. /// </summary> /// <param name="instance">The Harmony instance to execute patches.</param> private static void PostloadHandler(HarmonyInstance instance) { if (DebugNotIncludedOptions.Instance?.PowerUserMode ?? false) { instance.Patch(typeof(ModsScreen), "BuildDisplay", postfix: new HarmonyMethod(typeof(DebugNotIncludedPatches), nameof(BuildDisplay))); } KInputHandler.Add(Global.Instance.GetInputManager().GetDefaultController(), new UISnapshotHandler(), 1024); // Log which mod is running PLib RunningPLibAssembly = Assembly.GetCallingAssembly(); var latest = ModDebugRegistry.Instance.OwnerOfAssembly(RunningPLibAssembly); if (latest != null) { DebugLogger.LogDebug("Executing version of PLib is from: " + latest.ModName); } }
public void RemoveInputHandler(KInputHandler handler) { if (mChildren != null) { int num = 0; while (true) { if (num >= mChildren.Count) { return; } HandlerInfo handlerInfo = mChildren[num]; if (handlerInfo.handler == handler) { break; } num++; } mChildren.RemoveAt(num); } }
private static void PostloadHandler(HarmonyInstance instance) { if (DebugNotIncludedOptions.Instance?.PowerUserMode ?? false) { instance.Patch(typeof(ModsScreen), "BuildDisplay", new HarmonyMethod(typeof(DebugNotIncludedPatches), nameof(HidePopups)), new HarmonyMethod(typeof(DebugNotIncludedPatches), nameof(BuildDisplay))); } KInputHandler.Add(Global.Instance.GetInputManager().GetDefaultController(), new UISnapshotHandler(), 1024); // New postload architecture requires going back a little ways var st = new StackTrace(6); Assembly assembly = null; if (st.FrameCount > 0) { assembly = st.GetFrame(0).GetMethod()?.DeclaringType?.Assembly; } RunningPLibAssembly = assembly ?? Assembly.GetCallingAssembly(); // Log which mod is running PLib var latest = ModDebugRegistry.Instance.OwnerOfAssembly(RunningPLibAssembly); if (latest != null) { DebugLogger.LogDebug("Executing version of PLib is from: " + latest.ModName); } HarmonyPatchInspector.Check(); #if DEBUG // SaveManager.Load:: 13831 ms instance.ProfileMethod(typeof(SaveLoader).GetMethodSafe("Load", false, typeof( IReader))); instance.ProfileMethod(typeof(SaveLoader).GetMethodSafe("Save", false, typeof( BinaryWriter))); instance.ProfileMethod(typeof(SaveManager).GetMethodSafe("Load", false, PPatchTools.AnyArguments)); instance.ProfileMethod(typeof(SaveManager).GetMethodSafe("Save", false, PPatchTools.AnyArguments)); #endif }
internal static void AddSpamHandler() { KInputHandler.Add(Global.Instance.GetInputManager().GetDefaultController(), new SpamObjectsHandler(), 512); }
internal static void AfterModsLoad() { // Input manager is not set up until this time KInputHandler.Add(Global.Instance.GetInputManager().GetDefaultController(), new UISnapshotHandler(), 1024); }