diff --git a/osu.Game/Beatmaps/Beatmap.cs b/osu.Game/Beatmaps/Beatmap.cs index 39b9fd13b8..1fa4a1f7b8 100644 --- a/osu.Game/Beatmaps/Beatmap.cs +++ b/osu.Game/Beatmaps/Beatmap.cs @@ -1,7 +1,6 @@ // Copyright (c) 2007-2017 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE -using OpenTK.Graphics; using osu.Game.Beatmaps.Timing; using osu.Game.Database; using osu.Game.Modes; @@ -11,47 +10,21 @@ using System.Linq; namespace osu.Game.Beatmaps { - public class BeatmapBase - { - private BeatmapBase original; - - public BeatmapBase(BeatmapBase original = null) - { - this.original = original; - } - - private BeatmapInfo beatmapInfo; - public BeatmapInfo BeatmapInfo - { - get { return beatmapInfo ?? original?.BeatmapInfo; } - set { beatmapInfo = value; } - } - - private List controlPoints; - public List ControlPoints - { - get { return controlPoints ?? original?.ControlPoints; } - set { controlPoints = value; } - } - - private List comboColors; - public List ComboColors - { - get { return comboColors ?? original?.ComboColors; } - set { comboColors = value; } - } - - public BeatmapMetadata Metadata => BeatmapInfo?.Metadata ?? BeatmapInfo?.BeatmapSet?.Metadata; - } - /// - /// A generic beatmap that does not contain HitObjects. + /// A Beatmap containing HitObjects. /// public class Beatmap : BeatmapBase where T : HitObject { + /// + /// The HitObjects this Beatmap contains. + /// public List HitObjects; + /// + /// Constructs a new Beatmap containing HitObjects. + /// + /// If this Beatmap is a convert, the original Beatmap to use the properties of. public Beatmap(BeatmapBase original = null) : base(original) { @@ -99,15 +72,22 @@ namespace osu.Game.Beatmaps } } + /// + /// A Beatmap containing un-converted HitObjects. + /// public class Beatmap : Beatmap { - public Beatmap(BeatmapBase original = null) - : base(original) - { - } - + /// + /// Calculates the star difficulty for this Beatmap. + /// + /// The star difficulty. public double CalculateStarDifficulty() => Ruleset.GetRuleset(BeatmapInfo.Mode).CreateDifficultyCalculator(this).Calculate(); + /// + /// Converts this Beatmap to a containing another type of . + /// + /// The type of HitObject the new Beatmap should contain. + /// public Beatmap ConvertTo() where T : HitObject { return Ruleset.GetRuleset(BeatmapInfo.Mode).CreateBeatmapConverter().Convert(this); diff --git a/osu.Game/Beatmaps/BeatmapBase.cs b/osu.Game/Beatmaps/BeatmapBase.cs new file mode 100644 index 0000000000..f7256f4a54 --- /dev/null +++ b/osu.Game/Beatmaps/BeatmapBase.cs @@ -0,0 +1,51 @@ +// Copyright (c) 2007-2017 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using OpenTK.Graphics; +using osu.Game.Beatmaps.Timing; +using osu.Game.Database; +using System.Collections.Generic; + +namespace osu.Game.Beatmaps +{ + /// + /// Contains basic beatmap properties. + /// + /// This allows converted beatmaps () to refer to an original "base" Beatmap + /// for properties that shouldn't change unless in exceptional circumstances. + /// Properties here may be set to be overriden in such exceptional cases. + /// + /// + public class BeatmapBase + { + private BeatmapBase original; + + public BeatmapBase(BeatmapBase original = null) + { + this.original = original; + } + + private BeatmapInfo beatmapInfo; + public BeatmapInfo BeatmapInfo + { + get { return beatmapInfo ?? original?.BeatmapInfo; } + set { beatmapInfo = value; } + } + + private List controlPoints; + public List ControlPoints + { + get { return controlPoints ?? original?.ControlPoints; } + set { controlPoints = value; } + } + + private List comboColors; + public List ComboColors + { + get { return comboColors ?? original?.ComboColors; } + set { comboColors = value; } + } + + public BeatmapMetadata Metadata => BeatmapInfo?.Metadata ?? BeatmapInfo?.BeatmapSet?.Metadata; + } +} diff --git a/osu.Game/osu.Game.csproj b/osu.Game/osu.Game.csproj index 3d4a763cb8..c3097437c4 100644 --- a/osu.Game/osu.Game.csproj +++ b/osu.Game/osu.Game.csproj @@ -71,6 +71,7 @@ +