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

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.Skin, SkinInfo.ARGON_SKIN.ToString());
SetDefault(OsuSetting.BeatmapDetailTab, PlayBeatmapDetailArea.TabType.Details);
SetDefault(OsuSetting.BeatmapDetailTab, PlayBeatmapDetailArea.TabType.Local);
SetDefault(OsuSetting.BeatmapDetailModsFilter, false);
SetDefault(OsuSetting.ShowConvertedBeatmaps, true);

View File

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

View File

@ -61,7 +61,7 @@ namespace osu.Game.Screens.Select
{
Type = EdgeEffectType.Glow,
Colour = new Color4(130, 204, 255, 150),
Radius = 20,
Radius = 15,
Roundness = 15,
};
}
@ -305,7 +305,7 @@ namespace osu.Game.Screens.Select
},
infoLabelContainer = new FillFlowContainer
{
Margin = new MarginPadding { Top = 20 },
Margin = new MarginPadding { Top = 8 },
Spacing = new Vector2(20, 0),
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,
AutoSizeAxes = Axes.Y,
Children = new[]
{
FirstValue = new StatisticRow(), // circle size/key amount
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 },
},
};
case 1:
Child = new FillFlowContainer
{
RelativeSizeAxes = Axes.X,
AutoSizeAxes = Axes.Y,
Children = new[]
{
FirstValue = new StatisticRow(), // circle size/key amount
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]
@ -289,23 +335,36 @@ namespace osu.Game.Screens.Select.Details
Font = OsuFont.GetFont(size: 12)
},
},
bar = new Bar
new Container
{
Origin = Anchor.CentreLeft,
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,
RelativeSizeAxes = Axes.Both,
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
{

View File

@ -13,6 +13,7 @@ using osu.Framework.Bindables;
using osu.Framework.Extensions.ObjectExtensions;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Shapes;
using osu.Framework.Graphics.Sprites;
using osu.Framework.Graphics.UserInterface;
using osu.Framework.Input.Bindings;
@ -35,6 +36,7 @@ using osu.Game.Screens.Backgrounds;
using osu.Game.Screens.Edit;
using osu.Game.Screens.Menu;
using osu.Game.Screens.Play;
using osu.Game.Screens.Select.Details;
using osu.Game.Screens.Select.Options;
using osu.Game.Skinning;
using osuTK;
@ -45,7 +47,7 @@ namespace osu.Game.Screens.Select
{
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;
private const float left_area_padding = 20;
@ -132,6 +134,8 @@ namespace osu.Game.Screens.Select
private IDisposable? modSelectOverlayRegistration;
private AdvancedStats advancedStats = null!;
[Resolved]
private MusicController music { get; set; } = null!;
@ -235,7 +239,7 @@ namespace osu.Game.Screens.Select
Origin = Anchor.BottomLeft,
Anchor = Anchor.BottomLeft,
RelativeSizeAxes = Axes.Both,
Padding = new MarginPadding { Top = left_area_padding },
Padding = new MarginPadding { Top = 5 },
Children = new Drawable[]
{
new LeftSideInteractionContainer(() => Carousel.ScrollToSelected())
@ -253,12 +257,48 @@ namespace osu.Game.Screens.Select
},
},
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,
Padding = new MarginPadding
{
Bottom = Footer.HEIGHT,
Top = WEDGE_HEIGHT,
Top = WEDGE_HEIGHT + 70,
Left = left_area_padding,
Right = left_area_padding * 2,
},
@ -797,6 +837,8 @@ namespace osu.Game.Screens.Select
ModSelect.Beatmap = beatmap;
advancedStats.BeatmapInfo = beatmap.BeatmapInfo;
bool beatmapSelected = beatmap is not DummyWorkingBeatmap;
if (beatmapSelected)