diff --git a/osu.Game.Rulesets.Osu/Mods/OsuModTraceable.cs b/osu.Game.Rulesets.Osu/Mods/OsuModTraceable.cs
index 0cca3ae40c..cf1ce517e8 100644
--- a/osu.Game.Rulesets.Osu/Mods/OsuModTraceable.cs
+++ b/osu.Game.Rulesets.Osu/Mods/OsuModTraceable.cs
@@ -55,13 +55,8 @@ namespace osu.Game.Rulesets.Osu.Mods
break;
case DrawableSlider slider:
- slider.AccentColour.BindValueChanged(_ =>
- {
- //will trigger on skin change.
- ((PlaySliderBody)slider.Body.Drawable).AccentColour = slider.AccentColour.Value.Opacity(0);
- ((PlaySliderBody)slider.Body.Drawable).BorderColour = slider.AccentColour.Value;
- }, true);
-
+ slider.Body.OnSkinChanged += () => applySliderState(slider);
+ applySliderState(slider);
break;
case DrawableSpinner spinner:
@@ -70,5 +65,11 @@ namespace osu.Game.Rulesets.Osu.Mods
break;
}
}
+
+ private void applySliderState(DrawableSlider slider)
+ {
+ ((PlaySliderBody)slider.Body.Drawable).AccentColour = slider.AccentColour.Value.Opacity(0);
+ ((PlaySliderBody)slider.Body.Drawable).BorderColour = slider.AccentColour.Value;
+ }
}
}
diff --git a/osu.Game/Skinning/SkinReloadableDrawable.cs b/osu.Game/Skinning/SkinReloadableDrawable.cs
index 6d0b22dd51..4a1aaa62bf 100644
--- a/osu.Game/Skinning/SkinReloadableDrawable.cs
+++ b/osu.Game/Skinning/SkinReloadableDrawable.cs
@@ -12,6 +12,11 @@ namespace osu.Game.Skinning
///
public abstract class SkinReloadableDrawable : CompositeDrawable
{
+ ///
+ /// Invoked when has changed.
+ ///
+ public event Action OnSkinChanged;
+
///
/// The current skin source.
///
@@ -43,12 +48,18 @@ namespace osu.Game.Skinning
private void onChange() =>
// schedule required to avoid calls after disposed.
// note that this has the side-effect of components only performing a skin change when they are alive.
- Scheduler.AddOnce(() => SkinChanged(CurrentSkin, allowDefaultFallback));
+ Scheduler.AddOnce(skinChanged);
protected override void LoadAsyncComplete()
{
base.LoadAsyncComplete();
+ skinChanged();
+ }
+
+ private void skinChanged()
+ {
SkinChanged(CurrentSkin, allowDefaultFallback);
+ OnSkinChanged?.Invoke();
}
///
@@ -66,6 +77,8 @@ namespace osu.Game.Skinning
if (CurrentSkin != null)
CurrentSkin.SourceChanged -= onChange;
+
+ OnSkinChanged = null;
}
}
}