mirror of
https://github.com/osukey/osukey.git
synced 2025-05-29 01:17:35 +09:00
Cleanups.
This commit is contained in:
parent
592e05a2c8
commit
77a4a896c9
@ -1,7 +1,6 @@
|
|||||||
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
|
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
|
||||||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||||
|
|
||||||
using OpenTK.Graphics;
|
|
||||||
using osu.Game.Beatmaps.Timing;
|
using osu.Game.Beatmaps.Timing;
|
||||||
using osu.Game.Database;
|
using osu.Game.Database;
|
||||||
using osu.Game.Modes;
|
using osu.Game.Modes;
|
||||||
@ -11,47 +10,21 @@ using System.Linq;
|
|||||||
|
|
||||||
namespace osu.Game.Beatmaps
|
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<ControlPoint> controlPoints;
|
|
||||||
public List<ControlPoint> ControlPoints
|
|
||||||
{
|
|
||||||
get { return controlPoints ?? original?.ControlPoints; }
|
|
||||||
set { controlPoints = value; }
|
|
||||||
}
|
|
||||||
|
|
||||||
private List<Color4> comboColors;
|
|
||||||
public List<Color4> ComboColors
|
|
||||||
{
|
|
||||||
get { return comboColors ?? original?.ComboColors; }
|
|
||||||
set { comboColors = value; }
|
|
||||||
}
|
|
||||||
|
|
||||||
public BeatmapMetadata Metadata => BeatmapInfo?.Metadata ?? BeatmapInfo?.BeatmapSet?.Metadata;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// A generic beatmap that does not contain HitObjects.
|
/// A Beatmap containing HitObjects.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class Beatmap<T> : BeatmapBase
|
public class Beatmap<T> : BeatmapBase
|
||||||
where T : HitObject
|
where T : HitObject
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// The HitObjects this Beatmap contains.
|
||||||
|
/// </summary>
|
||||||
public List<T> HitObjects;
|
public List<T> HitObjects;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Constructs a new Beatmap containing HitObjects.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="original">If this Beatmap is a convert, the original Beatmap to use the properties of.</param>
|
||||||
public Beatmap(BeatmapBase original = null)
|
public Beatmap(BeatmapBase original = null)
|
||||||
: base(original)
|
: base(original)
|
||||||
{
|
{
|
||||||
@ -99,15 +72,22 @@ namespace osu.Game.Beatmaps
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// A Beatmap containing un-converted HitObjects.
|
||||||
|
/// </summary>
|
||||||
public class Beatmap : Beatmap<HitObject>
|
public class Beatmap : Beatmap<HitObject>
|
||||||
{
|
{
|
||||||
public Beatmap(BeatmapBase original = null)
|
/// <summary>
|
||||||
: base(original)
|
/// Calculates the star difficulty for this Beatmap.
|
||||||
{
|
/// </summary>
|
||||||
}
|
/// <returns>The star difficulty.</returns>
|
||||||
|
|
||||||
public double CalculateStarDifficulty() => Ruleset.GetRuleset(BeatmapInfo.Mode).CreateDifficultyCalculator(this).Calculate();
|
public double CalculateStarDifficulty() => Ruleset.GetRuleset(BeatmapInfo.Mode).CreateDifficultyCalculator(this).Calculate();
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Converts this Beatmap to a <see cref="Beatmap{T}"/> containing another type of <see cref="HitObject"/>.
|
||||||
|
/// </summary>
|
||||||
|
/// <typeparam name="T">The type of HitObject the new Beatmap should contain.</typeparam>
|
||||||
|
/// <returns></returns>
|
||||||
public Beatmap<T> ConvertTo<T>() where T : HitObject
|
public Beatmap<T> ConvertTo<T>() where T : HitObject
|
||||||
{
|
{
|
||||||
return Ruleset.GetRuleset(BeatmapInfo.Mode).CreateBeatmapConverter<T>().Convert(this);
|
return Ruleset.GetRuleset(BeatmapInfo.Mode).CreateBeatmapConverter<T>().Convert(this);
|
||||||
|
51
osu.Game/Beatmaps/BeatmapBase.cs
Normal file
51
osu.Game/Beatmaps/BeatmapBase.cs
Normal file
@ -0,0 +1,51 @@
|
|||||||
|
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
|
||||||
|
// 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
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Contains basic beatmap properties.
|
||||||
|
/// <para>
|
||||||
|
/// This allows converted beatmaps (<see cref="Beatmap{T}"/>) 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.
|
||||||
|
/// </para>
|
||||||
|
/// </summary>
|
||||||
|
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<ControlPoint> controlPoints;
|
||||||
|
public List<ControlPoint> ControlPoints
|
||||||
|
{
|
||||||
|
get { return controlPoints ?? original?.ControlPoints; }
|
||||||
|
set { controlPoints = value; }
|
||||||
|
}
|
||||||
|
|
||||||
|
private List<Color4> comboColors;
|
||||||
|
public List<Color4> ComboColors
|
||||||
|
{
|
||||||
|
get { return comboColors ?? original?.ComboColors; }
|
||||||
|
set { comboColors = value; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public BeatmapMetadata Metadata => BeatmapInfo?.Metadata ?? BeatmapInfo?.BeatmapSet?.Metadata;
|
||||||
|
}
|
||||||
|
}
|
@ -71,6 +71,7 @@
|
|||||||
<Reference Include="System.Xml" />
|
<Reference Include="System.Xml" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
<Compile Include="Beatmaps\BeatmapBase.cs" />
|
||||||
<Compile Include="Beatmaps\Drawables\BeatmapBackgroundSprite.cs" />
|
<Compile Include="Beatmaps\Drawables\BeatmapBackgroundSprite.cs" />
|
||||||
<Compile Include="Beatmaps\DifficultyCalculator.cs" />
|
<Compile Include="Beatmaps\DifficultyCalculator.cs" />
|
||||||
<Compile Include="Beatmaps\IBeatmapCoverter.cs" />
|
<Compile Include="Beatmaps\IBeatmapCoverter.cs" />
|
||||||
|
Loading…
x
Reference in New Issue
Block a user