예제 #1
0
        /// <summary>
        /// Get all valid <see cref="HitResult"/>s for this ruleset.
        /// Generally used for results display purposes, where it can't be determined if zero-count means the user has not achieved any or the type is not used by this ruleset.
        /// </summary>
        /// <returns>
        /// All valid <see cref="HitResult"/>s along with a display-friendly name.
        /// </returns>
        public IEnumerable <(HitResult result, string displayName)> GetHitResults()
        {
            var validResults = GetValidHitResults();

            // enumerate over ordered list to guarantee return order is stable.
            foreach (var result in OrderAttributeUtils.GetValuesInOrder <HitResult>())
            {
                switch (result)
                {
                // hard blocked types, should never be displayed even if the ruleset tells us to.
                case HitResult.None:
                case HitResult.IgnoreHit:
                case HitResult.IgnoreMiss:
                // display is handled as a completion count with corresponding "hit" type.
                case HitResult.LargeTickMiss:
                case HitResult.SmallTickMiss:
                    continue;
                }

                if (result == HitResult.Miss || validResults.Contains(result))
                {
                    yield return(result, GetDisplayNameForHitResult(result));
                }
            }
        }
예제 #2
0
        private TableColumn[] createHeaders(IReadOnlyList <ScoreInfo> scores)
        {
            var columns = new List <TableColumn>
            {
                new TableColumn("rank", Anchor.CentreRight, new Dimension(GridSizeMode.AutoSize)),
                new TableColumn("", Anchor.Centre, new Dimension(GridSizeMode.Absolute, 70)), // grade
                new TableColumn("score", Anchor.CentreLeft, new Dimension(GridSizeMode.AutoSize)),
                new TableColumn("accuracy", Anchor.CentreLeft, new Dimension(GridSizeMode.Absolute, minSize: 60, maxSize: 70)),
                new TableColumn("", Anchor.CentreLeft, new Dimension(GridSizeMode.Absolute, 25)), // flag
                new TableColumn("player", Anchor.CentreLeft, new Dimension(GridSizeMode.Distributed, minSize: 125)),
                new TableColumn("max combo", Anchor.CentreLeft, new Dimension(GridSizeMode.Distributed, minSize: 70, maxSize: 120))
            };

            // All statistics across all scores, unordered.
            var allScoreStatistics = scores.SelectMany(s => s.GetStatisticsForDisplay().Select(stat => stat.result)).ToHashSet();

            foreach (var result in OrderAttributeUtils.GetValuesInOrder <HitResult>())
            {
                if (!allScoreStatistics.Contains(result))
                {
                    continue;
                }

                columns.Add(new TableColumn(result.GetDescription(), Anchor.CentreLeft, new Dimension(GridSizeMode.Distributed, minSize: 35, maxSize: 60)));
                statisticResultTypes.Add(result);
            }

            if (showPerformancePoints)
            {
                columns.Add(new TableColumn("pp", Anchor.CentreLeft, new Dimension(GridSizeMode.Absolute, 30)));
            }

            columns.Add(new TableColumn("mods", Anchor.CentreLeft, new Dimension(GridSizeMode.AutoSize)));

            return(columns.ToArray());
        }
예제 #3
0
 /// <summary>
 /// Get all valid <see cref="HitResult"/>s for this ruleset.
 /// Generally used for results display purposes, where it can't be determined if zero-count means the user has not achieved any or the type is not used by this ruleset.
 /// </summary>
 /// <remarks>
 /// <see cref="HitResult.Miss"/> is implicitly included. Special types like <see cref="HitResult.IgnoreHit"/> are ignored even when specified.
 /// </remarks>
 protected virtual IEnumerable <HitResult> GetValidHitResults() => OrderAttributeUtils.GetValuesInOrder <HitResult>();