1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-15 10:23:02 +08:00

Adjust appearance of user profile sections

This commit is contained in:
Bartłomiej Dach 2022-12-31 17:32:20 +01:00
parent 3f81f173fb
commit 5b1111c6b1
No known key found for this signature in database
2 changed files with 22 additions and 49 deletions

View File

@ -3,16 +3,15 @@
using osu.Framework.Allocation;
using osu.Framework.Bindables;
using osu.Framework.Extensions.Color4Extensions;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Colour;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Effects;
using osu.Framework.Graphics.Shapes;
using osu.Framework.Localisation;
using osu.Game.Graphics;
using osu.Game.Graphics.Backgrounds;
using osu.Game.Graphics.Containers;
using osu.Game.Graphics.Sprites;
using osuTK;
namespace osu.Game.Overlays.Profile
{
@ -30,22 +29,29 @@ namespace osu.Game.Overlays.Profile
public readonly Bindable<UserProfileData?> User = new Bindable<UserProfileData?>();
private const float outer_gutter_width = 10;
protected ProfileSection()
{
AutoSizeAxes = Axes.Y;
RelativeSizeAxes = Axes.X;
Masking = true;
CornerRadius = 10;
EdgeEffect = new EdgeEffectParameters
{
Type = EdgeEffectType.Shadow,
Offset = new Vector2(0, 1),
Radius = 3,
Colour = Colour4.Black.Opacity(0.25f)
};
InternalChildren = new Drawable[]
{
background = new Box
{
RelativeSizeAxes = Axes.Both,
},
new SectionTriangles
{
Anchor = Anchor.BottomCentre,
Origin = Anchor.BottomCentre,
},
new FillFlowContainer
{
Direction = FillDirection.Vertical,
@ -58,8 +64,8 @@ namespace osu.Game.Overlays.Profile
AutoSizeAxes = Axes.Both,
Margin = new MarginPadding
{
Horizontal = UserProfileOverlay.CONTENT_X_MARGIN,
Top = 15,
Horizontal = UserProfileOverlay.CONTENT_X_MARGIN - outer_gutter_width,
Top = 20,
Bottom = 20,
},
Children = new Drawable[]
@ -67,7 +73,7 @@ namespace osu.Game.Overlays.Profile
new OsuSpriteText
{
Text = Title,
Font = OsuFont.GetFont(size: 20, weight: FontWeight.Bold),
Font = OsuFont.GetFont(size: 16, weight: FontWeight.Bold),
},
underscore = new Box
{
@ -88,7 +94,7 @@ namespace osu.Game.Overlays.Profile
RelativeSizeAxes = Axes.X,
Padding = new MarginPadding
{
Horizontal = UserProfileOverlay.CONTENT_X_MARGIN,
Horizontal = UserProfileOverlay.CONTENT_X_MARGIN - outer_gutter_width,
Bottom = 20
}
},
@ -100,43 +106,8 @@ namespace osu.Game.Overlays.Profile
[BackgroundDependencyLoader]
private void load(OverlayColourProvider colourProvider)
{
background.Colour = colourProvider.Background5;
background.Colour = colourProvider.Background4;
underscore.Colour = colourProvider.Highlight1;
}
private partial class SectionTriangles : Container
{
private readonly Triangles triangles;
private readonly Box foreground;
public SectionTriangles()
{
RelativeSizeAxes = Axes.X;
Height = 100;
Masking = true;
Children = new Drawable[]
{
triangles = new Triangles
{
Anchor = Anchor.BottomCentre,
Origin = Anchor.BottomCentre,
RelativeSizeAxes = Axes.Both,
TriangleScale = 3,
},
foreground = new Box
{
RelativeSizeAxes = Axes.Both,
}
};
}
[BackgroundDependencyLoader]
private void load(OverlayColourProvider colourProvider)
{
triangles.ColourLight = colourProvider.Background4;
triangles.ColourDark = colourProvider.Background5.Darken(0.2f);
foreground.Colour = ColourInfo.GradientVertical(colourProvider.Background5, colourProvider.Background5.Opacity(0));
}
}
}
}

View File

@ -259,7 +259,9 @@ namespace osu.Game.Overlays
Direction = FillDirection.Vertical,
AutoSizeAxes = Axes.Y,
RelativeSizeAxes = Axes.X,
Spacing = new Vector2(0, 20),
Spacing = new Vector2(0, 10),
Padding = new MarginPadding { Horizontal = 10 },
Margin = new MarginPadding { Bottom = 10 },
};
}
}