mirror of
https://github.com/ppy/osu.git
synced 2024-12-14 18:42:56 +08:00
Merge pull request #2182 from peppy/fix-duplicate-judgements
Remove judgements when deciding a new judgement for a HitObject
This commit is contained in:
commit
09b13ee618
@ -3,13 +3,14 @@
|
|||||||
|
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Game.Rulesets.Judgements;
|
using osu.Game.Rulesets.Judgements;
|
||||||
|
using osu.Game.Rulesets.Objects.Drawables;
|
||||||
|
|
||||||
namespace osu.Game.Rulesets.Mania.UI
|
namespace osu.Game.Rulesets.Mania.UI
|
||||||
{
|
{
|
||||||
internal class DrawableManiaJudgement : DrawableJudgement
|
internal class DrawableManiaJudgement : DrawableJudgement
|
||||||
{
|
{
|
||||||
public DrawableManiaJudgement(Judgement judgement)
|
public DrawableManiaJudgement(Judgement judgement, DrawableHitObject judgedObject)
|
||||||
: base(judgement)
|
: base(judgement, judgedObject)
|
||||||
{
|
{
|
||||||
JudgementText.TextSize = 25;
|
JudgementText.TextSize = 25;
|
||||||
}
|
}
|
||||||
|
@ -15,6 +15,7 @@ using osu.Game.Rulesets.Mania.Beatmaps;
|
|||||||
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.Objects.Drawables;
|
using osu.Game.Rulesets.Objects.Drawables;
|
||||||
|
using osu.Game.Rulesets.UI;
|
||||||
using osu.Game.Rulesets.UI.Scrolling;
|
using osu.Game.Rulesets.UI.Scrolling;
|
||||||
using OpenTK;
|
using OpenTK;
|
||||||
using OpenTK.Graphics;
|
using OpenTK.Graphics;
|
||||||
@ -40,7 +41,7 @@ namespace osu.Game.Rulesets.Mania.UI
|
|||||||
private readonly Container<Drawable> content;
|
private readonly Container<Drawable> content;
|
||||||
|
|
||||||
public Container<DrawableManiaJudgement> Judgements => judgements;
|
public Container<DrawableManiaJudgement> Judgements => judgements;
|
||||||
private readonly Container<DrawableManiaJudgement> judgements;
|
private readonly JudgementContainer<DrawableManiaJudgement> judgements;
|
||||||
|
|
||||||
private readonly Container topLevelContainer;
|
private readonly Container topLevelContainer;
|
||||||
|
|
||||||
@ -114,7 +115,7 @@ namespace osu.Game.Rulesets.Mania.UI
|
|||||||
Padding = new MarginPadding { Top = HIT_TARGET_POSITION }
|
Padding = new MarginPadding { Top = HIT_TARGET_POSITION }
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
judgements = new Container<DrawableManiaJudgement>
|
judgements = new JudgementContainer<DrawableManiaJudgement>
|
||||||
{
|
{
|
||||||
Anchor = Anchor.TopCentre,
|
Anchor = Anchor.TopCentre,
|
||||||
Origin = Anchor.Centre,
|
Origin = Anchor.Centre,
|
||||||
@ -171,7 +172,7 @@ namespace osu.Game.Rulesets.Mania.UI
|
|||||||
internal void OnJudgement(DrawableHitObject judgedObject, Judgement judgement)
|
internal void OnJudgement(DrawableHitObject judgedObject, Judgement judgement)
|
||||||
{
|
{
|
||||||
judgements.Clear();
|
judgements.Clear();
|
||||||
judgements.Add(new DrawableManiaJudgement(judgement)
|
judgements.Add(new DrawableManiaJudgement(judgement, judgedObject)
|
||||||
{
|
{
|
||||||
Anchor = Anchor.Centre,
|
Anchor = Anchor.Centre,
|
||||||
Origin = Anchor.Centre,
|
Origin = Anchor.Centre,
|
||||||
|
@ -2,17 +2,17 @@
|
|||||||
// 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.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Game.Rulesets.Osu.Judgements;
|
|
||||||
using OpenTK;
|
using OpenTK;
|
||||||
using osu.Game.Rulesets.Judgements;
|
using osu.Game.Rulesets.Judgements;
|
||||||
|
using osu.Game.Rulesets.Objects.Drawables;
|
||||||
using osu.Game.Rulesets.Scoring;
|
using osu.Game.Rulesets.Scoring;
|
||||||
|
|
||||||
namespace osu.Game.Rulesets.Osu.Objects.Drawables
|
namespace osu.Game.Rulesets.Osu.Objects.Drawables
|
||||||
{
|
{
|
||||||
public class DrawableOsuJudgement : DrawableJudgement
|
public class DrawableOsuJudgement : DrawableJudgement
|
||||||
{
|
{
|
||||||
public DrawableOsuJudgement(OsuJudgement judgement)
|
public DrawableOsuJudgement(Judgement judgement, DrawableHitObject judgedObject)
|
||||||
: base(judgement)
|
: base(judgement, judgedObject)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -18,7 +18,7 @@ namespace osu.Game.Rulesets.Osu.UI
|
|||||||
public class OsuPlayfield : Playfield
|
public class OsuPlayfield : Playfield
|
||||||
{
|
{
|
||||||
private readonly Container approachCircles;
|
private readonly Container approachCircles;
|
||||||
private readonly Container judgementLayer;
|
private readonly JudgementContainer<DrawableOsuJudgement> judgementLayer;
|
||||||
private readonly ConnectionRenderer<OsuHitObject> connectionLayer;
|
private readonly ConnectionRenderer<OsuHitObject> connectionLayer;
|
||||||
|
|
||||||
// Todo: This should not be a thing, but is currently required for the editor
|
// Todo: This should not be a thing, but is currently required for the editor
|
||||||
@ -40,7 +40,7 @@ namespace osu.Game.Rulesets.Osu.UI
|
|||||||
RelativeSizeAxes = Axes.Both,
|
RelativeSizeAxes = Axes.Both,
|
||||||
Depth = 2,
|
Depth = 2,
|
||||||
},
|
},
|
||||||
judgementLayer = new Container
|
judgementLayer = new JudgementContainer<DrawableOsuJudgement>
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.Both,
|
RelativeSizeAxes = Axes.Both,
|
||||||
Depth = 1,
|
Depth = 1,
|
||||||
@ -75,16 +75,13 @@ namespace osu.Game.Rulesets.Osu.UI
|
|||||||
|
|
||||||
private void onJudgement(DrawableHitObject judgedObject, Judgement judgement)
|
private void onJudgement(DrawableHitObject judgedObject, Judgement judgement)
|
||||||
{
|
{
|
||||||
var osuJudgement = (OsuJudgement)judgement;
|
|
||||||
var osuObject = (OsuHitObject)judgedObject.HitObject;
|
|
||||||
|
|
||||||
if (!judgedObject.DisplayJudgement)
|
if (!judgedObject.DisplayJudgement)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
DrawableOsuJudgement explosion = new DrawableOsuJudgement(osuJudgement)
|
DrawableOsuJudgement explosion = new DrawableOsuJudgement(judgement, judgedObject)
|
||||||
{
|
{
|
||||||
Origin = Anchor.Centre,
|
Origin = Anchor.Centre,
|
||||||
Position = osuObject.StackedEndPosition + osuJudgement.PositionOffset
|
Position = ((OsuHitObject)judgedObject.HitObject).StackedEndPosition + ((OsuJudgement)judgement).PositionOffset
|
||||||
};
|
};
|
||||||
|
|
||||||
judgementLayer.Add(explosion);
|
judgementLayer.Add(explosion);
|
||||||
|
@ -15,17 +15,14 @@ namespace osu.Game.Rulesets.Taiko.UI
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public class DrawableTaikoJudgement : DrawableJudgement
|
public class DrawableTaikoJudgement : DrawableJudgement
|
||||||
{
|
{
|
||||||
public readonly DrawableHitObject JudgedObject;
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Creates a new judgement text.
|
/// Creates a new judgement text.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="judgedObject">The object which is being judged.</param>
|
/// <param name="judgedObject">The object which is being judged.</param>
|
||||||
/// <param name="judgement">The judgement to visualise.</param>
|
/// <param name="judgement">The judgement to visualise.</param>
|
||||||
public DrawableTaikoJudgement(DrawableHitObject judgedObject, Judgement judgement)
|
public DrawableTaikoJudgement(Judgement judgement, DrawableHitObject judgedObject)
|
||||||
: base(judgement)
|
: base(judgement, judgedObject)
|
||||||
{
|
{
|
||||||
JudgedObject = judgedObject;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
|
@ -16,6 +16,7 @@ using System.Linq;
|
|||||||
using osu.Game.Rulesets.Judgements;
|
using osu.Game.Rulesets.Judgements;
|
||||||
using osu.Game.Rulesets.Taiko.Objects.Drawables;
|
using osu.Game.Rulesets.Taiko.Objects.Drawables;
|
||||||
using osu.Game.Beatmaps.ControlPoints;
|
using osu.Game.Beatmaps.ControlPoints;
|
||||||
|
using osu.Game.Rulesets.UI;
|
||||||
using osu.Game.Rulesets.UI.Scrolling;
|
using osu.Game.Rulesets.UI.Scrolling;
|
||||||
|
|
||||||
namespace osu.Game.Rulesets.Taiko.UI
|
namespace osu.Game.Rulesets.Taiko.UI
|
||||||
@ -41,7 +42,7 @@ namespace osu.Game.Rulesets.Taiko.UI
|
|||||||
|
|
||||||
private readonly Container<HitExplosion> hitExplosionContainer;
|
private readonly Container<HitExplosion> hitExplosionContainer;
|
||||||
private readonly Container<KiaiHitExplosion> kiaiExplosionContainer;
|
private readonly Container<KiaiHitExplosion> kiaiExplosionContainer;
|
||||||
private readonly Container<DrawableTaikoJudgement> judgementContainer;
|
private readonly JudgementContainer<DrawableTaikoJudgement> judgementContainer;
|
||||||
|
|
||||||
protected override Container<Drawable> Content => content;
|
protected override Container<Drawable> Content => content;
|
||||||
private readonly Container content;
|
private readonly Container content;
|
||||||
@ -131,7 +132,7 @@ namespace osu.Game.Rulesets.Taiko.UI
|
|||||||
Margin = new MarginPadding { Left = HIT_TARGET_OFFSET },
|
Margin = new MarginPadding { Left = HIT_TARGET_OFFSET },
|
||||||
Blending = BlendingMode.Additive
|
Blending = BlendingMode.Additive
|
||||||
},
|
},
|
||||||
judgementContainer = new Container<DrawableTaikoJudgement>
|
judgementContainer = new JudgementContainer<DrawableTaikoJudgement>
|
||||||
{
|
{
|
||||||
Name = "Judgements",
|
Name = "Judgements",
|
||||||
RelativeSizeAxes = Axes.Y,
|
RelativeSizeAxes = Axes.Y,
|
||||||
@ -227,7 +228,7 @@ namespace osu.Game.Rulesets.Taiko.UI
|
|||||||
{
|
{
|
||||||
if (judgedObject.DisplayJudgement && judgementContainer.FirstOrDefault(j => j.JudgedObject == judgedObject) == null)
|
if (judgedObject.DisplayJudgement && judgementContainer.FirstOrDefault(j => j.JudgedObject == judgedObject) == null)
|
||||||
{
|
{
|
||||||
judgementContainer.Add(new DrawableTaikoJudgement(judgedObject, judgement)
|
judgementContainer.Add(new DrawableTaikoJudgement(judgement, judgedObject)
|
||||||
{
|
{
|
||||||
Anchor = judgement.IsHit ? Anchor.TopLeft : Anchor.CentreLeft,
|
Anchor = judgement.IsHit ? Anchor.TopLeft : Anchor.CentreLeft,
|
||||||
Origin = judgement.IsHit ? Anchor.BottomCentre : Anchor.Centre,
|
Origin = judgement.IsHit ? Anchor.BottomCentre : Anchor.Centre,
|
||||||
|
@ -9,6 +9,7 @@ using osu.Framework.Graphics.Containers;
|
|||||||
using osu.Framework.Graphics.Sprites;
|
using osu.Framework.Graphics.Sprites;
|
||||||
using osu.Game.Graphics;
|
using osu.Game.Graphics;
|
||||||
using osu.Game.Graphics.Sprites;
|
using osu.Game.Graphics.Sprites;
|
||||||
|
using osu.Game.Rulesets.Objects.Drawables;
|
||||||
using osu.Game.Rulesets.Scoring;
|
using osu.Game.Rulesets.Scoring;
|
||||||
|
|
||||||
namespace osu.Game.Rulesets.Judgements
|
namespace osu.Game.Rulesets.Judgements
|
||||||
@ -20,15 +21,18 @@ namespace osu.Game.Rulesets.Judgements
|
|||||||
{
|
{
|
||||||
protected readonly Judgement Judgement;
|
protected readonly Judgement Judgement;
|
||||||
|
|
||||||
|
public readonly DrawableHitObject JudgedObject;
|
||||||
|
|
||||||
protected readonly SpriteText JudgementText;
|
protected readonly SpriteText JudgementText;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Creates a drawable which visualises a <see cref="Judgements.Judgement"/>.
|
/// Creates a drawable which visualises a <see cref="Judgements.Judgement"/>.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="judgement">The judgement to visualise.</param>
|
/// <param name="judgement">The judgement to visualise.</param>
|
||||||
public DrawableJudgement(Judgement judgement)
|
public DrawableJudgement(Judgement judgement, DrawableHitObject judgedObject)
|
||||||
{
|
{
|
||||||
Judgement = judgement;
|
Judgement = judgement;
|
||||||
|
JudgedObject = judgedObject;
|
||||||
|
|
||||||
AutoSizeAxes = Axes.Both;
|
AutoSizeAxes = Axes.Both;
|
||||||
|
|
||||||
|
24
osu.Game/Rulesets/UI/JudgementContainer.cs
Normal file
24
osu.Game/Rulesets/UI/JudgementContainer.cs
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
|
||||||
|
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||||
|
|
||||||
|
using System;
|
||||||
|
using osu.Framework.Graphics.Containers;
|
||||||
|
using osu.Game.Rulesets.Judgements;
|
||||||
|
|
||||||
|
namespace osu.Game.Rulesets.UI
|
||||||
|
{
|
||||||
|
public class JudgementContainer<T> : Container<T>
|
||||||
|
where T : DrawableJudgement
|
||||||
|
{
|
||||||
|
public override void Add(T judgement)
|
||||||
|
{
|
||||||
|
if (judgement == null) throw new ArgumentNullException(nameof(judgement));
|
||||||
|
|
||||||
|
// remove any existing judgements for the judged object.
|
||||||
|
// this can be the case when rewinding.
|
||||||
|
RemoveAll(c => c.JudgedObject == judgement.JudgedObject);
|
||||||
|
|
||||||
|
base.Add(judgement);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -378,6 +378,7 @@
|
|||||||
<Compile Include="Rulesets\Replays\ReplayFrame.cs" />
|
<Compile Include="Rulesets\Replays\ReplayFrame.cs" />
|
||||||
<Compile Include="Rulesets\Replays\Types\IConvertibleReplayFrame.cs" />
|
<Compile Include="Rulesets\Replays\Types\IConvertibleReplayFrame.cs" />
|
||||||
<Compile Include="Rulesets\Scoring\Legacy\LegacyScoreParser.cs" />
|
<Compile Include="Rulesets\Scoring\Legacy\LegacyScoreParser.cs" />
|
||||||
|
<Compile Include="Rulesets\UI\JudgementContainer.cs" />
|
||||||
<Compile Include="Screens\Play\ScreenWithBeatmapBackground.cs" />
|
<Compile Include="Screens\Play\ScreenWithBeatmapBackground.cs" />
|
||||||
<Compile Include="Screens\Play\PlayerSettings\VisualSettings.cs" />
|
<Compile Include="Screens\Play\PlayerSettings\VisualSettings.cs" />
|
||||||
<Compile Include="Rulesets\Objects\CatmullApproximator.cs" />
|
<Compile Include="Rulesets\Objects\CatmullApproximator.cs" />
|
||||||
|
Loading…
Reference in New Issue
Block a user