Skip to content

Commit

Permalink
Should just use "as container" instead.
Browse files Browse the repository at this point in the history
  • Loading branch information
andy840119 committed Mar 2, 2023
1 parent ae85cf9 commit e062da5
Showing 1 changed file with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
using osu.Game.Rulesets.Karaoke.UI.HUD;
using osu.Game.Rulesets.Scoring;
using osu.Game.Skinning;
using Container = osu.Framework.Graphics.Containers.Container;

namespace osu.Game.Rulesets.Karaoke.Skinning.Legacy
{
Expand All @@ -34,7 +35,7 @@ public KaraokeLegacySkinTransformer(ISkin source, IBeatmap beatmap)
switch (targetComponent.Target)
{
case SkinComponentsContainerLookup.TargetArea.MainHUDComponents:
var components = base.GetDrawableComponent(lookup) as SkinnableTargetComponentsContainer ?? getTargetComponentsContainerFromOtherPlace();
var components = base.GetDrawableComponent(lookup) as Container ?? getTargetComponentsContainerFromOtherPlace();
components?.Add(new SettingButtonsDisplay
{
Anchor = Anchor.CentreRight,
Expand Down Expand Up @@ -67,10 +68,10 @@ public KaraokeLegacySkinTransformer(ISkin source, IBeatmap beatmap)
return base.GetDrawableComponent(lookup);
}

SkinnableTargetComponentsContainer? getTargetComponentsContainerFromOtherPlace() =>
Container? getTargetComponentsContainerFromOtherPlace() =>
Skin switch
{
LegacySkin legacySkin => new TempLegacySkin(legacySkin.SkinInfo.Value).GetDrawableComponent(lookup) as SkinnableTargetComponentsContainer,
LegacySkin legacySkin => new TempLegacySkin(legacySkin.SkinInfo.Value).GetDrawableComponent(lookup) as Container,
_ => throw new InvalidCastException()
};
}
Expand Down

0 comments on commit e062da5

Please sign in to comment.