1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-06 09:58:21 +08:00

Make CursorExpand skinnable

This commit is contained in:
Dragicafit 2018-12-07 22:22:40 +01:00
parent 667eaf95d8
commit 0816eaacb8
3 changed files with 31 additions and 16 deletions

View File

@ -23,6 +23,8 @@ namespace osu.Game.Rulesets.Osu.UI.Cursor
protected override Container<Drawable> Content => fadeContainer;
private bool cursorExpand;
private readonly Container<Drawable> fadeContainer;
public GameplayCursor()
@ -37,6 +39,12 @@ namespace osu.Game.Rulesets.Osu.UI.Cursor
};
}
[BackgroundDependencyLoader]
private void load(ISkinSource source)
{
cursorExpand = source.GetValue<SkinConfiguration, string>(s => s.CursorExpand).Equals("1");
}
private int downCount;
private const float pressed_scale = 1.2f;
@ -46,28 +54,30 @@ namespace osu.Game.Rulesets.Osu.UI.Cursor
public bool OnPressed(OsuAction action)
{
switch (action)
{
case OsuAction.LeftButton:
case OsuAction.RightButton:
downCount++;
ActiveCursor.ScaleTo(released_scale).ScaleTo(targetScale, 100, Easing.OutQuad);
break;
}
if (cursorExpand)
switch (action)
{
case OsuAction.LeftButton:
case OsuAction.RightButton:
downCount++;
ActiveCursor.ScaleTo(released_scale).ScaleTo(targetScale, 100, Easing.OutQuad);
break;
}
return false;
}
public bool OnReleased(OsuAction action)
{
switch (action)
{
case OsuAction.LeftButton:
case OsuAction.RightButton:
if (--downCount == 0)
ActiveCursor.ScaleTo(targetScale, 200, Easing.OutQuad);
break;
}
if (cursorExpand)
switch (action)
{
case OsuAction.LeftButton:
case OsuAction.RightButton:
if (--downCount == 0)
ActiveCursor.ScaleTo(targetScale, 200, Easing.OutQuad);
break;
}
return false;
}

View File

@ -30,6 +30,9 @@ namespace osu.Game.Skinning
case @"Author":
skin.SkinInfo.Creator = pair.Value;
break;
case @"CursorExpand":
skin.CursorExpand = pair.Value;
break;
}
break;

View File

@ -16,5 +16,7 @@ namespace osu.Game.Skinning
public Dictionary<string, Color4> CustomColours { get; set; } = new Dictionary<string, Color4>();
public string HitCircleFont { get; set; } = "default";
public string CursorExpand { get; set; } = "1";
}
}