1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-14 07:42:57 +08:00

Adjust visual appearance of profile value displays

This commit is contained in:
Bartłomiej Dach 2022-12-31 17:51:58 +01:00
parent f80dddbb5e
commit de077403e9
No known key found for this signature in database
3 changed files with 30 additions and 41 deletions

View File

@ -1,19 +1,17 @@
// 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.
using osu.Framework.Allocation;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Shapes;
using osu.Framework.Localisation;
using osu.Game.Graphics;
using osu.Game.Graphics.Sprites;
using osuTK.Graphics;
namespace osu.Game.Overlays.Profile.Header.Components
{
public partial class OverlinedInfoContainer : CompositeDrawable
public partial class ProfileValueDisplay : CompositeDrawable
{
private readonly Circle line;
private readonly OsuSpriteText title;
private readonly OsuSpriteText content;
@ -27,12 +25,7 @@ namespace osu.Game.Overlays.Profile.Header.Components
set => content.Text = value;
}
public Color4 LineColour
{
set => line.Colour = value;
}
public OverlinedInfoContainer(bool big = false, int minimumWidth = 60)
public ProfileValueDisplay(bool big = false, int minimumWidth = 60)
{
AutoSizeAxes = Axes.Both;
InternalChild = new FillFlowContainer
@ -41,19 +34,13 @@ namespace osu.Game.Overlays.Profile.Header.Components
AutoSizeAxes = Axes.Both,
Children = new Drawable[]
{
line = new Circle
{
RelativeSizeAxes = Axes.X,
Height = 2,
Margin = new MarginPadding { Bottom = 2 }
},
title = new OsuSpriteText
{
Font = OsuFont.GetFont(size: big ? 14 : 12, weight: FontWeight.Bold)
Font = OsuFont.GetFont(size: 12)
},
content = new OsuSpriteText
{
Font = OsuFont.GetFont(size: big ? 40 : 18, weight: FontWeight.Light)
Font = OsuFont.GetFont(size: big ? 30 : 20, weight: FontWeight.Light)
},
new Container // Add a minimum size to the FillFlowContainer
{
@ -62,5 +49,12 @@ namespace osu.Game.Overlays.Profile.Header.Components
}
};
}
[BackgroundDependencyLoader]
private void load(OverlayColourProvider colourProvider)
{
title.Colour = colourProvider.Content1;
content.Colour = colourProvider.Content2;
}
}
}

View File

@ -11,15 +11,15 @@ using osu.Game.Resources.Localisation.Web;
namespace osu.Game.Overlays.Profile.Header.Components
{
public partial class OverlinedTotalPlayTime : CompositeDrawable, IHasTooltip
public partial class TotalPlayTime : CompositeDrawable, IHasTooltip
{
public readonly Bindable<UserProfileData?> User = new Bindable<UserProfileData?>();
public LocalisableString TooltipText { get; set; }
private OverlinedInfoContainer info = null!;
private ProfileValueDisplay info = null!;
public OverlinedTotalPlayTime()
public TotalPlayTime()
{
AutoSizeAxes = Axes.Both;
@ -27,12 +27,11 @@ namespace osu.Game.Overlays.Profile.Header.Components
}
[BackgroundDependencyLoader]
private void load(OverlayColourProvider colourProvider)
private void load()
{
InternalChild = info = new OverlinedInfoContainer
InternalChild = info = new ProfileValueDisplay(minimumWidth: 140)
{
Title = UsersStrings.ShowStatsPlayTime,
LineColour = colourProvider.Highlight1,
};
User.BindValueChanged(updateTime, true);

View File

@ -22,16 +22,16 @@ namespace osu.Game.Overlays.Profile.Header
public partial class DetailHeaderContainer : CompositeDrawable
{
private readonly Dictionary<ScoreRank, ScoreRankInfo> scoreRankInfos = new Dictionary<ScoreRank, ScoreRankInfo>();
private OverlinedInfoContainer medalInfo = null!;
private OverlinedInfoContainer ppInfo = null!;
private OverlinedInfoContainer detailGlobalRank = null!;
private OverlinedInfoContainer detailCountryRank = null!;
private ProfileValueDisplay medalInfo = null!;
private ProfileValueDisplay ppInfo = null!;
private ProfileValueDisplay detailGlobalRank = null!;
private ProfileValueDisplay detailCountryRank = null!;
private RankGraph rankGraph = null!;
public readonly Bindable<UserProfileData?> User = new Bindable<UserProfileData?>();
[BackgroundDependencyLoader]
private void load(OverlayColourProvider colourProvider, OsuColour colours)
private void load(OverlayColourProvider colourProvider)
{
AutoSizeAxes = Axes.Y;
@ -71,19 +71,17 @@ namespace osu.Game.Overlays.Profile.Header
Spacing = new Vector2(10, 0),
Children = new Drawable[]
{
new OverlinedTotalPlayTime
{
User = { BindTarget = User }
},
medalInfo = new OverlinedInfoContainer
medalInfo = new ProfileValueDisplay
{
Title = UsersStrings.ShowStatsMedals,
LineColour = colours.GreenLight,
},
ppInfo = new OverlinedInfoContainer
ppInfo = new ProfileValueDisplay
{
Title = "pp",
LineColour = colours.Red,
},
new TotalPlayTime
{
User = { BindTarget = User }
},
}
},
@ -126,15 +124,13 @@ namespace osu.Game.Overlays.Profile.Header
Spacing = new Vector2(0, 20),
Children = new Drawable[]
{
detailGlobalRank = new OverlinedInfoContainer(true, 110)
detailGlobalRank = new ProfileValueDisplay(true, 110)
{
Title = UsersStrings.ShowRankGlobalSimple,
LineColour = colourProvider.Highlight1,
},
detailCountryRank = new OverlinedInfoContainer(false, 110)
detailCountryRank = new ProfileValueDisplay(false, 110)
{
Title = UsersStrings.ShowRankCountrySimple,
LineColour = colourProvider.Highlight1,
},
}
}