2019-08-30 04:42:29 +00:00
|
|
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
|
|
|
// See the LICENCE file in the repository root for full licence text.
|
|
|
|
|
|
|
|
using osu.Framework.Allocation;
|
|
|
|
using osu.Framework.Graphics;
|
|
|
|
using osu.Framework.Graphics.Containers;
|
|
|
|
using osu.Game.Skinning;
|
|
|
|
using osuTK;
|
|
|
|
|
|
|
|
namespace osu.Game.Rulesets.Osu.Skinning
|
|
|
|
{
|
|
|
|
public class LegacyCursor : CompositeDrawable
|
|
|
|
{
|
2019-12-09 00:36:07 +00:00
|
|
|
public LegacyCursor(bool spin = true)
|
2019-08-30 04:42:29 +00:00
|
|
|
{
|
|
|
|
Size = new Vector2(50);
|
|
|
|
|
|
|
|
Anchor = Anchor.Centre;
|
|
|
|
Origin = Anchor.Centre;
|
2019-12-09 00:36:07 +00:00
|
|
|
|
|
|
|
rotate = spin;
|
2019-08-30 04:42:29 +00:00
|
|
|
}
|
|
|
|
|
2019-12-08 12:05:02 +00:00
|
|
|
private NonPlayfieldSprite cursor;
|
2019-12-09 00:49:44 +00:00
|
|
|
private readonly bool rotate;
|
2019-12-08 12:05:02 +00:00
|
|
|
|
2019-08-30 04:42:29 +00:00
|
|
|
[BackgroundDependencyLoader]
|
|
|
|
private void load(ISkinSource skin)
|
|
|
|
{
|
|
|
|
InternalChildren = new Drawable[]
|
|
|
|
{
|
|
|
|
new NonPlayfieldSprite
|
|
|
|
{
|
|
|
|
Texture = skin.GetTexture("cursormiddle"),
|
|
|
|
Anchor = Anchor.Centre,
|
|
|
|
Origin = Anchor.Centre,
|
|
|
|
},
|
2019-12-08 12:05:02 +00:00
|
|
|
cursor = new NonPlayfieldSprite
|
2019-08-30 04:42:29 +00:00
|
|
|
{
|
|
|
|
Texture = skin.GetTexture("cursor"),
|
|
|
|
Anchor = Anchor.Centre,
|
|
|
|
Origin = Anchor.Centre,
|
|
|
|
}
|
|
|
|
};
|
2019-12-08 12:47:28 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
protected override void LoadComplete()
|
|
|
|
{
|
2019-12-09 00:36:07 +00:00
|
|
|
if (rotate)
|
|
|
|
cursor.Spin(10000, RotationDirection.Clockwise);
|
2019-08-30 04:42:29 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|