1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-14 20:22:55 +08:00

Fix shear offset not being included in GameplayLeaderboard's own size

This commit is contained in:
Dean Herbert 2020-12-18 17:30:11 +09:00
parent 668536ce56
commit 615352c1e4
2 changed files with 15 additions and 8 deletions

View File

@ -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);

View File

@ -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,