mirror of
https://github.com/ppy/osu.git
synced 2024-11-06 09:58:21 +08:00
Fix skin sample reading failing
This commit is contained in:
parent
2a3f3dacb3
commit
0ea10a4922
@ -155,16 +155,40 @@ namespace osu.Game.Skinning
|
|||||||
// Spacing value was reverse-engineered from the ratio of the rendered sprite size in the visual inspector vs the actual texture size
|
// Spacing value was reverse-engineered from the ratio of the rendered sprite size in the visual inspector vs the actual texture size
|
||||||
Spacing = new Vector2(-Configuration.HitCircleOverlap * 0.89f, 0)
|
Spacing = new Vector2(-Configuration.HitCircleOverlap * 0.89f, 0)
|
||||||
};
|
};
|
||||||
|
|
||||||
default:
|
|
||||||
string lastPiece = componentName.Split('/').Last();
|
|
||||||
componentName = componentName.StartsWith("Gameplay/taiko/") ? "taiko-" + lastPiece : lastPiece;
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return getAnimation(componentName, animatable, looping);
|
return getAnimation(componentName, animatable, looping);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public override Texture GetTexture(string componentName)
|
||||||
|
{
|
||||||
|
componentName = getFallbackName(componentName);
|
||||||
|
|
||||||
|
float ratio = 2;
|
||||||
|
var texture = Textures.Get($"{componentName}@2x");
|
||||||
|
|
||||||
|
if (texture == null)
|
||||||
|
{
|
||||||
|
ratio = 1;
|
||||||
|
texture = Textures.Get(componentName);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (texture != null)
|
||||||
|
texture.ScaleAdjust = ratio;
|
||||||
|
|
||||||
|
return texture;
|
||||||
|
}
|
||||||
|
|
||||||
|
public override SampleChannel GetSample(string sampleName) => Samples.Get(getFallbackName(sampleName));
|
||||||
|
|
||||||
|
private bool hasFont(string fontName) => GetTexture($"{fontName}-0") != null;
|
||||||
|
|
||||||
|
private string getFallbackName(string componentName)
|
||||||
|
{
|
||||||
|
string lastPiece = componentName.Split('/').Last();
|
||||||
|
return componentName.StartsWith("Gameplay/taiko/") ? "taiko-" + lastPiece : lastPiece;
|
||||||
|
}
|
||||||
|
|
||||||
private Drawable getAnimation(string componentName, bool animatable, bool looping, string animationSeparator = "-")
|
private Drawable getAnimation(string componentName, bool animatable, bool looping, string animationSeparator = "-")
|
||||||
{
|
{
|
||||||
Texture texture;
|
Texture texture;
|
||||||
@ -200,27 +224,6 @@ namespace osu.Game.Skinning
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override Texture GetTexture(string componentName)
|
|
||||||
{
|
|
||||||
float ratio = 2;
|
|
||||||
var texture = Textures.Get($"{componentName}@2x");
|
|
||||||
|
|
||||||
if (texture == null)
|
|
||||||
{
|
|
||||||
ratio = 1;
|
|
||||||
texture = Textures.Get(componentName);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (texture != null)
|
|
||||||
texture.ScaleAdjust = ratio;
|
|
||||||
|
|
||||||
return texture;
|
|
||||||
}
|
|
||||||
|
|
||||||
public override SampleChannel GetSample(string sampleName) => Samples.Get(sampleName);
|
|
||||||
|
|
||||||
private bool hasFont(string fontName) => GetTexture($"{fontName}-0") != null;
|
|
||||||
|
|
||||||
protected class LegacySkinResourceStore<T> : IResourceStore<byte[]>
|
protected class LegacySkinResourceStore<T> : IResourceStore<byte[]>
|
||||||
where T : INamedFileInfo
|
where T : INamedFileInfo
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user