mirror of
https://github.com/ppy/osu
synced 2025-01-11 16:49:39 +00:00
Enable pooling for taiko judgements
This commit is contained in:
parent
06e42b4b4c
commit
8f4dadb06a
@ -3,7 +3,6 @@
|
|||||||
|
|
||||||
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.Taiko.UI
|
namespace osu.Game.Rulesets.Taiko.UI
|
||||||
{
|
{
|
||||||
@ -12,16 +11,6 @@ namespace osu.Game.Rulesets.Taiko.UI
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public class DrawableTaikoJudgement : DrawableJudgement
|
public class DrawableTaikoJudgement : DrawableJudgement
|
||||||
{
|
{
|
||||||
/// <summary>
|
|
||||||
/// Creates a new judgement text.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="judgedObject">The object which is being judged.</param>
|
|
||||||
/// <param name="result">The judgement to visualise.</param>
|
|
||||||
public DrawableTaikoJudgement(JudgementResult result, DrawableHitObject judgedObject)
|
|
||||||
: base(result, judgedObject)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override void ApplyHitAnimations()
|
protected override void ApplyHitAnimations()
|
||||||
{
|
{
|
||||||
this.MoveToY(-100, 500);
|
this.MoveToY(-100, 500);
|
||||||
|
@ -2,10 +2,12 @@
|
|||||||
// See the LICENCE file in the repository root for full licence text.
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Graphics.Containers;
|
using osu.Framework.Graphics.Containers;
|
||||||
|
using osu.Framework.Graphics.Pooling;
|
||||||
using osu.Game.Beatmaps.ControlPoints;
|
using osu.Game.Beatmaps.ControlPoints;
|
||||||
using osu.Game.Graphics;
|
using osu.Game.Graphics;
|
||||||
using osu.Game.Rulesets.Objects.Drawables;
|
using osu.Game.Rulesets.Objects.Drawables;
|
||||||
@ -17,6 +19,7 @@ using osu.Game.Rulesets.UI.Scrolling;
|
|||||||
using osu.Game.Rulesets.Taiko.Objects.Drawables;
|
using osu.Game.Rulesets.Taiko.Objects.Drawables;
|
||||||
using osu.Game.Rulesets.Taiko.Judgements;
|
using osu.Game.Rulesets.Taiko.Judgements;
|
||||||
using osu.Game.Rulesets.Taiko.Objects;
|
using osu.Game.Rulesets.Taiko.Objects;
|
||||||
|
using osu.Game.Rulesets.Taiko.Scoring;
|
||||||
using osu.Game.Skinning;
|
using osu.Game.Skinning;
|
||||||
using osuTK;
|
using osuTK;
|
||||||
|
|
||||||
@ -38,6 +41,8 @@ namespace osu.Game.Rulesets.Taiko.UI
|
|||||||
internal Drawable HitTarget;
|
internal Drawable HitTarget;
|
||||||
private SkinnableDrawable mascot;
|
private SkinnableDrawable mascot;
|
||||||
|
|
||||||
|
private readonly IDictionary<HitResult, DrawablePool<DrawableTaikoJudgement>> judgementPools = new Dictionary<HitResult, DrawablePool<DrawableTaikoJudgement>>();
|
||||||
|
|
||||||
private ProxyContainer topLevelHitContainer;
|
private ProxyContainer topLevelHitContainer;
|
||||||
private Container rightArea;
|
private Container rightArea;
|
||||||
private Container leftArea;
|
private Container leftArea;
|
||||||
@ -159,6 +164,12 @@ namespace osu.Game.Rulesets.Taiko.UI
|
|||||||
|
|
||||||
RegisterPool<Swell, DrawableSwell>(5);
|
RegisterPool<Swell, DrawableSwell>(5);
|
||||||
RegisterPool<SwellTick, DrawableSwellTick>(100);
|
RegisterPool<SwellTick, DrawableSwellTick>(100);
|
||||||
|
|
||||||
|
var hitWindows = new TaikoHitWindows();
|
||||||
|
foreach (var result in Enum.GetValues(typeof(HitResult)).OfType<HitResult>().Where(r => hitWindows.IsHitResultAllowed(r)))
|
||||||
|
judgementPools.Add(result, new DrawablePool<DrawableTaikoJudgement>(15));
|
||||||
|
|
||||||
|
AddRangeInternal(judgementPools.Values);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void LoadComplete()
|
protected override void LoadComplete()
|
||||||
@ -283,13 +294,15 @@ namespace osu.Game.Rulesets.Taiko.UI
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
judgementContainer.Add(new DrawableTaikoJudgement(result, judgedObject)
|
judgementContainer.Add(judgementPools[result.Type].Get(j =>
|
||||||
{
|
{
|
||||||
Anchor = result.IsHit ? Anchor.TopLeft : Anchor.CentreLeft,
|
j.Apply(result, judgedObject);
|
||||||
Origin = result.IsHit ? Anchor.BottomCentre : Anchor.Centre,
|
|
||||||
RelativePositionAxes = Axes.X,
|
j.Anchor = result.IsHit ? Anchor.TopLeft : Anchor.CentreLeft;
|
||||||
X = result.IsHit ? judgedObject.Position.X : 0,
|
j.Origin = result.IsHit ? Anchor.BottomCentre : Anchor.Centre;
|
||||||
});
|
j.RelativePositionAxes = Axes.X;
|
||||||
|
j.X = result.IsHit ? judgedObject.Position.X : 0;
|
||||||
|
}));
|
||||||
|
|
||||||
var type = (judgedObject.HitObject as Hit)?.Type ?? HitType.Centre;
|
var type = (judgedObject.HitObject as Hit)?.Type ?? HitType.Centre;
|
||||||
addExplosion(judgedObject, result.Type, type);
|
addExplosion(judgedObject, result.Type, type);
|
||||||
|
Loading…
Reference in New Issue
Block a user