コード例 #1
0
 public KeyModifiedStep(KeystrokesSettings Settings,
                        KeymapViewModel Keymap)
 {
     _keymap             = Keymap;
     _keystrokesSettings = Settings;
     _modifierStates     = ModifierStates.GetCurrent();
 }
コード例 #2
0
        private void LateUpdate()
        {
            // удаление ImDone модификаторов с вызовом OnDisable
            Modifiers.RemoveAll(x => x.ImDone);

            // заполнение States для танка перебором всех модификаторов в Modifiers
            States = new ModifierStates();
            foreach (Modifier modifier in Modifiers)
            {
                if (modifier.GetModifierStates().HasFlag(ModifierStates.MODIFIER_STATE_ATTACK_IMMUNE) && !States.HasFlag(ModifierStates.MODIFIER_STATE_ATTACK_IMMUNE))
                {
                    States |= ModifierStates.MODIFIER_STATE_ATTACK_IMMUNE;
                }
            }
        }
コード例 #3
0
ファイル: HookManager.cs プロジェクト: JannesP/InstantTimer
 private void NativeHookWrapper_KeyboardHookCalled(object sender, KeyboardHookEventArgs e)
 {
     lock (_syncRootMods)
     {
         if (ModifierStates.ContainsKey(e.Key))
         {
             bool newValue = e.Type == KeyboardHookEventArgs.EventType.KeyDown;
             if (ModifierStates[e.Key] != newValue)
             {
                 ModifierStates[e.Key] = newValue;
                 ModifierStateChanged?.Invoke(this, EventArgs.Empty);
             }
         }
         else
         {
             if (e.Type == KeyboardHookEventArgs.EventType.KeyDown)
             {
                 KeyEvent?.Invoke(this, e);
             }
         }
     }
 }
コード例 #4
0
ファイル: HookHandler.cs プロジェクト: pasccom/GlobalHotKeys
 /// <summary>
 ///     Update the array of modifier state.
 /// </summary>
 /// <param name="index">The index of the modifier</param>
 /// <param name="side">The state of the modifier</param>
 /// <param name="released">Whether the modifier was released or pressed</param>
 private void updateModifierState(ModifierIndexes index, ModifierStates side, bool released)
 {
     if (released)
         mModifierStates[(uint)index] &= (~side);
     else
         mModifierStates[(uint)index] |= side;
 }