diff --git a/osu.Game.Rulesets.Mania/ManiaRuleset.cs b/osu.Game.Rulesets.Mania/ManiaRuleset.cs index e46c85ab290e..802399e247b8 100644 --- a/osu.Game.Rulesets.Mania/ManiaRuleset.cs +++ b/osu.Game.Rulesets.Mania/ManiaRuleset.cs @@ -412,7 +412,7 @@ public override StatisticItem[] CreateStatisticsForScore(ScoreInfo score, IBeatm 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) diff --git a/osu.Game.Rulesets.Osu/OsuRuleset.cs b/osu.Game.Rulesets.Osu/OsuRuleset.cs index c00bab8ed701..220dc53705dc 100644 --- a/osu.Game.Rulesets.Osu/OsuRuleset.cs +++ b/osu.Game.Rulesets.Osu/OsuRuleset.cs @@ -319,7 +319,7 @@ public override StatisticItem[] CreateStatisticsForScore(ScoreInfo score, IBeatm 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) diff --git a/osu.Game.Rulesets.Osu/Statistics/AccuracyHeatmap.cs b/osu.Game.Rulesets.Osu/Statistics/AccuracyHeatmap.cs index 5d2f6a14c7b5..6564a086fea3 100644 --- a/osu.Game.Rulesets.Osu/Statistics/AccuracyHeatmap.cs +++ b/osu.Game.Rulesets.Osu/Statistics/AccuracyHeatmap.cs @@ -11,6 +11,7 @@ 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 @@ private void load() 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, }, diff --git a/osu.Game.Rulesets.Taiko/TaikoRuleset.cs b/osu.Game.Rulesets.Taiko/TaikoRuleset.cs index feb8b0c2c26f..584a91bfdc76 100644 --- a/osu.Game.Rulesets.Taiko/TaikoRuleset.cs +++ b/osu.Game.Rulesets.Taiko/TaikoRuleset.cs @@ -256,7 +256,7 @@ public override StatisticItem[] CreateStatisticsForScore(ScoreInfo score, IBeatm 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) diff --git a/osu.Game/Screens/Ranking/Statistics/HitEventTimingDistributionGraph.cs b/osu.Game/Screens/Ranking/Statistics/HitEventTimingDistributionGraph.cs index e8d2eefd81fd..1260ec2339e0 100644 --- a/osu.Game/Screens/Ranking/Statistics/HitEventTimingDistributionGraph.cs +++ b/osu.Game/Screens/Ranking/Statistics/HitEventTimingDistributionGraph.cs @@ -131,14 +131,11 @@ private void createBarDrawables() 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 @@ private void createBarDrawables() axisFlow = new Container { RelativeSizeAxes = Axes.X, - Height = axis_font_size, + Height = StatisticItem.FONT_SIZE, } }, }, @@ -174,7 +171,7 @@ private void createBarDrawables() 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 @@ private void createBarDrawables() 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 @@ private void createBarDrawables() 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) }); } } diff --git a/osu.Game/Screens/Ranking/Statistics/PerformanceBreakdownChart.cs b/osu.Game/Screens/Ranking/Statistics/PerformanceBreakdownChart.cs index 10cb77fa9195..ee0ce6183d0d 100644 --- a/osu.Game/Screens/Ranking/Statistics/PerformanceBreakdownChart.cs +++ b/osu.Game/Screens/Ranking/Statistics/PerformanceBreakdownChart.cs @@ -97,7 +97,7 @@ private void load() { 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 @@ private void load() { 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 @@ private void load() { 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 @@ private void load() { 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 @@ private Drawable[] createAttributeRow(PerformanceDisplayAttribute attribute, Per { 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 @@ private Drawable[] createAttributeRow(PerformanceDisplayAttribute attribute, Per { 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 } diff --git a/osu.Game/Screens/Ranking/Statistics/SimpleStatisticItem.cs b/osu.Game/Screens/Ranking/Statistics/SimpleStatisticItem.cs index 99f4e1e34224..23ccc3d0b7e3 100644 --- a/osu.Game/Screens/Ranking/Statistics/SimpleStatisticItem.cs +++ b/osu.Game/Screens/Ranking/Statistics/SimpleStatisticItem.cs @@ -44,13 +44,13 @@ protected SimpleStatisticItem(string name) 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) } }); } diff --git a/osu.Game/Screens/Ranking/Statistics/SimpleStatisticTable.cs b/osu.Game/Screens/Ranking/Statistics/SimpleStatisticTable.cs index d68df4558a0d..ed31bc8643e5 100644 --- a/osu.Game/Screens/Ranking/Statistics/SimpleStatisticTable.cs +++ b/osu.Game/Screens/Ranking/Statistics/SimpleStatisticTable.cs @@ -98,12 +98,11 @@ private IEnumerable createColumns() 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 { diff --git a/osu.Game/Screens/Ranking/Statistics/StatisticItem.cs b/osu.Game/Screens/Ranking/Statistics/StatisticItem.cs index fd7a0ddb4fff..cf95886905dd 100644 --- a/osu.Game/Screens/Ranking/Statistics/StatisticItem.cs +++ b/osu.Game/Screens/Ranking/Statistics/StatisticItem.cs @@ -12,6 +12,11 @@ namespace osu.Game.Screens.Ranking.Statistics /// public class StatisticItem { + /// + /// The recommended font size to use in statistic items to make sure they match others. + /// + public const float FONT_SIZE = 13; + /// /// The name of this item. /// diff --git a/osu.Game/Screens/Ranking/Statistics/StatisticContainer.cs b/osu.Game/Screens/Ranking/Statistics/StatisticItemContainer.cs similarity index 58% rename from osu.Game/Screens/Ranking/Statistics/StatisticContainer.cs rename to osu.Game/Screens/Ranking/Statistics/StatisticItemContainer.cs index 9191ee6f520a..6e18ae1fe422 100644 --- a/osu.Game/Screens/Ranking/Statistics/StatisticContainer.cs +++ b/osu.Game/Screens/Ranking/Statistics/StatisticItemContainer.cs @@ -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 /// /// Wraps a to add a header and suitable layout for use in . /// - internal partial class StatisticContainer : CompositeDrawable + internal partial class StatisticItemContainer : CompositeDrawable { /// - /// Creates a new . + /// Creates a new . /// /// The to display. - 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 @@ private static Drawable createHeader(StatisticItem item) 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 @@ private static Drawable createHeader(StatisticItem item) 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), } } }; diff --git a/osu.Game/Screens/Ranking/Statistics/StatisticsPanel.cs b/osu.Game/Screens/Ranking/Statistics/StatisticsPanel.cs index 8b059efaf4a9..19bd0c4393da 100644 --- a/osu.Game/Screens/Ranking/Statistics/StatisticsPanel.cs +++ b/osu.Game/Screens/Ranking/Statistics/StatisticsPanel.cs @@ -124,20 +124,23 @@ private void populateStatistics(ValueChangedEvent score) } 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 @@ private void populateStatistics(ValueChangedEvent score) foreach (var item in statisticItems) { - var columnContent = new List(); - 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, diff --git a/osu.Game/Screens/Ranking/Statistics/User/OverallRanking.cs b/osu.Game/Screens/Ranking/Statistics/User/OverallRanking.cs index 447f206128e5..d08a654e998a 100644 --- a/osu.Game/Screens/Ranking/Statistics/User/OverallRanking.cs +++ b/osu.Game/Screens/Ranking/Statistics/User/OverallRanking.cs @@ -7,7 +7,6 @@ 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 @@ public partial class OverallRanking : CompositeDrawable public Bindable StatisticsUpdate { get; } = new Bindable(); private LoadingLayer loadingLayer = null!; - private FillFlowContainer content = null!; + private GridContainer content = null!; [BackgroundDependencyLoader] private void load() @@ -33,21 +32,47 @@ private void load() { 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 } }, + } } } }; diff --git a/osu.Game/Screens/Ranking/Statistics/User/RankingChangeRow.cs b/osu.Game/Screens/Ranking/Statistics/User/RankingChangeRow.cs index 5348b4a5226c..906bf8d5cafd 100644 --- a/osu.Game/Screens/Ranking/Statistics/User/RankingChangeRow.cs +++ b/osu.Game/Screens/Ranking/Statistics/User/RankingChangeRow.cs @@ -6,6 +6,7 @@ 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 @@ private void load() 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 @@ private void load() 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 @@ private void load() { 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 @@ private void onStatisticsUpdate(ValueChangedEvent statist } else { - comparisonColour = colours.Orange1; + comparisonColour = colours.Gray4; icon = FontAwesome.Solid.Minus; }