2017-02-07 04:59:30 +00:00
|
|
|
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
|
|
|
|
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
2016-08-31 03:33:01 +00:00
|
|
|
|
2017-03-12 05:32:50 +00:00
|
|
|
using OpenTK.Graphics;
|
2016-08-31 04:51:00 +00:00
|
|
|
using osu.Game.Beatmaps.Timing;
|
2017-04-18 07:05:58 +00:00
|
|
|
using osu.Game.Rulesets.Objects;
|
2017-03-11 15:34:21 +00:00
|
|
|
using System.Collections.Generic;
|
2017-05-22 01:12:33 +00:00
|
|
|
using System.Linq;
|
2017-05-23 04:55:18 +00:00
|
|
|
using osu.Game.Beatmaps.ControlPoints;
|
2017-08-05 07:22:10 +00:00
|
|
|
using osu.Game.IO.Serialization;
|
2016-08-31 03:33:01 +00:00
|
|
|
|
|
|
|
namespace osu.Game.Beatmaps
|
|
|
|
{
|
2017-03-11 15:34:21 +00:00
|
|
|
/// <summary>
|
2017-03-12 05:32:50 +00:00
|
|
|
/// A Beatmap containing converted HitObjects.
|
2017-03-11 15:34:21 +00:00
|
|
|
/// </summary>
|
2017-03-12 05:32:50 +00:00
|
|
|
public class Beatmap<T>
|
2017-03-11 15:34:21 +00:00
|
|
|
where T : HitObject
|
|
|
|
{
|
2017-03-12 05:32:50 +00:00
|
|
|
public BeatmapInfo BeatmapInfo;
|
2017-05-23 04:55:18 +00:00
|
|
|
public ControlPointInfo ControlPointInfo = new ControlPointInfo();
|
2017-05-22 01:12:33 +00:00
|
|
|
public List<BreakPeriod> Breaks = new List<BreakPeriod>();
|
2017-03-14 08:14:11 +00:00
|
|
|
public readonly List<Color4> ComboColors = new List<Color4>
|
2017-03-14 08:01:21 +00:00
|
|
|
{
|
|
|
|
new Color4(17, 136, 170, 255),
|
|
|
|
new Color4(102, 136, 0, 255),
|
|
|
|
new Color4(204, 102, 0, 255),
|
|
|
|
new Color4(121, 9, 13, 255)
|
|
|
|
};
|
2017-03-12 05:32:50 +00:00
|
|
|
|
|
|
|
public BeatmapMetadata Metadata => BeatmapInfo?.Metadata ?? BeatmapInfo?.BeatmapSet?.Metadata;
|
|
|
|
|
2017-03-11 16:08:34 +00:00
|
|
|
/// <summary>
|
|
|
|
/// The HitObjects this Beatmap contains.
|
|
|
|
/// </summary>
|
2017-03-11 15:34:21 +00:00
|
|
|
public List<T> HitObjects;
|
|
|
|
|
2017-05-22 01:12:33 +00:00
|
|
|
/// <summary>
|
|
|
|
/// Total amount of break time in the beatmap.
|
|
|
|
/// </summary>
|
|
|
|
public double TotalBreakTime => Breaks.Sum(b => b.Duration);
|
|
|
|
|
2017-03-11 16:08:34 +00:00
|
|
|
/// <summary>
|
2017-03-12 05:32:50 +00:00
|
|
|
/// Constructs a new beatmap.
|
2017-03-11 16:08:34 +00:00
|
|
|
/// </summary>
|
2017-03-12 05:32:50 +00:00
|
|
|
/// <param name="original">The original beatmap to use the parameters of.</param>
|
|
|
|
public Beatmap(Beatmap original = null)
|
2017-03-11 15:34:21 +00:00
|
|
|
{
|
2017-08-05 07:22:10 +00:00
|
|
|
BeatmapInfo = original?.BeatmapInfo.DeepClone() ?? BeatmapInfo;
|
2017-05-23 04:55:18 +00:00
|
|
|
ControlPointInfo = original?.ControlPointInfo ?? ControlPointInfo;
|
2017-05-22 01:12:33 +00:00
|
|
|
Breaks = original?.Breaks ?? Breaks;
|
2017-03-14 08:01:21 +00:00
|
|
|
ComboColors = original?.ComboColors ?? ComboColors;
|
2017-03-11 15:34:21 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-03-11 16:08:34 +00:00
|
|
|
/// <summary>
|
|
|
|
/// A Beatmap containing un-converted HitObjects.
|
|
|
|
/// </summary>
|
2017-03-11 15:34:21 +00:00
|
|
|
public class Beatmap : Beatmap<HitObject>
|
|
|
|
{
|
2017-03-17 05:24:46 +00: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 05:24:16 +00:00
|
|
|
HitObjects = original?.HitObjects;
|
2017-03-17 05:24:46 +00:00
|
|
|
}
|
2016-08-31 03:33:01 +00:00
|
|
|
}
|
2016-10-19 14:31:10 +00:00
|
|
|
}
|