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

Merge pull request #24204 from peppy/results-screen-component-metrics

Touch up various results screen component's metrics
This commit is contained in:
Bartłomiej Dach 2023-07-13 22:03:49 +02:00 committed by GitHub
commit 96e4b8d792
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
13 changed files with 131 additions and 82 deletions

View File

@ -412,7 +412,7 @@ namespace osu.Game.Rulesets.Mania
RelativeSizeAxes = Axes.X,
Height = 250
}, true),
new StatisticItem("Statistics", () => new SimpleStatisticTable(3, new SimpleStatisticItem[]
new StatisticItem("Statistics", () => new SimpleStatisticTable(2, new SimpleStatisticItem[]
{
new AverageHitError(score.HitEvents),
new UnstableRate(score.HitEvents)

View File

@ -319,7 +319,7 @@ namespace osu.Game.Rulesets.Osu
RelativeSizeAxes = Axes.X,
Height = 250
}, true),
new StatisticItem("Statistics", () => new SimpleStatisticTable(3, new SimpleStatisticItem[]
new StatisticItem("Statistics", () => new SimpleStatisticTable(2, new SimpleStatisticItem[]
{
new AverageHitError(timedHitEvents),
new UnstableRate(timedHitEvents)

View File

@ -11,6 +11,7 @@ using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Shapes;
using osu.Framework.Utils;
using osu.Game.Beatmaps;
using osu.Game.Graphics;
using osu.Game.Graphics.Sprites;
using osu.Game.Rulesets.Osu.Objects;
using osu.Game.Scoring;
@ -120,18 +121,22 @@ namespace osu.Game.Rulesets.Osu.Statistics
new OsuSpriteText
{
Text = "Overshoot",
Font = OsuFont.GetFont(size: 12),
Anchor = Anchor.Centre,
Origin = Anchor.BottomCentre,
Padding = new MarginPadding(3),
Origin = Anchor.BottomLeft,
Padding = new MarginPadding(2),
Rotation = -rotation,
RelativePositionAxes = Axes.Both,
Y = -(inner_portion + line_extension) / 2,
},
new OsuSpriteText
{
Text = "Undershoot",
Font = OsuFont.GetFont(size: 12),
Anchor = Anchor.Centre,
Origin = Anchor.TopCentre,
Padding = new MarginPadding(3),
Origin = Anchor.TopRight,
Rotation = -rotation,
Padding = new MarginPadding(2),
RelativePositionAxes = Axes.Both,
Y = (inner_portion + line_extension) / 2,
},

View File

@ -256,7 +256,7 @@ namespace osu.Game.Rulesets.Taiko
RelativeSizeAxes = Axes.X,
Height = 250
}, true),
new StatisticItem("Statistics", () => new SimpleStatisticTable(3, new SimpleStatisticItem[]
new StatisticItem("Statistics", () => new SimpleStatisticTable(2, new SimpleStatisticItem[]
{
new AverageHitError(timedHitEvents),
new UnstableRate(timedHitEvents)

View File

@ -131,14 +131,11 @@ namespace osu.Game.Screens.Ranking.Statistics
Container axisFlow;
const float axis_font_size = 12;
Padding = new MarginPadding { Horizontal = 5 };
InternalChild = new GridContainer
{
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
RelativeSizeAxes = Axes.Both,
Width = 0.8f,
Content = new[]
{
new Drawable[]
@ -154,7 +151,7 @@ namespace osu.Game.Screens.Ranking.Statistics
axisFlow = new Container
{
RelativeSizeAxes = Axes.X,
Height = axis_font_size,
Height = StatisticItem.FONT_SIZE,
}
},
},
@ -174,7 +171,7 @@ namespace osu.Game.Screens.Ranking.Statistics
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
Text = "0",
Font = OsuFont.GetFont(size: axis_font_size, weight: FontWeight.SemiBold)
Font = OsuFont.GetFont(size: StatisticItem.FONT_SIZE, weight: FontWeight.SemiBold)
});
for (int i = 1; i <= axis_points; i++)
@ -191,7 +188,7 @@ namespace osu.Game.Screens.Ranking.Statistics
X = -position / 2,
Alpha = alpha,
Text = axisValue.ToString("-0"),
Font = OsuFont.GetFont(size: axis_font_size, weight: FontWeight.SemiBold)
Font = OsuFont.GetFont(size: StatisticItem.FONT_SIZE, weight: FontWeight.SemiBold)
});
axisFlow.Add(new OsuSpriteText
@ -202,7 +199,7 @@ namespace osu.Game.Screens.Ranking.Statistics
X = position / 2,
Alpha = alpha,
Text = axisValue.ToString("+0"),
Font = OsuFont.GetFont(size: axis_font_size, weight: FontWeight.SemiBold)
Font = OsuFont.GetFont(size: StatisticItem.FONT_SIZE, weight: FontWeight.SemiBold)
});
}
}

View File

@ -97,7 +97,7 @@ namespace osu.Game.Screens.Ranking.Statistics
{
Origin = Anchor.CentreLeft,
Anchor = Anchor.CentreLeft,
Font = OsuFont.GetFont(weight: FontWeight.Regular, size: 18),
Font = OsuFont.GetFont(weight: FontWeight.Regular, size: StatisticItem.FONT_SIZE),
Text = "Achieved PP",
Colour = Color4Extensions.FromHex("#66FFCC")
},
@ -105,7 +105,7 @@ namespace osu.Game.Screens.Ranking.Statistics
{
Origin = Anchor.CentreRight,
Anchor = Anchor.CentreRight,
Font = OsuFont.GetFont(weight: FontWeight.SemiBold, size: 18),
Font = OsuFont.GetFont(weight: FontWeight.SemiBold, size: StatisticItem.FONT_SIZE),
Colour = Color4Extensions.FromHex("#66FFCC")
}
},
@ -115,7 +115,7 @@ namespace osu.Game.Screens.Ranking.Statistics
{
Origin = Anchor.CentreLeft,
Anchor = Anchor.CentreLeft,
Font = OsuFont.GetFont(weight: FontWeight.Regular, size: 18),
Font = OsuFont.GetFont(weight: FontWeight.Regular, size: StatisticItem.FONT_SIZE),
Text = "Maximum",
Colour = OsuColour.Gray(0.7f)
},
@ -123,7 +123,7 @@ namespace osu.Game.Screens.Ranking.Statistics
{
Origin = Anchor.CentreLeft,
Anchor = Anchor.CentreLeft,
Font = OsuFont.GetFont(weight: FontWeight.Regular, size: 18),
Font = OsuFont.GetFont(weight: FontWeight.Regular, size: StatisticItem.FONT_SIZE),
Colour = OsuColour.Gray(0.7f)
}
}
@ -208,7 +208,7 @@ namespace osu.Game.Screens.Ranking.Statistics
{
Origin = Anchor.CentreLeft,
Anchor = Anchor.CentreLeft,
Font = OsuFont.GetFont(weight: FontWeight.Regular),
Font = OsuFont.GetFont(weight: FontWeight.Regular, size: StatisticItem.FONT_SIZE),
Text = attribute.DisplayName,
Colour = Colour4.White
},
@ -233,7 +233,7 @@ namespace osu.Game.Screens.Ranking.Statistics
{
Origin = Anchor.CentreRight,
Anchor = Anchor.CentreRight,
Font = OsuFont.GetFont(weight: FontWeight.SemiBold),
Font = OsuFont.GetFont(weight: FontWeight.SemiBold, size: StatisticItem.FONT_SIZE),
Text = percentage.ToLocalisableString("0%"),
Colour = Colour4.White
}

View File

@ -44,13 +44,13 @@ namespace osu.Game.Screens.Ranking.Statistics
Text = Name,
Anchor = Anchor.CentreLeft,
Origin = Anchor.CentreLeft,
Font = OsuFont.GetFont(size: 14)
Font = OsuFont.GetFont(size: StatisticItem.FONT_SIZE)
},
value = new OsuSpriteText
{
Anchor = Anchor.CentreRight,
Origin = Anchor.CentreRight,
Font = OsuFont.GetFont(size: 14, weight: FontWeight.Bold)
Font = OsuFont.GetFont(size: StatisticItem.FONT_SIZE, weight: FontWeight.Bold)
}
});
}

