mirror of
https://github.com/ppy/osu.git
synced 2025-02-22 07:23:22 +08:00
Only add legacy key overlay to osu! and catch HUD layers
This commit is contained in:
parent
26395bd443
commit
c3dae81935
@ -356,70 +356,16 @@ namespace osu.Game.Skinning
|
|||||||
switch (lookup)
|
switch (lookup)
|
||||||
{
|
{
|
||||||
case SkinComponentsContainerLookup containerLookup:
|
case SkinComponentsContainerLookup containerLookup:
|
||||||
// Only handle global level defaults for now.
|
|
||||||
if (containerLookup.Ruleset != null)
|
|
||||||
return null;
|
|
||||||
|
|
||||||
switch (containerLookup.Target)
|
switch (containerLookup.Target)
|
||||||
{
|
{
|
||||||
case SkinComponentsContainerLookup.TargetArea.MainHUDComponents:
|
case SkinComponentsContainerLookup.TargetArea.MainHUDComponents:
|
||||||
return new DefaultSkinComponentsContainer(container =>
|
return createDefaultHUDComponents(containerLookup);
|
||||||
{
|
|
||||||
var score = container.OfType<LegacyScoreCounter>().FirstOrDefault();
|
|
||||||
var accuracy = container.OfType<GameplayAccuracyCounter>().FirstOrDefault();
|
|
||||||
|
|
||||||
if (score != null && accuracy != null)
|
default:
|
||||||
{
|
return null;
|
||||||
accuracy.Y = container.ToLocalSpace(score.ScreenSpaceDrawQuad.BottomRight).Y;
|
|
||||||
}
|
|
||||||
|
|
||||||
var songProgress = container.OfType<LegacySongProgress>().FirstOrDefault();
|
|
||||||
|
|
||||||
if (songProgress != null && accuracy != null)
|
|
||||||
{
|
|
||||||
songProgress.Anchor = Anchor.TopRight;
|
|
||||||
songProgress.Origin = Anchor.CentreRight;
|
|
||||||
songProgress.X = -accuracy.ScreenSpaceDeltaToParentSpace(accuracy.ScreenSpaceDrawQuad.Size).X - 18;
|
|
||||||
songProgress.Y = container.ToLocalSpace(accuracy.ScreenSpaceDrawQuad.TopLeft).Y + (accuracy.ScreenSpaceDeltaToParentSpace(accuracy.ScreenSpaceDrawQuad.Size).Y / 2);
|
|
||||||
}
|
|
||||||
|
|
||||||
var hitError = container.OfType<HitErrorMeter>().FirstOrDefault();
|
|
||||||
|
|
||||||
if (hitError != null)
|
|
||||||
{
|
|
||||||
hitError.Anchor = Anchor.BottomCentre;
|
|
||||||
hitError.Origin = Anchor.CentreLeft;
|
|
||||||
hitError.Rotation = -90;
|
|
||||||
}
|
|
||||||
|
|
||||||
var keyCounter = container.OfType<LegacyKeyCounterDisplay>().FirstOrDefault();
|
|
||||||
|
|
||||||
if (keyCounter != null)
|
|
||||||
{
|
|
||||||
// set the anchor to top right so that it won't squash to the return button to the top
|
|
||||||
keyCounter.Anchor = Anchor.CentreRight;
|
|
||||||
keyCounter.Origin = Anchor.CentreRight;
|
|
||||||
keyCounter.X = 0;
|
|
||||||
// 340px is the default height inherit from stable
|
|
||||||
keyCounter.Y = container.ToLocalSpace(new Vector2(0, container.ScreenSpaceDrawQuad.Centre.Y - 340f)).Y;
|
|
||||||
}
|
|
||||||
})
|
|
||||||
{
|
|
||||||
Children = new Drawable[]
|
|
||||||
{
|
|
||||||
new LegacyComboCounter(),
|
|
||||||
new LegacyScoreCounter(),
|
|
||||||
new LegacyAccuracyCounter(),
|
|
||||||
new LegacySongProgress(),
|
|
||||||
new LegacyHealthDisplay(),
|
|
||||||
new BarHitErrorMeter(),
|
|
||||||
new LegacyKeyCounterDisplay(),
|
|
||||||
}
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return null;
|
|
||||||
|
|
||||||
case GameplaySkinComponentLookup<HitResult> resultComponent:
|
case GameplaySkinComponentLookup<HitResult> resultComponent:
|
||||||
|
|
||||||
// kind of wasteful that we throw this away, but should do for now.
|
// kind of wasteful that we throw this away, but should do for now.
|
||||||
@ -442,6 +388,84 @@ namespace osu.Game.Skinning
|
|||||||
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();
|
||||||
|
var accuracy = container.OfType<GameplayAccuracyCounter>().FirstOrDefault();
|
||||||
|
|
||||||
|
if (score != null && accuracy != null)
|
||||||
|
{
|
||||||
|
accuracy.Y = container.ToLocalSpace(score.ScreenSpaceDrawQuad.BottomRight).Y;
|
||||||
|
}
|
||||||
|
|
||||||
|
var songProgress = container.OfType<LegacySongProgress>().FirstOrDefault();
|
||||||
|
|
||||||
|
if (songProgress != null && accuracy != null)
|
||||||
|
{
|
||||||
|
songProgress.Anchor = Anchor.TopRight;
|
||||||
|
songProgress.Origin = Anchor.CentreRight;
|
||||||
|
songProgress.X = -accuracy.ScreenSpaceDeltaToParentSpace(accuracy.ScreenSpaceDrawQuad.Size).X - 18;
|
||||||
|
songProgress.Y = container.ToLocalSpace(accuracy.ScreenSpaceDrawQuad.TopLeft).Y + (accuracy.ScreenSpaceDeltaToParentSpace(accuracy.ScreenSpaceDrawQuad.Size).Y / 2);
|
||||||
|
}
|
||||||
|
|
||||||
|
var hitError = container.OfType<HitErrorMeter>().FirstOrDefault();
|
||||||
|
|
||||||
|
if (hitError != null)
|
||||||
|
{
|
||||||
|
hitError.Anchor = Anchor.BottomCentre;
|
||||||
|
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)
|
||||||
|
{
|
||||||
|
// set the anchor to top right so that it won't squash to the return button to the top
|
||||||
|
keyCounter.Anchor = Anchor.CentreRight;
|
||||||
|
keyCounter.Origin = Anchor.CentreRight;
|
||||||
|
keyCounter.X = 0;
|
||||||
|
// 340px is the default height inherit from stable
|
||||||
|
keyCounter.Y = container.ToLocalSpace(new Vector2(0, container.ScreenSpaceDrawQuad.Centre.Y - 340f)).Y;
|
||||||
|
}
|
||||||
|
})
|
||||||
|
{
|
||||||
|
Children = new Drawable[]
|
||||||
|
{
|
||||||
|
new LegacyKeyCounterDisplay(),
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
default:
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private Texture? getParticleTexture(HitResult result)
|
private Texture? getParticleTexture(HitResult result)
|
||||||
{
|
{
|
||||||
switch (result)
|
switch (result)
|
||||||
|
Loading…
Reference in New Issue
Block a user