1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-06 06:57:39 +08:00

Remove LookupName from base ISkinComponentLookup

This commit is contained in:
Dean Herbert 2022-11-09 16:39:33 +09:00
parent 1aa0e40f2f
commit e19ba65f91
8 changed files with 26 additions and 31 deletions

View File

@ -35,10 +35,10 @@ namespace osu.Game.Rulesets.Osu.Skinning.Legacy
switch (osuComponent.Component)
{
case OsuSkinComponents.FollowPoint:
return this.GetAnimation(lookup.LookupName, true, true, true, startAtCurrentTime: false);
return this.GetAnimation("followpoint", true, true, true, startAtCurrentTime: false);
case OsuSkinComponents.SliderScorePoint:
return this.GetAnimation(lookup.LookupName, false, false);
return this.GetAnimation("sliderscorepoint", false, false);
case OsuSkinComponents.SliderFollowCircle:
var followCircleContent = this.GetAnimation("sliderfollowcircle", true, true, true);

View File

@ -289,7 +289,7 @@ namespace osu.Game.Tests.Visual.Gameplay
}
public Drawable GetDrawableComponent(ISkinComponentLookup componentLookupName) =>
componentLookupName.LookupName == "available"
(componentLookupName as TestSkinComponentLookup)?.LookupName == "available"
? new DrawWidthBox
{
Colour = Color4.Yellow,

View File

@ -7,7 +7,6 @@ using JetBrains.Annotations;
using osu.Framework.Audio.Sample;
using osu.Framework.Bindables;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Sprites;
using osu.Framework.Graphics.Textures;
using osu.Game.Audio;
using osu.Game.Beatmaps.Formats;
@ -88,6 +87,16 @@ namespace osu.Game.Skinning
switch (lookup)
{
case SkinnableSprite.SpriteComponentLookup spriteLookup:
switch (spriteLookup.LookupName)
{
// Temporary until default skin has a valid hit lighting.
case @"lighting":
return Drawable.Empty();
}
break;
case GlobalSkinComponentLookup globalLookup:
switch (globalLookup.Lookup)
{
@ -178,16 +187,6 @@ namespace osu.Game.Skinning
return null;
}
switch (lookup.LookupName)
{
// Temporary until default skin has a valid hit lighting.
case @"lighting":
return Drawable.Empty();
}
if (GetTexture(lookup.LookupName) is Texture t)
return new Sprite { Texture = t };
return null;
}

View File

@ -7,8 +7,6 @@ namespace osu.Game.Skinning
{
public readonly LookupType Lookup;
public string LookupName => Lookup.ToString();
public GlobalSkinComponentLookup(LookupType lookup)
{
Lookup = lookup;

View File

@ -16,6 +16,5 @@ namespace osu.Game.Skinning
/// </remarks>
public interface ISkinComponentLookup
{
string LookupName { get; }
}
}

View File

@ -55,10 +55,10 @@ namespace osu.Game.Skinning
protected override Drawable CreateDefault(ISkinComponentLookup lookup)
{
var texture = textures.Get(lookup.LookupName);
var texture = textures.Get(((SpriteComponentLookup)lookup).LookupName);
if (texture == null)
return new SpriteNotFound(lookup.LookupName);
return new SpriteNotFound(((SpriteComponentLookup)lookup).LookupName);
return new Sprite { Texture = texture };
}

View File

@ -7,7 +7,6 @@ using JetBrains.Annotations;
using osu.Framework.Audio.Sample;
using osu.Framework.Bindables;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Sprites;
using osu.Framework.Graphics.Textures;
using osu.Game.Audio;
using osu.Game.Beatmaps.Formats;
@ -66,6 +65,16 @@ namespace osu.Game.Skinning
switch (lookup)
{
case SkinnableSprite.SpriteComponentLookup spriteLookup:
switch (spriteLookup.LookupName)
{
// Temporary until default skin has a valid hit lighting.
case @"lighting":
return Drawable.Empty();
}
break;
case GlobalSkinComponentLookup target:
switch (target.Lookup)
{
@ -156,16 +165,6 @@ namespace osu.Game.Skinning
return null;
}
switch (lookup.LookupName)
{
// Temporary until default skin has a valid hit lighting.
case @"lighting":
return Drawable.Empty();
}
if (GetTexture(lookup.LookupName) is Texture t)
return new Sprite { Texture = t };
return null;
}

View File

@ -8,7 +8,7 @@ namespace osu.Game.Skinning
public class UnsupportedSkinComponentException : Exception
{
public UnsupportedSkinComponentException(ISkinComponentLookup lookup)
: base($@"Unsupported component type: {lookup.GetType()} (lookup: ""{lookup.LookupName}"").")
: base($@"Unsupported component type: {lookup.GetType()} (lookup: ""{lookup}"").")
{
}
}