Пример #1
0
        public RatedMoves nextRating(float measure, DanceSequence sequence, InputState input)
        {
            RatedMoves rating = new RatedMoves();
            if (null == sequence)
                return rating;

            List<DanceSequence.Input> possibleMatches = sequence.findReachableInputs(measure);
            List<DanceSequence.Input> rated = new List<DanceSequence.Input>();

            this.addNotYetRated(possibleMatches);

            foreach (InputState.Move move in input.activeStates) {
                DanceSequence.Input matching = this.getMatchingInput(possibleMatches, move);
                if (null != matching && matching.positionInSong <= this.ratedUntil)
                    continue;

                if (null != matching) {
                    float accuracy = matching.getAccuracy(measure);
                    if (accuracy <= Song.MusicTimeInFractions(Song.MusicTime.SIXTEENTH) / 2.0f) {
                        this.score += 25;
                        rating.perfect.Add(matching);
                    } else if (accuracy <= Song.MusicTimeInFractions(Song.MusicTime.SIXTEENTH)) {
                        this.score += 15;
                        rating.good.Add(matching);
                    } else {
                        this.score += 5;
                        rating.ok.Add(matching);
                    }

                    rated.Add(matching);
                    this.notYetRated.Remove(matching);
                    if (measure > this.ratedUntil) {
                        this.ratedUntil = matching.positionInSong;
                    }
                } else {
                    rating.addWrongMove(sequence, measure, move);
                }
            }

            foreach (DanceSequence.Input possibleMiss in this.notYetRated) {
                if (!possibleMiss.isReachable(measure) ||
                        this.ratedUntil > possibleMiss.positionInSong) {

                    rating.missed.Add(possibleMiss);
                    rated.Add(possibleMiss);
                }
            }
            ListUtil.removeAllFromList(this.notYetRated, rating.missed);

            rating.validate();
            return rating;
        }