Remove all generic judgements.

This commit is contained in:
smoogipooo 2017-09-06 18:05:51 +09:00
parent e85d511645
commit 0cc443e618
30 changed files with 137 additions and 208 deletions

View File

@ -72,7 +72,7 @@ namespace osu.Desktop.Tests.Visual
[Test] [Test]
public void TestSpeedAdjustmentOrdering() public void TestSpeedAdjustmentOrdering()
{ {
var hitObjectContainer = new ScrollingPlayfield<TestHitObject, TestJudgement>.ScrollingHitObjectContainer(Axes.X); var hitObjectContainer = new ScrollingPlayfield<TestHitObject>.ScrollingHitObjectContainer(Axes.X);
var speedAdjustments = new[] var speedAdjustments = new[]
{ {
@ -129,7 +129,7 @@ namespace osu.Desktop.Tests.Visual
Assert.IsTrue(hitObjectContainer.SpeedAdjustments[3].Contains(hitObjects[1])); Assert.IsTrue(hitObjectContainer.SpeedAdjustments[3].Contains(hitObjects[1]));
} }
private class TestRulesetContainer : ScrollingRulesetContainer<TestPlayfield, TestHitObject, TestJudgement> private class TestRulesetContainer : ScrollingRulesetContainer<TestPlayfield, TestHitObject>
{ {
private readonly Axes scrollingAxes; private readonly Axes scrollingAxes;
@ -147,12 +147,12 @@ namespace osu.Desktop.Tests.Visual
protected override BeatmapConverter<TestHitObject> CreateBeatmapConverter() => new TestBeatmapConverter(); protected override BeatmapConverter<TestHitObject> CreateBeatmapConverter() => new TestBeatmapConverter();
protected override Playfield<TestHitObject, TestJudgement> CreatePlayfield() => new TestPlayfield(scrollingAxes); protected override Playfield<TestHitObject> CreatePlayfield() => new TestPlayfield(scrollingAxes);
protected override DrawableHitObject<TestHitObject, TestJudgement> GetVisualRepresentation(TestHitObject h) => new DrawableTestHitObject(scrollingAxes, h); protected override DrawableHitObject<TestHitObject> GetVisualRepresentation(TestHitObject h) => new DrawableTestHitObject(scrollingAxes, h);
} }
private class TestScoreProcessor : ScoreProcessor<TestHitObject, TestJudgement> private class TestScoreProcessor : ScoreProcessor<TestHitObject>
{ {
protected override void OnNewJudgement(Judgement judgement) protected override void OnNewJudgement(Judgement judgement)
{ {
@ -169,7 +169,7 @@ namespace osu.Desktop.Tests.Visual
} }
} }
private class DrawableTestHitObject : DrawableScrollingHitObject<TestHitObject, TestJudgement> private class DrawableTestHitObject : DrawableScrollingHitObject<TestHitObject>
{ {
public DrawableTestHitObject(Axes scrollingAxes, TestHitObject hitObject) public DrawableTestHitObject(Axes scrollingAxes, TestHitObject hitObject)
: base(hitObject) : base(hitObject)
@ -185,14 +185,12 @@ namespace osu.Desktop.Tests.Visual
}); });
} }
protected TestJudgement CreateJudgement() => new TestJudgement();
protected override void UpdateState(ArmedState state) protected override void UpdateState(ArmedState state)
{ {
} }
} }
private class TestPlayfield : ScrollingPlayfield<TestHitObject, TestJudgement> private class TestPlayfield : ScrollingPlayfield<TestHitObject>
{ {
protected override Container<Drawable> Content => content; protected override Container<Drawable> Content => content;
private readonly Container<Drawable> content; private readonly Container<Drawable> content;
@ -218,9 +216,5 @@ namespace osu.Desktop.Tests.Visual
private class TestHitObject : HitObject private class TestHitObject : HitObject
{ {
} }
private class TestJudgement : Judgement
{
}
} }
} }

View File

