mirror of
https://github.com/ppy/osu.git
synced 2024-11-11 17:07:38 +08:00
Implement SpeedAdjustedPlayfield and a new HitRenderer derivation.
This commit is contained in:
parent
c86f23baea
commit
0f901c99a0
@ -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.
|
||||
|
@ -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;
|
||||
|
||||
|
@ -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)
|
||||
|
@ -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);
|
||||
|
||||
|
15
osu.Game/Rulesets/UI/SpeedAdjustedPlayfield.cs
Normal file
15
osu.Game/Rulesets/UI/SpeedAdjustedPlayfield.cs
Normal 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)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
@ -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" />
|
||||
|
Loading…
Reference in New Issue
Block a user