mirror of
https://github.com/ppy/osu.git
synced 2024-12-14 07:33:20 +08:00
Fix cursor trail logic
This commit is contained in:
parent
b904fa6615
commit
9ebafb1ec0
@ -39,18 +39,28 @@ namespace osu.Game.Rulesets.Osu.Tests
|
|||||||
[Test]
|
[Test]
|
||||||
public void TestLegacySmoothCursorTrail()
|
public void TestLegacySmoothCursorTrail()
|
||||||
{
|
{
|
||||||
createTest(() => new LegacySkinContainer(false)
|
createTest(() =>
|
||||||
{
|
{
|
||||||
Child = new LegacyCursorTrail()
|
var skinContainer = new LegacySkinContainer(false);
|
||||||
|
var legacyCursorTrail = new LegacyCursorTrail(skinContainer);
|
||||||
|
|
||||||
|
skinContainer.Child = legacyCursorTrail;
|
||||||
|
|
||||||
|
return skinContainer;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
public void TestLegacyDisjointCursorTrail()
|
public void TestLegacyDisjointCursorTrail()
|
||||||
{
|
{
|
||||||
createTest(() => new LegacySkinContainer(true)
|
createTest(() =>
|
||||||
{
|
{
|
||||||
Child = new LegacyCursorTrail()
|
var skinContainer = new LegacySkinContainer(true);
|
||||||
|
var legacyCursorTrail = new LegacyCursorTrail(skinContainer);
|
||||||
|
|
||||||
|
skinContainer.Child = legacyCursorTrail;
|
||||||
|
|
||||||
|
return skinContainer;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -11,10 +11,12 @@ namespace osu.Game.Rulesets.Osu.Skinning.Legacy
|
|||||||
{
|
{
|
||||||
public class LegacyCursor : OsuCursorSprite
|
public class LegacyCursor : OsuCursorSprite
|
||||||
{
|
{
|
||||||
|
private readonly ISkin skin;
|
||||||
private bool spin;
|
private bool spin;
|
||||||
|
|
||||||
public LegacyCursor()
|
public LegacyCursor(ISkin skin)
|
||||||
{
|
{
|
||||||
|
this.skin = skin;
|
||||||
Size = new Vector2(50);
|
Size = new Vector2(50);
|
||||||
|
|
||||||
Anchor = Anchor.Centre;
|
Anchor = Anchor.Centre;
|
||||||
@ -22,7 +24,7 @@ namespace osu.Game.Rulesets.Osu.Skinning.Legacy
|
|||||||
}
|
}
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
private void load(ISkinSource skin)
|
private void load()
|
||||||
{
|
{
|
||||||
bool centre = skin.GetConfig<OsuSkinConfiguration, bool>(OsuSkinConfiguration.CursorCentre)?.Value ?? true;
|
bool centre = skin.GetConfig<OsuSkinConfiguration, bool>(OsuSkinConfiguration.CursorCentre)?.Value ?? true;
|
||||||
spin = skin.GetConfig<OsuSkinConfiguration, bool>(OsuSkinConfiguration.CursorRotate)?.Value ?? true;
|
spin = skin.GetConfig<OsuSkinConfiguration, bool>(OsuSkinConfiguration.CursorRotate)?.Value ?? true;
|
||||||
|
@ -14,14 +14,20 @@ namespace osu.Game.Rulesets.Osu.Skinning.Legacy
|
|||||||
{
|
{
|
||||||
public class LegacyCursorTrail : CursorTrail
|
public class LegacyCursorTrail : CursorTrail
|
||||||
{
|
{
|
||||||
|
private readonly ISkin skin;
|
||||||
private const double disjoint_trail_time_separation = 1000 / 60.0;
|
private const double disjoint_trail_time_separation = 1000 / 60.0;
|
||||||
|
|
||||||
private bool disjointTrail;
|
private bool disjointTrail;
|
||||||
private double lastTrailTime;
|
private double lastTrailTime;
|
||||||
private IBindable<float> cursorSize;
|
private IBindable<float> cursorSize;
|
||||||
|
|
||||||
|
public LegacyCursorTrail(ISkin skin)
|
||||||
|
{
|
||||||
|
this.skin = skin;
|
||||||
|
}
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
private void load(ISkinSource skin, OsuConfigManager config)
|
private void load(OsuConfigManager config)
|
||||||
{
|
{
|
||||||
Texture = skin.GetTexture("cursortrail");
|
Texture = skin.GetTexture("cursortrail");
|
||||||
disjointTrail = skin.GetTexture("cursormiddle") == null;
|
disjointTrail = skin.GetTexture("cursormiddle") == null;
|
||||||
|
@ -84,14 +84,18 @@ namespace osu.Game.Rulesets.Osu.Skinning.Legacy
|
|||||||
return null;
|
return null;
|
||||||
|
|
||||||
case OsuSkinComponents.Cursor:
|
case OsuSkinComponents.Cursor:
|
||||||
if (Source.GetTexture("cursor") != null)
|
var cursorProvider = Source.FindProvider(s => s.GetTexture("cursor") != null);
|
||||||
return new LegacyCursor();
|
|
||||||
|
if (cursorProvider != null)
|
||||||
|
return new LegacyCursor(cursorProvider);
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
case OsuSkinComponents.CursorTrail:
|
case OsuSkinComponents.CursorTrail:
|
||||||
if (Source.GetTexture("cursortrail") != null)
|
var trailProvider = Source.FindProvider(s => s.GetTexture("cursortrail") != null);
|
||||||
return new LegacyCursorTrail();
|
|
||||||
|
if (trailProvider != null)
|
||||||
|
return new LegacyCursorTrail(trailProvider);
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user