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

Fix performance background width

This commit is contained in:
recapitalverb 2020-02-02 21:08:16 +07:00
parent a641069ec2
commit 79efcbd6f3

View File

@ -1,10 +1,10 @@
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence. // Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text. // See the LICENCE file in the repository root for full licence text.
using System;
using System.Linq; using System.Linq;
using JetBrains.Annotations; using JetBrains.Annotations;
using osu.Framework.Allocation; using osu.Framework.Allocation;
using osu.Framework.Extensions.Color4Extensions;
using osu.Framework.Graphics; using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Shapes; using osu.Framework.Graphics.Shapes;
@ -16,14 +16,16 @@ using osu.Game.Online.Leaderboards;
using osu.Game.Rulesets.UI; using osu.Game.Rulesets.UI;
using osu.Game.Scoring; using osu.Game.Scoring;
using osuTK; using osuTK;
using osuTK.Graphics;
namespace osu.Game.Overlays.Profile.Sections.Ranks namespace osu.Game.Overlays.Profile.Sections.Ranks
{ {
public class DrawableProfileScore : CompositeDrawable public class DrawableProfileScore : CompositeDrawable
{ {
private const int height = 40;
private const int performance_width = 80; private const int performance_width = 80;
private const float performance_background_shear = 0.45f;
protected readonly ScoreInfo Score; protected readonly ScoreInfo Score;
[Resolved] [Resolved]
@ -37,12 +39,14 @@ namespace osu.Game.Overlays.Profile.Sections.Ranks
Score = score; Score = score;
RelativeSizeAxes = Axes.X; RelativeSizeAxes = Axes.X;
Height = 40; Height = height;
} }
[BackgroundDependencyLoader] [BackgroundDependencyLoader]
private void load() private void load()
{ {
float performance_background_width = performance_width + (height / 4f * MathF.Tan(performance_background_shear));
AddInternal(new ProfileItemContainer AddInternal(new ProfileItemContainer
{ {
Children = new Drawable[] Children = new Drawable[]
@ -143,22 +147,24 @@ namespace osu.Game.Overlays.Profile.Sections.Ranks
{ {
Anchor = Anchor.TopRight, Anchor = Anchor.TopRight,
Origin = Anchor.TopRight, Origin = Anchor.TopRight,
RelativeSizeAxes = Axes.Both, RelativeSizeAxes = Axes.Y,
Size = new Vector2(1.06f, 0.5f), Width = performance_background_width,
Height = 0.5f,
Colour = colourProvider.Background4, Colour = colourProvider.Background4,
Shear = new Vector2(-0.45f, 0), Shear = new Vector2(-performance_background_shear, 0),
EdgeSmoothness = new Vector2(2, 0), EdgeSmoothness = new Vector2(2, 0),
}, },
new Box new Box
{ {
Anchor = Anchor.TopRight, Anchor = Anchor.TopRight,
Origin = Anchor.TopRight, Origin = Anchor.TopRight,
RelativeSizeAxes = Axes.Both, RelativeSizeAxes = Axes.Y,
RelativePositionAxes = Axes.Y, RelativePositionAxes = Axes.Y,
Size = new Vector2(1.06f, -0.5f), Width = performance_background_width,
Height = -0.5f,
Position = new Vector2(0, 1), Position = new Vector2(0, 1),
Colour = colourProvider.Background4, Colour = colourProvider.Background4,
Shear = new Vector2(0.45f, 0), Shear = new Vector2(performance_background_shear, 0),
EdgeSmoothness = new Vector2(2, 0), EdgeSmoothness = new Vector2(2, 0),
}, },
createDrawablePerformance().With(d => createDrawablePerformance().With(d =>