mirror of
https://github.com/osukey/osukey.git
synced 2025-06-05 04:47:39 +09:00
Allow legacy skin textures from subpaths
This commit is contained in:
parent
bad1bb6618
commit
eff17c2da5
@ -243,21 +243,24 @@ namespace osu.Game.Skinning
|
|||||||
|
|
||||||
public override Texture GetTexture(string componentName)
|
public override Texture GetTexture(string componentName)
|
||||||
{
|
{
|
||||||
componentName = getFallbackName(componentName);
|
foreach (var name in getFallbackNames(componentName))
|
||||||
|
|
||||||
float ratio = 2;
|
|
||||||
var texture = Textures?.Get($"{componentName}@2x");
|
|
||||||
|
|
||||||
if (texture == null)
|
|
||||||
{
|
{
|
||||||
ratio = 1;
|
float ratio = 2;
|
||||||
texture = Textures?.Get(componentName);
|
var texture = Textures?.Get($"{name}@2x");
|
||||||
|
|
||||||
|
if (texture == null)
|
||||||
|
{
|
||||||
|
ratio = 1;
|
||||||
|
texture = Textures?.Get(name);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (texture != null)
|
||||||
|
texture.ScaleAdjust = ratio;
|
||||||
|
|
||||||
|
return texture;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (texture != null)
|
return null;
|
||||||
texture.ScaleAdjust = ratio;
|
|
||||||
|
|
||||||
return texture;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public override SampleChannel GetSample(ISampleInfo sampleInfo)
|
public override SampleChannel GetSample(ISampleInfo sampleInfo)
|
||||||
@ -277,10 +280,14 @@ namespace osu.Game.Skinning
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
private string getFallbackName(string componentName)
|
private IEnumerable<string> getFallbackNames(string componentName)
|
||||||
{
|
{
|
||||||
|
// May be something like "Gameplay/osu/approachcircle" from lazer, or "Arrows/note1" from a user skin.
|
||||||
|
yield return componentName;
|
||||||
|
|
||||||
|
// Fall back to using the last piece for components coming from lazer (e.g. "Gameplay/osu/approachcircle" -> "approachcircle").
|
||||||
string lastPiece = componentName.Split('/').Last();
|
string lastPiece = componentName.Split('/').Last();
|
||||||
return componentName.StartsWith("Gameplay/taiko/") ? "taiko-" + lastPiece : lastPiece;
|
yield return componentName.StartsWith("Gameplay/taiko/") ? "taiko-" + lastPiece : lastPiece;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -4,6 +4,7 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
using osu.Framework.Extensions;
|
||||||
using osu.Framework.IO.Stores;
|
using osu.Framework.IO.Stores;
|
||||||
using osu.Game.Database;
|
using osu.Game.Database;
|
||||||
|
|
||||||
@ -27,7 +28,7 @@ namespace osu.Game.Skinning
|
|||||||
|
|
||||||
foreach (var filename in base.GetFilenames(name))
|
foreach (var filename in base.GetFilenames(name))
|
||||||
{
|
{
|
||||||
var path = getPathForFile(filename);
|
var path = getPathForFile(filename.ToStandardisedPath());
|
||||||
if (path != null)
|
if (path != null)
|
||||||
yield return path;
|
yield return path;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user