mirror of
https://github.com/ppy/osu.git
synced 2024-12-14 13:22:55 +08:00
Merge pull request #10922 from peppy/fix-judgement-ordering
Ensure legacy skin judgements display in front of hitobjects
This commit is contained in:
commit
09f905355d
@ -40,6 +40,8 @@ namespace osu.Game.Rulesets.Osu.UI
|
||||
|
||||
private readonly IDictionary<HitResult, DrawablePool<DrawableOsuJudgement>> poolDictionary = new Dictionary<HitResult, DrawablePool<DrawableOsuJudgement>>();
|
||||
|
||||
private readonly Container judgementAboveHitObjectLayer;
|
||||
|
||||
public OsuPlayfield()
|
||||
{
|
||||
InternalChildren = new Drawable[]
|
||||
@ -49,6 +51,7 @@ namespace osu.Game.Rulesets.Osu.UI
|
||||
followPoints = new FollowPointRenderer { RelativeSizeAxes = Axes.Both },
|
||||
judgementLayer = new JudgementContainer<DrawableOsuJudgement> { RelativeSizeAxes = Axes.Both },
|
||||
HitObjectContainer,
|
||||
judgementAboveHitObjectLayer = new Container { RelativeSizeAxes = Axes.Both },
|
||||
approachCircles = new ProxyContainer { RelativeSizeAxes = Axes.Both },
|
||||
};
|
||||
|
||||
@ -58,13 +61,18 @@ namespace osu.Game.Rulesets.Osu.UI
|
||||
var hitWindows = new OsuHitWindows();
|
||||
|
||||
foreach (var result in Enum.GetValues(typeof(HitResult)).OfType<HitResult>().Where(r => r > HitResult.None && hitWindows.IsHitResultAllowed(r)))
|
||||
poolDictionary.Add(result, new DrawableJudgementPool(result));
|
||||
poolDictionary.Add(result, new DrawableJudgementPool(result, onJudgmentLoaded));
|
||||
|
||||
AddRangeInternal(poolDictionary.Values);
|
||||
|
||||
NewResult += onNewResult;
|
||||
}
|
||||
|
||||
private void onJudgmentLoaded(DrawableOsuJudgement judgement)
|
||||
{
|
||||
judgementAboveHitObjectLayer.Add(judgement.GetProxyAboveHitObjectsContent());
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader(true)]
|
||||
private void load(OsuRulesetConfigManager config)
|
||||
{
|
||||
@ -150,11 +158,13 @@ namespace osu.Game.Rulesets.Osu.UI
|
||||
private class DrawableJudgementPool : DrawablePool<DrawableOsuJudgement>
|
||||
{
|
||||
private readonly HitResult result;
|
||||
private readonly Action<DrawableOsuJudgement> onLoaded;
|
||||
|
||||
public DrawableJudgementPool(HitResult result)
|
||||
public DrawableJudgementPool(HitResult result, Action<DrawableOsuJudgement> onLoaded)
|
||||
: base(10)
|
||||
{
|
||||
this.result = result;
|
||||
this.onLoaded = onLoaded;
|
||||
}
|
||||
|
||||
protected override DrawableOsuJudgement CreateNewDrawable()
|
||||
@ -164,6 +174,8 @@ namespace osu.Game.Rulesets.Osu.UI
|
||||
// just a placeholder to initialise the correct drawable hierarchy for this pool.
|
||||
judgement.Apply(new JudgementResult(new HitObject(), new Judgement()) { Type = result }, null);
|
||||
|
||||
onLoaded?.Invoke(judgement);
|
||||
|
||||
return judgement;
|
||||
}
|
||||
}
|
||||
|
@ -69,5 +69,7 @@ namespace osu.Game.Rulesets.Judgements
|
||||
|
||||
this.FadeOutFromOne(800);
|
||||
}
|
||||
|
||||
public Drawable GetAboveHitObjectsProxiedContent() => null;
|
||||
}
|
||||
}
|
||||
|
@ -6,6 +6,7 @@ using System.Diagnostics;
|
||||
using JetBrains.Annotations;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Framework.Graphics.Pooling;
|
||||
using osu.Game.Rulesets.Objects.Drawables;
|
||||
using osu.Game.Rulesets.Scoring;
|
||||
@ -29,6 +30,8 @@ namespace osu.Game.Rulesets.Judgements
|
||||
|
||||
protected SkinnableDrawable JudgementBody { get; private set; }
|
||||
|
||||
private readonly Container aboveHitObjectsContent;
|
||||
|
||||
[Resolved]
|
||||
private ISkinSource skinSource { get; set; }
|
||||
|
||||
@ -59,6 +62,12 @@ namespace osu.Game.Rulesets.Judgements
|
||||
{
|
||||
Size = new Vector2(judgement_size);
|
||||
Origin = Anchor.Centre;
|
||||
|
||||
AddInternal(aboveHitObjectsContent = new Container
|
||||
{
|
||||
Depth = float.MinValue,
|
||||
RelativeSizeAxes = Axes.Both
|
||||
});
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
@ -67,6 +76,8 @@ namespace osu.Game.Rulesets.Judgements
|
||||
prepareDrawables();
|
||||
}
|
||||
|
||||
public Drawable GetProxyAboveHitObjectsContent() => aboveHitObjectsContent.CreateProxy();
|
||||
|
||||
protected override void LoadComplete()
|
||||
{
|
||||
base.LoadComplete();
|
||||
@ -189,6 +200,7 @@ namespace osu.Game.Rulesets.Judgements
|
||||
if (JudgementBody != null)
|
||||
RemoveInternal(JudgementBody);
|
||||
|
||||
aboveHitObjectsContent.Clear();
|
||||
AddInternal(JudgementBody = new SkinnableDrawable(new GameplaySkinComponent<HitResult>(type), _ =>
|
||||
CreateDefaultJudgement(type), confineMode: ConfineMode.NoScaling)
|
||||
{
|
||||
@ -196,6 +208,13 @@ namespace osu.Game.Rulesets.Judgements
|
||||
Origin = Anchor.Centre,
|
||||
});
|
||||
|
||||
if (JudgementBody.Drawable is IAnimatableJudgement animatable)
|
||||
{
|
||||
var proxiedContent = animatable.GetAboveHitObjectsProxiedContent();
|
||||
if (proxiedContent != null)
|
||||
aboveHitObjectsContent.Add(proxiedContent);
|
||||
}
|
||||
|
||||
currentDrawableType = type;
|
||||
}
|
||||
|
||||
|
@ -1,6 +1,7 @@
|
||||
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
||||
// See the LICENCE file in the repository root for full licence text.
|
||||
|
||||
using JetBrains.Annotations;
|
||||
using osu.Framework.Graphics;
|
||||
|
||||
namespace osu.Game.Rulesets.Judgements
|
||||
@ -10,6 +11,15 @@ namespace osu.Game.Rulesets.Judgements
|
||||
/// </summary>
|
||||
public interface IAnimatableJudgement : IDrawable
|
||||
{
|
||||
/// <summary>
|
||||
/// Start the animation for this judgement from the current point in time.
|
||||
/// </summary>
|
||||
void PlayAnimation();
|
||||
|
||||
/// <summary>
|
||||
/// Get proxied content which should be displayed above all hitobjects.
|
||||
/// </summary>
|
||||
[CanBeNull]
|
||||
Drawable GetAboveHitObjectsProxiedContent();
|
||||
}
|
||||
}
|
||||
|
@ -121,5 +121,7 @@ namespace osu.Game.Skinning
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public Drawable GetAboveHitObjectsProxiedContent() => temporaryOldStyle?.CreateProxy(); // for new style judgements, only the old style temporary display is in front of objects.
|
||||
}
|
||||
}
|
||||
|
@ -69,5 +69,7 @@ namespace osu.Game.Skinning
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public Drawable GetAboveHitObjectsProxiedContent() => CreateProxy();
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user