osu/osu.Game.Rulesets.Osu/Skinning/Legacy/LegacyCursor.cs

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

56 lines
1.7 KiB
C#
Raw Normal View History

// 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.Game.Rulesets.Osu.UI.Cursor;
2020-12-04 11:21:53 +00:00
using osu.Game.Skinning;
using osuTK;
2020-12-04 11:21:53 +00:00
namespace osu.Game.Rulesets.Osu.Skinning.Legacy
{
public class LegacyCursor : OsuCursorSprite
{
2021-06-06 13:26:27 +00:00
private readonly ISkin skin;
private bool spin;
2021-06-06 13:26:27 +00:00
public LegacyCursor(ISkin skin)
{
2021-06-06 13:26:27 +00:00
this.skin = skin;
Size = new Vector2(50);
Anchor = Anchor.Centre;
Origin = Anchor.Centre;
}
[BackgroundDependencyLoader]
2021-06-06 13:26:27 +00:00
private void load()
{
2021-04-14 05:16:45 +00:00
bool centre = skin.GetConfig<OsuSkinConfiguration, bool>(OsuSkinConfiguration.CursorCentre)?.Value ?? true;
spin = skin.GetConfig<OsuSkinConfiguration, bool>(OsuSkinConfiguration.CursorRotate)?.Value ?? true;
2019-12-10 12:40:10 +00:00
InternalChildren = new[]
{
2019-12-14 10:33:56 +00:00
ExpandTarget = new NonPlayfieldSprite
{
2019-12-14 10:33:56 +00:00
Texture = skin.GetTexture("cursor"),
Anchor = Anchor.Centre,
Origin = centre ? Anchor.Centre : Anchor.TopLeft,
},
2019-12-14 10:33:56 +00:00
new NonPlayfieldSprite
{
2019-12-14 10:33:56 +00:00
Texture = skin.GetTexture("cursormiddle"),
Anchor = Anchor.Centre,
Origin = centre ? Anchor.Centre : Anchor.TopLeft,
2019-12-14 10:33:56 +00:00
},
};
2019-12-08 12:47:28 +00:00
}
protected override void LoadComplete()
{
2019-12-09 04:11:04 +00:00
if (spin)
ExpandTarget.Spin(10000, RotationDirection.Clockwise);
}
}
}