mirror of
https://github.com/ppy/osu.git
synced 2025-01-28 18:12:56 +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)
|
public override void Add(DrawableHitObject h)
|
||||||
{
|
{
|
||||||
h.Depth = (float)h.HitObject.StartTime;
|
h.Depth = (float)h.HitObject.StartTime;
|
||||||
|
h.OnJudgement += OnJudgement;
|
||||||
|
|
||||||
base.Add(h);
|
base.Add(h);
|
||||||
|
|
||||||
@ -65,6 +66,6 @@ namespace osu.Game.Rulesets.Catch.UI
|
|||||||
fruit.CheckPosition = CheckIfWeCanCatch;
|
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)
|
public override void Add(DrawableHitObject hitObject)
|
||||||
{
|
{
|
||||||
hitObject.Depth = (float)hitObject.HitObject.StartTime;
|
hitObject.Depth = (float)hitObject.HitObject.StartTime;
|
||||||
|
|
||||||
hitObject.AccentColour = AccentColour;
|
hitObject.AccentColour = AccentColour;
|
||||||
|
hitObject.OnJudgement += OnJudgement;
|
||||||
|
|
||||||
HitObjects.Add(hitObject);
|
HitObjects.Add(hitObject);
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void OnJudgement(DrawableHitObject judgedObject, Judgement judgement)
|
public void OnJudgement(DrawableHitObject judgedObject, Judgement judgement)
|
||||||
{
|
{
|
||||||
if (!judgement.IsHit)
|
if (!judgement.IsHit)
|
||||||
return;
|
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.Clear();
|
||||||
judgements.Add(new DrawableManiaJudgement(judgement)
|
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);
|
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.Depth = (float)h.HitObject.StartTime;
|
||||||
|
|
||||||
|
h.OnJudgement += OnJudgement;
|
||||||
|
|
||||||
var c = h as IDrawableHitObjectWithProxiedApproach;
|
var c = h as IDrawableHitObjectWithProxiedApproach;
|
||||||
if (c != null && ProxyApproachCircles)
|
if (c != null && ProxyApproachCircles)
|
||||||
approachCircles.Add(c.ProxiedLayer.CreateProxy());
|
approachCircles.Add(c.ProxiedLayer.CreateProxy());
|
||||||
@ -84,7 +86,7 @@ namespace osu.Game.Rulesets.Osu.UI
|
|||||||
.OrderBy(h => h.StartTime).OfType<OsuHitObject>();
|
.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 osuJudgement = (OsuJudgement)judgement;
|
||||||
var osuObject = (OsuHitObject)judgedObject.HitObject;
|
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) };
|
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)
|
if (RNG.Next(10) == 0)
|
||||||
{
|
{
|
||||||
rulesetContainer.Playfield.OnJudgement(h, new TaikoJudgement { Result = hitResult });
|
((TaikoPlayfield)rulesetContainer.Playfield).OnJudgement(h, new TaikoJudgement { Result = hitResult });
|
||||||
rulesetContainer.Playfield.OnJudgement(h, new TaikoStrongHitJudgement());
|
((TaikoPlayfield)rulesetContainer.Playfield).OnJudgement(h, new TaikoStrongHitJudgement());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void addMissJudgement()
|
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)
|
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.Depth = (float)h.HitObject.StartTime;
|
||||||
|
|
||||||
|
h.OnJudgement += OnJudgement;
|
||||||
|
|
||||||
base.Add(h);
|
base.Add(h);
|
||||||
|
|
||||||
var barline = h as DrawableBarLine;
|
var barline = h as DrawableBarLine;
|
||||||
@ -221,7 +223,7 @@ namespace osu.Game.Rulesets.Taiko.UI
|
|||||||
swell.OnStart += () => topLevelHitContainer.Add(swell.CreateProxy());
|
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)
|
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.Framework.Graphics.Containers;
|
||||||
using osu.Game.Rulesets.Objects.Drawables;
|
using osu.Game.Rulesets.Objects.Drawables;
|
||||||
using OpenTK;
|
using OpenTK;
|
||||||
using osu.Game.Rulesets.Judgements;
|
|
||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
|
|
||||||
namespace osu.Game.Rulesets.UI
|
namespace osu.Game.Rulesets.UI
|
||||||
@ -86,13 +85,6 @@ namespace osu.Game.Rulesets.UI
|
|||||||
/// <param name="h">The DrawableHitObject to remove.</param>
|
/// <param name="h">The DrawableHitObject to remove.</param>
|
||||||
public virtual void Remove(DrawableHitObject 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"/>.
|
|
||||||
/// </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>
|
/// <summary>
|
||||||
/// Registers a <see cref="Playfield"/> as a nested <see cref="Playfield"/>.
|
/// Registers a <see cref="Playfield"/> as a nested <see cref="Playfield"/>.
|
||||||
/// This does not add the <see cref="Playfield"/> to the draw hierarchy.
|
/// This does not add the <see cref="Playfield"/> to the draw hierarchy.
|
||||||
|
@ -262,12 +262,7 @@ namespace osu.Game.Rulesets.UI
|
|||||||
if (drawableObject == null)
|
if (drawableObject == null)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
drawableObject.OnJudgement += (d, j) =>
|
drawableObject.OnJudgement += (d, j) => OnJudgement?.Invoke(j);
|
||||||
{
|
|
||||||
Playfield.OnJudgement(d, j);
|
|
||||||
OnJudgement?.Invoke(j);
|
|
||||||
};
|
|
||||||
|
|
||||||
drawableObject.OnJudgementRemoved += (d, j) => OnJudgementRemoved?.Invoke(j);
|
drawableObject.OnJudgementRemoved += (d, j) => OnJudgementRemoved?.Invoke(j);
|
||||||
|
|
||||||
Playfield.Add(drawableObject);
|
Playfield.Add(drawableObject);
|
||||||
|
Loading…
Reference in New Issue
Block a user