1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-15 01:52:55 +08:00

Use switch—case instead

This commit is contained in:
Salman Ahmed 2021-05-19 23:37:22 +03:00
parent e20c25b0d9
commit a4d52a7f52

View File

@ -24,19 +24,25 @@ namespace osu.Game.Rulesets.Catch.Skinning.Legacy
public override Drawable GetDrawableComponent(ISkinComponent component) public override Drawable GetDrawableComponent(ISkinComponent component)
{ {
if (component is SkinnableTargetComponent targetComponent && targetComponent.Target == SkinnableTarget.MainHUDComponents) if (component is SkinnableTargetComponent targetComponent)
{ {
if (!providesComboCounter) switch (targetComponent.Target)
return null;
if (Source.GetDrawableComponent(component) is SkinnableTargetComponentsContainer components)
{ {
// catch may provide its own combo counter; hide the default. case SkinnableTarget.MainHUDComponents:
// todo: this should be done in an elegant way per ruleset, defining which HUD skin components should be displayed. if (!providesComboCounter)
foreach (var legacyComboCounter in components.OfType<LegacyComboCounter>()) break;
legacyComboCounter.ContentVisible = false;
return components; if (Source.GetDrawableComponent(component) is SkinnableTargetComponentsContainer components)
{
// catch may provide its own combo counter; hide the default.
// todo: this should be done in an elegant way per ruleset, defining which HUD skin components should be displayed.
foreach (var legacyComboCounter in components.OfType<LegacyComboCounter>())
legacyComboCounter.ContentVisible = false;
return components;
}
break;
} }
return null; return null;