@ -214,15 +214,13 @@ namespace osu.Desktop.Tests.Visual
rulesetContainer.Playfield.Add(new DrawableRimHit(h)); rulesetContainer.Playfield.Add(new DrawableRimHit(h));
} }
private class DrawableTestHit : DrawableHitObject<TaikoHitObject, TaikoJudgement> private class DrawableTestHit : DrawableHitObject<TaikoHitObject>
{ {
public DrawableTestHit(TaikoHitObject hitObject) public DrawableTestHit(TaikoHitObject hitObject)
: base(hitObject) : base(hitObject)
{ {
} }
protected TaikoJudgement CreateJudgement() => new TaikoJudgement();
protected override void UpdateState(ArmedState state) protected override void UpdateState(ArmedState state)
{ {
} }

View File

@ -9,7 +9,6 @@ using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Shapes; using osu.Framework.Graphics.Shapes;
using osu.Framework.MathUtils; using osu.Framework.MathUtils;
using osu.Game.Graphics; using osu.Game.Graphics;
using osu.Game.Rulesets.Catch.Judgements;
using osu.Game.Rulesets.Judgements; using osu.Game.Rulesets.Judgements;
using osu.Game.Rulesets.Objects.Drawables; using osu.Game.Rulesets.Objects.Drawables;
using OpenTK; using OpenTK;
@ -17,7 +16,7 @@ using OpenTK.Graphics;
namespace osu.Game.Rulesets.Catch.Objects.Drawable namespace osu.Game.Rulesets.Catch.Objects.Drawable
{ {
public class DrawableFruit : DrawableScrollingHitObject<CatchBaseHit, CatchJudgement> public class DrawableFruit : DrawableScrollingHitObject<CatchBaseHit>
{ {
private const float pulp_size = 30; private const float pulp_size = 30;

View File

@ -1,7 +1,6 @@
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>. // Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using osu.Game.Rulesets.Catch.Judgements;
using osu.Game.Rulesets.Catch.Objects; using osu.Game.Rulesets.Catch.Objects;
using osu.Game.Rulesets.Judgements; using osu.Game.Rulesets.Judgements;
using osu.Game.Rulesets.Scoring; using osu.Game.Rulesets.Scoring;
@ -9,13 +8,13 @@ using osu.Game.Rulesets.UI;
namespace osu.Game.Rulesets.Catch.Scoring namespace osu.Game.Rulesets.Catch.Scoring
{ {
internal class CatchScoreProcessor : ScoreProcessor<CatchBaseHit, CatchJudgement> internal class CatchScoreProcessor : ScoreProcessor<CatchBaseHit>
{ {
public CatchScoreProcessor() public CatchScoreProcessor()
{ {
} }
public CatchScoreProcessor(RulesetContainer<CatchBaseHit, CatchJudgement> rulesetContainer) public CatchScoreProcessor(RulesetContainer<CatchBaseHit> rulesetContainer)
: base(rulesetContainer) : base(rulesetContainer)
{ {
} }

View File

@ -5,7 +5,6 @@ using osu.Framework.Graphics;
using osu.Game.Rulesets.Catch.Objects; using osu.Game.Rulesets.Catch.Objects;
using osu.Game.Rulesets.UI; using osu.Game.Rulesets.UI;
using OpenTK; using OpenTK;
using osu.Game.Rulesets.Catch.Judgements;
using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Containers;
using osu.Game.Rulesets.Catch.Objects.Drawable; using osu.Game.Rulesets.Catch.Objects.Drawable;
using osu.Game.Rulesets.Judgements; using osu.Game.Rulesets.Judgements;
@ -13,7 +12,7 @@ using osu.Game.Rulesets.Objects.Drawables;
namespace osu.Game.Rulesets.Catch.UI namespace osu.Game.Rulesets.Catch.UI
{ {
public class CatchPlayfield : ScrollingPlayfield<CatchBaseHit, CatchJudgement> public class CatchPlayfield : ScrollingPlayfield<CatchBaseHit>
{ {
protected override Container<Drawable> Content => content; protected override Container<Drawable> Content => content;
private readonly Container<Drawable> content; private readonly Container<Drawable> content;
@ -45,7 +44,7 @@ namespace osu.Game.Rulesets.Catch.UI
}; };
} }
public override void Add(DrawableHitObject<CatchBaseHit, CatchJudgement> h) public override void Add(DrawableHitObject<CatchBaseHit> h)
{ {
base.Add(h); base.Add(h);

View File

@ -5,7 +5,6 @@ using osu.Framework.Input;
using osu.Game.Beatmaps; using osu.Game.Beatmaps;
using osu.Game.Rulesets.Beatmaps; using osu.Game.Rulesets.Beatmaps;
using osu.Game.Rulesets.Catch.Beatmaps; using osu.Game.Rulesets.Catch.Beatmaps;
using osu.Game.Rulesets.Catch.Judgements;
using osu.Game.Rulesets.Catch.Objects; using osu.Game.Rulesets.Catch.Objects;
using osu.Game.Rulesets.Catch.Objects.Drawable; using osu.Game.Rulesets.Catch.Objects.Drawable;
using osu.Game.Rulesets.Catch.Scoring; using osu.Game.Rulesets.Catch.Scoring;
@ -15,7 +14,7 @@ using osu.Game.Rulesets.UI;
namespace osu.Game.Rulesets.Catch.UI namespace osu.Game.Rulesets.Catch.UI
{ {
public class CatchRulesetContainer : ScrollingRulesetContainer<CatchPlayfield, CatchBaseHit, CatchJudgement> public class CatchRulesetContainer : ScrollingRulesetContainer<CatchPlayfield, CatchBaseHit>
{ {
public CatchRulesetContainer(Ruleset ruleset, WorkingBeatmap beatmap, bool isForCurrentRuleset) public CatchRulesetContainer(Ruleset ruleset, WorkingBeatmap beatmap, bool isForCurrentRuleset)
: base(ruleset, beatmap, isForCurrentRuleset) : base(ruleset, beatmap, isForCurrentRuleset)
@ -26,11 +25,11 @@ namespace osu.Game.Rulesets.Catch.UI
protected override BeatmapConverter<CatchBaseHit> CreateBeatmapConverter() => new CatchBeatmapConverter(); protected override BeatmapConverter<CatchBaseHit> CreateBeatmapConverter() => new CatchBeatmapConverter();
protected override Playfield<CatchBaseHit, CatchJudgement> CreatePlayfield() => new CatchPlayfield(); protected override Playfield<CatchBaseHit> CreatePlayfield() => new CatchPlayfield();
public override PassThroughInputManager CreateInputManager() => new CatchInputManager(Ruleset.RulesetInfo); public override PassThroughInputManager CreateInputManager() => new CatchInputManager(Ruleset.RulesetInfo);
protected override DrawableHitObject<CatchBaseHit, CatchJudgement> GetVisualRepresentation(CatchBaseHit h) protected override DrawableHitObject<CatchBaseHit> GetVisualRepresentation(CatchBaseHit h)
{ {
if (h is Fruit) if (h is Fruit)
return new DrawableFruit(h); return new DrawableFruit(h);

View File

@ -2,12 +2,11 @@
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using OpenTK.Graphics; using OpenTK.Graphics;
using osu.Game.Rulesets.Mania.Judgements;
using osu.Game.Rulesets.Objects.Drawables; using osu.Game.Rulesets.Objects.Drawables;
namespace osu.Game.Rulesets.Mania.Objects.Drawables namespace osu.Game.Rulesets.Mania.Objects.Drawables
{ {
public abstract class DrawableManiaHitObject<TObject> : DrawableScrollingHitObject<ManiaHitObject, ManiaJudgement> public abstract class DrawableManiaHitObject<TObject> : DrawableScrollingHitObject<ManiaHitObject>
where TObject : ManiaHitObject where TObject : ManiaHitObject
{ {
/// <summary> /// <summary>

View File

@ -13,7 +13,7 @@ using osu.Game.Rulesets.UI;
namespace osu.Game.Rulesets.Mania.Scoring namespace osu.Game.Rulesets.Mania.Scoring
{ {
internal class ManiaScoreProcessor : ScoreProcessor<ManiaHitObject, ManiaJudgement> internal class ManiaScoreProcessor : ScoreProcessor<ManiaHitObject>
{ {
/// <summary> /// <summary>
/// The maximum score achievable. /// The maximum score achievable.
@ -156,7 +156,7 @@ namespace osu.Game.Rulesets.Mania.Scoring
{ {
} }
public ManiaScoreProcessor(RulesetContainer<ManiaHitObject, ManiaJudgement> rulesetContainer) public ManiaScoreProcessor(RulesetContainer<ManiaHitObject> rulesetContainer)
: base(rulesetContainer) : base(rulesetContainer)
{ {
} }

View File

@ -14,11 +14,10 @@ using System;
using osu.Framework.Input.Bindings; using osu.Framework.Input.Bindings;
using osu.Game.Rulesets.UI; using osu.Game.Rulesets.UI;
using osu.Game.Rulesets.Mania.Objects; using osu.Game.Rulesets.Mania.Objects;
using osu.Game.Rulesets.Mania.Judgements;
namespace osu.Game.Rulesets.Mania.UI namespace osu.Game.Rulesets.Mania.UI
{ {
public class Column : ScrollingPlayfield<ManiaHitObject, ManiaJudgement>, IHasAccentColour public class Column : ScrollingPlayfield<ManiaHitObject>, IHasAccentColour
{ {
private const float key_icon_size = 10; private const float key_icon_size = 10;
private const float key_icon_corner_radius = 3; private const float key_icon_corner_radius = 3;
@ -188,7 +187,7 @@ namespace osu.Game.Rulesets.Mania.UI
/// Adds a DrawableHitObject to this Playfield. /// Adds a DrawableHitObject to this Playfield.
/// </summary> /// </summary>
/// <param name="hitObject">The DrawableHitObject to add.</param> /// <param name="hitObject">The DrawableHitObject to add.</param>
public override void Add(DrawableHitObject<ManiaHitObject, ManiaJudgement> hitObject) public override void Add(DrawableHitObject<ManiaHitObject> hitObject)
{ {
hitObject.AccentColour = AccentColour; hitObject.AccentColour = AccentColour;
HitObjects.Add(hitObject); HitObjects.Add(hitObject);

View File

@ -6,7 +6,6 @@ using osu.Game.Rulesets.Mania.Objects;
using osu.Game.Rulesets.UI; using osu.Game.Rulesets.UI;
using OpenTK; using OpenTK;
using OpenTK.Graphics; using OpenTK.Graphics;
using osu.Game.Rulesets.Mania.Judgements;
using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Containers;
using System; using System;
using osu.Game.Graphics; using osu.Game.Graphics;
@ -21,7 +20,7 @@ using osu.Framework.Graphics.Shapes;
namespace osu.Game.Rulesets.Mania.UI namespace osu.Game.Rulesets.Mania.UI
{ {
public class ManiaPlayfield : ScrollingPlayfield<ManiaHitObject, ManiaJudgement> public class ManiaPlayfield : ScrollingPlayfield<ManiaHitObject>
{ {
public const float HIT_TARGET_POSITION = 50; public const float HIT_TARGET_POSITION = 50;
@ -203,7 +202,7 @@ namespace osu.Game.Rulesets.Mania.UI
} }
} }
public override void Add(DrawableHitObject<ManiaHitObject, ManiaJudgement> h) => Columns.ElementAt(h.HitObject.Column).Add(h); public override void Add(DrawableHitObject<ManiaHitObject> h) => Columns.ElementAt(h.HitObject.Column).Add(h);
public void Add(DrawableBarLine barline) => HitObjects.Add(barline); public void Add(DrawableBarLine barline) => HitObjects.Add(barline);
protected override void Update() protected override void Update()

View File

@ -15,7 +15,6 @@ using osu.Game.Beatmaps;
using osu.Game.Beatmaps.ControlPoints; using osu.Game.Beatmaps.ControlPoints;
using osu.Game.Rulesets.Beatmaps; using osu.Game.Rulesets.Beatmaps;
using osu.Game.Rulesets.Mania.Beatmaps; using osu.Game.Rulesets.Mania.Beatmaps;
using osu.Game.Rulesets.Mania.Judgements;
using osu.Game.Rulesets.Mania.Objects; using osu.Game.Rulesets.Mania.Objects;
using osu.Game.Rulesets.Mania.Objects.Drawables; using osu.Game.Rulesets.Mania.Objects.Drawables;
using osu.Game.Rulesets.Mania.Scoring; using osu.Game.Rulesets.Mania.Scoring;
@ -28,7 +27,7 @@ using osu.Game.Rulesets.UI;
namespace osu.Game.Rulesets.Mania.UI namespace osu.Game.Rulesets.Mania.UI
{ {
public class ManiaRulesetContainer : ScrollingRulesetContainer<ManiaPlayfield, ManiaHitObject, ManiaJudgement> public class ManiaRulesetContainer : ScrollingRulesetContainer<ManiaPlayfield, ManiaHitObject>
{ {
/// <summary> /// <summary>
/// The number of columns which the <see cref="ManiaPlayfield"/> should display, and which /// The number of columns which the <see cref="ManiaPlayfield"/> should display, and which
@ -75,7 +74,7 @@ namespace osu.Game.Rulesets.Mania.UI
BarLines.ForEach(Playfield.Add); BarLines.ForEach(Playfield.Add);
} }
protected sealed override Playfield<ManiaHitObject, ManiaJudgement> CreatePlayfield() => new ManiaPlayfield(availableColumns) protected sealed override Playfield<ManiaHitObject> CreatePlayfield() => new ManiaPlayfield(availableColumns)
{ {
Anchor = Anchor.Centre, Anchor = Anchor.Centre,
Origin = Anchor.Centre, Origin = Anchor.Centre,
@ -105,7 +104,7 @@ namespace osu.Game.Rulesets.Mania.UI
return new ManiaBeatmapConverter(IsForCurrentRuleset, availableColumns); return new ManiaBeatmapConverter(IsForCurrentRuleset, availableColumns);
} }
protected override DrawableHitObject<ManiaHitObject, ManiaJudgement> GetVisualRepresentation(ManiaHitObject h) protected override DrawableHitObject<ManiaHitObject> GetVisualRepresentation(ManiaHitObject h)
{ {
ManiaAction action = Playfield.Columns.ElementAt(h.Column).Action; ManiaAction action = Playfield.Columns.ElementAt(h.Column).Action;

View File

@ -3,13 +3,12 @@
using System.ComponentModel; using System.ComponentModel;
using osu.Game.Rulesets.Objects.Drawables; using osu.Game.Rulesets.Objects.Drawables;
using osu.Game.Rulesets.Osu.Judgements;
using osu.Framework.Graphics; using osu.Framework.Graphics;
using osu.Game.Rulesets.Objects.Types; using osu.Game.Rulesets.Objects.Types;
namespace osu.Game.Rulesets.Osu.Objects.Drawables namespace osu.Game.Rulesets.Osu.Objects.Drawables
{ {
public class DrawableOsuHitObject : DrawableHitObject<OsuHitObject, OsuJudgement> public class DrawableOsuHitObject : DrawableHitObject<OsuHitObject>
{ {
public const float TIME_PREEMPT = 600; public const float TIME_PREEMPT = 600;
public const float TIME_FADEIN = 400; public const float TIME_FADEIN = 400;

View File

@ -9,7 +9,7 @@ using osu.Game.Rulesets.Judgements;
namespace osu.Game.Rulesets.Osu.Objects.Drawables namespace osu.Game.Rulesets.Osu.Objects.Drawables
{ {
public class DrawableOsuJudgement : DrawableJudgement<OsuJudgement> public class DrawableOsuJudgement : DrawableJudgement
{ {
public DrawableOsuJudgement(OsuJudgement judgement) public DrawableOsuJudgement(OsuJudgement judgement)
: base(judgement) : base(judgement)

View File

@ -16,7 +16,7 @@ using osu.Game.Rulesets.UI;
namespace osu.Game.Rulesets.Osu.Scoring namespace osu.Game.Rulesets.Osu.Scoring
{ {
internal class OsuScoreProcessor : ScoreProcessor<OsuHitObject, OsuJudgement> internal class OsuScoreProcessor : ScoreProcessor<OsuHitObject>
{ {
public readonly Bindable<ScoringMode> Mode = new Bindable<ScoringMode>(ScoringMode.Exponential); public readonly Bindable<ScoringMode> Mode = new Bindable<ScoringMode>(ScoringMode.Exponential);
@ -24,7 +24,7 @@ namespace osu.Game.Rulesets.Osu.Scoring
{ {
} }
public OsuScoreProcessor(RulesetContainer<OsuHitObject, OsuJudgement> rulesetContainer) public OsuScoreProcessor(RulesetContainer<OsuHitObject> rulesetContainer)
: base(rulesetContainer) : base(rulesetContainer)
{ {
} }

View File

@ -16,7 +16,7 @@ using osu.Game.Rulesets.Osu.UI.Cursor;
namespace osu.Game.Rulesets.Osu.UI namespace osu.Game.Rulesets.Osu.UI
{ {
public class OsuPlayfield : Playfield<OsuHitObject, OsuJudgement> public class OsuPlayfield : Playfield<OsuHitObject>
{ {
private readonly Container approachCircles; private readonly Container approachCircles;
private readonly Container judgementLayer; private readonly Container judgementLayer;
@ -68,11 +68,11 @@ namespace osu.Game.Rulesets.Osu.UI
AddInternal(new GameplayCursor()); AddInternal(new GameplayCursor());
} }
public override void Add(DrawableHitObject<OsuHitObject, OsuJudgement> h) public override void Add(DrawableHitObject<OsuHitObject> h)
{ {
h.Depth = (float)h.HitObject.StartTime; h.Depth = (float)h.HitObject.StartTime;
IDrawableHitObjectWithProxiedApproach c = h as IDrawableHitObjectWithProxiedApproach; var c = h as IDrawableHitObjectWithProxiedApproach;
if (c != null) if (c != null)
approachCircles.Add(c.ProxiedLayer.CreateProxy()); approachCircles.Add(c.ProxiedLayer.CreateProxy());

View File

@ -7,7 +7,6 @@ using osu.Game.Beatmaps;
using osu.Game.Rulesets.Beatmaps; using osu.Game.Rulesets.Beatmaps;
using osu.Game.Rulesets.Objects.Drawables; using osu.Game.Rulesets.Objects.Drawables;
using osu.Game.Rulesets.Osu.Beatmaps; using osu.Game.Rulesets.Osu.Beatmaps;
using osu.Game.Rulesets.Osu.Judgements;
using osu.Game.Rulesets.Osu.Objects; using osu.Game.Rulesets.Osu.Objects;
using osu.Game.Rulesets.Osu.Objects.Drawables; using osu.Game.Rulesets.Osu.Objects.Drawables;
using osu.Game.Rulesets.Osu.Replays; using osu.Game.Rulesets.Osu.Replays;
@ -18,7 +17,7 @@ using osu.Game.Rulesets.Replays;
namespace osu.Game.Rulesets.Osu.UI namespace osu.Game.Rulesets.Osu.UI
{ {
public class OsuRulesetContainer : RulesetContainer<OsuHitObject, OsuJudgement> public class OsuRulesetContainer : RulesetContainer<OsuHitObject>
{ {
public OsuRulesetContainer(Ruleset ruleset, WorkingBeatmap beatmap, bool isForCurrentRuleset) public OsuRulesetContainer(Ruleset ruleset, WorkingBeatmap beatmap, bool isForCurrentRuleset)
: base(ruleset, beatmap, isForCurrentRuleset) : base(ruleset, beatmap, isForCurrentRuleset)
@ -31,11 +30,11 @@ namespace osu.Game.Rulesets.Osu.UI
protected override BeatmapProcessor<OsuHitObject> CreateBeatmapProcessor() => new OsuBeatmapProcessor(); protected override BeatmapProcessor<OsuHitObject> CreateBeatmapProcessor() => new OsuBeatmapProcessor();
protected override Playfield<OsuHitObject, OsuJudgement> CreatePlayfield() => new OsuPlayfield(); protected override Playfield<OsuHitObject> CreatePlayfield() => new OsuPlayfield();
public override PassThroughInputManager CreateInputManager() => new OsuInputManager(Ruleset.RulesetInfo); public override PassThroughInputManager CreateInputManager() => new OsuInputManager(Ruleset.RulesetInfo);
protected override DrawableHitObject<OsuHitObject, OsuJudgement> GetVisualRepresentation(OsuHitObject h) protected override DrawableHitObject<OsuHitObject> GetVisualRepresentation(OsuHitObject h)
{ {
var circle = h as HitCircle; var circle = h as HitCircle;
if (circle != null) if (circle != null)

View File

@ -5,14 +5,13 @@ using osu.Framework.Graphics;
using osu.Framework.Graphics.Shapes; using osu.Framework.Graphics.Shapes;
using OpenTK; using OpenTK;
using osu.Game.Rulesets.Objects.Drawables; using osu.Game.Rulesets.Objects.Drawables;
using osu.Game.Rulesets.Taiko.Judgements;
namespace osu.Game.Rulesets.Taiko.Objects.Drawables namespace osu.Game.Rulesets.Taiko.Objects.Drawables
{ {
/// <summary> /// <summary>
/// A line that scrolls alongside hit objects in the playfield and visualises control points. /// A line that scrolls alongside hit objects in the playfield and visualises control points.
/// </summary> /// </summary>
public class DrawableBarLine : DrawableScrollingHitObject<TaikoHitObject, TaikoJudgement> public class DrawableBarLine : DrawableScrollingHitObject<TaikoHitObject>
{ {
/// <summary> /// <summary>
/// The width of the line tracker. /// The width of the line tracker.

View File

@ -4,15 +4,13 @@
using osu.Framework.Graphics; using osu.Framework.Graphics;
using osu.Framework.Input.Bindings; using osu.Framework.Input.Bindings;
using osu.Game.Rulesets.Objects.Drawables; using osu.Game.Rulesets.Objects.Drawables;
using osu.Game.Rulesets.Taiko.Judgements;
using osu.Game.Rulesets.Taiko.Objects.Drawables.Pieces; using osu.Game.Rulesets.Taiko.Objects.Drawables.Pieces;
using OpenTK; using OpenTK;
namespace osu.Game.Rulesets.Taiko.Objects.Drawables namespace osu.Game.Rulesets.Taiko.Objects.Drawables
{ {
public abstract class DrawableTaikoHitObject<TaikoHitType> public abstract class DrawableTaikoHitObject<TaikoHitType> : DrawableScrollingHitObject<TaikoHitObject>, IKeyBindingHandler<TaikoAction>
: DrawableScrollingHitObject<TaikoHitObject, TaikoJudgement>, IKeyBindingHandler<TaikoAction> where TaikoHitType : TaikoHitObject
where TaikoHitType : TaikoHitObject
{ {
public override Vector2 OriginPosition => new Vector2(DrawHeight / 2); public override Vector2 OriginPosition => new Vector2(DrawHeight / 2);

View File

@ -13,7 +13,7 @@ using OpenTK;
namespace osu.Game.Rulesets.Taiko.Scoring namespace osu.Game.Rulesets.Taiko.Scoring
{ {
internal class TaikoScoreProcessor : ScoreProcessor<TaikoHitObject, TaikoJudgement> internal class TaikoScoreProcessor : ScoreProcessor<TaikoHitObject>
{ {
/// <summary> /// <summary>
/// The maximum score achievable. /// The maximum score achievable.
@ -114,7 +114,7 @@ namespace osu.Game.Rulesets.Taiko.Scoring
{ {
} }
public TaikoScoreProcessor(RulesetContainer<TaikoHitObject, TaikoJudgement> rulesetContainer) public TaikoScoreProcessor(RulesetContainer<TaikoHitObject> rulesetContainer)
: base(rulesetContainer) : base(rulesetContainer)
{ {
} }

View File

@ -1,7 +1,6 @@
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>. // Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using osu.Game.Rulesets.Taiko.Judgements;
using osu.Game.Rulesets.Objects.Drawables; using osu.Game.Rulesets.Objects.Drawables;
using osu.Framework.Allocation; using osu.Framework.Allocation;
using osu.Game.Graphics; using osu.Game.Graphics;
@ -13,7 +12,7 @@ namespace osu.Game.Rulesets.Taiko.UI
/// <summary> /// <summary>
/// Text that is shown as judgement when a hit object is hit or missed. /// Text that is shown as judgement when a hit object is hit or missed.
/// </summary> /// </summary>
public class DrawableTaikoJudgement : DrawableJudgement<TaikoJudgement> public class DrawableTaikoJudgement : DrawableJudgement
{ {
public readonly DrawableHitObject JudgedObject; public readonly DrawableHitObject JudgedObject;

View File

@ -19,7 +19,7 @@ using osu.Game.Rulesets.Taiko.Objects.Drawables;
namespace osu.Game.Rulesets.Taiko.UI namespace osu.Game.Rulesets.Taiko.UI
{ {
public class TaikoPlayfield : ScrollingPlayfield<TaikoHitObject, TaikoJudgement> public class TaikoPlayfield : ScrollingPlayfield<TaikoHitObject>
{ {
/// <summary> /// <summary>
/// Default height of a <see cref="TaikoPlayfield"/> when inside a <see cref="TaikoRulesetContainer"/>. /// Default height of a <see cref="TaikoPlayfield"/> when inside a <see cref="TaikoRulesetContainer"/>.
@ -203,7 +203,7 @@ namespace osu.Game.Rulesets.Taiko.UI
background.Colour = colours.Gray0; background.Colour = colours.Gray0;
} }
public override void Add(DrawableHitObject<TaikoHitObject, TaikoJudgement> h) public override void Add(DrawableHitObject<TaikoHitObject> h)
{ {
h.Depth = (float)h.HitObject.StartTime; h.Depth = (float)h.HitObject.StartTime;

View File

@ -9,7 +9,6 @@ using osu.Game.Rulesets.Objects.Types;
using osu.Game.Rulesets.Replays; using osu.Game.Rulesets.Replays;
using osu.Game.Rulesets.Scoring; using osu.Game.Rulesets.Scoring;
using osu.Game.Rulesets.Taiko.Beatmaps; using osu.Game.Rulesets.Taiko.Beatmaps;
using osu.Game.Rulesets.Taiko.Judgements;
using osu.Game.Rulesets.Taiko.Objects; using osu.Game.Rulesets.Taiko.Objects;
using osu.Game.Rulesets.Taiko.Objects.Drawables; using osu.Game.Rulesets.Taiko.Objects.Drawables;
using osu.Game.Rulesets.Taiko.Scoring; using osu.Game.Rulesets.Taiko.Scoring;
@ -22,7 +21,7 @@ using osu.Framework.Input;
namespace osu.Game.Rulesets.Taiko.UI namespace osu.Game.Rulesets.Taiko.UI
{ {
public class TaikoRulesetContainer : ScrollingRulesetContainer<TaikoPlayfield, TaikoHitObject, TaikoJudgement> public class TaikoRulesetContainer : ScrollingRulesetContainer<TaikoPlayfield, TaikoHitObject>
{ {
public TaikoRulesetContainer(Ruleset ruleset, WorkingBeatmap beatmap, bool isForCurrentRuleset) public TaikoRulesetContainer(Ruleset ruleset, WorkingBeatmap beatmap, bool isForCurrentRuleset)
: base(ruleset, beatmap, isForCurrentRuleset) : base(ruleset, beatmap, isForCurrentRuleset)
@ -95,13 +94,13 @@ namespace osu.Game.Rulesets.Taiko.UI
public override PassThroughInputManager CreateInputManager() => new TaikoInputManager(Ruleset.RulesetInfo); public override PassThroughInputManager CreateInputManager() => new TaikoInputManager(Ruleset.RulesetInfo);
protected override Playfield<TaikoHitObject, TaikoJudgement> CreatePlayfield() => new TaikoPlayfield protected override Playfield<TaikoHitObject> CreatePlayfield() => new TaikoPlayfield
{ {
Anchor = Anchor.CentreLeft, Anchor = Anchor.CentreLeft,
Origin = Anchor.CentreLeft Origin = Anchor.CentreLeft
}; };
protected override DrawableHitObject<TaikoHitObject, TaikoJudgement> GetVisualRepresentation(TaikoHitObject h) protected override DrawableHitObject<TaikoHitObject> GetVisualRepresentation(TaikoHitObject h)
{ {
var centreHit = h as CentreHit; var centreHit = h as CentreHit;
if (centreHit != null) if (centreHit != null)

View File

@ -16,9 +16,7 @@ namespace osu.Game.Rulesets.Judgements
/// <summary> /// <summary>
/// A drawable object which visualises the hit result of a <see cref="Judgements.Judgement"/>. /// A drawable object which visualises the hit result of a <see cref="Judgements.Judgement"/>.
/// </summary> /// </summary>
/// <typeparam name="TJudgement">The type of judgement to visualise.</typeparam> public class DrawableJudgement : Container
public class DrawableJudgement<TJudgement> : Container
where TJudgement : Judgement
{ {
protected readonly Judgement Judgement; protected readonly Judgement Judgement;

View File

@ -32,24 +32,12 @@ namespace osu.Game.Rulesets.Objects.Drawables
public abstract class DrawableHitObject<TObject> : DrawableHitObject public abstract class DrawableHitObject<TObject> : DrawableHitObject
where TObject : HitObject where TObject : HitObject
{
public new readonly TObject HitObject;
protected DrawableHitObject(TObject hitObject)
: base(hitObject)
{
HitObject = hitObject;
}
}
public abstract class DrawableHitObject<TObject, TJudgement> : DrawableHitObject<TObject>
where TObject : HitObject
where TJudgement : Judgement
{ {
public event Action<DrawableHitObject, Judgement> OnJudgement; public event Action<DrawableHitObject, Judgement> OnJudgement;
public override bool HandleInput => Interactive; public new readonly TObject HitObject;
public override bool HandleInput => Interactive;
public bool Interactive = true; public bool Interactive = true;
/// <summary> /// <summary>
@ -65,6 +53,7 @@ namespace osu.Game.Rulesets.Objects.Drawables
protected DrawableHitObject(TObject hitObject) protected DrawableHitObject(TObject hitObject)
: base(hitObject) : base(hitObject)
{ {
HitObject = hitObject;
} }
private ArmedState state; private ArmedState state;
@ -202,13 +191,13 @@ namespace osu.Game.Rulesets.Objects.Drawables
} }
} }
private List<DrawableHitObject<TObject, TJudgement>> nestedHitObjects; private List<DrawableHitObject<TObject>> nestedHitObjects;
protected IEnumerable<DrawableHitObject<TObject, TJudgement>> NestedHitObjects => nestedHitObjects; protected IEnumerable<DrawableHitObject<TObject>> NestedHitObjects => nestedHitObjects;
protected virtual void AddNested(DrawableHitObject<TObject, TJudgement> h) protected virtual void AddNested(DrawableHitObject<TObject> h)
{ {
if (nestedHitObjects == null) if (nestedHitObjects == null)
nestedHitObjects = new List<DrawableHitObject<TObject, TJudgement>>(); nestedHitObjects = new List<DrawableHitObject<TObject>>();
h.OnJudgement += (d, j) => OnJudgement?.Invoke(d, j); h.OnJudgement += (d, j) => OnJudgement?.Invoke(d, j);
nestedHitObjects.Add(h); nestedHitObjects.Add(h);

View File

@ -3,19 +3,17 @@
using osu.Framework.Configuration; using osu.Framework.Configuration;
using osu.Framework.Graphics; using osu.Framework.Graphics;
using osu.Game.Rulesets.Judgements;
using osu.Game.Rulesets.Objects.Types; using osu.Game.Rulesets.Objects.Types;
namespace osu.Game.Rulesets.Objects.Drawables namespace osu.Game.Rulesets.Objects.Drawables
{ {
/// <summary> /// <summary>
/// A basic class that overrides <see cref="DrawableHitObject{TObject, TJudgement}"/> and implements <see cref="IScrollingHitObject"/>. /// A basic class that overrides <see cref="DrawableHitObject{TObject}"/> and implements <see cref="IScrollingHitObject"/>.
/// This object does not need to have its <see cref="Drawable.RelativePositionAxes"/> set to be able to scroll, as this will /// This object does not need to have its <see cref="Drawable.RelativePositionAxes"/> set to be able to scroll, as this will
/// will be set by the scrolling container that contains it. /// will be set by the scrolling container that contains it.
/// </summary> /// </summary>
public abstract class DrawableScrollingHitObject<TObject, TJudgement> : DrawableHitObject<TObject, TJudgement>, IScrollingHitObject public abstract class DrawableScrollingHitObject<TObject> : DrawableHitObject<TObject>, IScrollingHitObject
where TObject : HitObject where TObject : HitObject
where TJudgement : Judgement
{ {
public BindableDouble LifetimeOffset { get; } = new BindableDouble(); public BindableDouble LifetimeOffset { get; } = new BindableDouble();
@ -57,7 +55,7 @@ namespace osu.Game.Rulesets.Objects.Drawables
set { lifetimeEnd = value; } set { lifetimeEnd = value; }
} }
protected override void AddNested(DrawableHitObject<TObject, TJudgement> h) protected override void AddNested(DrawableHitObject<TObject> h)
{ {
var scrollingHitObject = h as IScrollingHitObject; var scrollingHitObject = h as IScrollingHitObject;
scrollingHitObject?.LifetimeOffset.BindTo(LifetimeOffset); scrollingHitObject?.LifetimeOffset.BindTo(LifetimeOffset);

View File

@ -135,9 +135,8 @@ namespace osu.Game.Rulesets.Scoring
} }
} }
public abstract class ScoreProcessor<TObject, TJudgement> : ScoreProcessor public abstract class ScoreProcessor<TObject> : ScoreProcessor
where TObject : HitObject where TObject : HitObject
where TJudgement : Judgement
{ {
/// <summary> /// <summary>
/// All judgements held by this ScoreProcessor. /// All judgements held by this ScoreProcessor.
@ -150,7 +149,7 @@ namespace osu.Game.Rulesets.Scoring
{ {
} }
protected ScoreProcessor(RulesetContainer<TObject, TJudgement> rulesetContainer) protected ScoreProcessor(RulesetContainer<TObject> rulesetContainer)
{ {
Judgements.Capacity = rulesetContainer.Beatmap.HitObjects.Count; Judgements.Capacity = rulesetContainer.Beatmap.HitObjects.Count;

View File

@ -14,9 +14,8 @@ using System.Linq;
namespace osu.Game.Rulesets.UI namespace osu.Game.Rulesets.UI
{ {
public abstract class Playfield<TObject, TJudgement> : Container public abstract class Playfield<TObject> : Container
where TObject : HitObject where TObject : HitObject
where TJudgement : Judgement
{ {
/// <summary> /// <summary>
/// The HitObjects contained in this Playfield. /// The HitObjects contained in this Playfield.
@ -70,7 +69,7 @@ namespace osu.Game.Rulesets.UI
public override Axes RelativeSizeAxes public override Axes RelativeSizeAxes
{ {
get { return Axes.Both; } get { return Axes.Both; }
set { throw new InvalidOperationException($@"{nameof(Playfield<TObject, TJudgement>)}'s {nameof(RelativeSizeAxes)} should never be changed from {Axes.Both}"); } set { throw new InvalidOperationException($@"{nameof(Playfield<TObject>)}'s {nameof(RelativeSizeAxes)} should never be changed from {Axes.Both}"); }
} }
/// <summary> /// <summary>
@ -82,18 +81,19 @@ namespace osu.Game.Rulesets.UI
/// Adds a DrawableHitObject to this Playfield. /// Adds a DrawableHitObject to this Playfield.
/// </summary> /// </summary>
/// <param name="h">The DrawableHitObject to add.</param> /// <param name="h">The DrawableHitObject to add.</param>
public virtual void Add(DrawableHitObject<TObject, TJudgement> h) => HitObjects.Add(h); public virtual void Add(DrawableHitObject<TObject> h) => HitObjects.Add(h);
/// <summary> /// <summary>
/// Remove a DrawableHitObject from this Playfield. /// Remove a DrawableHitObject from this Playfield.
/// </summary> /// </summary>
/// <param name="h">The DrawableHitObject to remove.</param> /// <param name="h">The DrawableHitObject to remove.</param>
public virtual void Remove(DrawableHitObject<TObject, TJudgement> h) => HitObjects.Remove(h); public virtual void Remove(DrawableHitObject<TObject> h) => HitObjects.Remove(h);
/// <summary> /// <summary>
/// Triggered when an object's Judgement is updated. /// Triggered when a new <see cref="Judgement"/> occurs on a <see cref="DrawableHitObject"/>.
/// </summary> /// </summary>
/// <param name="judgedObject">The object that Judgement has been updated for.</param> /// <param name="judgedObject">The object that <paramref name="judgement"/> occured for.</param>
/// <param name="judgement">The <see cref="Judgement"/> that occurred.</param>
public virtual void OnJudgement(DrawableHitObject judgedObject, Judgement judgement) { } public virtual void OnJudgement(DrawableHitObject judgedObject, Judgement judgement) { }
public class HitObjectContainer : CompositeDrawable public class HitObjectContainer : CompositeDrawable

View File

@ -24,7 +24,7 @@ namespace osu.Game.Rulesets.UI
/// <summary> /// <summary>
/// Base RulesetContainer. Doesn't hold objects. /// Base RulesetContainer. Doesn't hold objects.
/// <para> /// <para>
/// Should not be derived - derive <see cref="RulesetContainer{TObject,TJudgement}"/> instead. /// Should not be derived - derive <see cref="RulesetContainer{TObject}"/> instead.
/// </para> /// </para>
/// </summary> /// </summary>
public abstract class RulesetContainer : Container public abstract class RulesetContainer : Container
@ -35,7 +35,7 @@ namespace osu.Game.Rulesets.UI
public event Action OnAllJudged; public event Action OnAllJudged;
/// <summary> /// <summary>
/// Whether to apply adjustments to the child <see cref="Playfield{TObject,TJudgement}"/> based on our own size. /// Whether to apply adjustments to the child <see cref="Playfield{TObject}"/> based on our own size.
/// </summary> /// </summary>
public bool AspectAdjust = true; public bool AspectAdjust = true;
@ -119,13 +119,15 @@ namespace osu.Game.Rulesets.UI
/// RulesetContainer that applies conversion to Beatmaps. Does not contain a Playfield /// RulesetContainer that applies conversion to Beatmaps. Does not contain a Playfield
/// and does not load drawable hit objects. /// and does not load drawable hit objects.
/// <para> /// <para>
/// Should not be derived - derive <see cref="RulesetContainer{TObject,TJudgement}"/> instead. /// Should not be derived - derive <see cref="RulesetContainer{TObject}"/> instead.
/// </para> /// </para>
/// </summary> /// </summary>
/// <typeparam name="TObject">The type of HitObject contained by this RulesetContainer.</typeparam> /// <typeparam name="TObject">The type of HitObject contained by this RulesetContainer.</typeparam>
public abstract class RulesetContainer<TObject> : RulesetContainer public abstract class RulesetContainer<TObject> : RulesetContainer
where TObject : HitObject where TObject : HitObject
{ {
public event Action<Judgement> OnJudgement;
/// <summary> /// <summary>
/// The Beatmap /// The Beatmap
/// </summary> /// </summary>
@ -151,6 +153,20 @@ namespace osu.Game.Rulesets.UI
/// </summary> /// </summary>
protected readonly bool IsForCurrentRuleset; protected readonly bool IsForCurrentRuleset;
public sealed override bool ProvidingUserCursor => !HasReplayLoaded && Playfield.ProvidingUserCursor;
protected override bool AllObjectsJudged => drawableObjects.All(h => h.AllJudged);
/// <summary>
/// The playfield.
/// </summary>
public Playfield<TObject> Playfield { get; private set; }
protected override Container<Drawable> Content => content;
private Container content;
private readonly List<DrawableHitObject<TObject>> drawableObjects = new List<DrawableHitObject<TObject>>();
/// <summary> /// <summary>
/// Whether to assume the beatmap passed into this <see cref="RulesetContainer{TObject}"/> is for the current ruleset. /// Whether to assume the beatmap passed into this <see cref="RulesetContainer{TObject}"/> is for the current ruleset.
/// Creates a hit renderer for a beatmap. /// Creates a hit renderer for a beatmap.
@ -158,7 +174,7 @@ namespace osu.Game.Rulesets.UI
/// <param name="ruleset">The ruleset being repesented.</param> /// <param name="ruleset">The ruleset being repesented.</param>
/// <param name="workingBeatmap">The beatmap to create the hit renderer for.</param> /// <param name="workingBeatmap">The beatmap to create the hit renderer for.</param>
/// <param name="isForCurrentRuleset">Whether to assume the beatmap is for the current ruleset.</param> /// <param name="isForCurrentRuleset">Whether to assume the beatmap is for the current ruleset.</param>
internal RulesetContainer(Ruleset ruleset, WorkingBeatmap workingBeatmap, bool isForCurrentRuleset) protected RulesetContainer(Ruleset ruleset, WorkingBeatmap workingBeatmap, bool isForCurrentRuleset)
: base(ruleset) : base(ruleset)
{ {
Debug.Assert(workingBeatmap != null, "RulesetContainer initialized with a null beatmap."); Debug.Assert(workingBeatmap != null, "RulesetContainer initialized with a null beatmap.");
@ -194,74 +210,6 @@ namespace osu.Game.Rulesets.UI
applyMods(Mods); applyMods(Mods);
} }
/// <summary>
/// Applies the active mods to this RulesetContainer.
/// </summary>
/// <param name="mods"></param>
private void applyMods(IEnumerable<Mod> mods)
{
if (mods == null)
return;
foreach (var mod in mods.OfType<IApplicableMod<TObject>>())
mod.ApplyToRulesetContainer(this);
}
/// <summary>
/// Creates a processor to perform post-processing operations
/// on HitObjects in converted Beatmaps.
/// </summary>
/// <returns>The Beatmap processor.</returns>
protected virtual BeatmapProcessor<TObject> CreateBeatmapProcessor() => new BeatmapProcessor<TObject>();
/// <summary>
/// Creates a converter to convert Beatmap to a specific mode.
/// </summary>
/// <returns>The Beatmap converter.</returns>
protected abstract BeatmapConverter<TObject> CreateBeatmapConverter();
}
/// <summary>
/// A derivable RulesetContainer that manages the Playfield and HitObjects.
/// </summary>
/// <typeparam name="TObject">The type of HitObject contained by this RulesetContainer.</typeparam>
/// <typeparam name="TJudgement">The type of Judgement of DrawableHitObjects contained by this RulesetContainer.</typeparam>
public abstract class RulesetContainer<TObject, TJudgement> : RulesetContainer<TObject>
where TObject : HitObject
where TJudgement : Judgement
{
public event Action<Judgement> OnJudgement;
public sealed override bool ProvidingUserCursor => !HasReplayLoaded && Playfield.ProvidingUserCursor;
/// <summary>
/// All the converted hit objects contained by this hit renderer.
/// </summary>
public new IEnumerable<TObject> Objects => Beatmap.HitObjects;
protected override bool AllObjectsJudged => drawableObjects.All(h => h.AllJudged);
/// <summary>
/// The playfield.
/// </summary>
public Playfield<TObject, TJudgement> Playfield { get; private set; }
protected override Container<Drawable> Content => content;
private Container content;
private readonly List<DrawableHitObject<TObject, TJudgement>> drawableObjects = new List<DrawableHitObject<TObject, TJudgement>>();
/// <summary>
/// Creates a hit renderer for a beatmap.
/// </summary>
/// <param name="ruleset">The ruleset being repesented.</param>
/// <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 RulesetContainer(Ruleset ruleset, WorkingBeatmap beatmap, bool isForCurrentRuleset)
: base(ruleset, beatmap, isForCurrentRuleset)
{
}
[BackgroundDependencyLoader] [BackgroundDependencyLoader]
private void load() private void load()
{ {
@ -276,6 +224,19 @@ namespace osu.Game.Rulesets.UI
loadObjects(); loadObjects();
} }
/// <summary>
/// Applies the active mods to this RulesetContainer.
/// </summary>
/// <param name="mods"></param>
private void applyMods(IEnumerable<Mod> mods)
{
if (mods == null)
return;
foreach (var mod in mods.OfType<IApplicableMod<TObject>>())
mod.ApplyToRulesetContainer(this);
}
public override void SetReplay(Replay replay) public override void SetReplay(Replay replay)
{ {
base.SetReplay(replay); base.SetReplay(replay);
@ -320,23 +281,36 @@ namespace osu.Game.Rulesets.UI
} }
/// <summary> /// <summary>
/// In some cases we want to apply changes to the relative size of our contained <see cref="Playfield{TObject, TJudgement}"/> based on custom conditions. /// Creates a processor to perform post-processing operations
/// on HitObjects in converted Beatmaps.
/// </summary>
/// <returns>The Beatmap processor.</returns>
protected virtual BeatmapProcessor<TObject> CreateBeatmapProcessor() => new BeatmapProcessor<TObject>();
/// <summary>
/// In some cases we want to apply changes to the relative size of our contained <see cref="Playfield{TObject}"/> based on custom conditions.
/// </summary> /// </summary>
/// <returns></returns> /// <returns></returns>
protected virtual Vector2 GetPlayfieldAspectAdjust() => new Vector2(0.75f); //a sane default protected virtual Vector2 GetPlayfieldAspectAdjust() => new Vector2(0.75f); //a sane default
/// <summary>
/// Creates a converter to convert Beatmap to a specific mode.
/// </summary>
/// <returns>The Beatmap converter.</returns>
protected abstract BeatmapConverter<TObject> CreateBeatmapConverter();
/// <summary> /// <summary>
/// Creates a DrawableHitObject from a HitObject. /// Creates a DrawableHitObject from a HitObject.
/// </summary> /// </summary>
/// <param name="h">The HitObject to make drawable.</param> /// <param name="h">The HitObject to make drawable.</param>
/// <returns>The DrawableHitObject.</returns> /// <returns>The DrawableHitObject.</returns>
protected abstract DrawableHitObject<TObject, TJudgement> GetVisualRepresentation(TObject h); protected abstract DrawableHitObject<TObject> GetVisualRepresentation(TObject h);
/// <summary> /// <summary>
/// Creates a Playfield. /// Creates a Playfield.
/// </summary> /// </summary>
/// <returns>The Playfield.</returns> /// <returns>The Playfield.</returns>
protected abstract Playfield<TObject, TJudgement> CreatePlayfield(); protected abstract Playfield<TObject> CreatePlayfield();
} }
/// <summary> /// <summary>
@ -344,11 +318,9 @@ namespace osu.Game.Rulesets.UI
/// </summary> /// </summary>
/// <typeparam name="TPlayfield">The type of Playfield contained by this RulesetContainer.</typeparam> /// <typeparam name="TPlayfield">The type of Playfield contained by this RulesetContainer.</typeparam>
/// <typeparam name="TObject">The type of HitObject contained by this RulesetContainer.</typeparam> /// <typeparam name="TObject">The type of HitObject contained by this RulesetContainer.</typeparam>
/// <typeparam name="TJudgement">The type of Judgement of DrawableHitObjects contained by this RulesetContainer.</typeparam> public abstract class RulesetContainer<TPlayfield, TObject> : RulesetContainer<TObject>
public abstract class RulesetContainer<TPlayfield, TObject, TJudgement> : RulesetContainer<TObject, TJudgement>
where TObject : HitObject where TObject : HitObject
where TJudgement : Judgement where TPlayfield : Playfield<TObject>
where TPlayfield : Playfield<TObject, TJudgement>
{ {
/// <summary> /// <summary>
/// The playfield. /// The playfield.

View File

@ -11,7 +11,6 @@ using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Transforms; using osu.Framework.Graphics.Transforms;
using osu.Framework.Input; using osu.Framework.Input;
using osu.Framework.MathUtils; using osu.Framework.MathUtils;
using osu.Game.Rulesets.Judgements;
using osu.Game.Rulesets.Objects; using osu.Game.Rulesets.Objects;
using osu.Game.Rulesets.Objects.Drawables; using osu.Game.Rulesets.Objects.Drawables;
using osu.Game.Rulesets.Timing; using osu.Game.Rulesets.Timing;
@ -19,11 +18,10 @@ using osu.Game.Rulesets.Timing;
namespace osu.Game.Rulesets.UI namespace osu.Game.Rulesets.UI
{ {
/// <summary> /// <summary>
/// A type of <see cref="Playfield{TObject, TJudgement}"/> specialized towards scrolling <see cref="DrawableHitObject"/>s. /// A type of <see cref="Playfield{TObject}"/> specialized towards scrolling <see cref="DrawableHitObject"/>s.
/// </summary> /// </summary>
public class ScrollingPlayfield<TObject, TJudgement> : Playfield<TObject, TJudgement> public class ScrollingPlayfield<TObject> : Playfield<TObject>
where TObject : HitObject where TObject : HitObject
where TJudgement : Judgement
{ {
/// <summary> /// <summary>
/// The default span of time visible by the length of the scrolling axes. /// The default span of time visible by the length of the scrolling axes.
@ -65,7 +63,7 @@ namespace osu.Game.Rulesets.UI
public new readonly ScrollingHitObjectContainer HitObjects; public new readonly ScrollingHitObjectContainer HitObjects;
/// <summary> /// <summary>
/// Creates a new <see cref="ScrollingPlayfield{TObject, TJudgement}"/>. /// Creates a new <see cref="ScrollingPlayfield{TObject}"/>.
/// </summary> /// </summary>
/// <param name="scrollingAxes">The axes on which <see cref="DrawableHitObject"/>s in this container should scroll.</param> /// <param name="scrollingAxes">The axes on which <see cref="DrawableHitObject"/>s in this container should scroll.</param>
/// <param name="customWidth">Whether we want our internal coordinate system to be scaled to a specified width</param> /// <param name="customWidth">Whether we want our internal coordinate system to be scaled to a specified width</param>
@ -77,21 +75,21 @@ namespace osu.Game.Rulesets.UI
HitObjects.Reversed.BindTo(Reversed); HitObjects.Reversed.BindTo(Reversed);
} }
private List<ScrollingPlayfield<TObject, TJudgement>> nestedPlayfields; private List<ScrollingPlayfield<TObject>> nestedPlayfields;
/// <summary> /// <summary>
/// All the <see cref="ScrollingPlayfield{TObject, TJudgement}"/>s nested inside this playfield. /// All the <see cref="ScrollingPlayfield{TObject}"/>s nested inside this playfield.
/// </summary> /// </summary>
public IEnumerable<ScrollingPlayfield<TObject, TJudgement>> NestedPlayfields => nestedPlayfields; public IEnumerable<ScrollingPlayfield<TObject>> NestedPlayfields => nestedPlayfields;
/// <summary> /// <summary>
/// Adds a <see cref="ScrollingPlayfield{TObject, TJudgement}"/> to this playfield. The nested <see cref="ScrollingPlayfield{TObject, TJudgement}"/> /// 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. /// will be given all of the same speed adjustments as this playfield.
/// </summary> /// </summary>
/// <param name="otherPlayfield">The <see cref="ScrollingPlayfield{TObject, TJudgement}"/> to add.</param> /// <param name="otherPlayfield">The <see cref="ScrollingPlayfield{TObject}"/> to add.</param>
protected void AddNested(ScrollingPlayfield<TObject, TJudgement> otherPlayfield) protected void AddNested(ScrollingPlayfield<TObject> otherPlayfield)
{ {
if (nestedPlayfields == null) if (nestedPlayfields == null)
nestedPlayfields = new List<ScrollingPlayfield<TObject, TJudgement>>(); nestedPlayfields = new List<ScrollingPlayfield<TObject>>();
nestedPlayfields.Add(otherPlayfield); nestedPlayfields.Add(otherPlayfield);
} }
@ -119,7 +117,7 @@ namespace osu.Game.Rulesets.UI
this.TransformTo(this.PopulateTransform(new TransformVisibleTimeRange(), newTimeRange, duration, easing)); this.TransformTo(this.PopulateTransform(new TransformVisibleTimeRange(), newTimeRange, duration, easing));
} }
private class TransformVisibleTimeRange : Transform<double, ScrollingPlayfield<TObject, TJudgement>> private class TransformVisibleTimeRange : Transform<double, ScrollingPlayfield<TObject>>
{ {
private double valueAt(double time) private double valueAt(double time)
{ {
@ -131,8 +129,8 @@ namespace osu.Game.Rulesets.UI
public override string TargetMember => "VisibleTimeRange.Value"; public override string TargetMember => "VisibleTimeRange.Value";
protected override void Apply(ScrollingPlayfield<TObject, TJudgement> d, double time) => d.VisibleTimeRange.Value = valueAt(time); protected override void Apply(ScrollingPlayfield<TObject> d, double time) => d.VisibleTimeRange.Value = valueAt(time);
protected override void ReadIntoStartValue(ScrollingPlayfield<TObject, TJudgement> d) => StartValue = d.VisibleTimeRange.Value; protected override void ReadIntoStartValue(ScrollingPlayfield<TObject> d) => StartValue = d.VisibleTimeRange.Value;
} }
/// <summary> /// <summary>

View File

@ -9,7 +9,6 @@ using osu.Framework.Lists;
using osu.Game.Beatmaps; using osu.Game.Beatmaps;
using osu.Game.Beatmaps.ControlPoints; using osu.Game.Beatmaps.ControlPoints;
using osu.Game.IO.Serialization; using osu.Game.IO.Serialization;
using osu.Game.Rulesets.Judgements;
using osu.Game.Rulesets.Objects; using osu.Game.Rulesets.Objects;
using osu.Game.Rulesets.Objects.Types; using osu.Game.Rulesets.Objects.Types;
using osu.Game.Rulesets.Timing; using osu.Game.Rulesets.Timing;
@ -17,17 +16,16 @@ using osu.Game.Rulesets.Timing;
namespace osu.Game.Rulesets.UI namespace osu.Game.Rulesets.UI
{ {
/// <summary> /// <summary>
/// A type of <see cref="RulesetContainer{TPlayfield,TObject,TJudgement}"/> that supports a <see cref="ScrollingPlayfield{TObject, TJudgement}"/>. /// A type of <see cref="RulesetContainer{TPlayfield,TObject}"/> that supports a <see cref="ScrollingPlayfield{TObject}"/>.
/// <see cref="HitObject"/>s inside this <see cref="RulesetContainer{TPlayfield,TObject,TJudgement}"/> will scroll within the playfield. /// <see cref="HitObject"/>s inside this <see cref="RulesetContainer{TPlayfield,TObject}"/> will scroll within the playfield.
/// </summary> /// </summary>
public abstract class ScrollingRulesetContainer<TPlayfield, TObject, TJudgement> : RulesetContainer<TPlayfield, TObject, TJudgement> public abstract class ScrollingRulesetContainer<TPlayfield, TObject> : RulesetContainer<TPlayfield, TObject>
where TObject : HitObject where TObject : HitObject
where TJudgement : Judgement where TPlayfield : ScrollingPlayfield<TObject>
where TPlayfield : ScrollingPlayfield<TObject, TJudgement>
{ {
/// <summary> /// <summary>
/// Provides the default <see cref="MultiplierControlPoint"/>s that adjust the scrolling rate of <see cref="HitObject"/>s /// Provides the default <see cref="MultiplierControlPoint"/>s that adjust the scrolling rate of <see cref="HitObject"/>s
/// inside this <see cref="RulesetContainer{TPlayfield,TObject,TJudgement}"/>. /// inside this <see cref="RulesetContainer{TPlayfield,TObject}"/>.
/// </summary> /// </summary>
/// <returns></returns> /// <returns></returns>
protected readonly SortedList<MultiplierControlPoint> DefaultControlPoints = new SortedList<MultiplierControlPoint>(Comparer<MultiplierControlPoint>.Default); protected readonly SortedList<MultiplierControlPoint> DefaultControlPoints = new SortedList<MultiplierControlPoint>(Comparer<MultiplierControlPoint>.Default);
@ -88,7 +86,7 @@ namespace osu.Game.Rulesets.UI
DefaultControlPoints.ForEach(c => applySpeedAdjustment(c, Playfield)); DefaultControlPoints.ForEach(c => applySpeedAdjustment(c, Playfield));
} }
private void applySpeedAdjustment(MultiplierControlPoint controlPoint, ScrollingPlayfield<TObject, TJudgement> playfield) private void applySpeedAdjustment(MultiplierControlPoint controlPoint, ScrollingPlayfield<TObject> playfield)
{ {
playfield.HitObjects.AddSpeedAdjustment(CreateSpeedAdjustmentContainer(controlPoint)); playfield.HitObjects.AddSpeedAdjustment(CreateSpeedAdjustmentContainer(controlPoint));
playfield.NestedPlayfields.ForEach(p => applySpeedAdjustment(controlPoint, p)); playfield.NestedPlayfields.ForEach(p => applySpeedAdjustment(controlPoint, p));