1
0
mirror of https://github.com/ppy/osu.git synced 2025-03-05 16:02:56 +08:00

Avoid calculating constants in load()

This commit is contained in:
recapitalverb 2020-02-02 22:37:58 +07:00
parent bd3d7a285b
commit 0a186fe722

View File

@ -25,6 +25,7 @@ namespace osu.Game.Overlays.Profile.Sections.Ranks
private const int performance_width = 80; private const int performance_width = 80;
private const float performance_background_shear = 0.45f; private const float performance_background_shear = 0.45f;
private float performance_background_width = performance_width + (height / 4f * MathF.Tan(performance_background_shear));
protected readonly ScoreInfo Score; protected readonly ScoreInfo Score;
@ -45,8 +46,6 @@ namespace osu.Game.Overlays.Profile.Sections.Ranks
[BackgroundDependencyLoader] [BackgroundDependencyLoader]
private void load() private void load()
{ {
float performanceBackgroundWidth = performance_width + (height / 4f * MathF.Tan(performance_background_shear));
AddInternal(new ProfileItemContainer AddInternal(new ProfileItemContainer
{ {
Children = new Drawable[] Children = new Drawable[]
@ -148,7 +147,7 @@ namespace osu.Game.Overlays.Profile.Sections.Ranks
Anchor = Anchor.TopRight, Anchor = Anchor.TopRight,
Origin = Anchor.TopRight, Origin = Anchor.TopRight,
RelativeSizeAxes = Axes.Y, RelativeSizeAxes = Axes.Y,
Width = performanceBackgroundWidth, Width = performance_background_width,
Height = 0.5f, Height = 0.5f,
Colour = colourProvider.Background4, Colour = colourProvider.Background4,
Shear = new Vector2(-performance_background_shear, 0), Shear = new Vector2(-performance_background_shear, 0),
@ -160,7 +159,7 @@ namespace osu.Game.Overlays.Profile.Sections.Ranks
Origin = Anchor.TopRight, Origin = Anchor.TopRight,
RelativeSizeAxes = Axes.Y, RelativeSizeAxes = Axes.Y,
RelativePositionAxes = Axes.Y, RelativePositionAxes = Axes.Y,
Width = performanceBackgroundWidth, Width = performance_background_width,
Height = -0.5f, Height = -0.5f,
Position = new Vector2(0, 1), Position = new Vector2(0, 1),
Colour = colourProvider.Background4, Colour = colourProvider.Background4,