1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-14 04:02:59 +08:00

adjust beatmap length and drain based on rate changing mods

This commit is contained in:
Simon G 2023-12-22 03:04:48 +01:00 committed by GitHub
parent a7326e3891
commit b31b9e96d0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -161,6 +161,7 @@ namespace osu.Game.Screens.Select
private ILocalisedBindableString artistBinding;
private FillFlowContainer infoLabelContainer;
private Container bpmLabelContainer;
private Container lengthLabelContainer;
private readonly WorkingBeatmap working;
private readonly RulesetInfo ruleset;
@ -341,10 +342,10 @@ namespace osu.Game.Screens.Select
{
settingChangeTracker?.Dispose();
refreshBPMLabel();
refreshBPMAndLengthLabel();
settingChangeTracker = new ModSettingChangeTracker(m.NewValue);
settingChangeTracker.SettingChanged += _ => refreshBPMLabel();
settingChangeTracker.SettingChanged += _ => refreshBPMAndLengthLabel();
}, true);
}
@ -370,12 +371,10 @@ namespace osu.Game.Screens.Select
infoLabelContainer.Children = new Drawable[]
{
new InfoLabel(new BeatmapStatistic
lengthLabelContainer = new Container
{
Name = BeatmapsetsStrings.ShowStatsTotalLength(playableBeatmap.CalculateDrainLength().ToFormattedDuration()),
CreateIcon = () => new BeatmapStatisticIcon(BeatmapStatisticsIconType.Length),
Content = working.BeatmapInfo.Length.ToFormattedDuration().ToString(),
}),
AutoSizeAxes = Axes.Both,
},
bpmLabelContainer = new Container
{
AutoSizeAxes = Axes.Both,
@ -394,7 +393,7 @@ namespace osu.Game.Screens.Select
}
}
private void refreshBPMLabel()
private void refreshBPMAndLengthLabel()
{
var beatmap = working.Beatmap;
@ -420,6 +419,16 @@ namespace osu.Game.Screens.Select
CreateIcon = () => new BeatmapStatisticIcon(BeatmapStatisticsIconType.Bpm),
Content = labelText
});
double drainLength = Math.Round(beatmap.CalculateDrainLength() / rate);
double hitLength = Math.Round(beatmap.BeatmapInfo.Length / rate);
lengthLabelContainer.Child = new InfoLabel(new BeatmapStatistic
{
Name = BeatmapsetsStrings.ShowStatsTotalLength(drainLength.ToFormattedDuration()),
CreateIcon = () => new BeatmapStatisticIcon(BeatmapStatisticsIconType.Length),
Content = hitLength.ToFormattedDuration().ToString(),
});
}
private Drawable getMapper(BeatmapMetadata metadata)