1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-16 11:22:55 +08:00
osu-lazer/osu.Game/Beatmaps/Beatmap.cs

72 lines
2.4 KiB
C#
Raw Normal View History

// 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;
2017-04-18 15:05:58 +08:00
using osu.Game.Rulesets.Objects;
2017-03-11 23:34:21 +08:00
using System.Collections.Generic;
using System.Linq;
using osu.Game.Beatmaps.ControlPoints;
namespace osu.Game.Beatmaps
{
2017-03-11 23:34:21 +08:00
/// <summary>
/// A Beatmap containing converted HitObjects.
2017-03-11 23:34:21 +08:00
/// </summary>
public class Beatmap<T>
2017-03-11 23:34:21 +08:00
where T : HitObject
{
public BeatmapInfo BeatmapInfo;
public ControlPointInfo ControlPointInfo = new ControlPointInfo();
public List<BreakPeriod> Breaks = new List<BreakPeriod>();
2017-03-14 16:14:11 +08:00
public readonly List<Color4> ComboColors = new List<Color4>
{
new Color4(17, 136, 170, 255),
new Color4(102, 136, 0, 255),
new Color4(204, 102, 0, 255),
new Color4(121, 9, 13, 255)
};
public BeatmapMetadata Metadata => BeatmapInfo?.Metadata ?? BeatmapInfo?.BeatmapSet?.Metadata;
2017-03-12 00:08:34 +08:00
/// <summary>
/// The HitObjects this Beatmap contains.
/// </summary>
2017-03-11 23:34:21 +08:00
public List<T> HitObjects;
/// <summary>
/// Total amount of break time in the beatmap.
/// </summary>
public double TotalBreakTime => Breaks.Sum(b => b.Duration);
2017-03-12 00:08:34 +08:00
/// <summary>
/// Constructs a new beatmap.
2017-03-12 00:08:34 +08:00
/// </summary>
/// <param name="original">The original beatmap to use the parameters of.</param>
public Beatmap(Beatmap original = null)
2017-03-11 23:34:21 +08:00
{
BeatmapInfo = original?.BeatmapInfo ?? BeatmapInfo;
ControlPointInfo = original?.ControlPointInfo ?? ControlPointInfo;
Breaks = original?.Breaks ?? Breaks;
ComboColors = original?.ComboColors ?? ComboColors;
2017-03-11 23:34:21 +08:00
}
}
2017-03-12 00:08:34 +08:00
/// <summary>
/// A Beatmap containing un-converted HitObjects.
/// </summary>
2017-03-11 23:34:21 +08:00
public class Beatmap : Beatmap<HitObject>
{
2017-03-17 13:24:46 +08:00
/// <summary>
/// Constructs a new beatmap.
/// </summary>
/// <param name="original">The original beatmap to use the parameters of.</param>
public Beatmap(Beatmap original = null)
: base(original)
{
2017-04-18 13:24:16 +08:00
HitObjects = original?.HitObjects;
2017-03-17 13:24:46 +08:00
}
}
}