Move user stats into detail header container

This commit is contained in:
Bartłomiej Dach 2022-12-31 19:00:40 +01:00
parent 7a475d9cf8
commit f7c942ac10
No known key found for this signature in database
3 changed files with 46 additions and 5 deletions

View File

@ -17,7 +17,7 @@ namespace osu.Game.Overlays.Profile.Header.Components
{
public partial class ExtendedDetails : CompositeDrawable
{
public Bindable<UserProfile?> UserProfile { get; } = new Bindable<UserProfile?>();
public Bindable<UserProfileData?> User { get; } = new Bindable<UserProfileData?>();
private SpriteText rankedScore = null!;
private SpriteText hitAccuracy = null!;
@ -46,6 +46,7 @@ namespace osu.Game.Overlays.Profile.Header.Components
new FillFlowContainer
{
Name = @"Labels",
AutoSizeAxes = Axes.Both,
Direction = FillDirection.Vertical,
Spacing = new Vector2(0, vertical_spacing),
Children = new Drawable[]
@ -62,6 +63,7 @@ namespace osu.Game.Overlays.Profile.Header.Components
new FillFlowContainer
{
Name = @"Values",
AutoSizeAxes = Axes.Both,
Direction = FillDirection.Vertical,
Spacing = new Vector2(0, vertical_spacing),
Children = new Drawable[]
@ -83,7 +85,7 @@ namespace osu.Game.Overlays.Profile.Header.Components
{
base.LoadComplete();
UserProfile.BindValueChanged(userProfile => updateStatistics(userProfile.NewValue?.User.Statistics), true);
User.BindValueChanged(user => updateStatistics(user.NewValue?.User.Statistics), true);
}
private void updateStatistics(UserStatistics? statistics)

View File

@ -40,7 +40,6 @@ namespace osu.Game.Overlays.Profile.Header.Components
AutoSizeDuration = 200,
AutoSizeEasing = Easing.OutQuint,
Masking = true,
Padding = new MarginPadding { Horizontal = UserProfileOverlay.CONTENT_X_MARGIN, Vertical = 10 },
Direction = FillDirection.Vertical,
Spacing = new Vector2(0, 15),
Children = new Drawable[]

View File

@ -26,10 +26,50 @@ namespace osu.Game.Overlays.Profile.Header
RelativeSizeAxes = Axes.Both,
Colour = colourProvider.Background5,
},
new MainDetails
new Container
{
RelativeSizeAxes = Axes.X,
User = { BindTarget = User }
AutoSizeAxes = Axes.Y,
Padding = new MarginPadding { Horizontal = UserProfileOverlay.CONTENT_X_MARGIN, Vertical = 10 },
Child = new GridContainer
{
RelativeSizeAxes = Axes.X,
AutoSizeAxes = Axes.Y,
RowDimensions = new[]
{
new Dimension(GridSizeMode.AutoSize),
},
ColumnDimensions = new[]
{
new Dimension(),
new Dimension(GridSizeMode.AutoSize),
new Dimension(GridSizeMode.AutoSize),
},
Content = new[]
{
new Drawable[]
{
new MainDetails
{
RelativeSizeAxes = Axes.X,
User = { BindTarget = User }
},
new Box
{
RelativeSizeAxes = Axes.Y,
Width = 2,
Colour = colourProvider.Background6,
Margin = new MarginPadding { Horizontal = 15 }
},
new ExtendedDetails
{
Anchor = Anchor.CentreLeft,
Origin = Anchor.CentreLeft,
User = { BindTarget = User }
}
}
}
}
}
};
}