1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-06 12:17:46 +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; protected override Container<Drawable> Content => fadeContainer;
private bool cursorExpand;
private readonly Container<Drawable> fadeContainer; private readonly Container<Drawable> fadeContainer;
public GameplayCursor() 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 int downCount;
private const float pressed_scale = 1.2f; private const float pressed_scale = 1.2f;
@ -46,28 +54,30 @@ namespace osu.Game.Rulesets.Osu.UI.Cursor
public bool OnPressed(OsuAction action) public bool OnPressed(OsuAction action)
{ {
switch (action) if (cursorExpand)
{ switch (action)
case OsuAction.LeftButton: {
case OsuAction.RightButton: case OsuAction.LeftButton:
downCount++; case OsuAction.RightButton:
ActiveCursor.ScaleTo(released_scale).ScaleTo(targetScale, 100, Easing.OutQuad); downCount++;
break; ActiveCursor.ScaleTo(released_scale).ScaleTo(targetScale, 100, Easing.OutQuad);
} break;
}
return false; return false;
} }
public bool OnReleased(OsuAction action) public bool OnReleased(OsuAction action)
{ {
switch (action) if (cursorExpand)
{ switch (action)
case OsuAction.LeftButton: {
case OsuAction.RightButton: case OsuAction.LeftButton:
if (--downCount == 0) case OsuAction.RightButton:
ActiveCursor.ScaleTo(targetScale, 200, Easing.OutQuad); if (--downCount == 0)
break; ActiveCursor.ScaleTo(targetScale, 200, Easing.OutQuad);
} break;
}
return false; return false;
} }

View File

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

View File

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