mirror of
https://github.com/ppy/osu.git
synced 2025-01-15 00:43:22 +08:00
Remove the concept of beatmap events, rename BreakEvent -> BreakPeriod.
This commit is contained in:
parent
8c260e3364
commit
0a0139aded
@ -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;
|
||||
|
@ -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<BreakPeriod> Breaks = new List<BreakPeriod>();
|
||||
public readonly List<Color4> ComboColors = new List<Color4>
|
||||
{
|
||||
new Color4(17, 136, 170, 255),
|
||||
@ -34,6 +34,11 @@ namespace osu.Game.Beatmaps
|
||||
/// </summary>
|
||||
public List<T> HitObjects;
|
||||
|
||||
/// <summary>
|
||||
/// Total amount of break time in the beatmap.
|
||||
/// </summary>
|
||||
public double TotalBreakTime => Breaks.Sum(b => b.Duration);
|
||||
|
||||
/// <summary>
|
||||
/// Constructs a new beatmap.
|
||||
/// </summary>
|
||||
@ -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;
|
||||
}
|
||||
}
|
||||
|
@ -1,13 +0,0 @@
|
||||
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
|
||||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||
|
||||
namespace osu.Game.Beatmaps.Events
|
||||
{
|
||||
public class BackgroundEvent : Event
|
||||
{
|
||||
/// <summary>
|
||||
/// The file name.
|
||||
/// </summary>
|
||||
public string Filename;
|
||||
}
|
||||
}
|
@ -1,13 +0,0 @@
|
||||
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
|
||||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||
|
||||
namespace osu.Game.Beatmaps.Events
|
||||
{
|
||||
public abstract class Event
|
||||
{
|
||||
/// <summary>
|
||||
/// The event start time.
|
||||
/// </summary>
|
||||
public double StartTime;
|
||||
}
|
||||
}
|
@ -1,33 +0,0 @@
|
||||
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
|
||||
// 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
|
||||
{
|
||||
/// <summary>
|
||||
/// All the background events.
|
||||
/// </summary>
|
||||
public readonly List<BackgroundEvent> Backgrounds = new List<BackgroundEvent>();
|
||||
|
||||
/// <summary>
|
||||
/// All the break events.
|
||||
/// </summary>
|
||||
public readonly List<BreakEvent> Breaks = new List<BreakEvent>();
|
||||
|
||||
/// <summary>
|
||||
/// Total duration of all breaks.
|
||||
/// </summary>
|
||||
public double TotalBreakTime => Breaks.Sum(b => b.Duration);
|
||||
|
||||
/// <summary>
|
||||
/// Retrieves the active background at a time.
|
||||
/// </summary>
|
||||
/// <param name="time">The time to retrieve the background at.</param>
|
||||
/// <returns>The background.</returns>
|
||||
public BackgroundEvent BackgroundAt(double time) => Backgrounds.FirstOrDefault(b => b.StartTime <= time);
|
||||
}
|
||||
}
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
@ -1,27 +1,32 @@
|
||||
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
|
||||
// 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
|
||||
{
|
||||
/// <summary>
|
||||
/// The minimum duration required for a break to have any effect.
|
||||
/// </summary>
|
||||
private const double min_break_duration = 650;
|
||||
|
||||
/// <summary>
|
||||
/// The break start time.
|
||||
/// </summary>
|
||||
public double StartTime;
|
||||
|
||||
/// <summary>
|
||||
/// The break end time.
|
||||
/// </summary>
|
||||
public double EndTime;
|
||||
|
||||
/// <summary>
|
||||
/// The duration of the break.
|
||||
/// The break duration.
|
||||
/// </summary>
|
||||
public double Duration => EndTime - StartTime;
|
||||
|
||||
/// <summary>
|
||||
/// 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.
|
||||
/// </summary>
|
||||
public bool HasEffect => Duration >= min_break_duration;
|
||||
}
|
@ -74,10 +74,6 @@
|
||||
<Compile Include="Audio\SampleInfoList.cs" />
|
||||
<Compile Include="Beatmaps\Drawables\BeatmapBackgroundSprite.cs" />
|
||||
<Compile Include="Beatmaps\DifficultyCalculator.cs" />
|
||||
<Compile Include="Beatmaps\Events\BackgroundEvent.cs" />
|
||||
<Compile Include="Beatmaps\Events\BreakEvent.cs" />
|
||||
<Compile Include="Beatmaps\Events\Event.cs" />
|
||||
<Compile Include="Beatmaps\Events\EventInfo.cs" />
|
||||
<Compile Include="Online\API\Requests\PostMessageRequest.cs" />
|
||||
<Compile Include="Online\Chat\ErrorMessage.cs" />
|
||||
<Compile Include="Overlays\Chat\ChatTabControl.cs" />
|
||||
@ -91,6 +87,7 @@
|
||||
<Compile Include="Rulesets\Beatmaps\BeatmapConverter.cs" />
|
||||
<Compile Include="Rulesets\Beatmaps\BeatmapProcessor.cs" />
|
||||
<Compile Include="Beatmaps\Legacy\LegacyBeatmap.cs" />
|
||||
<Compile Include="Beatmaps\Timing\BreakPeriod.cs" />
|
||||
<Compile Include="Beatmaps\Timing\TimeSignatures.cs" />
|
||||
<Compile Include="Beatmaps\Timing\TimingInfo.cs" />
|
||||
<Compile Include="Database\BeatmapMetrics.cs" />
|
||||
|
Loading…
Reference in New Issue
Block a user