Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow easier keyboard reading in custom drawers #56

Closed
JKohlman opened this issue Dec 22, 2022 · 0 comments
Closed

Allow easier keyboard reading in custom drawers #56

JKohlman opened this issue Dec 22, 2022 · 0 comments

Comments

@JKohlman
Copy link

Currently as it stands reading from the keyboard (Input.GetKeyDown, etc..) appears to be, at best, very difficult from a custom drawer without requiring a reference to ConfigurationManager.dll.

The main root of this lies in the config manager OnGUI at

if (!SettingFieldDrawer.SettingKeyboardShortcut)
UnityInput.Current.ResetInputAxes();
which resets the keyboard inputs every frame. This is easy to work around in a global drawer by including ConfigurationManager.dll and simply setting SettingFieldDrawer._currentKeyboardShortcutToSet to your current SettingEntryBase.
private static SettingEntryBase _currentKeyboardShortcutToSet;
public static bool SettingKeyboardShortcut => _currentKeyboardShortcutToSet != null;
HOWEVER, in a drawer that is not global and does not include ConfigurationManager.dll, the signature is:

static void CustomDrawer(BepInEx.Configuration.ConfigEntryBase entry)

And of course since the type is different you can no longer simply set that variable.

If there is an easy workaround that I'm missing I'd gladly make use of it but I can't seem to find one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant
  翻译: