mirror of
https://github.com/ppy/osu.git
synced 2024-12-16 05:02:56 +08:00
Fix beatmap attributes display in mod select recreating star difficulty bindable every setting change
This commit is contained in:
parent
868604ca04
commit
2ad8eeb918
@ -108,8 +108,6 @@ namespace osu.Game.Overlays.Mods
|
|||||||
updateValues();
|
updateValues();
|
||||||
}, true);
|
}, true);
|
||||||
|
|
||||||
BeatmapInfo.BindValueChanged(_ => updateValues());
|
|
||||||
|
|
||||||
Collapsed.BindValueChanged(_ =>
|
Collapsed.BindValueChanged(_ =>
|
||||||
{
|
{
|
||||||
// Only start autosize animations on first collapse toggle. This avoids an ugly initial presentation.
|
// Only start autosize animations on first collapse toggle. This avoids an ugly initial presentation.
|
||||||
@ -120,12 +118,32 @@ namespace osu.Game.Overlays.Mods
|
|||||||
GameRuleset = game.Ruleset.GetBoundCopy();
|
GameRuleset = game.Ruleset.GetBoundCopy();
|
||||||
GameRuleset.BindValueChanged(_ => updateValues());
|
GameRuleset.BindValueChanged(_ => updateValues());
|
||||||
|
|
||||||
BeatmapInfo.BindValueChanged(_ => updateValues());
|
BeatmapInfo.BindValueChanged(_ =>
|
||||||
|
{
|
||||||
|
updateStarDifficultyBindable();
|
||||||
updateValues();
|
updateValues();
|
||||||
|
}, true);
|
||||||
|
|
||||||
updateCollapsedState();
|
updateCollapsedState();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void updateStarDifficultyBindable()
|
||||||
|
{
|
||||||
|
cancellationSource?.Cancel();
|
||||||
|
|
||||||
|
if (BeatmapInfo.Value == null)
|
||||||
|
return;
|
||||||
|
|
||||||
|
starDifficulty = difficultyCache.GetBindableDifficulty(BeatmapInfo.Value, (cancellationSource = new CancellationTokenSource()).Token);
|
||||||
|
starDifficulty.BindValueChanged(s =>
|
||||||
|
{
|
||||||
|
starRatingDisplay.Current.Value = s.NewValue ?? default;
|
||||||
|
|
||||||
|
if (!starRatingDisplay.IsPresent)
|
||||||
|
starRatingDisplay.FinishTransforms(true);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
protected override bool OnHover(HoverEvent e)
|
protected override bool OnHover(HoverEvent e)
|
||||||
{
|
{
|
||||||
startAnimating();
|
startAnimating();
|
||||||
@ -154,17 +172,6 @@ namespace osu.Game.Overlays.Mods
|
|||||||
if (BeatmapInfo.Value == null)
|
if (BeatmapInfo.Value == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
cancellationSource?.Cancel();
|
|
||||||
|
|
||||||
starDifficulty = difficultyCache.GetBindableDifficulty(BeatmapInfo.Value, (cancellationSource = new CancellationTokenSource()).Token);
|
|
||||||
starDifficulty.BindValueChanged(s =>
|
|
||||||
{
|
|
||||||
starRatingDisplay.Current.Value = s.NewValue ?? default;
|
|
||||||
|
|
||||||
if (!starRatingDisplay.IsPresent)
|
|
||||||
starRatingDisplay.FinishTransforms(true);
|
|
||||||
});
|
|
||||||
|
|
||||||
double rate = ModUtils.CalculateRateWithMods(Mods.Value);
|
double rate = ModUtils.CalculateRateWithMods(Mods.Value);
|
||||||
|
|
||||||
bpmDisplay.Current.Value = FormatUtils.RoundBPM(BeatmapInfo.Value.BPM, rate);
|
bpmDisplay.Current.Value = FormatUtils.RoundBPM(BeatmapInfo.Value.BPM, rate);
|
||||||
|
Loading…
Reference in New Issue
Block a user