1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-26 18:52:55 +08:00

Move some sizes as consts.

This commit is contained in:
Huo Yaoyuan 2017-06-15 16:57:34 +08:00
parent 1e0653eff9
commit 74f503874f

View File

@ -26,12 +26,14 @@ namespace osu.Game.Users.Profile
private int[] ranks, performances; private int[] ranks, performances;
private int rank, performance, countryRank; private int rank, performance, countryRank;
private const float primary_textsize = 25, secondary_textsize = 13, padding = 10;
private readonly User user; private readonly User user;
public RankChart(User user) public RankChart(User user)
{ {
this.user = user; this.user = user;
Padding = new MarginPadding { Vertical = 10 }; Padding = new MarginPadding { Vertical = padding };
Children = new Drawable[] Children = new Drawable[]
{ {
rankText = new OsuSpriteText rankText = new OsuSpriteText
@ -39,7 +41,7 @@ namespace osu.Game.Users.Profile
Anchor = Anchor.TopCentre, Anchor = Anchor.TopCentre,
Origin = Anchor.TopCentre, Origin = Anchor.TopCentre,
Font = @"Exo2.0-RegularItalic", Font = @"Exo2.0-RegularItalic",
TextSize = 25 TextSize = primary_textsize
}, },
relativeText = new OsuSpriteText relativeText = new OsuSpriteText
{ {
@ -47,21 +49,21 @@ namespace osu.Game.Users.Profile
Origin = Anchor.TopCentre, Origin = Anchor.TopCentre,
Font = @"Exo2.0-RegularItalic", Font = @"Exo2.0-RegularItalic",
Y = 25, Y = 25,
TextSize = 13 TextSize = secondary_textsize
}, },
performanceText = new OsuSpriteText performanceText = new OsuSpriteText
{ {
Anchor = Anchor.BottomCentre, Anchor = Anchor.BottomCentre,
Origin = Anchor.BottomCentre, Origin = Anchor.BottomCentre,
Font = @"Exo2.0-RegularItalic", Font = @"Exo2.0-RegularItalic",
TextSize = 13 TextSize = secondary_textsize
}, },
graph = new RankChartLineGraph graph = new RankChartLineGraph
{ {
Anchor = Anchor.BottomCentre, Anchor = Anchor.BottomCentre,
Origin = Anchor.BottomCentre, Origin = Anchor.BottomCentre,
RelativeSizeAxes = Axes.X, RelativeSizeAxes = Axes.X,
Y = -13, Y = -secondary_textsize,
DefaultValueCount = 90, DefaultValueCount = 90,
BallRelease = updateRankTexts, BallRelease = updateRankTexts,
BallMove = showHistoryRankTexts BallMove = showHistoryRankTexts
@ -108,7 +110,7 @@ namespace osu.Game.Users.Profile
{ {
if ((invalidation & Invalidation.DrawSize) != 0) if ((invalidation & Invalidation.DrawSize) != 0)
{ {
graph.Height = DrawHeight - 71; graph.Height = DrawHeight - padding * 2 - primary_textsize - secondary_textsize * 2;
} }
return base.Invalidate(invalidation, source, shallPropagate); return base.Invalidate(invalidation, source, shallPropagate);