mirror of
https://github.com/ppy/osu.git
synced 2024-12-13 03:42:57 +08:00
Add size limitation for approach circles
This commit is contained in:
parent
f963a921db
commit
b823507b2a
@ -5,12 +5,14 @@ using osu.Framework.Allocation;
|
||||
using osu.Framework.Bindables;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Game.Rulesets.Objects.Drawables;
|
||||
using osu.Game.Rulesets.Osu.Objects;
|
||||
using osu.Game.Skinning;
|
||||
using osuTK;
|
||||
using osuTK.Graphics;
|
||||
|
||||
namespace osu.Game.Rulesets.Osu.Skinning.Legacy
|
||||
{
|
||||
// todo: this should probably not be a SkinnableSprite, as this is always created for legacy skins and is recreated on skin change.
|
||||
public partial class LegacyApproachCircle : SkinnableSprite
|
||||
{
|
||||
private readonly IBindable<Color4> accentColour = new Bindable<Color4>();
|
||||
@ -19,7 +21,7 @@ namespace osu.Game.Rulesets.Osu.Skinning.Legacy
|
||||
private DrawableHitObject drawableObject { get; set; } = null!;
|
||||
|
||||
public LegacyApproachCircle()
|
||||
: base("Gameplay/osu/approachcircle")
|
||||
: base("Gameplay/osu/approachcircle", new Vector2(OsuHitObject.OBJECT_RADIUS * 2))
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -190,7 +190,7 @@ namespace osu.Game.Skinning
|
||||
{
|
||||
// This fallback is important for user skins which use SkinnableSprites.
|
||||
case SkinnableSprite.SpriteComponentLookup sprite:
|
||||
return this.GetAnimation(sprite.LookupName, false, false);
|
||||
return this.GetAnimation(sprite.LookupName, false, false, maxSize: sprite.MaxSize);
|
||||
|
||||
case SkinComponentsContainerLookup containerLookup:
|
||||
|
||||
|
@ -34,8 +34,8 @@ namespace osu.Game.Skinning
|
||||
[Resolved]
|
||||
private ISkinSource source { get; set; } = null!;
|
||||
|
||||
public SkinnableSprite(string textureName, ConfineMode confineMode = ConfineMode.NoScaling)
|
||||
: base(new SpriteComponentLookup(textureName), confineMode)
|
||||
public SkinnableSprite(string textureName, Vector2? maxSize = null, ConfineMode confineMode = ConfineMode.NoScaling)
|
||||
: base(new SpriteComponentLookup(textureName, maxSize), confineMode)
|
||||
{
|
||||
SpriteName.Value = textureName;
|
||||
}
|
||||
@ -56,10 +56,14 @@ namespace osu.Game.Skinning
|
||||
|
||||
protected override Drawable CreateDefault(ISkinComponentLookup lookup)
|
||||
{
|
||||
var texture = textures.Get(((SpriteComponentLookup)lookup).LookupName);
|
||||
var spriteLookup = (SpriteComponentLookup)lookup;
|
||||
var texture = textures.Get(spriteLookup.LookupName);
|
||||
|
||||
if (texture == null)
|
||||
return new SpriteNotFound(((SpriteComponentLookup)lookup).LookupName);
|
||||
return new SpriteNotFound(spriteLookup.LookupName);
|
||||
|
||||
if (spriteLookup.MaxSize != null)
|
||||
texture = texture.WithMaximumSize(spriteLookup.MaxSize.Value);
|
||||
|
||||
return new Sprite { Texture = texture };
|
||||
}
|
||||
@ -69,10 +73,12 @@ namespace osu.Game.Skinning
|
||||
internal class SpriteComponentLookup : ISkinComponentLookup
|
||||
{
|
||||
public string LookupName { get; set; }
|
||||
public Vector2? MaxSize { get; set; }
|
||||
|
||||
public SpriteComponentLookup(string textureName)
|
||||
public SpriteComponentLookup(string textureName, Vector2? maxSize = null)
|
||||
{
|
||||
LookupName = textureName;
|
||||
MaxSize = maxSize;
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user