mirror of
https://github.com/ppy/osu
synced 2024-12-28 09:52:56 +00:00
Merge pull request #17941 from frenzibyte/remove-legacy-skin-fallback
Handle all legacy skin component types explicitly and remove texture fallback
This commit is contained in:
commit
ed894d6428
@ -90,6 +90,9 @@ namespace osu.Game.Rulesets.Catch.Skinning.Legacy
|
||||
return new LegacyHitExplosion();
|
||||
|
||||
return null;
|
||||
|
||||
default:
|
||||
throw new UnsupportedSkinComponentException(component);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -116,9 +116,10 @@ namespace osu.Game.Rulesets.Mania.Skinning.Legacy
|
||||
|
||||
case ManiaSkinComponents.StageForeground:
|
||||
return new LegacyStageForeground();
|
||||
}
|
||||
|
||||
break;
|
||||
default:
|
||||
throw new UnsupportedSkinComponentException(component);
|
||||
}
|
||||
}
|
||||
|
||||
return base.GetDrawableComponent(component);
|
||||
|
@ -70,7 +70,9 @@ namespace osu.Game.Rulesets.Osu.Tests
|
||||
var tintingSkin = skinManager.GetSkin(DefaultLegacySkin.CreateInfo());
|
||||
tintingSkin.Configuration.ConfigDictionary["AllowSliderBallTint"] = "1";
|
||||
|
||||
Child = new SkinProvidingContainer(tintingSkin)
|
||||
var provider = Ruleset.Value.CreateInstance().CreateLegacySkinProvider(tintingSkin, Beatmap.Value.Beatmap);
|
||||
|
||||
Child = new SkinProvidingContainer(provider)
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Child = dho = new DrawableSlider(prepareObject(new Slider
|
||||
|
@ -35,6 +35,9 @@ namespace osu.Game.Rulesets.Osu.Skinning.Legacy
|
||||
case OsuSkinComponents.FollowPoint:
|
||||
return this.GetAnimation(component.LookupName, true, true, true, startAtCurrentTime: false);
|
||||
|
||||
case OsuSkinComponents.SliderScorePoint:
|
||||
return this.GetAnimation(component.LookupName, false, false);
|
||||
|
||||
case OsuSkinComponents.SliderFollowCircle:
|
||||
var followCircle = this.GetAnimation("sliderfollowcircle", true, true, true);
|
||||
if (followCircle != null)
|
||||
@ -123,6 +126,9 @@ namespace osu.Game.Rulesets.Osu.Skinning.Legacy
|
||||
|
||||
case OsuSkinComponents.ApproachCircle:
|
||||
return new LegacyApproachCircle();
|
||||
|
||||
default:
|
||||
throw new UnsupportedSkinComponentException(component);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -57,6 +57,10 @@ namespace osu.Game.Rulesets.Taiko.Skinning.Legacy
|
||||
case TaikoSkinComponents.DrumRollTick:
|
||||
return this.GetAnimation("sliderscorepoint", false, false);
|
||||
|
||||
case TaikoSkinComponents.Swell:
|
||||
// todo: support taiko legacy swell (https://github.com/ppy/osu/issues/13601).
|
||||
return null;
|
||||
|
||||
case TaikoSkinComponents.HitTarget:
|
||||
if (GetTexture("taikobigcircle") != null)
|
||||
return new TaikoLegacyHitTarget();
|
||||
@ -119,6 +123,9 @@ namespace osu.Game.Rulesets.Taiko.Skinning.Legacy
|
||||
|
||||
case TaikoSkinComponents.Mascot:
|
||||
return new DrawableTaikoMascot();
|
||||
|
||||
default:
|
||||
throw new UnsupportedSkinComponentException(component);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -155,7 +155,7 @@ namespace osu.Game.Skinning
|
||||
return skinnableTargetWrapper;
|
||||
}
|
||||
|
||||
break;
|
||||
return null;
|
||||
}
|
||||
|
||||
switch (component.LookupName)
|
||||
|
@ -391,9 +391,13 @@ namespace osu.Game.Skinning
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
return this.GetAnimation(component.LookupName, false, false);
|
||||
case SkinnableSprite.SpriteComponent sprite:
|
||||
return this.GetAnimation(sprite.LookupName, false, false);
|
||||
|
||||
default:
|
||||
throw new UnsupportedSkinComponentException(component);
|
||||
}
|
||||
}
|
||||
|
||||
private Texture? getParticleTexture(HitResult result)
|
||||
|
@ -65,7 +65,7 @@ namespace osu.Game.Skinning
|
||||
|
||||
public bool UsesFixedAnchor { get; set; }
|
||||
|
||||
private class SpriteComponent : ISkinComponent
|
||||
internal class SpriteComponent : ISkinComponent
|
||||
{
|
||||
public string LookupName { get; set; }
|
||||
|
||||
|
15
osu.Game/Skinning/UnsupportedSkinComponentException.cs
Normal file
15
osu.Game/Skinning/UnsupportedSkinComponentException.cs
Normal file
@ -0,0 +1,15 @@
|
||||
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
||||
// See the LICENCE file in the repository root for full licence text.
|
||||
|
||||
using System;
|
||||
|
||||
namespace osu.Game.Skinning
|
||||
{
|
||||
public class UnsupportedSkinComponentException : Exception
|
||||
{
|
||||
public UnsupportedSkinComponentException(ISkinComponent component)
|
||||
: base($@"Unsupported component type: {component.GetType()} (lookup: ""{component.LookupName}"").")
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
@ -74,11 +74,15 @@ namespace osu.Game.Tests.Visual
|
||||
|
||||
createdDrawables.Add(created);
|
||||
|
||||
SkinProvidingContainer mainProvider;
|
||||
Container childContainer;
|
||||
OutlineBox outlineBox;
|
||||
SkinProvidingContainer skinProvider;
|
||||
|
||||
ISkin provider = skin;
|
||||
|
||||
if (provider is LegacySkin legacyProvider)
|
||||
provider = Ruleset.Value.CreateInstance().CreateLegacySkinProvider(legacyProvider, beatmap);
|
||||
|
||||
var children = new Container
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
@ -107,12 +111,10 @@ namespace osu.Game.Tests.Visual
|
||||
Children = new Drawable[]
|
||||
{
|
||||
outlineBox = new OutlineBox(),
|
||||
(mainProvider = new SkinProvidingContainer(skin)).WithChild(
|
||||
skinProvider = new SkinProvidingContainer(Ruleset.Value.CreateInstance().CreateLegacySkinProvider(mainProvider, beatmap))
|
||||
{
|
||||
Child = created,
|
||||
}
|
||||
)
|
||||
skinProvider = new SkinProvidingContainer(provider)
|
||||
{
|
||||
Child = created,
|
||||
}
|
||||
}
|
||||
},
|
||||
}
|
||||
@ -130,7 +132,7 @@ namespace osu.Game.Tests.Visual
|
||||
{
|
||||
bool autoSize = created.RelativeSizeAxes == Axes.None;
|
||||
|
||||
foreach (var c in new[] { mainProvider, childContainer, skinProvider })
|
||||
foreach (var c in new[] { childContainer, skinProvider })
|
||||
{
|
||||
c.RelativeSizeAxes = Axes.None;
|
||||
c.AutoSizeAxes = Axes.None;
|
||||
|
Loading…
Reference in New Issue
Block a user