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
|
|
|
|
|
|
|
|
|
using osu.Game.Beatmaps;
|
2018-11-28 16:20:37 +08:00
|
|
|
|
using osu.Game.Replays;
|
2019-08-19 22:18:25 +08:00
|
|
|
|
using osu.Game.Rulesets.Objects;
|
2018-04-13 17:19:50 +08:00
|
|
|
|
|
|
|
|
|
namespace osu.Game.Rulesets.Replays
|
|
|
|
|
{
|
2019-03-07 17:30:31 +08:00
|
|
|
|
public abstract class AutoGenerator : IAutoGenerator
|
2018-04-13 17:19:50 +08:00
|
|
|
|
{
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Creates the auto replay and returns it.
|
|
|
|
|
/// Every subclass of OsuAutoGeneratorBase should implement this!
|
|
|
|
|
/// </summary>
|
|
|
|
|
public abstract Replay Generate();
|
|
|
|
|
|
|
|
|
|
#region Parameters
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// The beatmap we're making.
|
|
|
|
|
/// </summary>
|
2019-03-07 17:30:31 +08:00
|
|
|
|
protected IBeatmap Beatmap;
|
2018-04-13 17:19:50 +08:00
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
2019-03-07 17:30:31 +08:00
|
|
|
|
protected AutoGenerator(IBeatmap beatmap)
|
2018-04-13 17:19:50 +08:00
|
|
|
|
{
|
|
|
|
|
Beatmap = beatmap;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#region Constants
|
|
|
|
|
|
|
|
|
|
// Shared amongst all modes
|
2020-02-14 16:13:50 +08:00
|
|
|
|
public const double KEY_UP_DELAY = 50;
|
2018-04-13 17:19:50 +08:00
|
|
|
|
|
|
|
|
|
#endregion
|
2019-08-19 22:18:25 +08:00
|
|
|
|
|
|
|
|
|
protected virtual HitObject GetNextObject(int currentIndex)
|
|
|
|
|
{
|
|
|
|
|
if (currentIndex >= Beatmap.HitObjects.Count - 1)
|
|
|
|
|
return null;
|
|
|
|
|
|
|
|
|
|
return Beatmap.HitObjects[currentIndex + 1];
|
|
|
|
|
}
|
2018-04-13 17:19:50 +08:00
|
|
|
|
}
|
|
|
|
|
}
|