Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Touch up various results screen component's metrics #24204

Merged
merged 19 commits into from
Jul 13, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion osu.Game.Rulesets.Mania/ManiaRuleset.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion osu.Game.Rulesets.Osu/OsuRuleset.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
13 changes: 9 additions & 4 deletions osu.Game.Rulesets.Osu/Statistics/AccuracyHeatmap.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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,
},
Expand Down
2 changes: 1 addition & 1 deletion osu.Game.Rulesets.Taiko/TaikoRuleset.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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[]
Expand All @@ -154,7 +151,7 @@ private void createBarDrawables()
axisFlow = new Container
{
RelativeSizeAxes = Axes.X,
Height = axis_font_size,
Height = StatisticItem.FONT_SIZE,
}
},
},
Expand All @@ -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++)
Expand All @@ -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
Expand All @@ -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)
});
}
}
Expand Down
12 changes: 6 additions & 6 deletions osu.Game/Screens/Ranking/Statistics/PerformanceBreakdownChart.cs
Original file line number Diff line number Diff line change
Expand Up @@ -97,15 +97,15 @@ 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")
},
achievedPerformance = new OsuSpriteText
{
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")
}
},
Expand All @@ -115,15 +115,15 @@ 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)
},
maximumPerformance = new OsuSpriteText
{
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)
}
}
Expand Down Expand Up @@ -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
},
Expand All @@ -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
}
Expand Down
4 changes: 2 additions & 2 deletions osu.Game/Screens/Ranking/Statistics/SimpleStatisticItem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
});
}
Expand Down
3 changes: 1 addition & 2 deletions osu.Game/Screens/Ranking/Statistics/SimpleStatisticTable.cs
Original file line number Diff line number Diff line change
Expand Up @@ -98,12 +98,11 @@ private IEnumerable<Drawable> 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
{
Expand Down
5 changes: 5 additions & 0 deletions osu.Game/Screens/Ranking/Statistics/StatisticItem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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),
}
};
}
Expand All @@ -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[]
Expand All @@ -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),
}
}
};
Expand Down
26 changes: 8 additions & 18 deletions osu.Game/Screens/Ranking/Statistics/StatisticsPanel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -124,20 +124,23 @@ private void populateStatistics(ValueChangedEvent<ScoreInfo> 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,
}
}
};
Expand All @@ -146,35 +149,22 @@ private void populateStatistics(ValueChangedEvent<ScoreInfo> score)

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,
Expand Down
Loading