Exemple #1
0
        private void MainBorder_PreviewKeyDown(object sender, KeyEventArgs e)
        {
            // キー情報取得
            if (e.ImeProcessedKey != Key.None) // Ime有効な場合の対処
            {
                this.Key = e.ImeProcessedKey;
            }
            else if (e.Key == Key.System) // システムキーが押された場合
            {
                this.Key = e.SystemKey;
            }
            else
            {
                this.Key = e.Key;
            }

            this.Modifiers    = Keyboard.Modifiers;
            this.KeyText.Text = GetKeyString();
            e.Handled         = true;

            // キー割り当て完了通知
            if (IsValidKey())
            {
                KeyAssigned?.Invoke(this, new EventArgs());
            }
        }
Exemple #2
0
        public override void Update(GameTime gameTime)
        {
            if (!Active)
            {
                base.Update(gameTime);
            }
            DoubleActivationProtectionTimer++;
            ActiveTimer++;
            if (!Active || ActiveTimer < 3)
            {
                return;
            }
            var i = game1.Input.RecentInput(Filter);

            if (i.Type != InputTypes.None)
            {
                if (i.Key == Keys.Escape)
                {
                    //Input = Input;
                }
                else
                {
                    //Input = i;
                    game1.Input.SetKeybind(i, Action);
                    KeyAssigned.Invoke(null, new EventArgs());
                }
                SetInactive();
            }
        }