mirror of
https://github.com/osukey/osukey.git
synced 2025-07-02 00:40:09 +09:00
Remove generics from Playfield (fixes catch)
This commit is contained in:
@ -72,7 +72,7 @@ namespace osu.Desktop.Tests.Visual
|
||||
[Test]
|
||||
public void TestSpeedAdjustmentOrdering()
|
||||
{
|
||||
var hitObjectContainer = new ScrollingPlayfield<TestHitObject>.ScrollingHitObjectContainer(Axes.X);
|
||||
var hitObjectContainer = new ScrollingPlayfield.ScrollingHitObjectContainer(Axes.X);
|
||||
|
||||
var speedAdjustments = new[]
|
||||
{
|
||||
@ -147,7 +147,7 @@ namespace osu.Desktop.Tests.Visual
|
||||
|
||||
protected override BeatmapConverter<TestHitObject> CreateBeatmapConverter() => new TestBeatmapConverter();
|
||||
|
||||
protected override Playfield<TestHitObject> CreatePlayfield() => new TestPlayfield(scrollingAxes);
|
||||
protected override Playfield CreatePlayfield() => new TestPlayfield(scrollingAxes);
|
||||
|
||||
protected override DrawableHitObject<TestHitObject> GetVisualRepresentation(TestHitObject h) => new DrawableTestHitObject(scrollingAxes, h);
|
||||
}
|
||||
@ -190,7 +190,7 @@ namespace osu.Desktop.Tests.Visual
|
||||
}
|
||||
}
|
||||
|
||||
private class TestPlayfield : ScrollingPlayfield<TestHitObject>
|
||||
private class TestPlayfield : ScrollingPlayfield
|
||||
{
|
||||
protected override Container<Drawable> Content => content;
|
||||
private readonly Container<Drawable> content;
|
||||
|
@ -12,7 +12,7 @@ using osu.Game.Rulesets.Objects.Drawables;
|
||||
|
||||
namespace osu.Game.Rulesets.Catch.UI
|
||||
{
|
||||
public class CatchPlayfield : ScrollingPlayfield<CatchBaseHit>
|
||||
public class CatchPlayfield : ScrollingPlayfield
|
||||
{
|
||||
protected override Container<Drawable> Content => content;
|
||||
private readonly Container<Drawable> content;
|
||||
@ -44,7 +44,7 @@ namespace osu.Game.Rulesets.Catch.UI
|
||||
};
|
||||
}
|
||||
|
||||
public override void Add(DrawableHitObject<CatchBaseHit> h)
|
||||
public override void Add(DrawableHitObject h)
|
||||
{
|
||||
base.Add(h);
|
||||
|
||||
|
@ -25,7 +25,7 @@ namespace osu.Game.Rulesets.Catch.UI
|
||||
|
||||
protected override BeatmapConverter<CatchBaseHit> CreateBeatmapConverter() => new CatchBeatmapConverter();
|
||||
|
||||
protected override Playfield<CatchBaseHit> CreatePlayfield() => new CatchPlayfield();
|
||||
protected override Playfield CreatePlayfield() => new CatchPlayfield();
|
||||
|
||||
public override PassThroughInputManager CreateInputManager() => new CatchInputManager(Ruleset.RulesetInfo);
|
||||
|
||||
|
@ -160,7 +160,6 @@ namespace osu.Game.Rulesets.Catch.UI
|
||||
fruit.Origin = Anchor.BottomCentre;
|
||||
fruit.Scale *= 0.7f;
|
||||
fruit.LifetimeEnd = double.MaxValue;
|
||||
fruit.Depth = (float)Time.Current;
|
||||
|
||||
float distance = fruit.DrawSize.X / 2 * fruit.Scale.X;
|
||||
|
||||
|
@ -18,7 +18,7 @@ using osu.Game.Rulesets.Judgements;
|
||||
|
||||
namespace osu.Game.Rulesets.Mania.UI
|
||||
{
|
||||
public class Column : ScrollingPlayfield<ManiaHitObject>, IHasAccentColour
|
||||
public class Column : ScrollingPlayfield, IHasAccentColour
|
||||
{
|
||||
private const float key_icon_size = 10;
|
||||
private const float key_icon_corner_radius = 3;
|
||||
@ -199,7 +199,7 @@ namespace osu.Game.Rulesets.Mania.UI
|
||||
/// Adds a DrawableHitObject to this Playfield.
|
||||
/// </summary>
|
||||
/// <param name="hitObject">The DrawableHitObject to add.</param>
|
||||
public override void Add(DrawableHitObject<ManiaHitObject> hitObject)
|
||||
public override void Add(DrawableHitObject hitObject)
|
||||
{
|
||||
hitObject.AccentColour = AccentColour;
|
||||
HitObjects.Add(hitObject);
|
||||
|
@ -20,7 +20,7 @@ using osu.Game.Rulesets.Judgements;
|
||||
|
||||
namespace osu.Game.Rulesets.Mania.UI
|
||||
{
|
||||
public class ManiaPlayfield : ScrollingPlayfield<ManiaHitObject>
|
||||
public class ManiaPlayfield : ScrollingPlayfield
|
||||
{
|
||||
public const float HIT_TARGET_POSITION = 50;
|
||||
|
||||
@ -224,7 +224,8 @@ namespace osu.Game.Rulesets.Mania.UI
|
||||
}
|
||||
}
|
||||
|
||||
public override void Add(DrawableHitObject<ManiaHitObject> h) => Columns.ElementAt(h.HitObject.Column).Add(h);
|
||||
public override void Add(DrawableHitObject h) => Columns.ElementAt(((ManiaHitObject)h.HitObject).Column).Add(h);
|
||||
|
||||
public void Add(DrawableBarLine barline) => HitObjects.Add(barline);
|
||||
|
||||
protected override void Update()
|
||||
|
@ -74,7 +74,7 @@ namespace osu.Game.Rulesets.Mania.UI
|
||||
BarLines.ForEach(Playfield.Add);
|
||||
}
|
||||
|
||||
protected sealed override Playfield<ManiaHitObject> CreatePlayfield() => new ManiaPlayfield(availableColumns)
|
||||
protected sealed override Playfield CreatePlayfield() => new ManiaPlayfield(availableColumns)
|
||||
{
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.Centre,
|
||||
|
@ -16,7 +16,7 @@ using osu.Game.Rulesets.Osu.UI.Cursor;
|
||||
|
||||
namespace osu.Game.Rulesets.Osu.UI
|
||||
{
|
||||
public class OsuPlayfield : Playfield<OsuHitObject>
|
||||
public class OsuPlayfield : Playfield
|
||||
{
|
||||
private readonly Container approachCircles;
|
||||
private readonly Container judgementLayer;
|
||||
@ -68,10 +68,8 @@ namespace osu.Game.Rulesets.Osu.UI
|
||||
AddInternal(new GameplayCursor());
|
||||
}
|
||||
|
||||
public override void Add(DrawableHitObject<OsuHitObject> h)
|
||||
public override void Add(DrawableHitObject h)
|
||||
{
|
||||
h.Depth = (float)h.HitObject.StartTime;
|
||||
|
||||
var c = h as IDrawableHitObjectWithProxiedApproach;
|
||||
if (c != null)
|
||||
approachCircles.Add(c.ProxiedLayer.CreateProxy());
|
||||
|
@ -30,7 +30,7 @@ namespace osu.Game.Rulesets.Osu.UI
|
||||
|
||||
protected override BeatmapProcessor<OsuHitObject> CreateBeatmapProcessor() => new OsuBeatmapProcessor();
|
||||
|
||||
protected override Playfield<OsuHitObject> CreatePlayfield() => new OsuPlayfield();
|
||||
protected override Playfield CreatePlayfield() => new OsuPlayfield();
|
||||
|
||||
public override PassThroughInputManager CreateInputManager() => new OsuInputManager(Ruleset.RulesetInfo);
|
||||
|
||||
|
@ -19,7 +19,7 @@ using osu.Game.Rulesets.Taiko.Objects.Drawables;
|
||||
|
||||
namespace osu.Game.Rulesets.Taiko.UI
|
||||
{
|
||||
public class TaikoPlayfield : ScrollingPlayfield<TaikoHitObject>
|
||||
public class TaikoPlayfield : ScrollingPlayfield
|
||||
{
|
||||
/// <summary>
|
||||
/// Default height of a <see cref="TaikoPlayfield"/> when inside a <see cref="TaikoRulesetContainer"/>.
|
||||
@ -203,10 +203,8 @@ namespace osu.Game.Rulesets.Taiko.UI
|
||||
background.Colour = colours.Gray0;
|
||||
}
|
||||
|
||||
public override void Add(DrawableHitObject<TaikoHitObject> h)
|
||||
public override void Add(DrawableHitObject h)
|
||||
{
|
||||
h.Depth = (float)h.HitObject.StartTime;
|
||||
|
||||
base.Add(h);
|
||||
|
||||
var barline = h as DrawableBarLine;
|
||||
|
@ -94,7 +94,7 @@ namespace osu.Game.Rulesets.Taiko.UI
|
||||
|
||||
public override PassThroughInputManager CreateInputManager() => new TaikoInputManager(Ruleset.RulesetInfo);
|
||||
|
||||
protected override Playfield<TaikoHitObject> CreatePlayfield() => new TaikoPlayfield
|
||||
protected override Playfield CreatePlayfield() => new TaikoPlayfield
|
||||
{
|
||||
Anchor = Anchor.CentreLeft,
|
||||
Origin = Anchor.CentreLeft
|
||||
|
@ -55,6 +55,8 @@ namespace osu.Game.Rulesets.Objects.Drawables
|
||||
: base(hitObject)
|
||||
{
|
||||
HitObject = hitObject;
|
||||
|
||||
Depth = (float)hitObject.StartTime;
|
||||
}
|
||||
|
||||
private ArmedState state;
|
||||
|
@ -14,8 +14,7 @@ using System.Linq;
|
||||
|
||||
namespace osu.Game.Rulesets.UI
|
||||
{
|
||||
public abstract class Playfield<TObject> : Container
|
||||
where TObject : HitObject
|
||||
public abstract class Playfield : Container
|
||||
{
|
||||
/// <summary>
|
||||
/// The HitObjects contained in this Playfield.
|
||||
@ -69,7 +68,7 @@ namespace osu.Game.Rulesets.UI
|
||||
public override Axes RelativeSizeAxes
|
||||
{
|
||||
get { return Axes.Both; }
|
||||
set { throw new InvalidOperationException($@"{nameof(Playfield<TObject>)}'s {nameof(RelativeSizeAxes)} should never be changed from {Axes.Both}"); }
|
||||
set { throw new InvalidOperationException($@"{nameof(Playfield)}'s {nameof(RelativeSizeAxes)} should never be changed from {Axes.Both}"); }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -81,13 +80,13 @@ namespace osu.Game.Rulesets.UI
|
||||
/// Adds a DrawableHitObject to this Playfield.
|
||||
/// </summary>
|
||||
/// <param name="h">The DrawableHitObject to add.</param>
|
||||
public virtual void Add(DrawableHitObject<TObject> h) => HitObjects.Add(h);
|
||||
public virtual void Add(DrawableHitObject h) => HitObjects.Add(h);
|
||||
|
||||
/// <summary>
|
||||
/// Remove a DrawableHitObject from this Playfield.
|
||||
/// </summary>
|
||||
/// <param name="h">The DrawableHitObject to remove.</param>
|
||||
public virtual void Remove(DrawableHitObject<TObject> h) => HitObjects.Remove(h);
|
||||
public virtual void Remove(DrawableHitObject h) => HitObjects.Remove(h);
|
||||
|
||||
/// <summary>
|
||||
/// Triggered when a new <see cref="Judgement"/> occurs on a <see cref="DrawableHitObject"/>.
|
||||
|
@ -157,7 +157,7 @@ namespace osu.Game.Rulesets.UI
|
||||
/// <summary>
|
||||
/// The playfield.
|
||||
/// </summary>
|
||||
public Playfield<TObject> Playfield { get; private set; }
|
||||
public Playfield Playfield { get; private set; }
|
||||
|
||||
protected override Container<Drawable> Content => content;
|
||||
private Container content;
|
||||
@ -310,7 +310,7 @@ namespace osu.Game.Rulesets.UI
|
||||
/// Creates a Playfield.
|
||||
/// </summary>
|
||||
/// <returns>The Playfield.</returns>
|
||||
protected abstract Playfield<TObject> CreatePlayfield();
|
||||
protected abstract Playfield CreatePlayfield();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -320,7 +320,7 @@ namespace osu.Game.Rulesets.UI
|
||||
/// <typeparam name="TObject">The type of HitObject contained by this RulesetContainer.</typeparam>
|
||||
public abstract class RulesetContainer<TPlayfield, TObject> : RulesetContainer<TObject>
|
||||
where TObject : HitObject
|
||||
where TPlayfield : Playfield<TObject>
|
||||
where TPlayfield : Playfield
|
||||
{
|
||||
/// <summary>
|
||||
/// The playfield.
|
||||
|
@ -20,8 +20,7 @@ namespace osu.Game.Rulesets.UI
|
||||
/// <summary>
|
||||
/// A type of <see cref="Playfield{TObject}"/> specialized towards scrolling <see cref="DrawableHitObject"/>s.
|
||||
/// </summary>
|
||||
public class ScrollingPlayfield<TObject> : Playfield<TObject>
|
||||
where TObject : HitObject
|
||||
public class ScrollingPlayfield : Playfield
|
||||
{
|
||||
/// <summary>
|
||||
/// The default span of time visible by the length of the scrolling axes.
|
||||
@ -75,21 +74,21 @@ namespace osu.Game.Rulesets.UI
|
||||
HitObjects.Reversed.BindTo(Reversed);
|
||||
}
|
||||
|
||||
private List<ScrollingPlayfield<TObject>> nestedPlayfields;
|
||||
private List<ScrollingPlayfield> nestedPlayfields;
|
||||
/// <summary>
|
||||
/// All the <see cref="ScrollingPlayfield{TObject}"/>s nested inside this playfield.
|
||||
/// </summary>
|
||||
public IEnumerable<ScrollingPlayfield<TObject>> NestedPlayfields => nestedPlayfields;
|
||||
public IEnumerable<ScrollingPlayfield> NestedPlayfields => nestedPlayfields;
|
||||
|
||||
/// <summary>
|
||||
/// Adds a <see cref="ScrollingPlayfield{TObject}"/> to this playfield. The nested <see cref="ScrollingPlayfield{TObject}"/>
|
||||
/// will be given all of the same speed adjustments as this playfield.
|
||||
/// </summary>
|
||||
/// <param name="otherPlayfield">The <see cref="ScrollingPlayfield{TObject}"/> to add.</param>
|
||||
protected void AddNested(ScrollingPlayfield<TObject> otherPlayfield)
|
||||
protected void AddNested(ScrollingPlayfield otherPlayfield)
|
||||
{
|
||||
if (nestedPlayfields == null)
|
||||
nestedPlayfields = new List<ScrollingPlayfield<TObject>>();
|
||||
nestedPlayfields = new List<ScrollingPlayfield>();
|
||||
|
||||
nestedPlayfields.Add(otherPlayfield);
|
||||
}
|
||||
@ -117,7 +116,7 @@ namespace osu.Game.Rulesets.UI
|
||||
this.TransformTo(this.PopulateTransform(new TransformVisibleTimeRange(), newTimeRange, duration, easing));
|
||||
}
|
||||
|
||||
private class TransformVisibleTimeRange : Transform<double, ScrollingPlayfield<TObject>>
|
||||
private class TransformVisibleTimeRange : Transform<double, ScrollingPlayfield>
|
||||
{
|
||||
private double valueAt(double time)
|
||||
{
|
||||
@ -129,8 +128,8 @@ namespace osu.Game.Rulesets.UI
|
||||
|
||||
public override string TargetMember => "VisibleTimeRange.Value";
|
||||
|
||||
protected override void Apply(ScrollingPlayfield<TObject> d, double time) => d.VisibleTimeRange.Value = valueAt(time);
|
||||
protected override void ReadIntoStartValue(ScrollingPlayfield<TObject> d) => StartValue = d.VisibleTimeRange.Value;
|
||||
protected override void Apply(ScrollingPlayfield d, double time) => d.VisibleTimeRange.Value = valueAt(time);
|
||||
protected override void ReadIntoStartValue(ScrollingPlayfield d) => StartValue = d.VisibleTimeRange.Value;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -21,7 +21,7 @@ namespace osu.Game.Rulesets.UI
|
||||
/// </summary>
|
||||
public abstract class ScrollingRulesetContainer<TPlayfield, TObject> : RulesetContainer<TPlayfield, TObject>
|
||||
where TObject : HitObject
|
||||
where TPlayfield : ScrollingPlayfield<TObject>
|
||||
where TPlayfield : ScrollingPlayfield
|
||||
{
|
||||
/// <summary>
|
||||
/// Provides the default <see cref="MultiplierControlPoint"/>s that adjust the scrolling rate of <see cref="HitObject"/>s
|
||||
@ -86,7 +86,7 @@ namespace osu.Game.Rulesets.UI
|
||||
DefaultControlPoints.ForEach(c => applySpeedAdjustment(c, Playfield));
|
||||
}
|
||||
|
||||
private void applySpeedAdjustment(MultiplierControlPoint controlPoint, ScrollingPlayfield<TObject> playfield)
|
||||
private void applySpeedAdjustment(MultiplierControlPoint controlPoint, ScrollingPlayfield playfield)
|
||||
{
|
||||
playfield.HitObjects.AddSpeedAdjustment(CreateSpeedAdjustmentContainer(controlPoint));
|
||||
playfield.NestedPlayfields.ForEach(p => applySpeedAdjustment(controlPoint, p));
|
||||
|
Reference in New Issue
Block a user