mirror of
https://github.com/ppy/osu.git
synced 2025-03-21 21:47:20 +08: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@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))]
|
||||
|
@ -443,9 +443,7 @@ namespace osu.Game.Skinning
|
||||
string lookupName = name.Replace(@"@2x", string.Empty);
|
||||
|
||||
float ratio = 2;
|
||||
string twoTimesFilename = Path.HasExtension(lookupName)
|
||||
? @$"{Path.GetFileNameWithoutExtension(lookupName)}@2x{Path.GetExtension(lookupName)}"
|
||||
: @$"{lookupName}@2x";
|
||||
string twoTimesFilename = $"{Path.ChangeExtension(lookupName, null)}@2x{Path.GetExtension(lookupName)}";
|
||||
|
||||
var texture = Textures?.Get(twoTimesFilename, wrapModeS, wrapModeT);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user