diff --git a/typebeat.Game.Rulesets.TypeBeat/UI/LyricLineDisplay.BackingVocals.cs b/typebeat.Game.Rulesets.TypeBeat/UI/LyricLineDisplay.BackingVocals.cs index 65e0b5f0..fcfdae56 100644 --- a/typebeat.Game.Rulesets.TypeBeat/UI/LyricLineDisplay.BackingVocals.cs +++ b/typebeat.Game.Rulesets.TypeBeat/UI/LyricLineDisplay.BackingVocals.cs @@ -52,6 +52,7 @@ public partial class LyricLineDisplay private float[] backingTilts = Array.Empty(); private Vector2[] backingRest = Array.Empty(); private bool backingEnabled = true; + private float backingStageWidth; /// The backing words this line shows (its source line's, see ). private IReadOnlyList backingWords => Line.Source.BackingVocals; @@ -93,12 +94,14 @@ private void layoutBackingVocals() if (backingTexts.Length == 0) return; - float width = cellX[^1]; + float lyricWidth = cellX[^1]; + float span = backingStageWidth > 0 ? backingStageWidth : lyricWidth; + float left = (lyricWidth - span) * 0.5f; float ruby = furigana.Count > 0 ? requestedFontSize * 0.36f * 1.15f + 2 * SizeRatio : 0; float lift = ruby + BACKING_GAP * SizeRatio; for (int i = 0; i < backingTexts.Length; i++) - backingRest[i] = new Vector2(width * (float)BackingVocals.AnchorOf(backingWords, i), -lift); + backingRest[i] = new Vector2(left + span * (float)BackingVocals.AnchorOf(backingWords, i), -lift); updateBackingVocals(Time.Current); } @@ -132,6 +135,18 @@ public void SetBackingVocalsEnabled(bool enabled) updateBackingVocals(Time.Current); } + /// Sets the full stage width used to place backing vocals across the screen. + public void SetBackingStageWidth(float width) + { + if (width <= 0 || Math.Abs(backingStageWidth - width) < 0.1f) + return; + + backingStageWidth = width; + + if (IsLoaded) + layoutBackingVocals(); + } + /// How many backing words this line draws (test support). internal int BackingVocalCount => backingTexts.Length; diff --git a/typebeat.Game.Rulesets.TypeBeat/UI/LyricStage.cs b/typebeat.Game.Rulesets.TypeBeat/UI/LyricStage.cs index 925c440f..d6cf0fb0 100644 --- a/typebeat.Game.Rulesets.TypeBeat/UI/LyricStage.cs +++ b/typebeat.Game.Rulesets.TypeBeat/UI/LyricStage.cs @@ -826,7 +826,10 @@ protected override void Update() bool resized = false; foreach (var display in displays) + { + display.SetBackingStageWidth(DrawWidth); resized |= display.SetMaximumWidth(lineWidth); + } if (resized) {