mirror of
https://github.com/ppy/osu.git
synced 2024-11-11 22:27:25 +08:00
Merge pull request #7725 from recapitalverb/top-score-statistics
Adjust TopScoreStatisticsSection to closer match web design
This commit is contained in:
commit
5277ce5370
@ -42,7 +42,12 @@ namespace osu.Game.Overlays.BeatmapSet.Scores
|
|||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.X,
|
RelativeSizeAxes = Axes.X,
|
||||||
AutoSizeAxes = Axes.Y,
|
AutoSizeAxes = Axes.Y,
|
||||||
Padding = new MarginPadding(10),
|
Padding = new MarginPadding
|
||||||
|
{
|
||||||
|
Vertical = 10,
|
||||||
|
Left = 10,
|
||||||
|
Right = 25,
|
||||||
|
},
|
||||||
Children = new Drawable[]
|
Children = new Drawable[]
|
||||||
{
|
{
|
||||||
new AutoSizingGrid
|
new AutoSizingGrid
|
||||||
|
@ -23,6 +23,8 @@ namespace osu.Game.Overlays.BeatmapSet.Scores
|
|||||||
public class TopScoreStatisticsSection : CompositeDrawable
|
public class TopScoreStatisticsSection : CompositeDrawable
|
||||||
{
|
{
|
||||||
private const float margin = 10;
|
private const float margin = 10;
|
||||||
|
private const float top_columns_min_width = 64;
|
||||||
|
private const float bottom_columns_min_width = 45;
|
||||||
|
|
||||||
private readonly FontUsage smallFont = OsuFont.GetFont(size: 16);
|
private readonly FontUsage smallFont = OsuFont.GetFont(size: 16);
|
||||||
private readonly FontUsage largeFont = OsuFont.GetFont(size: 22);
|
private readonly FontUsage largeFont = OsuFont.GetFont(size: 22);
|
||||||
@ -44,9 +46,24 @@ namespace osu.Game.Overlays.BeatmapSet.Scores
|
|||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.X,
|
RelativeSizeAxes = Axes.X,
|
||||||
AutoSizeAxes = Axes.Y,
|
AutoSizeAxes = Axes.Y,
|
||||||
Spacing = new Vector2(10, 0),
|
Direction = FillDirection.Vertical,
|
||||||
|
Spacing = new Vector2(10, 8),
|
||||||
Children = new Drawable[]
|
Children = new Drawable[]
|
||||||
{
|
{
|
||||||
|
new FillFlowContainer
|
||||||
|
{
|
||||||
|
Anchor = Anchor.TopRight,
|
||||||
|
Origin = Anchor.TopRight,
|
||||||
|
AutoSizeAxes = Axes.Both,
|
||||||
|
Direction = FillDirection.Horizontal,
|
||||||
|
Spacing = new Vector2(margin, 0),
|
||||||
|
Children = new Drawable[]
|
||||||
|
{
|
||||||
|
totalScoreColumn = new TextColumn("total score", largeFont, top_columns_min_width),
|
||||||
|
accuracyColumn = new TextColumn("accuracy", largeFont, top_columns_min_width),
|
||||||
|
maxComboColumn = new TextColumn("max combo", largeFont, top_columns_min_width)
|
||||||
|
}
|
||||||
|
},
|
||||||
new FillFlowContainer
|
new FillFlowContainer
|
||||||
{
|
{
|
||||||
Anchor = Anchor.TopRight,
|
Anchor = Anchor.TopRight,
|
||||||
@ -62,24 +79,10 @@ namespace osu.Game.Overlays.BeatmapSet.Scores
|
|||||||
Direction = FillDirection.Horizontal,
|
Direction = FillDirection.Horizontal,
|
||||||
Spacing = new Vector2(margin, 0),
|
Spacing = new Vector2(margin, 0),
|
||||||
},
|
},
|
||||||
ppColumn = new TextColumn("pp", smallFont),
|
ppColumn = new TextColumn("pp", smallFont, bottom_columns_min_width),
|
||||||
modsColumn = new ModsInfoColumn(),
|
modsColumn = new ModsInfoColumn(),
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
new FillFlowContainer
|
|
||||||
{
|
|
||||||
Anchor = Anchor.TopRight,
|
|
||||||
Origin = Anchor.TopRight,
|
|
||||||
AutoSizeAxes = Axes.Both,
|
|
||||||
Direction = FillDirection.Horizontal,
|
|
||||||
Spacing = new Vector2(margin, 0),
|
|
||||||
Children = new Drawable[]
|
|
||||||
{
|
|
||||||
totalScoreColumn = new TextColumn("total score", largeFont),
|
|
||||||
accuracyColumn = new TextColumn("accuracy", largeFont),
|
|
||||||
maxComboColumn = new TextColumn("max combo", largeFont)
|
|
||||||
}
|
|
||||||
},
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
@ -96,12 +99,14 @@ namespace osu.Game.Overlays.BeatmapSet.Scores
|
|||||||
maxComboColumn.Text = $@"{value.MaxCombo:N0}x";
|
maxComboColumn.Text = $@"{value.MaxCombo:N0}x";
|
||||||
ppColumn.Text = $@"{value.PP:N0}";
|
ppColumn.Text = $@"{value.PP:N0}";
|
||||||
|
|
||||||
statisticsColumns.ChildrenEnumerable = value.Statistics.Select(kvp => createStatisticsColumn(kvp.Key, kvp.Value));
|
statisticsColumns.ChildrenEnumerable = value.Statistics
|
||||||
|
.OrderByDescending(pair => pair.Key)
|
||||||
|
.Select(kvp => createStatisticsColumn(kvp.Key, kvp.Value));
|
||||||
modsColumn.Mods = value.Mods;
|
modsColumn.Mods = value.Mods;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private TextColumn createStatisticsColumn(HitResult hitResult, int count) => new TextColumn(hitResult.GetDescription(), smallFont)
|
private TextColumn createStatisticsColumn(HitResult hitResult, int count) => new TextColumn(hitResult.GetDescription(), smallFont, bottom_columns_min_width)
|
||||||
{
|
{
|
||||||
Text = count.ToString()
|
Text = count.ToString()
|
||||||
};
|
};
|
||||||
@ -111,7 +116,7 @@ namespace osu.Game.Overlays.BeatmapSet.Scores
|
|||||||
private readonly Box separator;
|
private readonly Box separator;
|
||||||
private readonly OsuSpriteText text;
|
private readonly OsuSpriteText text;
|
||||||
|
|
||||||
public InfoColumn(string title, Drawable content)
|
public InfoColumn(string title, Drawable content, float? minWidth = null)
|
||||||
{
|
{
|
||||||
AutoSizeAxes = Axes.Both;
|
AutoSizeAxes = Axes.Both;
|
||||||
|
|
||||||
@ -119,18 +124,20 @@ namespace osu.Game.Overlays.BeatmapSet.Scores
|
|||||||
{
|
{
|
||||||
AutoSizeAxes = Axes.Both,
|
AutoSizeAxes = Axes.Both,
|
||||||
Direction = FillDirection.Vertical,
|
Direction = FillDirection.Vertical,
|
||||||
Spacing = new Vector2(0, 2),
|
Spacing = new Vector2(0, 1),
|
||||||
Children = new[]
|
Children = new[]
|
||||||
{
|
{
|
||||||
text = new OsuSpriteText
|
text = new OsuSpriteText
|
||||||
{
|
{
|
||||||
Font = OsuFont.GetFont(size: 10, weight: FontWeight.Black),
|
Font = OsuFont.GetFont(size: 10, weight: FontWeight.Bold),
|
||||||
Text = title.ToUpper()
|
Text = title.ToUpper()
|
||||||
},
|
},
|
||||||
separator = new Box
|
separator = new Box
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.X,
|
RelativeSizeAxes = minWidth == null ? Axes.X : Axes.None,
|
||||||
Height = 1
|
Width = minWidth ?? 1f,
|
||||||
|
Height = 2,
|
||||||
|
Margin = new MarginPadding { Top = 2 }
|
||||||
},
|
},
|
||||||
content
|
content
|
||||||
}
|
}
|
||||||
@ -140,7 +147,8 @@ namespace osu.Game.Overlays.BeatmapSet.Scores
|
|||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
private void load(OverlayColourProvider colourProvider)
|
private void load(OverlayColourProvider colourProvider)
|
||||||
{
|
{
|
||||||
separator.Colour = text.Colour = colourProvider.Foreground1;
|
text.Colour = colourProvider.Foreground1;
|
||||||
|
separator.Colour = colourProvider.Background3;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -148,13 +156,13 @@ namespace osu.Game.Overlays.BeatmapSet.Scores
|
|||||||
{
|
{
|
||||||
private readonly SpriteText text;
|
private readonly SpriteText text;
|
||||||
|
|
||||||
public TextColumn(string title, FontUsage font)
|
public TextColumn(string title, FontUsage font, float? minWidth = null)
|
||||||
: this(title, new OsuSpriteText { Font = font })
|
: this(title, new OsuSpriteText { Font = font }, minWidth)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
private TextColumn(string title, SpriteText text)
|
private TextColumn(string title, SpriteText text, float? minWidth = null)
|
||||||
: base(title, text)
|
: base(title, text, minWidth)
|
||||||
{
|
{
|
||||||
this.text = text;
|
this.text = text;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user