mirror of
https://github.com/ppy/osu
synced 2024-12-09 08:30:36 +00:00
Fix LegacyCursor's cursormiddle expanding
This commit is contained in:
parent
1e49078c52
commit
22f2a4bed2
@ -5,13 +5,13 @@ using osu.Framework.Allocation;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Game.Skinning;
|
||||
using osu.Game.Rulesets.Osu.UI.Cursor;
|
||||
using osuTK;
|
||||
|
||||
namespace osu.Game.Rulesets.Osu.Skinning
|
||||
{
|
||||
public class LegacyCursor : CompositeDrawable
|
||||
public class LegacyCursor : OsuCursorSprite
|
||||
{
|
||||
private NonPlayfieldSprite cursor;
|
||||
private bool spin;
|
||||
|
||||
public LegacyCursor()
|
||||
@ -35,7 +35,7 @@ namespace osu.Game.Rulesets.Osu.Skinning
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.Centre,
|
||||
},
|
||||
cursor = new NonPlayfieldSprite
|
||||
ExpandTarget = new NonPlayfieldSprite
|
||||
{
|
||||
Texture = skin.GetTexture("cursor"),
|
||||
Anchor = Anchor.Centre,
|
||||
@ -47,7 +47,7 @@ namespace osu.Game.Rulesets.Osu.Skinning
|
||||
protected override void LoadComplete()
|
||||
{
|
||||
if (spin)
|
||||
cursor.Spin(10000, RotationDirection.Clockwise);
|
||||
ExpandTarget.Spin(10000, RotationDirection.Clockwise);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -20,7 +20,7 @@ namespace osu.Game.Rulesets.Osu.UI.Cursor
|
||||
|
||||
private bool cursorExpand;
|
||||
|
||||
private Container expandTarget;
|
||||
private OsuCursorSprite cursorSprite;
|
||||
|
||||
public OsuCursor()
|
||||
{
|
||||
@ -37,17 +37,19 @@ namespace osu.Game.Rulesets.Osu.UI.Cursor
|
||||
[BackgroundDependencyLoader]
|
||||
private void load()
|
||||
{
|
||||
InternalChild = expandTarget = new Container
|
||||
SkinnableDrawable cursor;
|
||||
InternalChild = new Container
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Origin = Anchor.Centre,
|
||||
Anchor = Anchor.Centre,
|
||||
Child = new SkinnableDrawable(new OsuSkinComponent(OsuSkinComponents.Cursor), _ => new DefaultCursor(), confineMode: ConfineMode.NoScaling)
|
||||
Child = cursor = new SkinnableDrawable(new OsuSkinComponent(OsuSkinComponents.Cursor), _ => new DefaultCursor(), confineMode: ConfineMode.NoScaling)
|
||||
{
|
||||
Origin = Anchor.Centre,
|
||||
Anchor = Anchor.Centre,
|
||||
}
|
||||
};
|
||||
cursorSprite = cursor.Drawable as OsuCursorSprite;
|
||||
}
|
||||
|
||||
private const float pressed_scale = 1.2f;
|
||||
@ -57,12 +59,12 @@ namespace osu.Game.Rulesets.Osu.UI.Cursor
|
||||
{
|
||||
if (!cursorExpand) return;
|
||||
|
||||
expandTarget.ScaleTo(released_scale).ScaleTo(pressed_scale, 100, Easing.OutQuad);
|
||||
cursorSprite.ExpandTarget.ScaleTo(released_scale).ScaleTo(pressed_scale, 100, Easing.OutQuad);
|
||||
}
|
||||
|
||||
public void Contract() => expandTarget.ScaleTo(released_scale, 100, Easing.OutQuad);
|
||||
public void Contract() => cursorSprite.ExpandTarget.ScaleTo(released_scale, 100, Easing.OutQuad);
|
||||
|
||||
private class DefaultCursor : CompositeDrawable
|
||||
private class DefaultCursor : OsuCursorSprite
|
||||
{
|
||||
public DefaultCursor()
|
||||
{
|
||||
@ -73,8 +75,10 @@ namespace osu.Game.Rulesets.Osu.UI.Cursor
|
||||
|
||||
InternalChildren = new Drawable[]
|
||||
{
|
||||
new CircularContainer
|
||||
ExpandTarget = new CircularContainer
|
||||
{
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.Centre,
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Masking = true,
|
||||
BorderThickness = size / 6,
|
||||
|
Loading…
Reference in New Issue
Block a user