mirror of https://github.com/ppy/osu
Merge pull request #17700 from peppy/fix-skin-lookups-extension-specified
Fix filename lookups on `LegacySkin`s going awry when extension is specified
This commit is contained in:
commit
f0698937b7
|
@ -69,6 +69,20 @@ public sealed class LegacySkinTextureFallbackTest
|
|||
"Gameplay/osu/followpoint",
|
||||
"followpoint", 1
|
||||
},
|
||||
new object[]
|
||||
{
|
||||
// Looking up a filename with extension specified should work.
|
||||
new[] { "followpoint.png" },
|
||||
"followpoint.png",
|
||||
"followpoint.png", 1
|
||||
},
|
||||
new object[]
|
||||
{
|
||||
// Looking up a filename with extension specified should also work with @2x sprites.
|
||||
new[] { "followpoint@2x.png" },
|
||||
"followpoint.png",
|
||||
"followpoint@2x.png", 2
|
||||
},
|
||||
};
|
||||
|
||||
[TestCaseSource(nameof(fallbackTestCases))]
|
||||
|
|
|
@ -443,7 +443,11 @@ protected override void ParseConfigurationStream(Stream stream)
|
|||
string lookupName = name.Replace(@"@2x", string.Empty);
|
||||
|
||||
float ratio = 2;
|
||||
var texture = Textures?.Get(@$"{lookupName}@2x", wrapModeS, wrapModeT);
|
||||
string twoTimesFilename = Path.HasExtension(lookupName)
|
||||
? @$"{Path.GetFileNameWithoutExtension(lookupName)}@2x{Path.GetExtension(lookupName)}"
|
||||
: @$"{lookupName}@2x";
|
||||
|
||||
var texture = Textures?.Get(twoTimesFilename, wrapModeS, wrapModeT);
|
||||
|
||||
if (texture == null)
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue