mirror of
https://github.com/ppy/osu.git
synced 2024-11-11 10:33:30 +08:00
Remove base OnJudgement from Playfield to properly accomodate nested playfields
This commit is contained in:
parent
c32ff9c43b
commit
8c5ef0a330
@ -58,6 +58,7 @@ namespace osu.Game.Rulesets.Catch.UI
|
||||
public override void Add(DrawableHitObject h)
|
||||
{
|
||||
h.Depth = (float)h.HitObject.StartTime;
|
||||
h.OnJudgement += OnJudgement;
|
||||
|
||||
base.Add(h);
|
||||
|
||||
@ -65,6 +66,6 @@ namespace osu.Game.Rulesets.Catch.UI
|
||||
fruit.CheckPosition = CheckIfWeCanCatch;
|
||||
}
|
||||
|
||||
public override void OnJudgement(DrawableHitObject judgedObject, Judgement judgement) => catcherArea.OnJudgement((DrawableCatchHitObject)judgedObject, judgement);
|
||||
public void OnJudgement(DrawableHitObject judgedObject, Judgement judgement) => catcherArea.OnJudgement((DrawableCatchHitObject)judgedObject, judgement);
|
||||
}
|
||||
}
|
||||
|
@ -204,12 +204,13 @@ namespace osu.Game.Rulesets.Mania.UI
|
||||
public override void Add(DrawableHitObject hitObject)
|
||||
{
|
||||
hitObject.Depth = (float)hitObject.HitObject.StartTime;
|
||||
|
||||
hitObject.AccentColour = AccentColour;
|
||||
hitObject.OnJudgement += OnJudgement;
|
||||
|
||||
HitObjects.Add(hitObject);
|
||||
}
|
||||
|
||||
public override void OnJudgement(DrawableHitObject judgedObject, Judgement judgement)
|
||||
public void OnJudgement(DrawableHitObject judgedObject, Judgement judgement)
|
||||
{
|
||||
if (!judgement.IsHit)
|
||||
return;
|
||||
|
@ -192,11 +192,8 @@ namespace osu.Game.Rulesets.Mania.UI
|
||||
}
|
||||
}
|
||||
|
||||
public override void OnJudgement(DrawableHitObject judgedObject, Judgement judgement)
|
||||
public void OnJudgement(DrawableHitObject judgedObject, Judgement judgement)
|
||||
{
|
||||
var maniaObject = (ManiaHitObject)judgedObject.HitObject;
|
||||
columns[maniaObject.Column].OnJudgement(judgedObject, judgement);
|
||||
|
||||
judgements.Clear();
|
||||
judgements.Add(new DrawableManiaJudgement(judgement)
|
||||
{
|
||||
@ -224,7 +221,11 @@ namespace osu.Game.Rulesets.Mania.UI
|
||||
}
|
||||
}
|
||||
|
||||
public override void Add(DrawableHitObject h) => Columns.ElementAt(((ManiaHitObject)h.HitObject).Column).Add(h);
|
||||
public override void Add(DrawableHitObject h)
|
||||
{
|
||||
h.OnJudgement += OnJudgement;
|
||||
Columns.ElementAt(((ManiaHitObject)h.HitObject).Column).Add(h);
|
||||
}
|
||||
|
||||
public void Add(DrawableBarLine barline) => HitObjects.Add(barline);
|
||||
|
||||
|
@ -70,6 +70,8 @@ namespace osu.Game.Rulesets.Osu.UI
|
||||
{
|
||||
h.Depth = (float)h.HitObject.StartTime;
|
||||
|
||||
h.OnJudgement += OnJudgement;
|
||||
|
||||
var c = h as IDrawableHitObjectWithProxiedApproach;
|
||||
if (c != null && ProxyApproachCircles)
|
||||
approachCircles.Add(c.ProxiedLayer.CreateProxy());
|
||||
@ -84,7 +86,7 @@ namespace osu.Game.Rulesets.Osu.UI
|
||||
.OrderBy(h => h.StartTime).OfType<OsuHitObject>();
|
||||
}
|
||||
|
||||
public override void OnJudgement(DrawableHitObject judgedObject, Judgement judgement)
|
||||
public void OnJudgement(DrawableHitObject judgedObject, Judgement judgement)
|
||||
{
|
||||
var osuJudgement = (OsuJudgement)judgement;
|
||||
var osuObject = (OsuHitObject)judgedObject.HitObject;
|
||||
|
@ -143,18 +143,18 @@ namespace osu.Game.Rulesets.Taiko.Tests
|
||||
|
||||
var h = new DrawableTestHit(hit) { X = RNG.NextSingle(hitResult == HitResult.Good ? -0.1f : -0.05f, hitResult == HitResult.Good ? 0.1f : 0.05f) };
|
||||
|
||||
rulesetContainer.Playfield.OnJudgement(h, new TaikoJudgement { Result = hitResult });
|
||||
((TaikoPlayfield)rulesetContainer.Playfield).OnJudgement(h, new TaikoJudgement { Result = hitResult });
|
||||
|
||||
if (RNG.Next(10) == 0)
|
||||
{
|
||||
rulesetContainer.Playfield.OnJudgement(h, new TaikoJudgement { Result = hitResult });
|
||||
rulesetContainer.Playfield.OnJudgement(h, new TaikoStrongHitJudgement());
|
||||
((TaikoPlayfield)rulesetContainer.Playfield).OnJudgement(h, new TaikoJudgement { Result = hitResult });
|
||||
((TaikoPlayfield)rulesetContainer.Playfield).OnJudgement(h, new TaikoStrongHitJudgement());
|
||||
}
|
||||
}
|
||||
|
||||
private void addMissJudgement()
|
||||
{
|
||||
rulesetContainer.Playfield.OnJudgement(new DrawableTestHit(new Hit()), new TaikoJudgement { Result = HitResult.Miss });
|
||||
((TaikoPlayfield)rulesetContainer.Playfield).OnJudgement(new DrawableTestHit(new Hit()), new TaikoJudgement { Result = HitResult.Miss });
|
||||
}
|
||||
|
||||
private void addBarLine(bool major, double delay = scroll_time)
|
||||
|
@ -209,6 +209,8 @@ namespace osu.Game.Rulesets.Taiko.UI
|
||||
{
|
||||
h.Depth = (float)h.HitObject.StartTime;
|
||||
|
||||
h.OnJudgement += OnJudgement;
|
||||
|
||||
base.Add(h);
|
||||
|
||||
var barline = h as DrawableBarLine;
|
||||
@ -221,7 +223,7 @@ namespace osu.Game.Rulesets.Taiko.UI
|
||||
swell.OnStart += () => topLevelHitContainer.Add(swell.CreateProxy());
|
||||
}
|
||||
|
||||
public override void OnJudgement(DrawableHitObject judgedObject, Judgement judgement)
|
||||
public void OnJudgement(DrawableHitObject judgedObject, Judgement judgement)
|
||||
{
|
||||
if (judgedObject.DisplayJudgement && judgementContainer.FirstOrDefault(j => j.JudgedObject == judgedObject) == null)
|
||||
{
|
||||
|
@ -7,7 +7,6 @@ using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Game.Rulesets.Objects.Drawables;
|
||||
using OpenTK;
|
||||
using osu.Game.Rulesets.Judgements;
|
||||
using osu.Framework.Allocation;
|
||||
|
||||
namespace osu.Game.Rulesets.UI
|
||||
@ -86,13 +85,6 @@ namespace osu.Game.Rulesets.UI
|
||||
/// <param name="h">The DrawableHitObject to remove.</param>
|
||||
public virtual void Remove(DrawableHitObject h) => HitObjects.Remove(h);
|
||||
|
||||
/// <summary>
|
||||
/// Triggered when a new <see cref="Judgement"/> occurs on a <see cref="DrawableHitObject"/>.
|
||||
/// </summary>
|
||||
/// <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) { }
|
||||
|
||||
/// <summary>
|
||||
/// Registers a <see cref="Playfield"/> as a nested <see cref="Playfield"/>.
|
||||
/// This does not add the <see cref="Playfield"/> to the draw hierarchy.
|
||||
|
@ -262,12 +262,7 @@ namespace osu.Game.Rulesets.UI
|
||||
if (drawableObject == null)
|
||||
continue;
|
||||
|
||||
drawableObject.OnJudgement += (d, j) =>
|
||||
{
|
||||
Playfield.OnJudgement(d, j);
|
||||
OnJudgement?.Invoke(j);
|
||||
};
|
||||
|
||||
drawableObject.OnJudgement += (d, j) => OnJudgement?.Invoke(j);
|
||||
drawableObject.OnJudgementRemoved += (d, j) => OnJudgementRemoved?.Invoke(j);
|
||||
|
||||
Playfield.Add(drawableObject);
|
||||
|
Loading…
Reference in New Issue
Block a user