1
0
mirror of https://github.com/ppy/osu.git synced 2024-09-22 03:27:24 +08:00

Implement SpeedAdjustedPlayfield and a new HitRenderer derivation.

This commit is contained in:
smoogipooo 2017-08-04 14:44:43 +09:30
parent c86f23baea
commit 0f901c99a0
6 changed files with 49 additions and 5 deletions

View File

@ -30,7 +30,7 @@ using osu.Game.Rulesets.UI;
namespace osu.Game.Rulesets.Mania.UI
{
public class ManiaHitRenderer : SpeedAdjustedHitRenderer<ManiaHitObject, ManiaJudgement>
public class ManiaHitRenderer : SpeedAdjustedHitRenderer<ManiaPlayfield, ManiaHitObject, ManiaJudgement>
{
/// <summary>
/// Preferred column count. This will only have an effect during the initialization of the play field.

View File

@ -23,7 +23,7 @@ using osu.Framework.Graphics.Shapes;
namespace osu.Game.Rulesets.Mania.UI
{
public class ManiaPlayfield : Playfield<ManiaHitObject, ManiaJudgement>
public class ManiaPlayfield : SpeedAdjustedPlayfield<ManiaHitObject, ManiaJudgement>
{
public const float HIT_TARGET_POSITION = 50;

View File

@ -221,7 +221,7 @@ namespace osu.Game.Rulesets.UI
/// <summary>
/// The playfield.
/// </summary>
protected Playfield<TObject, TJudgement> Playfield;
protected Playfield<TObject, TJudgement> Playfield { get; private set; }
protected override Container<Drawable> Content => content;
private readonly Container content;
@ -319,6 +319,32 @@ namespace osu.Game.Rulesets.UI
protected abstract Playfield<TObject, TJudgement> CreatePlayfield();
}
/// <summary>
/// A derivable HitRenderer that manages the Playfield and HitObjects.
/// </summary>
/// <typeparam name="TObject">The type of HitObject contained by this HitRenderer.</typeparam>
/// <typeparam name="TJudgement">The type of Judgement of DrawableHitObjects contained by this HitRenderer.</typeparam>
public abstract class HitRenderer<TPlayfield, TObject, TJudgement> : HitRenderer<TObject, TJudgement>
where TObject : HitObject
where TJudgement : Judgement
where TPlayfield : Playfield<TObject, TJudgement>
{
/// <summary>
/// The playfield.
/// </summary>
protected new TPlayfield Playfield => (TPlayfield)base.Playfield;
/// <summary>
/// Creates a hit renderer for a beatmap.
/// </summary>
/// <param name="beatmap">The beatmap to create the hit renderer for.</param>
/// <param name="isForCurrentRuleset">Whether to assume the beatmap is for the current ruleset.</param>
protected HitRenderer(WorkingBeatmap beatmap, bool isForCurrentRuleset)
: base(beatmap, isForCurrentRuleset)
{
}
}
public class BeatmapInvalidForRulesetException : ArgumentException
{
public BeatmapInvalidForRulesetException(string text)

View File

@ -16,11 +16,13 @@ using osu.Game.Rulesets.Timing;
namespace osu.Game.Rulesets.UI
{
/// <summary>
/// A type of <see cref="HitRenderer{TObject, TJudgement}"/> that supports speed adjustments in some capacity.
/// A type of <see cref="HitRenderer{TObject, TJudgement}"/> that exposes <see cref="MultiplierControlPoint"/>s to be used
/// in <see cref="SpeedAdjustmentCollection"/>s.
/// </summary>
public abstract class SpeedAdjustedHitRenderer<TObject, TJudgement> : HitRenderer<TObject, TJudgement>
public abstract class SpeedAdjustedHitRenderer<TPlayfield, TObject, TJudgement> : HitRenderer<TPlayfield, TObject, TJudgement>
where TObject : HitObject
where TJudgement : Judgement
where TPlayfield : SpeedAdjustedPlayfield<TObject, TJudgement>
{
protected readonly SortedList<MultiplierControlPoint> DefaultControlPoints = new SortedList<MultiplierControlPoint>(Comparer<MultiplierControlPoint>.Default);

View File

@ -0,0 +1,15 @@
using osu.Game.Rulesets.Judgements;
using osu.Game.Rulesets.Objects;
namespace osu.Game.Rulesets.UI
{
public class SpeedAdjustedPlayfield<TObject, TJudgement> : Playfield<TObject, TJudgement>
where TObject : HitObject
where TJudgement : Judgement
{
protected SpeedAdjustedPlayfield(float? customWidth = null)
: base(customWidth)
{
}
}
}

View File

@ -340,6 +340,7 @@
<Compile Include="Rulesets\UI\HitRenderer.cs" />
<Compile Include="Rulesets\UI\Playfield.cs" />
<Compile Include="Rulesets\UI\SpeedAdjustedHitRenderer.cs" />
<Compile Include="Rulesets\UI\SpeedAdjustedPlayfield.cs" />
<Compile Include="Screens\Select\EditSongSelect.cs" />
<Compile Include="Screens\Play\HUD\ComboCounter.cs" />
<Compile Include="Screens\Play\HUD\ComboResultCounter.cs" />