mirror of
https://github.com/ppy/osu.git
synced 2024-11-11 12:57:36 +08:00
Fix vertical size potentially changing during relayout
This commit is contained in:
parent
e82986b763
commit
668536ce56
@ -25,7 +25,7 @@ namespace osu.Game.Tests.Visual.Gameplay
|
|||||||
Add(leaderboard = new TestGameplayLeaderboard
|
Add(leaderboard = new TestGameplayLeaderboard
|
||||||
{
|
{
|
||||||
Anchor = Anchor.Centre,
|
Anchor = Anchor.Centre,
|
||||||
Origin = Anchor.TopCentre,
|
Origin = Anchor.Centre,
|
||||||
Scale = new Vector2(2),
|
Scale = new Vector2(2),
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -14,7 +14,7 @@ namespace osu.Game.Screens.Play.HUD
|
|||||||
{
|
{
|
||||||
public GameplayLeaderboard()
|
public GameplayLeaderboard()
|
||||||
{
|
{
|
||||||
AutoSizeAxes = Axes.Both;
|
Width = GameplayLeaderboardScore.EXTENDED_WIDTH;
|
||||||
|
|
||||||
Direction = FillDirection.Vertical;
|
Direction = FillDirection.Vertical;
|
||||||
|
|
||||||
@ -30,6 +30,8 @@ namespace osu.Game.Screens.Play.HUD
|
|||||||
base.Add(drawable);
|
base.Add(drawable);
|
||||||
drawable.TotalScore.BindValueChanged(_ => Scheduler.AddOnce(sort), true);
|
drawable.TotalScore.BindValueChanged(_ => Scheduler.AddOnce(sort), true);
|
||||||
|
|
||||||
|
Height = Count * (GameplayLeaderboardScore.PANEL_HEIGHT + Spacing.Y);
|
||||||
|
|
||||||
return drawable;
|
return drawable;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -19,10 +19,11 @@ namespace osu.Game.Screens.Play.HUD
|
|||||||
{
|
{
|
||||||
public class GameplayLeaderboardScore : CompositeDrawable, ILeaderboardScore
|
public class GameplayLeaderboardScore : CompositeDrawable, ILeaderboardScore
|
||||||
{
|
{
|
||||||
private const float regular_width = 215f;
|
public const float EXTENDED_WIDTH = 235f;
|
||||||
private const float extended_width = 235f;
|
|
||||||
|
|
||||||
private const float panel_height = 35f;
|
private const float regular_width = 215f;
|
||||||
|
|
||||||
|
public const float PANEL_HEIGHT = 35f;
|
||||||
|
|
||||||
private OsuSpriteText positionText, scoreText, accuracyText, comboText, usernameText;
|
private OsuSpriteText positionText, scoreText, accuracyText, comboText, usernameText;
|
||||||
|
|
||||||
@ -67,7 +68,7 @@ namespace osu.Game.Screens.Play.HUD
|
|||||||
User = user;
|
User = user;
|
||||||
this.trackedPlayer = trackedPlayer;
|
this.trackedPlayer = trackedPlayer;
|
||||||
|
|
||||||
Size = new Vector2(extended_width, panel_height);
|
Size = new Vector2(EXTENDED_WIDTH, PANEL_HEIGHT);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void LoadComplete()
|
protected override void LoadComplete()
|
||||||
@ -84,13 +85,13 @@ namespace osu.Game.Screens.Play.HUD
|
|||||||
{
|
{
|
||||||
if (scorePosition == 1)
|
if (scorePosition == 1)
|
||||||
{
|
{
|
||||||
mainFillContainer.ResizeWidthTo(extended_width, transition_duration, Easing.OutElastic);
|
mainFillContainer.ResizeWidthTo(EXTENDED_WIDTH, transition_duration, Easing.OutElastic);
|
||||||
panelColour = Color4Extensions.FromHex("7fcc33");
|
panelColour = Color4Extensions.FromHex("7fcc33");
|
||||||
textColour = Color4.White;
|
textColour = Color4.White;
|
||||||
}
|
}
|
||||||
else if (trackedPlayer)
|
else if (trackedPlayer)
|
||||||
{
|
{
|
||||||
mainFillContainer.ResizeWidthTo(extended_width, transition_duration, Easing.OutElastic);
|
mainFillContainer.ResizeWidthTo(EXTENDED_WIDTH, transition_duration, Easing.OutElastic);
|
||||||
panelColour = Color4Extensions.FromHex("ffd966");
|
panelColour = Color4Extensions.FromHex("ffd966");
|
||||||
textColour = Color4Extensions.FromHex("2e576b");
|
textColour = Color4Extensions.FromHex("2e576b");
|
||||||
}
|
}
|
||||||
@ -127,7 +128,7 @@ namespace osu.Game.Screens.Play.HUD
|
|||||||
private void load()
|
private void load()
|
||||||
{
|
{
|
||||||
const float panel_shear = 0.15f;
|
const float panel_shear = 0.15f;
|
||||||
const float shear_width = panel_height * panel_shear;
|
const float shear_width = PANEL_HEIGHT * panel_shear;
|
||||||
|
|
||||||
InternalChildren = new Drawable[]
|
InternalChildren = new Drawable[]
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user