Merge pull request #25898 from peppy/song-select-stats

Update song select to always show difficulty stats
This commit is contained in:
Dan Balasescu 2023-12-20 14:39:35 +09:00 committed by GitHub
commit 3818977a36
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 141 additions and 51 deletions

View File

@ -37,7 +37,7 @@ namespace osu.Game.Configuration
SetDefault(OsuSetting.Ruleset, string.Empty); SetDefault(OsuSetting.Ruleset, string.Empty);
SetDefault(OsuSetting.Skin, SkinInfo.ARGON_SKIN.ToString()); SetDefault(OsuSetting.Skin, SkinInfo.ARGON_SKIN.ToString());
SetDefault(OsuSetting.BeatmapDetailTab, PlayBeatmapDetailArea.TabType.Details); SetDefault(OsuSetting.BeatmapDetailTab, PlayBeatmapDetailArea.TabType.Local);
SetDefault(OsuSetting.BeatmapDetailModsFilter, false); SetDefault(OsuSetting.BeatmapDetailModsFilter, false);
SetDefault(OsuSetting.ShowConvertedBeatmaps, true); SetDefault(OsuSetting.ShowConvertedBeatmaps, true);

View File

@ -3,7 +3,6 @@
using System.Linq; using System.Linq;
using osu.Framework.Allocation; using osu.Framework.Allocation;
using osu.Framework.Extensions.Color4Extensions;
using osu.Framework.Graphics; using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Shapes; using osu.Framework.Graphics.Shapes;
@ -19,7 +18,6 @@ using osu.Game.Overlays.BeatmapSet;
using osu.Game.Resources.Localisation.Web; using osu.Game.Resources.Localisation.Web;
using osu.Game.Screens.Select.Details; using osu.Game.Screens.Select.Details;
using osuTK; using osuTK;
using osuTK.Graphics;
namespace osu.Game.Screens.Select namespace osu.Game.Screens.Select
{ {
@ -28,7 +26,6 @@ namespace osu.Game.Screens.Select
private const float spacing = 10; private const float spacing = 10;
private const float transition_duration = 250; private const float transition_duration = 250;
private readonly AdvancedStats advanced;
private readonly UserRatings ratingsDisplay; private readonly UserRatings ratingsDisplay;
private readonly MetadataSection description, source, tags; private readonly MetadataSection description, source, tags;
private readonly Container failRetryContainer; private readonly Container failRetryContainer;
@ -68,12 +65,15 @@ namespace osu.Game.Screens.Select
public BeatmapDetails() public BeatmapDetails()
{ {
CornerRadius = 10;
Masking = true;
Children = new Drawable[] Children = new Drawable[]
{ {
new Box new Box
{ {
RelativeSizeAxes = Axes.Both, RelativeSizeAxes = Axes.Both,
Colour = Color4.Black.Opacity(0.5f), Colour = Colour4.Black.Opacity(0.3f),
}, },
new Container new Container
{ {
@ -109,12 +109,6 @@ namespace osu.Game.Screens.Select
Padding = new MarginPadding { Right = spacing / 2 }, Padding = new MarginPadding { Right = spacing / 2 },
Children = new[] Children = new[]
{ {
new DetailBox().WithChild(advanced = new AdvancedStats
{
RelativeSizeAxes = Axes.X,
AutoSizeAxes = Axes.Y,
Padding = new MarginPadding { Horizontal = spacing, Top = spacing * 2, Bottom = spacing },
}),
new DetailBox().WithChild(new OnlineViewContainer(string.Empty) new DetailBox().WithChild(new OnlineViewContainer(string.Empty)
{ {
RelativeSizeAxes = Axes.X, RelativeSizeAxes = Axes.X,
@ -129,7 +123,8 @@ namespace osu.Game.Screens.Select
}, },
new OsuScrollContainer new OsuScrollContainer
{ {
RelativeSizeAxes = Axes.Both, RelativeSizeAxes = Axes.X,
Height = 250,
Width = 0.5f, Width = 0.5f,
ScrollbarVisible = false, ScrollbarVisible = false,
Padding = new MarginPadding { Left = spacing / 2 }, Padding = new MarginPadding { Left = spacing / 2 },
@ -180,7 +175,6 @@ namespace osu.Game.Screens.Select
private void updateStatistics() private void updateStatistics()
{ {
advanced.BeatmapInfo = BeatmapInfo;
description.Metadata = BeatmapInfo?.DifficultyName ?? string.Empty; description.Metadata = BeatmapInfo?.DifficultyName ?? string.Empty;
source.Metadata = BeatmapInfo?.Metadata.Source ?? string.Empty; source.Metadata = BeatmapInfo?.Metadata.Source ?? string.Empty;
tags.Metadata = BeatmapInfo?.Metadata.Tags ?? string.Empty; tags.Metadata = BeatmapInfo?.Metadata.Tags ?? string.Empty;
@ -279,11 +273,6 @@ namespace osu.Game.Screens.Select
InternalChildren = new Drawable[] InternalChildren = new Drawable[]
{ {
new Box
{
RelativeSizeAxes = Axes.Both,
Colour = Color4.Black.Opacity(0.5f),
},
content = new Container content = new Container
{ {
RelativeSizeAxes = Axes.X, RelativeSizeAxes = Axes.X,

View File

@ -61,7 +61,7 @@ namespace osu.Game.Screens.Select
{ {
Type = EdgeEffectType.Glow, Type = EdgeEffectType.Glow,
Colour = new Color4(130, 204, 255, 150), Colour = new Color4(130, 204, 255, 150),
Radius = 20, Radius = 15,
Roundness = 15, Roundness = 15,
}; };
} }
@ -305,7 +305,7 @@ namespace osu.Game.Screens.Select
}, },
infoLabelContainer = new FillFlowContainer infoLabelContainer = new FillFlowContainer
{ {
Margin = new MarginPadding { Top = 20 }, Margin = new MarginPadding { Top = 8 },
Spacing = new Vector2(20, 0), Spacing = new Vector2(20, 0),
AutoSizeAxes = Axes.Both, AutoSizeAxes = Axes.Both,
} }

View File

@ -64,21 +64,67 @@ namespace osu.Game.Screens.Select.Details
} }
} }
public AdvancedStats() public AdvancedStats(int columns = 1)
{ {
Child = new FillFlowContainer switch (columns)
{ {
RelativeSizeAxes = Axes.X, case 1:
AutoSizeAxes = Axes.Y, Child = new FillFlowContainer
Children = new[] {
{ RelativeSizeAxes = Axes.X,
FirstValue = new StatisticRow(), // circle size/key amount AutoSizeAxes = Axes.Y,
HpDrain = new StatisticRow { Title = BeatmapsetsStrings.ShowStatsDrain }, Children = new[]
Accuracy = new StatisticRow { Title = BeatmapsetsStrings.ShowStatsAccuracy }, {
ApproachRate = new StatisticRow { Title = BeatmapsetsStrings.ShowStatsAr }, FirstValue = new StatisticRow(), // circle size/key amount
starDifficulty = new StatisticRow(10, true) { Title = BeatmapsetsStrings.ShowStatsStars }, HpDrain = new StatisticRow { Title = BeatmapsetsStrings.ShowStatsDrain },
}, Accuracy = new StatisticRow { Title = BeatmapsetsStrings.ShowStatsAccuracy },
}; ApproachRate = new StatisticRow { Title = BeatmapsetsStrings.ShowStatsAr },
starDifficulty = new StatisticRow(10, true) { Title = BeatmapsetsStrings.ShowStatsStars },
},
};
break;
case 2:
Child = new FillFlowContainer
{
RelativeSizeAxes = Axes.X,
AutoSizeAxes = Axes.Y,
Direction = FillDirection.Full,
Children = new[]
{
FirstValue = new StatisticRow
{
Width = 0.5f,
Padding = new MarginPadding { Right = 5, Vertical = 2.5f },
}, // circle size/key amount
HpDrain = new StatisticRow
{
Title = BeatmapsetsStrings.ShowStatsDrain,
Width = 0.5f,
Padding = new MarginPadding { Left = 5, Vertical = 2.5f },
},
Accuracy = new StatisticRow
{
Title = BeatmapsetsStrings.ShowStatsAccuracy,
Width = 0.5f,
Padding = new MarginPadding { Right = 5, Vertical = 2.5f },
},
ApproachRate = new StatisticRow
{
Title = BeatmapsetsStrings.ShowStatsAr,
Width = 0.5f,
Padding = new MarginPadding { Left = 5, Vertical = 2.5f },
},
starDifficulty = new StatisticRow(10, true)
{
Title = BeatmapsetsStrings.ShowStatsStars,
Width = 0.5f,
Padding = new MarginPadding { Right = 5, Vertical = 2.5f },
},
},
};
break;
}
} }
[BackgroundDependencyLoader] [BackgroundDependencyLoader]
@ -289,23 +335,36 @@ namespace osu.Game.Screens.Select.Details
Font = OsuFont.GetFont(size: 12) Font = OsuFont.GetFont(size: 12)
}, },
}, },
bar = new Bar new Container
{ {
Origin = Anchor.CentreLeft, RelativeSizeAxes = Axes.Both,
Anchor = Anchor.CentreLeft,
RelativeSizeAxes = Axes.X,
Height = 5,
BackgroundColour = Color4.White.Opacity(0.5f),
Padding = new MarginPadding { Left = name_width + 10, Right = value_width + 10 },
},
ModBar = new Bar
{
Origin = Anchor.CentreLeft,
Anchor = Anchor.CentreLeft,
RelativeSizeAxes = Axes.X,
Alpha = 0.5f,
Height = 5,
Padding = new MarginPadding { Left = name_width + 10, Right = value_width + 10 }, Padding = new MarginPadding { Left = name_width + 10, Right = value_width + 10 },
Children = new Drawable[]
{
new Container
{
Origin = Anchor.CentreLeft,
Anchor = Anchor.CentreLeft,
RelativeSizeAxes = Axes.X,
Height = 5,
CornerRadius = 2,
Masking = true,
Children = new Drawable[]
{
bar = new Bar
{
RelativeSizeAxes = Axes.Both,
BackgroundColour = Color4.White.Opacity(0.5f),
},
ModBar = new Bar
{
RelativeSizeAxes = Axes.Both,
Alpha = 0.5f,
},
}
},
}
}, },
new Container new Container
{ {

View File

@ -13,6 +13,7 @@ using osu.Framework.Bindables;
using osu.Framework.Extensions.ObjectExtensions; using osu.Framework.Extensions.ObjectExtensions;
using osu.Framework.Graphics; using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Shapes;
using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.Sprites;
using osu.Framework.Graphics.UserInterface; using osu.Framework.Graphics.UserInterface;
using osu.Framework.Input.Bindings; using osu.Framework.Input.Bindings;
@ -35,6 +36,7 @@ using osu.Game.Screens.Backgrounds;
using osu.Game.Screens.Edit; using osu.Game.Screens.Edit;
using osu.Game.Screens.Menu; using osu.Game.Screens.Menu;
using osu.Game.Screens.Play; using osu.Game.Screens.Play;
using osu.Game.Screens.Select.Details;
using osu.Game.Screens.Select.Options; using osu.Game.Screens.Select.Options;
using osu.Game.Skinning; using osu.Game.Skinning;
using osuTK; using osuTK;
@ -45,7 +47,7 @@ namespace osu.Game.Screens.Select
{ {
public abstract partial class SongSelect : ScreenWithBeatmapBackground, IKeyBindingHandler<GlobalAction> public abstract partial class SongSelect : ScreenWithBeatmapBackground, IKeyBindingHandler<GlobalAction>
{ {
public static readonly float WEDGE_HEIGHT = 245; public static readonly float WEDGE_HEIGHT = 200;
protected const float BACKGROUND_BLUR = 20; protected const float BACKGROUND_BLUR = 20;
private const float left_area_padding = 20; private const float left_area_padding = 20;
@ -132,6 +134,8 @@ namespace osu.Game.Screens.Select
private IDisposable? modSelectOverlayRegistration; private IDisposable? modSelectOverlayRegistration;
private AdvancedStats advancedStats = null!;
[Resolved] [Resolved]
private MusicController music { get; set; } = null!; private MusicController music { get; set; } = null!;
@ -235,7 +239,7 @@ namespace osu.Game.Screens.Select
Origin = Anchor.BottomLeft, Origin = Anchor.BottomLeft,
Anchor = Anchor.BottomLeft, Anchor = Anchor.BottomLeft,
RelativeSizeAxes = Axes.Both, RelativeSizeAxes = Axes.Both,
Padding = new MarginPadding { Top = left_area_padding }, Padding = new MarginPadding { Top = 5 },
Children = new Drawable[] Children = new Drawable[]
{ {
new LeftSideInteractionContainer(() => Carousel.ScrollToSelected()) new LeftSideInteractionContainer(() => Carousel.ScrollToSelected())
@ -253,12 +257,48 @@ namespace osu.Game.Screens.Select
}, },
}, },
new Container new Container
{
RelativeSizeAxes = Axes.X,
Height = 90,
Padding = new MarginPadding(10)
{
Left = left_area_padding,
Right = left_area_padding * 2 + 5,
},
Y = WEDGE_HEIGHT,
Children = new Drawable[]
{
new Container
{
RelativeSizeAxes = Axes.Both,
Masking = true,
CornerRadius = 10,
Children = new Drawable[]
{
new Box
{
RelativeSizeAxes = Axes.Both,
Colour = Colour4.Black.Opacity(0.3f),
},
advancedStats = new AdvancedStats(2)
{
RelativeSizeAxes = Axes.X,
AutoSizeAxes = Axes.Y,
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
Padding = new MarginPadding(10)
},
}
},
}
},
new Container
{ {
RelativeSizeAxes = Axes.Both, RelativeSizeAxes = Axes.Both,
Padding = new MarginPadding Padding = new MarginPadding
{ {
Bottom = Footer.HEIGHT, Bottom = Footer.HEIGHT,
Top = WEDGE_HEIGHT, Top = WEDGE_HEIGHT + 70,
Left = left_area_padding, Left = left_area_padding,
Right = left_area_padding * 2, Right = left_area_padding * 2,
}, },
@ -797,6 +837,8 @@ namespace osu.Game.Screens.Select
ModSelect.Beatmap = beatmap; ModSelect.Beatmap = beatmap;
advancedStats.BeatmapInfo = beatmap.BeatmapInfo;
bool beatmapSelected = beatmap is not DummyWorkingBeatmap; bool beatmapSelected = beatmap is not DummyWorkingBeatmap;
if (beatmapSelected) if (beatmapSelected)