mirror of
https://github.com/ppy/osu.git
synced 2024-11-06 06:57:39 +08:00
Correct top-right element offset by finding the lower top anchor element
This commit is contained in:
parent
ca74cf824c
commit
6983978c98
@ -16,6 +16,7 @@ using osu.Game.Rulesets.Mods;
|
||||
using osu.Game.Rulesets.Scoring;
|
||||
using osu.Game.Rulesets.UI;
|
||||
using osu.Game.Screens.Play.HUD;
|
||||
using osu.Game.Skinning;
|
||||
using osuTK;
|
||||
using osuTK.Input;
|
||||
|
||||
@ -65,6 +66,8 @@ namespace osu.Game.Screens.Play
|
||||
private readonly FillFlowContainer bottomRightElements;
|
||||
private readonly FillFlowContainer topRightElements;
|
||||
|
||||
private Container mainUIElements;
|
||||
|
||||
private IEnumerable<Drawable> hideTargets => new Drawable[] { visibilityContainer, KeyCounter };
|
||||
|
||||
public HUDOverlay(ScoreProcessor scoreProcessor, HealthProcessor healthProcessor, DrawableRuleset drawableRuleset, IReadOnlyList<Mod> mods)
|
||||
@ -89,7 +92,7 @@ namespace osu.Game.Screens.Play
|
||||
{
|
||||
new Drawable[]
|
||||
{
|
||||
new Container
|
||||
mainUIElements = new Container
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Children = new Drawable[]
|
||||
@ -205,7 +208,17 @@ namespace osu.Game.Screens.Play
|
||||
{
|
||||
base.Update();
|
||||
|
||||
topRightElements.Y = ToLocalSpace(ScoreCounter.Drawable.ScreenSpaceDrawQuad.BottomRight).Y;
|
||||
float topRightOffset = 0;
|
||||
|
||||
// fetch the bottom-most position of any main ui element that is anchored to the top of the screen.
|
||||
// consider this kind of temporary.
|
||||
foreach (var d in mainUIElements)
|
||||
{
|
||||
if (d is SkinnableDrawable sd && (sd.Drawable.Anchor & Anchor.y0) > 0)
|
||||
topRightOffset = Math.Max(sd.Drawable.ScreenSpaceDrawQuad.BottomRight.Y, topRightOffset);
|
||||
}
|
||||
|
||||
topRightElements.Y = ToLocalSpace(new Vector2(0, topRightOffset)).Y;
|
||||
bottomRightElements.Y = -Progress.Height;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user