1
0
mirror of https://github.com/ppy/osu.git synced 2024-09-21 18:47:27 +08:00

Merge pull request #28111 from Joehuu/fix-broken-scrolling-unicode

Fix now playing overlay text scroll breaking when toggling metadata language setting
This commit is contained in:
Dean Herbert 2024-05-06 11:15:51 +08:00 committed by GitHub
commit 6f0fc6f78f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 17 additions and 5 deletions

View File

@ -5,6 +5,7 @@
using NUnit.Framework;
using osu.Framework.Allocation;
using osu.Framework.Configuration;
using osu.Framework.Graphics;
using osu.Game.Beatmaps;
using osu.Game.Overlays;
@ -21,8 +22,10 @@ namespace osu.Game.Tests.Visual.UserInterface
private NowPlayingOverlay nowPlayingOverlay;
[BackgroundDependencyLoader]
private void load()
private void load(FrameworkConfigManager frameworkConfig)
{
AddToggleStep("toggle unicode", v => frameworkConfig.SetValue(FrameworkSetting.ShowUnicode, v));
nowPlayingOverlay = new NowPlayingOverlay
{
Origin = Anchor.Centre,
@ -50,9 +53,9 @@ namespace osu.Game.Tests.Visual.UserInterface
Metadata =
{
Artist = "very very very very very very very very very very verry long artist",
ArtistUnicode = "very very very very very very very very very very verry long artist",
ArtistUnicode = "very very very very very very very very very very verry long artist unicode",
Title = "very very very very very verry long title",
TitleUnicode = "very very very very very verry long title",
TitleUnicode = "very very very very very verry long title unicode",
}
}));
@ -61,9 +64,9 @@ namespace osu.Game.Tests.Visual.UserInterface
Metadata =
{
Artist = "very very very very very very very very very very verrry long artist",
ArtistUnicode = "very very very very very very very very very very verrry long artist",
ArtistUnicode = "not very long artist unicode",
Title = "very very very very very verrry long title",
TitleUnicode = "very very very very very verrry long title",
TitleUnicode = "not very long title unicode",
}
}));

View File

@ -5,6 +5,7 @@ using System;
using System.Threading;
using osu.Framework.Allocation;
using osu.Framework.Bindables;
using osu.Framework.Configuration;
using osu.Framework.Extensions.Color4Extensions;
using osu.Framework.Extensions.ObjectExtensions;
using osu.Framework.Graphics;
@ -479,6 +480,11 @@ namespace osu.Game.Overlays
private OsuSpriteText mainSpriteText = null!;
private OsuSpriteText fillerSpriteText = null!;
private Bindable<bool> showUnicode = null!;
[Resolved]
private FrameworkConfigManager frameworkConfig { get; set; } = null!;
private LocalisableString text;
public LocalisableString Text
@ -531,6 +537,9 @@ namespace osu.Game.Overlays
{
base.LoadComplete();
showUnicode = frameworkConfig.GetBindable<bool>(FrameworkSetting.ShowUnicode);
showUnicode.BindValueChanged(_ => updateText());
updateFontAndText();
}