1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-13 14:12:56 +08:00

correctly count HitObjects for their type

also legacy classes are internal again
This commit is contained in:
Aergwyn 2017-12-13 16:32:32 +01:00
parent 1d206f7ec6
commit d4cd835419
5 changed files with 27 additions and 18 deletions

View File

@ -17,7 +17,8 @@ using osu.Game.Rulesets.Scoring;
using osu.Game.Rulesets.Osu.Scoring; using osu.Game.Rulesets.Osu.Scoring;
using osu.Game.Rulesets.Osu.Edit; using osu.Game.Rulesets.Osu.Edit;
using osu.Game.Rulesets.Edit; using osu.Game.Rulesets.Edit;
using osu.Game.Rulesets.Objects.Legacy.Osu; using osu.Game.Rulesets.Objects.Types;
using osu.Game.Rulesets.Objects;
namespace osu.Game.Rulesets.Osu namespace osu.Game.Rulesets.Osu
{ {
@ -33,21 +34,29 @@ namespace osu.Game.Rulesets.Osu
new KeyBinding(InputKey.MouseRight, OsuAction.RightButton), new KeyBinding(InputKey.MouseRight, OsuAction.RightButton),
}; };
public override IEnumerable<BeatmapStatistic> GetBeatmapStatistics(WorkingBeatmap beatmap) => new[] public override IEnumerable<BeatmapStatistic> GetBeatmapStatistics(WorkingBeatmap beatmap)
{
IEnumerable<HitObject> hitObjects = beatmap.Beatmap.HitObjects;
IEnumerable<HitObject> durationObjects = hitObjects.Where(d => d is IHasEndTime);
IEnumerable<HitObject> circles = hitObjects.Except(durationObjects);
IEnumerable<HitObject> sliders = hitObjects.Where(s => s is IHasCurve);
return new[]
{ {
new BeatmapStatistic new BeatmapStatistic
{ {
Name = @"Circle Count", Name = @"Circle Count",
Content = beatmap.Beatmap.HitObjects.Count(h => h is ConvertHit).ToString(), Content = circles.Count().ToString(),
Icon = FontAwesome.fa_dot_circle_o Icon = FontAwesome.fa_circle_o
}, },
new BeatmapStatistic new BeatmapStatistic
{ {
Name = @"Slider Count", Name = @"Slider Count",
Content = beatmap.Beatmap.HitObjects.Count(h => h is ConvertSlider).ToString(), Content = sliders.Count().ToString(),
Icon = FontAwesome.fa_circle_o Icon = FontAwesome.fa_circle
} }
}; };
}
public override IEnumerable<Mod> GetModsFor(ModType type) public override IEnumerable<Mod> GetModsFor(ModType type)
{ {

View File

@ -11,7 +11,7 @@ using osu.Game.Beatmaps.ControlPoints;
namespace osu.Game.Rulesets.Objects.Legacy namespace osu.Game.Rulesets.Objects.Legacy
{ {
public abstract class ConvertSlider : HitObject, IHasCurve internal abstract class ConvertSlider : HitObject, IHasCurve
{ {
/// <summary> /// <summary>
/// Scoring distance with a speed-adjusted beat length of 1 second. /// Scoring distance with a speed-adjusted beat length of 1 second.

View File

@ -9,7 +9,7 @@ namespace osu.Game.Rulesets.Objects.Legacy.Osu
/// <summary> /// <summary>
/// Legacy osu! Hit-type, used for parsing Beatmaps. /// Legacy osu! Hit-type, used for parsing Beatmaps.
/// </summary> /// </summary>
public sealed class ConvertHit : HitObject, IHasPosition, IHasCombo internal sealed class ConvertHit : HitObject, IHasPosition, IHasCombo
{ {
public Vector2 Position { get; set; } public Vector2 Position { get; set; }

View File

@ -9,7 +9,7 @@ namespace osu.Game.Rulesets.Objects.Legacy.Osu
/// <summary> /// <summary>
/// Legacy osu! Slider-type, used for parsing Beatmaps. /// Legacy osu! Slider-type, used for parsing Beatmaps.
/// </summary> /// </summary>
public sealed class ConvertSlider : Legacy.ConvertSlider, IHasPosition, IHasCombo internal sealed class ConvertSlider : Legacy.ConvertSlider, IHasPosition, IHasCombo
{ {
public Vector2 Position { get; set; } public Vector2 Position { get; set; }

View File

@ -9,7 +9,7 @@ namespace osu.Game.Rulesets.Objects.Legacy.Osu
/// <summary> /// <summary>
/// Legacy osu! Spinner-type, used for parsing Beatmaps. /// Legacy osu! Spinner-type, used for parsing Beatmaps.
/// </summary> /// </summary>
public sealed class ConvertSpinner : HitObject, IHasEndTime, IHasPosition internal sealed class ConvertSpinner : HitObject, IHasEndTime, IHasPosition
{ {
public double EndTime { get; set; } public double EndTime { get; set; }