mirror of
https://github.com/ppy/osu
synced 2025-01-08 23:29:43 +00:00
Rename FramedAutoGenerator<T> -> AutoGenerator<T>
This commit is contained in:
parent
95c74c906a
commit
207f7f1e56
@ -7,7 +7,7 @@ using osu.Game.Rulesets.Replays;
|
||||
|
||||
namespace osu.Game.Rulesets.EmptyFreeform.Replays
|
||||
{
|
||||
public class EmptyFreeformAutoGenerator : FramedAutoGenerator<EmptyFreeformReplayFrame>
|
||||
public class EmptyFreeformAutoGenerator : AutoGenerator<EmptyFreeformReplayFrame>
|
||||
{
|
||||
public new Beatmap<EmptyFreeformHitObject> Beatmap => (Beatmap<EmptyFreeformHitObject>)base.Beatmap;
|
||||
|
||||
|
@ -7,7 +7,7 @@ using osu.Game.Rulesets.Replays;
|
||||
|
||||
namespace osu.Game.Rulesets.Pippidon.Replays
|
||||
{
|
||||
public class PippidonAutoGenerator : FramedAutoGenerator<PippidonReplayFrame>
|
||||
public class PippidonAutoGenerator : AutoGenerator<PippidonReplayFrame>
|
||||
{
|
||||
public new Beatmap<PippidonHitObject> Beatmap => (Beatmap<PippidonHitObject>)base.Beatmap;
|
||||
|
||||
|
@ -7,7 +7,7 @@ using osu.Game.Rulesets.Replays;
|
||||
|
||||
namespace osu.Game.Rulesets.EmptyScrolling.Replays
|
||||
{
|
||||
public class EmptyScrollingAutoGenerator : FramedAutoGenerator<EmptyScrollingReplayFrame>
|
||||
public class EmptyScrollingAutoGenerator : AutoGenerator<EmptyScrollingReplayFrame>
|
||||
{
|
||||
public new Beatmap<EmptyScrollingHitObject> Beatmap => (Beatmap<EmptyScrollingHitObject>)base.Beatmap;
|
||||
|
||||
|
@ -9,7 +9,7 @@ using osu.Game.Rulesets.Replays;
|
||||
|
||||
namespace osu.Game.Rulesets.Pippidon.Replays
|
||||
{
|
||||
public class PippidonAutoGenerator : FramedAutoGenerator<PippidonReplayFrame>
|
||||
public class PippidonAutoGenerator : AutoGenerator<PippidonReplayFrame>
|
||||
{
|
||||
public new Beatmap<PippidonHitObject> Beatmap => (Beatmap<PippidonHitObject>)base.Beatmap;
|
||||
|
||||
|
@ -12,7 +12,7 @@ using osu.Game.Rulesets.Replays;
|
||||
|
||||
namespace osu.Game.Rulesets.Catch.Replays
|
||||
{
|
||||
internal class CatchAutoGenerator : FramedAutoGenerator<CatchReplayFrame>
|
||||
internal class CatchAutoGenerator : AutoGenerator<CatchReplayFrame>
|
||||
{
|
||||
public new CatchBeatmap Beatmap => (CatchBeatmap)base.Beatmap;
|
||||
|
||||
|
@ -10,7 +10,7 @@ using osu.Game.Rulesets.Replays;
|
||||
|
||||
namespace osu.Game.Rulesets.Mania.Replays
|
||||
{
|
||||
internal class ManiaAutoGenerator : FramedAutoGenerator<ManiaReplayFrame>
|
||||
internal class ManiaAutoGenerator : AutoGenerator<ManiaReplayFrame>
|
||||
{
|
||||
public const double RELEASE_DELAY = 20;
|
||||
|
||||
|
@ -11,7 +11,7 @@ using osu.Game.Rulesets.Objects;
|
||||
|
||||
namespace osu.Game.Rulesets.Taiko.Replays
|
||||
{
|
||||
public class TaikoAutoGenerator : FramedAutoGenerator<TaikoReplayFrame>
|
||||
public class TaikoAutoGenerator : AutoGenerator<TaikoReplayFrame>
|
||||
{
|
||||
public new TaikoBeatmap Beatmap => (TaikoBeatmap)base.Beatmap;
|
||||
|
||||
|
@ -1,6 +1,9 @@
|
||||
// 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.
|
||||
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using JetBrains.Annotations;
|
||||
using osu.Game.Beatmaps;
|
||||
using osu.Game.Replays;
|
||||
using osu.Game.Rulesets.Objects;
|
||||
@ -37,4 +40,37 @@ namespace osu.Game.Rulesets.Replays
|
||||
return Beatmap.HitObjects[currentIndex + 1];
|
||||
}
|
||||
}
|
||||
|
||||
public abstract class AutoGenerator<TFrame> : AutoGenerator
|
||||
where TFrame : ReplayFrame
|
||||
{
|
||||
/// <summary>
|
||||
/// The replay frames of the autoplay.
|
||||
/// </summary>
|
||||
protected readonly List<TFrame> Frames = new List<TFrame>();
|
||||
|
||||
[CanBeNull]
|
||||
protected TFrame LastFrame => Frames.Count == 0 ? null : Frames[^1];
|
||||
|
||||
protected AutoGenerator(IBeatmap beatmap)
|
||||
: base(beatmap)
|
||||
{
|
||||
}
|
||||
|
||||
public sealed override Replay Generate()
|
||||
{
|
||||
Frames.Clear();
|
||||
GenerateFrames();
|
||||
|
||||
return new Replay
|
||||
{
|
||||
Frames = Frames.OrderBy(frame => frame.Time).Cast<ReplayFrame>().ToList()
|
||||
};
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Generate the replay frames of the autoplay and populate <see cref="Frames"/>.
|
||||
/// </summary>
|
||||
protected abstract void GenerateFrames();
|
||||
}
|
||||
}
|
||||
|
@ -1,44 +0,0 @@
|
||||
// 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.
|
||||
|
||||
#nullable enable
|
||||
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using osu.Game.Beatmaps;
|
||||
using osu.Game.Replays;
|
||||
|
||||
namespace osu.Game.Rulesets.Replays
|
||||
{
|
||||
public abstract class FramedAutoGenerator<TFrame> : AutoGenerator
|
||||
where TFrame : ReplayFrame
|
||||
{
|
||||
/// <summary>
|
||||
/// The replay frames of the autoplay.
|
||||
/// </summary>
|
||||
protected readonly List<TFrame> Frames = new List<TFrame>();
|
||||
|
||||
protected TFrame? LastFrame => Frames.Count == 0 ? null : Frames[^1];
|
||||
|
||||
protected FramedAutoGenerator(IBeatmap beatmap)
|
||||
: base(beatmap)
|
||||
{
|
||||
}
|
||||
|
||||
public sealed override Replay Generate()
|
||||
{
|
||||
Frames.Clear();
|
||||
GenerateFrames();
|
||||
|
||||
return new Replay
|
||||
{
|
||||
Frames = Frames.OrderBy(frame => frame.Time).Cast<ReplayFrame>().ToList()
|
||||
};
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Generate the replay frames of the autoplay and populate <see cref="Frames"/>.
|
||||
/// </summary>
|
||||
protected abstract void GenerateFrames();
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user