From 615352c1e41a13c9dc189003aeb4ee2b8a3f95df Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 18 Dec 2020 17:30:11 +0900 Subject: [PATCH] Fix shear offset not being included in GameplayLeaderboard's own size --- osu.Game/Screens/Play/HUD/GameplayLeaderboard.cs | 9 +++++++-- .../Screens/Play/HUD/GameplayLeaderboardScore.cs | 14 ++++++++------ 2 files changed, 15 insertions(+), 8 deletions(-) diff --git a/osu.Game/Screens/Play/HUD/GameplayLeaderboard.cs b/osu.Game/Screens/Play/HUD/GameplayLeaderboard.cs index 99319c0008..aa668cc4c8 100644 --- a/osu.Game/Screens/Play/HUD/GameplayLeaderboard.cs +++ b/osu.Game/Screens/Play/HUD/GameplayLeaderboard.cs @@ -14,7 +14,7 @@ namespace osu.Game.Screens.Play.HUD { public GameplayLeaderboard() { - Width = GameplayLeaderboardScore.EXTENDED_WIDTH; + Width = GameplayLeaderboardScore.EXTENDED_WIDTH + GameplayLeaderboardScore.SHEAR_WIDTH; Direction = FillDirection.Vertical; @@ -26,7 +26,12 @@ namespace osu.Game.Screens.Play.HUD public ILeaderboardScore AddPlayer(User user, bool isTracked) { - var drawable = new GameplayLeaderboardScore(user, isTracked); + var drawable = new GameplayLeaderboardScore(user, isTracked) + { + Anchor = Anchor.TopRight, + Origin = Anchor.TopRight, + }; + base.Add(drawable); drawable.TotalScore.BindValueChanged(_ => Scheduler.AddOnce(sort), true); diff --git a/osu.Game/Screens/Play/HUD/GameplayLeaderboardScore.cs b/osu.Game/Screens/Play/HUD/GameplayLeaderboardScore.cs index 242e7ff6b9..5c4b4406cc 100644 --- a/osu.Game/Screens/Play/HUD/GameplayLeaderboardScore.cs +++ b/osu.Game/Screens/Play/HUD/GameplayLeaderboardScore.cs @@ -16,6 +16,7 @@ using osuTK; using osuTK.Graphics; namespace osu.Game.Screens.Play.HUD + { public class GameplayLeaderboardScore : CompositeDrawable, ILeaderboardScore { @@ -25,6 +26,10 @@ namespace osu.Game.Screens.Play.HUD public const float PANEL_HEIGHT = 35f; + public const float SHEAR_WIDTH = PANEL_HEIGHT * panel_shear; + + private const float panel_shear = 0.15f; + private OsuSpriteText positionText, scoreText, accuracyText, comboText, usernameText; public BindableDouble TotalScore { get; } = new BindableDouble(); @@ -127,9 +132,6 @@ namespace osu.Game.Screens.Play.HUD [BackgroundDependencyLoader] private void load() { - const float panel_shear = 0.15f; - const float shear_width = PANEL_HEIGHT * panel_shear; - InternalChildren = new Drawable[] { mainFillContainer = new Container @@ -165,7 +167,7 @@ namespace osu.Game.Screens.Play.HUD { positionText = new OsuSpriteText { - Padding = new MarginPadding { Right = shear_width / 2 }, + Padding = new MarginPadding { Right = SHEAR_WIDTH / 2 }, Anchor = Anchor.Centre, Origin = Anchor.Centre, Colour = Color4.White, @@ -174,7 +176,7 @@ namespace osu.Game.Screens.Play.HUD }, new Container { - Padding = new MarginPadding { Horizontal = shear_width / 3 }, + Padding = new MarginPadding { Horizontal = SHEAR_WIDTH / 3 }, RelativeSizeAxes = Axes.Both, Children = new Drawable[] { @@ -196,7 +198,7 @@ namespace osu.Game.Screens.Play.HUD }, usernameText = new OsuSpriteText { - Padding = new MarginPadding { Left = shear_width }, + Padding = new MarginPadding { Left = SHEAR_WIDTH }, RelativeSizeAxes = Axes.X, Width = 0.8f, Anchor = Anchor.CentreLeft,