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

Bring back mod setting tracker in BeatmapAttributesDisplay

This commit is contained in:
Salman Ahmed 2024-02-26 21:26:35 +03:00
parent d4bc3090e7
commit 2b73d816a7
2 changed files with 12 additions and 7 deletions

View File

@ -13,6 +13,7 @@ using osu.Framework.Input.Events;
using osu.Framework.Localisation;
using osu.Game.Beatmaps;
using osu.Game.Beatmaps.Drawables;
using osu.Game.Configuration;
using osu.Game.Graphics;
using osu.Game.Graphics.Sprites;
using osu.Game.Graphics.UserInterface;
@ -43,6 +44,8 @@ namespace osu.Game.Overlays.Mods
public BindableBool Collapsed { get; } = new BindableBool(true);
private ModSettingChangeTracker? modSettingChangeTracker;
[Resolved]
private BeatmapDifficultyCache difficultyCache { get; set; } = null!;
@ -97,7 +100,14 @@ namespace osu.Game.Overlays.Mods
{
base.LoadComplete();
Mods.BindValueChanged(_ => updateValues());
Mods.BindValueChanged(_ =>
{
modSettingChangeTracker?.Dispose();
modSettingChangeTracker = new ModSettingChangeTracker(Mods.Value);
modSettingChangeTracker.SettingChanged += _ => updateValues();
updateValues();
}, true);
BeatmapInfo.BindValueChanged(_ => updateValues());
Collapsed.BindValueChanged(_ =>

View File

@ -468,12 +468,7 @@ namespace osu.Game.Overlays.Mods
}
if (beatmapAttributesDisplay != null)
{
if (!ReferenceEquals(beatmapAttributesDisplay.Mods.Value, mods))
beatmapAttributesDisplay.Mods.Value = mods;
else
beatmapAttributesDisplay.Mods.TriggerChange(); // mods list may be same but a mod setting has changed, trigger change in that case.
}
beatmapAttributesDisplay.Mods.Value = mods;
}
private void updateCustomisation()