mirror of
https://github.com/ppy/osu
synced 2024-12-28 01:42:57 +00:00
Remove ancient osu-resources lookup path from legacy skin textures
This commit is contained in:
parent
98c65f36c9
commit
e54d20ea93
@ -21,7 +21,7 @@ namespace osu.Game.Rulesets.Osu.Skinning.Legacy
|
||||
private DrawableHitObject drawableObject { get; set; } = null!;
|
||||
|
||||
public LegacyApproachCircle()
|
||||
: base("Gameplay/osu/approachcircle", OsuHitObject.OBJECT_DIMENSIONS * 2)
|
||||
: base(@"approachcircle", OsuHitObject.OBJECT_DIMENSIONS * 2)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -34,19 +34,19 @@ namespace osu.Game.Rulesets.Osu.Skinning.Legacy
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(DrawableHitObject drawableObject, ISkinSource skinSource)
|
||||
{
|
||||
const string lookup_name = @"reversearrow";
|
||||
|
||||
drawableRepeat = (DrawableSliderRepeat)drawableObject;
|
||||
|
||||
AutoSizeAxes = Axes.Both;
|
||||
|
||||
string lookupName = new OsuSkinComponentLookup(OsuSkinComponents.ReverseArrow).LookupName;
|
||||
|
||||
var skin = skinSource.FindProvider(s => s.GetTexture(lookupName) != null);
|
||||
var skin = skinSource.FindProvider(s => s.GetTexture(lookup_name) != null);
|
||||
|
||||
InternalChild = arrow = new Sprite
|
||||
{
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.Centre,
|
||||
Texture = skin?.GetTexture(lookupName)?.WithMaximumSize(maxSize: OsuHitObject.OBJECT_DIMENSIONS * 2),
|
||||
Texture = skin?.GetTexture(lookup_name)?.WithMaximumSize(maxSize: OsuHitObject.OBJECT_DIMENSIONS * 2),
|
||||
};
|
||||
|
||||
textureIsDefaultSkin = skin is ISkinTransformer transformer && transformer.Skin is DefaultLegacySkin;
|
||||
|
@ -2,7 +2,6 @@
|
||||
// See the LICENCE file in the repository root for full licence text.
|
||||
|
||||
using System;
|
||||
using System.Linq;
|
||||
using osu.Game.Rulesets.Judgements;
|
||||
using osu.Game.Rulesets.Scoring;
|
||||
|
||||
@ -28,8 +27,5 @@ namespace osu.Game.Skinning
|
||||
|
||||
protected virtual string RulesetPrefix => string.Empty;
|
||||
protected virtual string ComponentName => Component.ToString();
|
||||
|
||||
public string LookupName =>
|
||||
string.Join('/', new[] { "Gameplay", RulesetPrefix, ComponentName }.Where(s => !string.IsNullOrEmpty(s)));
|
||||
}
|
||||
}
|
||||
|
@ -491,39 +491,30 @@ namespace osu.Game.Skinning
|
||||
break;
|
||||
}
|
||||
|
||||
foreach (string name in getFallbackNames(componentName))
|
||||
Texture? texture = null;
|
||||
float ratio = 1;
|
||||
|
||||
if (AllowHighResolutionSprites)
|
||||
{
|
||||
string lookupName = name;
|
||||
Texture? texture = null;
|
||||
float ratio = 1;
|
||||
// some component names (especially user-controlled ones, like `HitX` in mania)
|
||||
// may contain `@2x` scale specifications.
|
||||
// stable happens to check for that and strip them, so do the same to match stable behaviour.
|
||||
componentName = componentName.Replace(@"@2x", string.Empty);
|
||||
|
||||
if (AllowHighResolutionSprites)
|
||||
{
|
||||
// some component names (especially user-controlled ones, like `HitX` in mania)
|
||||
// may contain `@2x` scale specifications.
|
||||
// stable happens to check for that and strip them, so do the same to match stable behaviour.
|
||||
lookupName = name.Replace(@"@2x", string.Empty);
|
||||
string twoTimesFilename = $"{Path.ChangeExtension(componentName, null)}@2x{Path.GetExtension(componentName)}";
|
||||
|
||||
string twoTimesFilename = $"{Path.ChangeExtension(lookupName, null)}@2x{Path.GetExtension(lookupName)}";
|
||||
texture = Textures?.Get(twoTimesFilename, wrapModeS, wrapModeT);
|
||||
|
||||
texture = Textures?.Get(twoTimesFilename, wrapModeS, wrapModeT);
|
||||
if (texture != null)
|
||||
ratio = 2;
|
||||
}
|
||||
|
||||
if (texture == null)
|
||||
{
|
||||
ratio = 1;
|
||||
texture = Textures?.Get(lookupName, wrapModeS, wrapModeT);
|
||||
}
|
||||
|
||||
if (texture == null)
|
||||
continue;
|
||||
|
||||
texture.ScaleAdjust = ratio;
|
||||
return texture;
|
||||
}
|
||||
|
||||
return null;
|
||||
texture ??= Textures?.Get(componentName, wrapModeS, wrapModeT);
|
||||
|
||||
if (texture != null)
|
||||
texture.ScaleAdjust = ratio;
|
||||
|
||||
return texture;
|
||||
}
|
||||
|
||||
public override ISample? GetSample(ISampleInfo sampleInfo)
|
||||
@ -534,7 +525,7 @@ namespace osu.Game.Skinning
|
||||
lookupNames = getLegacyLookupNames(hitSample);
|
||||
else
|
||||
{
|
||||
lookupNames = sampleInfo.LookupNames.SelectMany(getFallbackNames);
|
||||
lookupNames = sampleInfo.LookupNames.SelectMany(getFallbackSampleNames);
|
||||
}
|
||||
|
||||
foreach (string lookup in lookupNames)
|
||||
@ -552,7 +543,7 @@ namespace osu.Game.Skinning
|
||||
|
||||
private IEnumerable<string> getLegacyLookupNames(HitSampleInfo hitSample)
|
||||
{
|
||||
var lookupNames = hitSample.LookupNames.SelectMany(getFallbackNames);
|
||||
var lookupNames = hitSample.LookupNames.SelectMany(getFallbackSampleNames);
|
||||
|
||||
if (!UseCustomSampleBanks && !string.IsNullOrEmpty(hitSample.Suffix))
|
||||
{
|
||||
@ -571,13 +562,13 @@ namespace osu.Game.Skinning
|
||||
yield return hitSample.Name;
|
||||
}
|
||||
|
||||
private IEnumerable<string> getFallbackNames(string componentName)
|
||||
private IEnumerable<string> getFallbackSampleNames(string name)
|
||||
{
|
||||
// May be something like "Gameplay/osu/approachcircle" from lazer, or "Arrows/note1" from a user skin.
|
||||
yield return componentName;
|
||||
// May be something like "Gameplay/normal-hitnormal" from lazer.
|
||||
yield return name;
|
||||
|
||||
// Fall back to using the last piece for components coming from lazer (e.g. "Gameplay/osu/approachcircle" -> "approachcircle").
|
||||
yield return componentName.Split('/').Last();
|
||||
// Fall back to using the last piece for components coming from lazer (e.g. "Gameplay/normal-hitnormal" -> "normal-hitnormal").
|
||||
yield return name.Split('/').Last();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user