mirror of
https://github.com/ppy/osu.git
synced 2025-03-20 03:47:28 +08:00
Handle all skin component types explicitly
This commit is contained in:
parent
69e2e30971
commit
61078910a6
@ -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);
|
||||
|
@ -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)
|
||||
|
@ -392,8 +392,11 @@ namespace osu.Game.Skinning
|
||||
|
||||
return null;
|
||||
|
||||
case SkinnableSprite.SpriteComponent sprite:
|
||||
return this.GetAnimation(sprite.LookupName, false, false);
|
||||
|
||||
default:
|
||||
throw new ArgumentOutOfRangeException(nameof(component));
|
||||
throw new UnsupportedSkinComponentException(component);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -65,7 +65,7 @@ namespace osu.Game.Skinning
|
||||
|
||||
public bool UsesFixedAnchor { get; set; }
|
||||
|
||||
private class SpriteComponent : ISkinComponent
|
||||
public 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()}(""{component.LookupName}"").")
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user