// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. using osu.Game.Beatmaps.Timing; using osu.Game.Rulesets.Objects; using System.Collections.Generic; using System.Linq; using osu.Game.Beatmaps.ControlPoints; using Newtonsoft.Json; using osu.Game.IO.Serialization.Converters; namespace osu.Game.Beatmaps { /// /// A Beatmap containing converted HitObjects. /// public class Beatmap : IBeatmap where T : HitObject { public BeatmapInfo BeatmapInfo { get; set; } = new BeatmapInfo { Metadata = new BeatmapMetadata { Artist = @"Unknown", Title = @"Unknown", AuthorString = @"Unknown Creator", }, Version = @"Normal", BaseDifficulty = new BeatmapDifficulty() }; [JsonIgnore] public BeatmapMetadata Metadata => BeatmapInfo?.Metadata ?? BeatmapInfo?.BeatmapSet?.Metadata; public ControlPointInfo ControlPointInfo { get; set; } = new ControlPointInfo(); public List Breaks { get; set; } = new List(); [JsonIgnore] public double TotalBreakTime => Breaks.Sum(b => b.Duration); [JsonConverter(typeof(TypedListConverter))] public List HitObjects { get; set; } = new List(); IReadOnlyList IBeatmap.HitObjects => HitObjects; IReadOnlyList IBeatmap.HitObjects => HitObjects; public virtual IEnumerable GetStatistics() => Enumerable.Empty(); IBeatmap IBeatmap.Clone() => Clone(); public Beatmap Clone() => (Beatmap)MemberwiseClone(); } public class Beatmap : Beatmap { public new Beatmap Clone() => (Beatmap)base.Clone(); public override string ToString() => BeatmapInfo?.ToString() ?? base.ToString(); } }