diff --git a/osu.Game.Rulesets.Osu/UI/Cursor/GameplayCursor.cs b/osu.Game.Rulesets.Osu/UI/Cursor/GameplayCursor.cs index 5489ccf2bd..0d2e5c272d 100644 --- a/osu.Game.Rulesets.Osu/UI/Cursor/GameplayCursor.cs +++ b/osu.Game.Rulesets.Osu/UI/Cursor/GameplayCursor.cs @@ -27,24 +27,24 @@ namespace osu.Game.Rulesets.Osu.UI.Cursor private readonly Container fadeContainer; + private SkinnableCursor skinnableCursor; + public GameplayCursor() { - InternalChild = fadeContainer = new Container + InternalChildren = new Drawable[] { - RelativeSizeAxes = Axes.Both, - Children = new Drawable[] + fadeContainer = new Container { - new CursorTrail { Depth = 1 } - } + RelativeSizeAxes = Axes.Both, + Children = new Drawable[] + { + new CursorTrail { Depth = 1 } + } + }, + skinnableCursor = new SkinnableCursor() }; } - [BackgroundDependencyLoader] - private void load(ISkinSource source) - { - cursorExpand = source.GetValue(s => s.CursorExpand) ?? true; - } - private int downCount; private const float pressed_scale = 1.2f; @@ -54,6 +54,8 @@ namespace osu.Game.Rulesets.Osu.UI.Cursor public bool OnPressed(OsuAction action) { + cursorExpand = skinnableCursor.CursorExpand; + if (!cursorExpand) return false; @@ -205,4 +207,14 @@ namespace osu.Game.Rulesets.Osu.UI.Cursor } } } + + public class SkinnableCursor : SkinReloadableDrawable + { + public bool CursorExpand { get; set; } = true; + + protected override void SkinChanged(ISkinSource skin, bool allowFallback) + { + CursorExpand = skin.GetValue(s => s.CursorExpand) ?? true; + } + } }