/// <summary> /// Start <c>HotkeyManager</c> /// </summary> /// <param name="sender"></param> /// <param name="eventArgs"></param> private static void HotKeyManagerOnLoaded(object sender, EventArgs eventArgs) { HotKeyManager.Add(Keys.W); HotKeyManager.Add(Keys.A); HotKeyManager.Add(Keys.S); HotKeyManager.Add(Keys.D); HotKeyManager.HotKeyPressedDown += GameManager.OnKeyDown; HotKeyManager.HotKeyPressedUp += GameManager.OnKeyUp; Report.Success("Hotkeys loaded and applied"); }
protected override void OnBeforeInitialModuleScreenSetAsRoot() { base.OnBeforeInitialModuleScreenSetAsRoot(); try { if (_hotkeyManager == null) { _hotkeyManager = HotKeyManager.Create("mbbannerlord.autorun"); _hotkeyManager.Add <AutoRunHotKey>(); _hotkeyManager.Build(); } } catch (Exception ex) { MessageBox.Show("Failed initializing auto-run hotkey:\n" + ex.ToString()); } }