1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-31 15:12:54 +08:00

Make the text are always horizontal

This commit is contained in:
normalid 2024-07-23 19:56:43 +08:00
parent 777a0deb0f
commit 5dcc8b7a8f
2 changed files with 22 additions and 1 deletions

View File

@ -20,6 +20,17 @@ namespace osu.Game.Skinning
public Colour4 KeyDownBackgroundColour { get; set; } = Colour4.Yellow;
private float keyTextRotation = 0f;
public float KeyTextRotation
{
get => keyTextRotation;
set
{
keyTextRotation = value;
overlayKeyText.Rotation = value;
}
}
public Colour4 KeyUpBackgroundColour { get; set; } = Colour4.White;
private Container keyContainer = null!;
@ -56,6 +67,7 @@ namespace osu.Game.Skinning
Text = trigger.Name,
Colour = KeyTextColour,
Font = OsuFont.Default.With(fixedWidth: true),
Rotation = KeyTextRotation
},
}
};
@ -65,7 +77,7 @@ namespace osu.Game.Skinning
{
base.LoadComplete();
Width = Math.Max(overlayKey.Width, 48 * 0.95f);
Height = Math.Max(overlayKey.Height, 48 * 0.95f);
Height = Math.Max(overlayKey.Height, 46 * 0.95f);
}
protected override void Activate(bool forwardPlayback = true)

View File

@ -57,8 +57,17 @@ namespace osu.Game.Skinning
{
TransitionDuration = key_transition_time,
KeyTextColour = keyTextColor,
KeyTextRotation = -Rotation,
};
protected override void Update()
{
base.Update();
// keep the text are always horizontal
foreach (var child in KeyFlow.Cast<LegacyKeyCounter>())
child.KeyTextRotation = -Rotation;
}
private Color4 keyTextColor = Color4.White;
public Color4 KeyTextColor