View File

@ -98,12 +98,11 @@ namespace osu.Game.Screens.Ranking.Statistics
Direction = FillDirection.Vertical
};
private partial class Spacer : CompositeDrawable
public partial class Spacer : CompositeDrawable
{
public Spacer()
{
RelativeSizeAxes = Axes.Both;
Padding = new MarginPadding { Vertical = 4 };
InternalChild = new CircularContainer
{

View File

@ -12,6 +12,11 @@ namespace osu.Game.Screens.Ranking.Statistics
/// </summary>
public class StatisticItem
{
/// <summary>
/// The recommended font size to use in statistic items to make sure they match others.
/// </summary>
public const float FONT_SIZE = 13;
/// <summary>
/// The name of this item.
/// </summary>

View File

@ -3,6 +3,7 @@
using osu.Framework.Extensions.Color4Extensions;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Colour;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Shapes;
using osu.Framework.Localisation;
@ -15,42 +16,53 @@ namespace osu.Game.Screens.Ranking.Statistics
/// <summary>
/// Wraps a <see cref="StatisticItem"/> to add a header and suitable layout for use in <see cref="ResultsScreen"/>.
/// </summary>
internal partial class StatisticContainer : CompositeDrawable
internal partial class StatisticItemContainer : CompositeDrawable
{
/// <summary>
/// Creates a new <see cref="StatisticContainer"/>.
/// Creates a new <see cref="StatisticItemContainer"/>.
/// </summary>
/// <param name="item">The <see cref="StatisticItem"/> to display.</param>
public StatisticContainer(StatisticItem item)
public StatisticItemContainer(StatisticItem item)
{
RelativeSizeAxes = Axes.X;
AutoSizeAxes = Axes.Y;
InternalChild = new GridContainer
Padding = new MarginPadding(5);
InternalChild = new Container
{
RelativeSizeAxes = Axes.X,
AutoSizeAxes = Axes.Y,
Content = new[]
Masking = true,
CornerRadius = 6,
Children = new Drawable[]
{
new[]
new Box
{
createHeader(item)
Colour = ColourInfo.GradientVertical(
OsuColour.Gray(0.25f),
OsuColour.Gray(0.18f)
),
Alpha = 0.95f,
RelativeSizeAxes = Axes.Both,
},
new Drawable[]
new Container
{
new Container
RelativeSizeAxes = Axes.X,
AutoSizeAxes = Axes.Y,
Padding = new MarginPadding(5),
Children = new[]
{
RelativeSizeAxes = Axes.X,
AutoSizeAxes = Axes.Y,
Margin = new MarginPadding { Top = 15 },
Child = item.CreateContent()
createHeader(item),
new Container
{
RelativeSizeAxes = Axes.X,
AutoSizeAxes = Axes.Y,
Padding = new MarginPadding(10) { Top = 30 },
Child = item.CreateContent()
}
}
},
},
RowDimensions = new[]
{
new Dimension(GridSizeMode.AutoSize),
new Dimension(GridSizeMode.AutoSize),
}
};
}
@ -63,7 +75,7 @@ namespace osu.Game.Screens.Ranking.Statistics
return new FillFlowContainer
{
RelativeSizeAxes = Axes.X,
AutoSizeAxes = Axes.Y,
Height = 20,
Direction = FillDirection.Horizontal,
Spacing = new Vector2(5, 0),
Children = new Drawable[]
@ -81,7 +93,7 @@ namespace osu.Game.Screens.Ranking.Statistics
Anchor = Anchor.CentreLeft,
Origin = Anchor.CentreLeft,
Text = item.Name,
Font = OsuFont.GetFont(size: 14, weight: FontWeight.SemiBold),
Font = OsuFont.GetFont(size: StatisticItem.FONT_SIZE, weight: FontWeight.SemiBold),
}
}
};

View File

@ -124,20 +124,23 @@ namespace osu.Game.Screens.Ranking.Statistics
}
else
{
FillFlowContainer rows;
FillFlowContainer flow;
container = new OsuScrollContainer(Direction.Vertical)
{
RelativeSizeAxes = Axes.Both,
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
Masking = false,
ScrollbarOverlapsContent = false,
Alpha = 0,
Children = new[]
{
rows = new FillFlowContainer
flow = new FillFlowContainer
{
RelativeSizeAxes = Axes.X,
AutoSizeAxes = Axes.Y,
Spacing = new Vector2(30, 15)
Spacing = new Vector2(30, 15),
Direction = FillDirection.Full,
}
}
};
@ -146,35 +149,22 @@ namespace osu.Game.Screens.Ranking.Statistics
foreach (var item in statisticItems)
{
var columnContent = new List<Drawable>();
if (!hitEventsAvailable && item.RequiresHitEvents)
{
anyRequiredHitEvents = true;
continue;
}
columnContent.Add(new StatisticContainer(item)
{
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
});
rows.Add(new GridContainer
flow.Add(new StatisticItemContainer(item)
{
Anchor = Anchor.TopCentre,
Origin = Anchor.TopCentre,
RelativeSizeAxes = Axes.X,
AutoSizeAxes = Axes.Y,
Content = new[] { columnContent.ToArray() },
ColumnDimensions = new[] { new Dimension() },
RowDimensions = new[] { new Dimension(GridSizeMode.AutoSize) }
});
}
if (anyRequiredHitEvents)
{
rows.Add(new FillFlowContainer
flow.Add(new FillFlowContainer
{
RelativeSizeAxes = Axes.X,
AutoSizeAxes = Axes.Y,

View File

@ -7,7 +7,6 @@ using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Game.Graphics.UserInterface;
using osu.Game.Online.Solo;
using osuTK;
namespace osu.Game.Screens.Ranking.Statistics.User
{
@ -18,7 +17,7 @@ namespace osu.Game.Screens.Ranking.Statistics.User
public Bindable<SoloStatisticsUpdate?> StatisticsUpdate { get; } = new Bindable<SoloStatisticsUpdate?>();
private LoadingLayer loadingLayer = null!;
private FillFlowContainer content = null!;
private GridContainer content = null!;
[BackgroundDependencyLoader]
private void load()
@ -33,21 +32,47 @@ namespace osu.Game.Screens.Ranking.Statistics.User
{
RelativeSizeAxes = Axes.Both,
},
content = new FillFlowContainer
content = new GridContainer
{
AlwaysPresent = true,
RelativeSizeAxes = Axes.X,
AutoSizeAxes = Axes.Y,
Direction = FillDirection.Vertical,
Spacing = new Vector2(10),
Children = new Drawable[]
ColumnDimensions = new[]
{
new GlobalRankChangeRow { StatisticsUpdate = { BindTarget = StatisticsUpdate } },
new AccuracyChangeRow { StatisticsUpdate = { BindTarget = StatisticsUpdate } },
new MaximumComboChangeRow { StatisticsUpdate = { BindTarget = StatisticsUpdate } },
new RankedScoreChangeRow { StatisticsUpdate = { BindTarget = StatisticsUpdate } },
new TotalScoreChangeRow { StatisticsUpdate = { BindTarget = StatisticsUpdate } },
new PerformancePointsChangeRow { StatisticsUpdate = { BindTarget = StatisticsUpdate } }
new Dimension(),
new Dimension(GridSizeMode.Absolute, 30),
new Dimension(),
},
RowDimensions = new[]
{
new Dimension(GridSizeMode.AutoSize),
new Dimension(GridSizeMode.Absolute, 10),
new Dimension(GridSizeMode.AutoSize),
new Dimension(GridSizeMode.Absolute, 10),
new Dimension(GridSizeMode.AutoSize),
},
Content = new[]
{
new Drawable[]
{
new GlobalRankChangeRow { StatisticsUpdate = { BindTarget = StatisticsUpdate } },
new SimpleStatisticTable.Spacer(),
new PerformancePointsChangeRow { StatisticsUpdate = { BindTarget = StatisticsUpdate } },
},
new Drawable[] { },
new Drawable[]
{
new MaximumComboChangeRow { StatisticsUpdate = { BindTarget = StatisticsUpdate } },
new SimpleStatisticTable.Spacer(),
new AccuracyChangeRow { StatisticsUpdate = { BindTarget = StatisticsUpdate } },
},
new Drawable[] { },
new Drawable[]
{
new RankedScoreChangeRow { StatisticsUpdate = { BindTarget = StatisticsUpdate } },
new SimpleStatisticTable.Spacer(),
new TotalScoreChangeRow { StatisticsUpdate = { BindTarget = StatisticsUpdate } },
}
}
}
};

View File

@ -6,6 +6,7 @@ using osu.Framework.Allocation;
using osu.Framework.Bindables;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Shapes;
using osu.Framework.Graphics.Sprites;
using osu.Framework.Localisation;
using osu.Game.Graphics;
@ -46,14 +47,15 @@ namespace osu.Game.Screens.Ranking.Statistics.User
new OsuSpriteText
{
Text = Label,
Font = OsuFont.Default.With(size: 18)
Font = OsuFont.Default.With(size: StatisticItem.FONT_SIZE)
},
new FillFlowContainer
{
Anchor = Anchor.TopRight,
Origin = Anchor.TopRight,
Direction = FillDirection.Vertical,
AutoSizeAxes = Axes.Both,
AutoSizeAxes = Axes.X,
Height = StatisticItem.FONT_SIZE * 2,
Children = new Drawable[]
{
new FillFlowContainer
@ -65,17 +67,31 @@ namespace osu.Game.Screens.Ranking.Statistics.User
Spacing = new Vector2(5),
Children = new Drawable[]
{
changeIcon = new SpriteIcon
new Container
{
Size = new Vector2(14),
Anchor = Anchor.CentreRight,
Origin = Anchor.CentreRight,
Size = new Vector2(18)
Children = new Drawable[]
{
new Circle
{
RelativeSizeAxes = Axes.Both,
Colour = colours.Gray1
},
changeIcon = new SpriteIcon
{
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
Size = new Vector2(10),
},
}
},
currentValueText = new OsuSpriteText
{
Anchor = Anchor.CentreRight,
Origin = Anchor.CentreRight,
Font = OsuFont.Default.With(size: 18, weight: FontWeight.Bold)
Font = OsuFont.Default.With(size: StatisticItem.FONT_SIZE, weight: FontWeight.Bold)
},
}
},
@ -83,7 +99,7 @@ namespace osu.Game.Screens.Ranking.Statistics.User
{
Anchor = Anchor.TopRight,
Origin = Anchor.TopRight,
Font = OsuFont.Default.With(weight: FontWeight.Bold)
Font = OsuFont.Default.With(size: StatisticItem.FONT_SIZE, weight: FontWeight.Bold)
}
}
}
@ -123,7 +139,7 @@ namespace osu.Game.Screens.Ranking.Statistics.User
}
else
{
comparisonColour = colours.Orange1;
comparisonColour = colours.Gray4;
icon = FontAwesome.Solid.Minus;
}