mirror of
https://github.com/osukey/osukey.git
synced 2025-04-29 02:37:25 +09:00
Merge pull request #17708 from frenzibyte/fix-texture-lookups-no-longer-handling-paths
Fix skin texture lookups not handling paths with extensions
This commit is contained in:
commit
c40b1bf30c
@ -83,6 +83,20 @@ namespace osu.Game.Tests.NonVisual.Skinning
|
|||||||
"followpoint.png",
|
"followpoint.png",
|
||||||
"followpoint@2x.png", 2
|
"followpoint@2x.png", 2
|
||||||
},
|
},
|
||||||
|
new object[]
|
||||||
|
{
|
||||||
|
// Looking up a path with extension specified should work.
|
||||||
|
new[] { "Gameplay/osu/followpoint.png" },
|
||||||
|
"Gameplay/osu/followpoint.png",
|
||||||
|
"Gameplay/osu/followpoint.png", 1
|
||||||
|
},
|
||||||
|
new object[]
|
||||||
|
{
|
||||||
|
// Looking up a path with extension specified should also work with @2x sprites.
|
||||||
|
new[] { "Gameplay/osu/followpoint@2x.png" },
|
||||||
|
"Gameplay/osu/followpoint.png",
|
||||||
|
"Gameplay/osu/followpoint@2x.png", 2
|
||||||
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
[TestCaseSource(nameof(fallbackTestCases))]
|
[TestCaseSource(nameof(fallbackTestCases))]
|
||||||
|
@ -443,9 +443,7 @@ namespace osu.Game.Skinning
|
|||||||
string lookupName = name.Replace(@"@2x", string.Empty);
|
string lookupName = name.Replace(@"@2x", string.Empty);
|
||||||
|
|
||||||
float ratio = 2;
|
float ratio = 2;
|
||||||
string twoTimesFilename = Path.HasExtension(lookupName)
|
string twoTimesFilename = $"{Path.ChangeExtension(lookupName, null)}@2x{Path.GetExtension(lookupName)}";
|
||||||
? @$"{Path.GetFileNameWithoutExtension(lookupName)}@2x{Path.GetExtension(lookupName)}"
|
|
||||||
: @$"{lookupName}@2x";
|
|
||||||
|
|
||||||
var texture = Textures?.Get(twoTimesFilename, wrapModeS, wrapModeT);
|
var texture = Textures?.Get(twoTimesFilename, wrapModeS, wrapModeT);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user