1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-30 06:52:53 +08:00

Expire legacy combo counters on catch ruleset

This commit is contained in:
Salman Ahmed 2021-05-15 14:32:58 +03:00
parent 4c25fe750f
commit 102842bcf1

View File

@ -1,8 +1,10 @@
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence. // 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. // See the LICENCE file in the repository root for full licence text.
using System.Linq;
using osu.Framework.Bindables; using osu.Framework.Bindables;
using osu.Framework.Graphics; using osu.Framework.Graphics;
using osu.Game.Screens.Play.HUD;
using osu.Game.Skinning; using osu.Game.Skinning;
using osuTK.Graphics; using osuTK.Graphics;
@ -22,14 +24,17 @@ namespace osu.Game.Rulesets.Catch.Skinning.Legacy
public override Drawable GetDrawableComponent(ISkinComponent component) public override Drawable GetDrawableComponent(ISkinComponent component)
{ {
if (component is HUDSkinComponent hudComponent) if (component is SkinnableTargetComponent targetComponent && targetComponent.Target == SkinnableTarget.MainHUDComponents)
{ {
switch (hudComponent.Component) if (!providesComboCounter || !(Source.GetDrawableComponent(component) is SkinnableTargetComponentsContainer components))
{ return null;
case HUDSkinComponents.ComboCounter:
// catch may provide its own combo counter; hide the default. // catch may provide its own combo counter; hide the default.
return providesComboCounter ? Drawable.Empty() : null; // todo: this should probably be done in an elegant way.
} foreach (var legacyComboCounter in components.OfType<LegacyComboCounter>())
legacyComboCounter.Expire();
return components;
} }
if (!(component is CatchSkinComponent catchSkinComponent)) if (!(component is CatchSkinComponent catchSkinComponent))