public static string ToModText(this HotkeyData hkd) { if (hkd.alt == hkd.shift == hkd.ctrl == false) { return("NONE"); } List <string> btns = new List <string>(); string ret = ""; if (hkd.ctrl) { btns.Add("CTRL"); } if (hkd.alt) { btns.Add("ALT"); } if (hkd.shift) { btns.Add("SHIFT"); } for (int i = 0; i < btns.Count; i++) { ret += btns[i]; if (i < btns.Count - 1) { ret += " + "; } } return(ret); }
private void Update() { Boolean anyKeyDown = Input.anyKeyDown; Boolean anyKey = Input.anyKey; DirtyCheck(); if (anyKeyDown && anyKey) { s_ActiveHotkeys.Clear(); for (Int32 i = 0; i < s_HotkeyMapSorted.Length; i++) { HotkeyData hotkeyData = s_HotkeyMapSorted[i]; if (hotkeyData.m_EventHandler != null && hotkeyData.m_Action.IsDown && AddToList(ref hotkeyData)) { break; } } HandleEvents(true); } if ((s_LastAnyKey && anyKey) || (s_LastAnyKey && anyKey != s_LastAnyKey)) { s_ActiveHotkeys.Clear(); for (Int32 j = 0; j < s_HotkeyMapSorted.Length; j++) { HotkeyData hotkeyData2 = s_HotkeyMapSorted[j]; if (hotkeyData2.m_EventHandler != null && hotkeyData2.m_Action.IsUp && AddToList(ref hotkeyData2)) { break; } } HandleEvents(false); } s_LastAnyKey = anyKey; }
public override void Init() { current = TranslateOptions.Instance.HookOptions; cbControlCC.Checked = current.ControlCC; cbControlInsIns.Checked = current.ControlInsIns; cbTranslateOnHotkey.Checked = current.TranslateOnHotkey; if (current.Shortcut == Keys.None && current.MouseShortcut == MouseButtons.None) { cbHotkeys.SelectedIndex = 0; } else { selectedMouseShortcut = current.MouseShortcut; selectedKeysShortcut = current.Shortcut; cbHotkeys.SelectedIndex = 1; foreach (object o in cbHotkeys.Items) { HotkeyData hd = o as HotkeyData; if (current.Shortcut == hd.Keys && current.MouseShortcut == hd.MouseButtons) { cbHotkeys.SelectedItem = hd; break; } } } }
private static void HandleEvents(Boolean keyDown) { for (Int32 i = 0; i < s_ActiveHotkeys.Count; i++) { HotkeyData hotkeyData = s_ActiveHotkeys[i]; try { if (hotkeyData.m_EventHandler != null) { hotkeyData.m_EventHandler(null, new HotkeyEventArgs(hotkeyData.m_Action.Type, keyDown, hotkeyData.m_Action.Key1)); } } catch (Exception ex) { Debug.LogError(String.Concat(new Object[] { "Exception handle ", hotkeyData.m_Action.Type, ", KeyDown: ", keyDown, ", Key:", hotkeyData.m_Action.Key1, "\n", ex })); } } }
public HotkeySelectionWindow() { Hotkey = new HotkeyData(); InitializeComponent(); UpdateText(); SourceInitialized += (_, __) => AccentPolicyLibrary.SetWindowBlur(this, true, true); this.FlowDirection = SystemSettings.IsRTL ? FlowDirection.RightToLeft : FlowDirection.LeftToRight; }
public HotkeySelectViewModel() { Hotkey = new HotkeyData(); HotkeyManager.Current.Pause(); Save = new RelayCommand(() => { Saved = true; Close(); }); }
public Config(string Name, string LogoImageFilePath, Color MainColor, Color SubColor, Color FontColor, int SoundVolume, int ScoreBoardSize, string ScoreBoardPosition, HotkeyData WinHotkey, HotkeyData LoseHotkey, HotkeyData DrawHotkey) { this.Name = Name; this.LogoImageFilePath = LogoImageFilePath; this.MainColorHtml = ColorTranslator.ToHtml(MainColor); this.SubColorHtml = ColorTranslator.ToHtml(SubColor); this.FontColorHtml = ColorTranslator.ToHtml(FontColor); this.SoundVolume = SoundVolume; this.ScoreBoardSize = ScoreBoardSize; this.ScoreBoardPosition = ScoreBoardPosition; this.WinHotkey = WinHotkey; this.LoseHotkey = LoseHotkey; this.DrawHotkey = DrawHotkey; }
private void OnHotKeyPressed(HotkeyData hotkey) { if (hotkey.Equals(SettingsService.FlyoutHotkey)) { FlyoutViewModel.OpenFlyout(FlyoutShowOptions.Keyboard); } else if (hotkey.Equals(SettingsService.SettingsHotkey)) { _settingsWindow.OpenOrBringToFront(); } else if (hotkey.Equals(SettingsService.MixerHotkey)) { _mixerWindow.OpenOrClose(); } }
private static Boolean AddToList(ref HotkeyData data) { if (data.m_Action.IsMouse) { s_ActiveHotkeys.Add(data); return(false); } if (data.m_Action.KeyCount != 1) { s_ActiveHotkeys.Add(data); return(true); } s_ActiveHotkeys.Add(data); return(false); }
void CbHotkeysSelectedIndexChanged(object sender, EventArgs e) { HotkeyData hd = cbHotkeys.SelectedItem as HotkeyData; if (hd != null) { if (hd.Name == "Custom Hotkey") { hotkeyEditor.SetShortcut(selectedKeysShortcut, selectedMouseShortcut, true); } else { hotkeyEditor.SetShortcut(hd.Keys, hd.MouseButtons, false); selectedKeysShortcut = hd.Keys; selectedMouseShortcut = hd.MouseButtons; } } }