From fb1d20bd39605eca96837d2d8e9b2cc394800cba Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 22 Apr 2024 15:07:11 +0800 Subject: [PATCH] Comment in some clarification --- .../TestSceneCursorTrail.cs | 14 +++++++------- .../Skinning/Legacy/LegacyCursorTrail.cs | 3 +++ 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/osu.Game.Rulesets.Osu.Tests/TestSceneCursorTrail.cs b/osu.Game.Rulesets.Osu.Tests/TestSceneCursorTrail.cs index afb0246b21..4db66fde4b 100644 --- a/osu.Game.Rulesets.Osu.Tests/TestSceneCursorTrail.cs +++ b/osu.Game.Rulesets.Osu.Tests/TestSceneCursorTrail.cs @@ -49,7 +49,7 @@ namespace osu.Game.Rulesets.Osu.Tests { createTest(() => { - var skinContainer = new LegacySkinContainer(renderer, false); + var skinContainer = new LegacySkinContainer(renderer, provideMiddle: false); var legacyCursorTrail = new LegacyCursorTrail(skinContainer); skinContainer.Child = legacyCursorTrail; @@ -63,7 +63,7 @@ namespace osu.Game.Rulesets.Osu.Tests { createTest(() => { - var skinContainer = new LegacySkinContainer(renderer, true); + var skinContainer = new LegacySkinContainer(renderer, provideMiddle: true); var legacyCursorTrail = new LegacyCursorTrail(skinContainer); skinContainer.Child = legacyCursorTrail; @@ -77,7 +77,7 @@ namespace osu.Game.Rulesets.Osu.Tests { createTest(() => { - var skinContainer = new LegacySkinContainer(renderer, false, false); + var skinContainer = new LegacySkinContainer(renderer, provideMiddle: false, provideCursor: false); var legacyCursorTrail = new LegacyCursorTrail(skinContainer); skinContainer.Child = legacyCursorTrail; @@ -104,13 +104,13 @@ namespace osu.Game.Rulesets.Osu.Tests private partial class LegacySkinContainer : Container, ISkinSource { private readonly IRenderer renderer; - private readonly bool disjoint; + private readonly bool provideMiddle; private readonly bool provideCursor; - public LegacySkinContainer(IRenderer renderer, bool disjoint, bool provideCursor = true) + public LegacySkinContainer(IRenderer renderer, bool provideMiddle, bool provideCursor = true) { this.renderer = renderer; - this.disjoint = disjoint; + this.provideMiddle = provideMiddle; this.provideCursor = provideCursor; RelativeSizeAxes = Axes.Both; @@ -129,7 +129,7 @@ namespace osu.Game.Rulesets.Osu.Tests return new Texture(renderer.WhitePixel); case "cursormiddle": - return disjoint ? null : renderer.WhitePixel; + return provideMiddle ? null : renderer.WhitePixel; } return null; diff --git a/osu.Game.Rulesets.Osu/Skinning/Legacy/LegacyCursorTrail.cs b/osu.Game.Rulesets.Osu/Skinning/Legacy/LegacyCursorTrail.cs index da52956719..ca0002d8c0 100644 --- a/osu.Game.Rulesets.Osu/Skinning/Legacy/LegacyCursorTrail.cs +++ b/osu.Game.Rulesets.Osu/Skinning/Legacy/LegacyCursorTrail.cs @@ -37,6 +37,9 @@ namespace osu.Game.Rulesets.Osu.Skinning.Legacy Texture = skin.GetTexture("cursortrail"); + // Cursor and cursor trail components are sourced from potentially different skin sources. + // Stable always chooses cursor trail disjoint behaviour based on the cursor texture lookup source, so we need to fetch where that occurred. + // See https://github.com/peppy/osu-stable-reference/blob/3ea48705eb67172c430371dcfc8a16a002ed0d3d/osu!/Graphics/Skinning/SkinManager.cs#L269 var cursorProvider = skinSource.FindProvider(s => s.GetTexture("cursor") != null); DisjointTrail = cursorProvider?.GetTexture("cursormiddle") == null;