mirror of
https://github.com/osukey/osukey.git
synced 2025-07-01 08:20:00 +09:00
Simplify StarCounter and SpriteIcon
This commit is contained in:
@ -15,14 +15,19 @@ namespace osu.Game.Graphics
|
||||
{
|
||||
public class SpriteIcon : CompositeDrawable
|
||||
{
|
||||
private readonly Sprite spriteShadow;
|
||||
private readonly Sprite spriteMain;
|
||||
private Sprite spriteShadow;
|
||||
private Sprite spriteMain;
|
||||
|
||||
private Cached layout = new Cached();
|
||||
private readonly Container shadowVisibility;
|
||||
private Container shadowVisibility;
|
||||
|
||||
public SpriteIcon()
|
||||
private FontStore store;
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(FontStore store)
|
||||
{
|
||||
this.store = store;
|
||||
|
||||
InternalChildren = new Drawable[]
|
||||
{
|
||||
shadowVisibility = new Container
|
||||
@ -39,7 +44,7 @@ namespace osu.Game.Graphics
|
||||
Y = 2,
|
||||
Colour = new Color4(0f, 0f, 0f, 0.2f),
|
||||
},
|
||||
Alpha = 0,
|
||||
Alpha = shadow ? 1 : 0,
|
||||
},
|
||||
spriteMain = new Sprite
|
||||
{
|
||||
@ -49,14 +54,7 @@ namespace osu.Game.Graphics
|
||||
FillMode = FillMode.Fit
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
private FontStore store;
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(FontStore store)
|
||||
{
|
||||
this.store = store;
|
||||
updateTexture();
|
||||
}
|
||||
|
||||
@ -105,12 +103,15 @@ namespace osu.Game.Graphics
|
||||
}
|
||||
}
|
||||
|
||||
private bool shadow;
|
||||
public bool Shadow
|
||||
{
|
||||
get { return spriteShadow.IsPresent; }
|
||||
get { return shadow; }
|
||||
set
|
||||
{
|
||||
shadowVisibility.Alpha = value ? 1 : 0;
|
||||
shadow = value;
|
||||
if (shadowVisibility != null)
|
||||
shadowVisibility.Alpha = value ? 1 : 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user