Esempio n. 1
0
        protected override bool OnKeyDown(InputState state, KeyDownEventArgs args)
        {
            // Check if we've handled the initial key
            if (!Judgement.Result.HasValue)
            {
                bool result = base.OnKeyDown(state, args);

                if (result)
                {
                    firstHitTime = Time.Current;
                    firstHitKey  = args.Key;
                }

                return(result);
            }

            // If we've already hit the second key, don't handle this object any further
            if (Judgement.SecondHit)
            {
                return(false);
            }

            // Don't handle represses of the same key
            if (firstHitKey == args.Key)
            {
                return(false);
            }

            // Don't handle invalid hit key presses
            if (!HitKeys.Contains(args.Key))
            {
                return(false);
            }

            // If we're not holding the first key down still, assume the intention
            // was not to hit the accented hit with both keys simultaneously
            if (!state.Keyboard.Keys.Contains(firstHitKey))
            {
                return(false);
            }

            return(UpdateJudgement(true));
        }
Esempio n. 2
0
        protected override bool HandleKeyPress(Key key)
        {
            // Check if we've handled the first key
            if (Judgement.Result == HitResult.None)
            {
                // First key hasn't been handled yet, attempt to handle it
                bool handled = base.HandleKeyPress(key);

                if (handled)
                {
                    firstHitTime = Time.Current;
                    firstHitKey  = key;
                }

                return(handled);
            }

            // If we've already hit the second key, don't handle this object any further
            if (Judgement.SecondHit)
            {
                return(false);
            }

            // Don't handle represses of the first key
            if (firstHitKey == key)
            {
                return(false);
            }

            // Don't handle invalid hit key presses
            if (!HitKeys.Contains(key))
            {
                return(false);
            }

            // Assume the intention was to hit the strong hit with both keys only if the first key is still being held down
            return(firstKeyHeld && UpdateJudgement(true));
        }