harbingerofme / DebugToolkit

Debugging commands for Risk of Rain 2. Previously known as RoR2Cheats.
https://thunderstore.io/package/IHarbHD/DebugToolkit/
BSD 3-Clause "New" or "Revised" License
14 stars 8 forks source link

Ignore keybinds when an inspector window is open. Closes #127 #154

Closed SChinchi closed 10 months ago

SChinchi commented 10 months ago

This PR closes #127

As described in the issue using the event systems we can check for any UI object being focused/pressed, i.e., text boxes, menu buttons, etc. UnityInspector has a config option to either use the RoR2 ones or override it with its own, which we can get from the base class that the event systems are derived from.

Checking for the inspector windows being open is as simple as checking whether the related game object is present and active. Technically, it's the Canvas component within them that needs to also be active for the panels to appear, but I'm keeping it simple.

I also changed the keybind iterator to prevent an error if the keybinds are modified while they're enumerated.