1
0
mirror of https://github.com/ppy/osu.git synced 2025-02-22 03:43:01 +08:00

Only add legacy key overlay to osu! and catch HUD layers

This commit is contained in:
Bartłomiej Dach 2024-07-24 15:41:20 +02:00
parent 26395bd443
commit c3dae81935
No known key found for this signature in database

View File

@ -356,13 +356,44 @@ namespace osu.Game.Skinning
switch (lookup)
{
case SkinComponentsContainerLookup containerLookup:
// Only handle global level defaults for now.
if (containerLookup.Ruleset != null)
return null;
switch (containerLookup.Target)
{
case SkinComponentsContainerLookup.TargetArea.MainHUDComponents:
return createDefaultHUDComponents(containerLookup);
default:
return null;
}
case GameplaySkinComponentLookup<HitResult> resultComponent:
// kind of wasteful that we throw this away, but should do for now.
if (getJudgementAnimation(resultComponent.Component) != null)
{
// TODO: this should be inside the judgement pieces.
Func<Drawable> createDrawable = () => getJudgementAnimation(resultComponent.Component).AsNonNull();
var particle = getParticleTexture(resultComponent.Component);
if (particle != null)
return new LegacyJudgementPieceNew(resultComponent.Component, createDrawable, particle);
return new LegacyJudgementPieceOld(resultComponent.Component, createDrawable);
}
return null;
}
return null;
}
private static DefaultSkinComponentsContainer? createDefaultHUDComponents(SkinComponentsContainerLookup containerLookup)
{
switch (containerLookup.Ruleset?.ShortName)
{
case null:
{
return new DefaultSkinComponentsContainer(container =>
{
var score = container.OfType<LegacyScoreCounter>().FirstOrDefault();
@ -391,7 +422,25 @@ namespace osu.Game.Skinning
hitError.Origin = Anchor.CentreLeft;
hitError.Rotation = -90;
}
})
{
Children = new Drawable[]
{
new LegacyComboCounter(),
new LegacyScoreCounter(),
new LegacyAccuracyCounter(),
new LegacySongProgress(),
new LegacyHealthDisplay(),
new BarHitErrorMeter(),
}
};
}
case @"osu":
case @"fruits":
{
return new DefaultSkinComponentsContainer(container =>
{
var keyCounter = container.OfType<LegacyKeyCounterDisplay>().FirstOrDefault();
if (keyCounter != null)
@ -407,39 +456,14 @@ namespace osu.Game.Skinning
{
Children = new Drawable[]
{
new LegacyComboCounter(),
new LegacyScoreCounter(),
new LegacyAccuracyCounter(),
new LegacySongProgress(),
new LegacyHealthDisplay(),
new BarHitErrorMeter(),
new LegacyKeyCounterDisplay(),
}
};
}
return null;
case GameplaySkinComponentLookup<HitResult> resultComponent:
// kind of wasteful that we throw this away, but should do for now.
if (getJudgementAnimation(resultComponent.Component) != null)
{
// TODO: this should be inside the judgement pieces.
Func<Drawable> createDrawable = () => getJudgementAnimation(resultComponent.Component).AsNonNull();
var particle = getParticleTexture(resultComponent.Component);
if (particle != null)
return new LegacyJudgementPieceNew(resultComponent.Component, createDrawable, particle);
return new LegacyJudgementPieceOld(resultComponent.Component, createDrawable);
}
default:
return null;
}
return null;
}
private Texture? getParticleTexture(HitResult result)