diff --git a/osu.Game.Rulesets.Mania/Beatmaps/Patterns/Legacy/PatternGenerator.cs b/osu.Game.Rulesets.Mania/Beatmaps/Patterns/Legacy/PatternGenerator.cs index ad07c03b96..e6e3f1d07f 100644 --- a/osu.Game.Rulesets.Mania/Beatmaps/Patterns/Legacy/PatternGenerator.cs +++ b/osu.Game.Rulesets.Mania/Beatmaps/Patterns/Legacy/PatternGenerator.cs @@ -90,7 +90,7 @@ namespace osu.Game.Rulesets.Mania.Beatmaps.Patterns.Legacy HitObject firstObject = Beatmap.HitObjects.FirstOrDefault(); double drainTime = (lastObject?.StartTime ?? 0) - (firstObject?.StartTime ?? 0); - drainTime -= Beatmap.EventInfo.TotalBreakTime; + drainTime -= Beatmap.TotalBreakTime; if (drainTime == 0) drainTime = 10000; diff --git a/osu.Game/Beatmaps/Beatmap.cs b/osu.Game/Beatmaps/Beatmap.cs index a64002e0b0..608b2fcd19 100644 --- a/osu.Game/Beatmaps/Beatmap.cs +++ b/osu.Game/Beatmaps/Beatmap.cs @@ -2,11 +2,11 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using OpenTK.Graphics; -using osu.Game.Beatmaps.Events; using osu.Game.Beatmaps.Timing; using osu.Game.Database; using osu.Game.Rulesets.Objects; using System.Collections.Generic; +using System.Linq; namespace osu.Game.Beatmaps { @@ -18,7 +18,7 @@ namespace osu.Game.Beatmaps { public BeatmapInfo BeatmapInfo; public TimingInfo TimingInfo = new TimingInfo(); - public EventInfo EventInfo = new EventInfo(); + public List Breaks = new List(); public readonly List ComboColors = new List { new Color4(17, 136, 170, 255), @@ -34,6 +34,11 @@ namespace osu.Game.Beatmaps /// public List HitObjects; + /// + /// Total amount of break time in the beatmap. + /// + public double TotalBreakTime => Breaks.Sum(b => b.Duration); + /// /// Constructs a new beatmap. /// @@ -42,7 +47,7 @@ namespace osu.Game.Beatmaps { BeatmapInfo = original?.BeatmapInfo ?? BeatmapInfo; TimingInfo = original?.TimingInfo ?? TimingInfo; - EventInfo = original?.EventInfo ?? EventInfo; + Breaks = original?.Breaks ?? Breaks; ComboColors = original?.ComboColors ?? ComboColors; } } diff --git a/osu.Game/Beatmaps/Events/BackgroundEvent.cs b/osu.Game/Beatmaps/Events/BackgroundEvent.cs deleted file mode 100644 index 215373bd3b..0000000000 --- a/osu.Game/Beatmaps/Events/BackgroundEvent.cs +++ /dev/null @@ -1,13 +0,0 @@ -// Copyright (c) 2007-2017 ppy Pty Ltd . -// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE - -namespace osu.Game.Beatmaps.Events -{ - public class BackgroundEvent : Event - { - /// - /// The file name. - /// - public string Filename; - } -} diff --git a/osu.Game/Beatmaps/Events/Event.cs b/osu.Game/Beatmaps/Events/Event.cs deleted file mode 100644 index 3af3909462..0000000000 --- a/osu.Game/Beatmaps/Events/Event.cs +++ /dev/null @@ -1,13 +0,0 @@ -// Copyright (c) 2007-2017 ppy Pty Ltd . -// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE - -namespace osu.Game.Beatmaps.Events -{ - public abstract class Event - { - /// - /// The event start time. - /// - public double StartTime; - } -} diff --git a/osu.Game/Beatmaps/Events/EventInfo.cs b/osu.Game/Beatmaps/Events/EventInfo.cs deleted file mode 100644 index 3ba3d5ba03..0000000000 --- a/osu.Game/Beatmaps/Events/EventInfo.cs +++ /dev/null @@ -1,33 +0,0 @@ -// Copyright (c) 2007-2017 ppy Pty Ltd . -// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE - -using System.Collections.Generic; -using System.Linq; - -namespace osu.Game.Beatmaps.Events -{ - public class EventInfo - { - /// - /// All the background events. - /// - public readonly List Backgrounds = new List(); - - /// - /// All the break events. - /// - public readonly List Breaks = new List(); - - /// - /// Total duration of all breaks. - /// - public double TotalBreakTime => Breaks.Sum(b => b.Duration); - - /// - /// Retrieves the active background at a time. - /// - /// The time to retrieve the background at. - /// The background. - public BackgroundEvent BackgroundAt(double time) => Backgrounds.FirstOrDefault(b => b.StartTime <= time); - } -} diff --git a/osu.Game/Beatmaps/Formats/OsuLegacyDecoder.cs b/osu.Game/Beatmaps/Formats/OsuLegacyDecoder.cs index 772c0e9c07..04208337c7 100644 --- a/osu.Game/Beatmaps/Formats/OsuLegacyDecoder.cs +++ b/osu.Game/Beatmaps/Formats/OsuLegacyDecoder.cs @@ -5,7 +5,6 @@ using System; using System.Globalization; using System.IO; using OpenTK.Graphics; -using osu.Game.Beatmaps.Events; using osu.Game.Beatmaps.Timing; using osu.Game.Beatmaps.Legacy; using osu.Game.Rulesets.Objects.Legacy; @@ -217,18 +216,12 @@ namespace osu.Game.Beatmaps.Formats case EventType.Background: string filename = split[2].Trim('"'); - beatmap.EventInfo.Backgrounds.Add(new BackgroundEvent - { - StartTime = double.Parse(split[1], NumberFormatInfo.InvariantInfo), - Filename = filename - }); - if (type == EventType.Background) beatmap.BeatmapInfo.Metadata.BackgroundFile = filename; break; case EventType.Break: - var breakEvent = new BreakEvent + var breakEvent = new BreakPeriod { StartTime = double.Parse(split[1], NumberFormatInfo.InvariantInfo), EndTime = double.Parse(split[2], NumberFormatInfo.InvariantInfo) @@ -237,7 +230,7 @@ namespace osu.Game.Beatmaps.Formats if (!breakEvent.HasEffect) return; - beatmap.EventInfo.Breaks.Add(breakEvent); + beatmap.Breaks.Add(breakEvent); break; } } diff --git a/osu.Game/Beatmaps/Events/BreakEvent.cs b/osu.Game/Beatmaps/Timing/BreakPeriod.cs similarity index 70% rename from osu.Game/Beatmaps/Events/BreakEvent.cs rename to osu.Game/Beatmaps/Timing/BreakPeriod.cs index 78e33f2fbb..fb307b7144 100644 --- a/osu.Game/Beatmaps/Events/BreakEvent.cs +++ b/osu.Game/Beatmaps/Timing/BreakPeriod.cs @@ -1,27 +1,32 @@ // Copyright (c) 2007-2017 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE -namespace osu.Game.Beatmaps.Events +namespace osu.Game.Beatmaps.Timing { - public class BreakEvent : Event + public class BreakPeriod { /// /// The minimum duration required for a break to have any effect. /// private const double min_break_duration = 650; + /// + /// The break start time. + /// + public double StartTime; + /// /// The break end time. /// public double EndTime; /// - /// The duration of the break. + /// The break duration. /// public double Duration => EndTime - StartTime; /// - /// Whether the break has any effect. Breaks that are too short are culled before they reach the EventInfo. + /// Whether the break has any effect. Breaks that are too short are culled before they are added to the beatmap. /// public bool HasEffect => Duration >= min_break_duration; } diff --git a/osu.Game/osu.Game.csproj b/osu.Game/osu.Game.csproj index acc6fd4abe..1631311ef6 100644 --- a/osu.Game/osu.Game.csproj +++ b/osu.Game/osu.Game.csproj @@ -74,10 +74,6 @@ - - - - @@ -91,6 +87,7 @@ +