mirror of
https://github.com/ppy/osu.git
synced 2024-11-11 18:27:26 +08:00
Replace SkinnableSprite
with Sprite
This commit is contained in:
parent
a015fde014
commit
9fe369b7f4
@ -1,8 +1,11 @@
|
||||
// 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 osu.Framework.Allocation;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Framework.Graphics.Sprites;
|
||||
using osu.Framework.Graphics.Textures;
|
||||
using osu.Game.Graphics;
|
||||
using osu.Game.Graphics.Sprites;
|
||||
using osu.Game.Screens.Play.HUD;
|
||||
@ -22,6 +25,7 @@ namespace osu.Game.Skinning
|
||||
public Colour4 KeyUpBackgroundColour { get; set; } = Colour4.White;
|
||||
|
||||
private float keyTextRotation = 0f;
|
||||
|
||||
public float KeyTextRotation
|
||||
{
|
||||
get => keyTextRotation;
|
||||
@ -36,6 +40,8 @@ namespace osu.Game.Skinning
|
||||
|
||||
private OsuSpriteText overlayKeyText = null!;
|
||||
|
||||
private Sprite keySprite = null!;
|
||||
|
||||
public LegacyKeyCounter(InputTrigger trigger)
|
||||
: base(trigger)
|
||||
{
|
||||
@ -48,12 +54,11 @@ namespace osu.Game.Skinning
|
||||
Anchor = Anchor.Centre,
|
||||
Children = new Drawable[]
|
||||
{
|
||||
new SkinnableSprite
|
||||
keySprite = new Sprite
|
||||
{
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.Centre,
|
||||
BypassAutoSizeAxes = Axes.Both,
|
||||
SpriteName = { Value = "inputoverlay-key" },
|
||||
Rotation = -90,
|
||||
},
|
||||
overlayKeyText = new OsuSpriteText
|
||||
@ -72,6 +77,15 @@ namespace osu.Game.Skinning
|
||||
Height = Width = 48 * 0.95f;
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(ISkinSource source)
|
||||
{
|
||||
Texture? keyTexture = source.GetTexture($"inputoverlay-key");
|
||||
|
||||
if (keyTexture != null)
|
||||
keySprite.Texture = keyTexture;
|
||||
}
|
||||
|
||||
protected override void Activate(bool forwardPlayback = true)
|
||||
{
|
||||
base.Activate(forwardPlayback);
|
||||
|
@ -7,6 +7,8 @@ using osu.Framework.Graphics.Containers;
|
||||
using osu.Game.Screens.Play.HUD;
|
||||
using osuTK.Graphics;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Graphics.Sprites;
|
||||
using osu.Framework.Graphics.Textures;
|
||||
|
||||
namespace osu.Game.Skinning
|
||||
{
|
||||
@ -16,17 +18,18 @@ namespace osu.Game.Skinning
|
||||
|
||||
protected override FillFlowContainer<KeyCounter> KeyFlow { get; } = null!;
|
||||
|
||||
private Sprite backgroundSprite = null!;
|
||||
|
||||
public LegacyKeyCounterDisplay()
|
||||
{
|
||||
AutoSizeAxes = Axes.Both;
|
||||
|
||||
AddRangeInternal(new Drawable[]
|
||||
{
|
||||
new SkinnableSprite
|
||||
backgroundSprite = new Sprite
|
||||
{
|
||||
Anchor = Anchor.TopLeft,
|
||||
Origin = Anchor.TopLeft,
|
||||
SpriteName = { Value= "inputoverlay-background" },
|
||||
},
|
||||
KeyFlow = new FillFlowContainer<KeyCounter>
|
||||
{
|
||||
@ -49,6 +52,11 @@ namespace osu.Game.Skinning
|
||||
{
|
||||
KeyTextColor = v.NewValue;
|
||||
}, true);
|
||||
|
||||
Texture? backgroundTexture = source.GetTexture($"inputoverlay-background");
|
||||
|
||||
if (backgroundTexture != null)
|
||||
backgroundSprite.Texture = backgroundTexture;
|
||||
}
|
||||
|
||||
protected override KeyCounter CreateCounter(InputTrigger trigger) => new LegacyKeyCounter(trigger)
|
||||
|
Loading…
Reference in New Issue
Block a user