1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-11 12:17:26 +08:00

using SkinReloadableDrawable

This commit is contained in:
Dragicafit 2018-12-11 18:06:41 +01:00
parent fb7d767909
commit bfe3b03945

View File

@ -27,24 +27,24 @@ namespace osu.Game.Rulesets.Osu.UI.Cursor
private readonly Container<Drawable> 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<SkinConfiguration, bool>(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<SkinConfiguration, bool>(s => s.CursorExpand) ?? true;
}
}
}