Skip to content

Commit

Permalink
Remove the logic in the legacy skin transformers.
Browse files Browse the repository at this point in the history
  • Loading branch information
andy840119 committed Apr 29, 2023
1 parent d442939 commit e43b2d0
Showing 1 changed file with 0 additions and 34 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,8 @@
using osu.Framework.Bindables;
using osu.Framework.Graphics;
using osu.Game.Beatmaps;
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 @@ -31,22 +29,6 @@ public KaraokeLegacySkinTransformer(ISkin source, IBeatmap beatmap)
{
switch (lookup)
{
case SkinComponentsContainerLookup targetComponent:
switch (targetComponent.Target)
{
case SkinComponentsContainerLookup.TargetArea.MainHUDComponents:
var components = base.GetDrawableComponent(lookup) as Container ?? getTargetComponentsContainerFromOtherPlace();
components?.Add(new SettingButtonsDisplay
{
Anchor = Anchor.CentreRight,
Origin = Anchor.CentreRight,
});
return components;

default:
return base.GetDrawableComponent(lookup);
}

case GameplaySkinComponentLookup<HitResult> resultComponent:
return getResult(resultComponent.Component);

Expand All @@ -67,13 +49,6 @@ public KaraokeLegacySkinTransformer(ISkin source, IBeatmap beatmap)
default:
return base.GetDrawableComponent(lookup);
}

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

private Drawable? getResult(HitResult result)
Expand All @@ -84,14 +59,5 @@ public KaraokeLegacySkinTransformer(ISkin source, IBeatmap beatmap)

public override IBindable<TValue>? GetConfig<TLookup, TValue>(TLookup lookup)
=> karaokeSkin.GetConfig<TLookup, TValue>(lookup);

// it's a temp class for just getting SkinnableTarget.MainHUDComponents
private class TempLegacySkin : LegacySkin
{
public TempLegacySkin(SkinInfo skin)
: base(skin, null, null)
{
}
}
}
}

0 comments on commit e43b2d0

Please sign in to comment.