2019-01-24 16:43:03 +08:00
|
|
|
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
|
|
|
|
// See the LICENCE file in the repository root for full licence text.
|
2018-04-13 17:19:50 +08:00
|
|
|
|
|
2018-03-20 14:45:40 +08:00
|
|
|
|
using System.Linq;
|
|
|
|
|
using osu.Game.Rulesets.Objects.Types;
|
2018-04-13 17:19:50 +08:00
|
|
|
|
|
2017-09-18 21:32:49 +08:00
|
|
|
|
namespace osu.Game.Beatmaps
|
2017-03-14 16:01:21 +08:00
|
|
|
|
{
|
|
|
|
|
/// <summary>
|
2018-06-29 12:07:00 +08:00
|
|
|
|
/// Provides functionality to alter a <see cref="IBeatmap"/> after it has been converted.
|
2017-03-14 16:01:21 +08:00
|
|
|
|
/// </summary>
|
2018-04-19 21:04:12 +08:00
|
|
|
|
public class BeatmapProcessor : IBeatmapProcessor
|
2017-03-14 16:01:21 +08:00
|
|
|
|
{
|
2018-04-19 21:04:12 +08:00
|
|
|
|
public IBeatmap Beatmap { get; }
|
|
|
|
|
|
|
|
|
|
public BeatmapProcessor(IBeatmap beatmap)
|
|
|
|
|
{
|
|
|
|
|
Beatmap = beatmap;
|
|
|
|
|
}
|
|
|
|
|
|
2018-06-29 11:45:48 +08:00
|
|
|
|
public virtual void PreProcess()
|
2018-03-20 14:45:40 +08:00
|
|
|
|
{
|
2023-05-17 16:19:07 +08:00
|
|
|
|
IHasComboInformation? lastObj = null;
|
2020-10-06 18:04:50 +08:00
|
|
|
|
|
2018-04-19 21:04:12 +08:00
|
|
|
|
foreach (var obj in Beatmap.HitObjects.OfType<IHasComboInformation>())
|
2018-03-20 14:45:40 +08:00
|
|
|
|
{
|
2023-05-17 16:19:07 +08:00
|
|
|
|
if (lastObj == null)
|
2020-10-06 18:04:50 +08:00
|
|
|
|
{
|
|
|
|
|
// first hitobject should always be marked as a new combo for sanity.
|
2023-05-17 16:19:07 +08:00
|
|
|
|
obj.NewCombo = true;
|
2018-03-20 14:45:40 +08:00
|
|
|
|
}
|
2018-04-13 17:19:50 +08:00
|
|
|
|
|
2023-05-17 16:19:07 +08:00
|
|
|
|
obj.UpdateComboInformation(lastObj);
|
2018-03-20 14:45:40 +08:00
|
|
|
|
lastObj = obj;
|
|
|
|
|
}
|
|
|
|
|
}
|
2018-06-29 11:45:48 +08:00
|
|
|
|
|
|
|
|
|
public virtual void PostProcess()
|
|
|
|
|
{
|
|
|
|
|
}
|
2017-03-14 16:01:21 +08:00
|
|
|
|
}
|
|
|
|
|
}
|