1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-15 08:22:56 +08:00

Merge branch 'master' into update-bpm-with-mods

This commit is contained in:
smoogipoo 2021-02-25 21:58:54 +09:00
commit b090a82b35
50 changed files with 115 additions and 103 deletions

View File

@ -52,6 +52,6 @@
</ItemGroup>
<ItemGroup>
<PackageReference Include="ppy.osu.Game.Resources" Version="2021.211.1" />
<PackageReference Include="ppy.osu.Framework.Android" Version="2021.222.0" />
<PackageReference Include="ppy.osu.Framework.Android" Version="2021.225.0" />
</ItemGroup>
</Project>

View File

@ -18,7 +18,7 @@ namespace osu.Game.Rulesets.Osu.Skinning.Default
public string Text
{
get => number.Text;
get => number.Text.ToString();
set => number.Text = value;
}

View File

@ -37,7 +37,7 @@ namespace osu.Game.Tests.Visual.Ranking
Beatmap = createTestBeatmap(author)
}));
AddAssert("mapper name present", () => this.ChildrenOfType<OsuSpriteText>().Any(spriteText => spriteText.Text == "mapper_name"));
AddAssert("mapper name present", () => this.ChildrenOfType<OsuSpriteText>().Any(spriteText => spriteText.Current.Value == "mapper_name"));
}
[Test]
@ -49,7 +49,7 @@ namespace osu.Game.Tests.Visual.Ranking
}));
AddAssert("mapped by text not present", () =>
this.ChildrenOfType<OsuSpriteText>().All(spriteText => !containsAny(spriteText.Text, "mapped", "by")));
this.ChildrenOfType<OsuSpriteText>().All(spriteText => !containsAny(spriteText.Current.Value, "mapped", "by")));
}
private void showPanel(ScoreInfo score) => Child = new ExpandedPanelMiddleContentContainer(score);

View File

@ -78,7 +78,7 @@ namespace osu.Game.Tests.Visual.Settings
clickClearButton();
AddAssert("first binding cleared", () => string.IsNullOrEmpty(multiBindingRow.ChildrenOfType<KeyBindingRow.KeyButton>().First().Text.Text));
AddAssert("first binding cleared", () => string.IsNullOrEmpty(multiBindingRow.ChildrenOfType<KeyBindingRow.KeyButton>().First().Text.Text.ToString()));
AddStep("click second binding", () =>
{
@ -90,7 +90,7 @@ namespace osu.Game.Tests.Visual.Settings
clickClearButton();
AddAssert("second binding cleared", () => string.IsNullOrEmpty(multiBindingRow.ChildrenOfType<KeyBindingRow.KeyButton>().ElementAt(1).Text.Text));
AddAssert("second binding cleared", () => string.IsNullOrEmpty(multiBindingRow.ChildrenOfType<KeyBindingRow.KeyButton>().ElementAt(1).Text.Text.ToString()));
void clickClearButton()
{

View File

@ -103,10 +103,10 @@ namespace osu.Game.Tests.Visual.SongSelect
private void testBeatmapLabels(Ruleset ruleset)
{
AddAssert("check version", () => infoWedge.Info.VersionLabel.Text == $"{ruleset.ShortName}Version");
AddAssert("check title", () => infoWedge.Info.TitleLabel.Text == $"{ruleset.ShortName}Source — {ruleset.ShortName}Title");
AddAssert("check artist", () => infoWedge.Info.ArtistLabel.Text == $"{ruleset.ShortName}Artist");
AddAssert("check author", () => infoWedge.Info.MapperContainer.Children.OfType<OsuSpriteText>().Any(s => s.Text == $"{ruleset.ShortName}Author"));
AddAssert("check version", () => infoWedge.Info.VersionLabel.Current.Value == $"{ruleset.ShortName}Version");
AddAssert("check title", () => infoWedge.Info.TitleLabel.Current.Value == $"{ruleset.ShortName}Source — {ruleset.ShortName}Title");
AddAssert("check artist", () => infoWedge.Info.ArtistLabel.Current.Value == $"{ruleset.ShortName}Artist");
AddAssert("check author", () => infoWedge.Info.MapperContainer.Children.OfType<OsuSpriteText>().Any(s => s.Current.Value == $"{ruleset.ShortName}Author"));
}
private void testInfoLabels(int expectedCount)
@ -119,9 +119,9 @@ namespace osu.Game.Tests.Visual.SongSelect
public void TestNullBeatmap()
{
selectBeatmap(null);
AddAssert("check empty version", () => string.IsNullOrEmpty(infoWedge.Info.VersionLabel.Text));
AddAssert("check default title", () => infoWedge.Info.TitleLabel.Text == Beatmap.Default.BeatmapInfo.Metadata.Title);
AddAssert("check default artist", () => infoWedge.Info.ArtistLabel.Text == Beatmap.Default.BeatmapInfo.Metadata.Artist);
AddAssert("check empty version", () => string.IsNullOrEmpty(infoWedge.Info.VersionLabel.Current.Value));
AddAssert("check default title", () => infoWedge.Info.TitleLabel.Current.Value == Beatmap.Default.BeatmapInfo.Metadata.Title);
AddAssert("check default artist", () => infoWedge.Info.ArtistLabel.Current.Value == Beatmap.Default.BeatmapInfo.Metadata.Artist);
AddAssert("check empty author", () => !infoWedge.Info.MapperContainer.Children.Any());
AddAssert("check no info labels", () => !infoWedge.Info.InfoLabelContainer.Children.Any());
}

View File

@ -145,7 +145,7 @@ namespace osu.Game.Tests.Visual.UserInterface
AddStep("click delete option", () =>
{
InputManager.MoveMouseTo(contextMenuContainer.ChildrenOfType<DrawableOsuMenuItem>().First(i => i.Item.Text.Value.ToLowerInvariant() == "delete"));
InputManager.MoveMouseTo(contextMenuContainer.ChildrenOfType<DrawableOsuMenuItem>().First(i => i.Item.Text.Value.ToString().ToLowerInvariant() == "delete"));
InputManager.Click(MouseButton.Left);
});

View File

@ -76,7 +76,7 @@ namespace osu.Game.Tests.Visual.UserInterface
var multiplier = mods.Aggregate(1.0, (current, mod) => current * mod.ScoreMultiplier);
var expectedValue = multiplier.Equals(1.0) ? string.Empty : $"{multiplier:N2}x";
return expectedValue == footerButtonMods.MultiplierText.Text;
return expectedValue == footerButtonMods.MultiplierText.Current.Value;
}
private class TestFooterButtonMods : FooterButtonMods

View File

@ -74,9 +74,9 @@ namespace osu.Game.Tournament.Components
{
new TournamentSpriteText
{
Text = new LocalisedString((
Text = new RomanisableString(
$"{Beatmap.Metadata.ArtistUnicode ?? Beatmap.Metadata.Artist} - {Beatmap.Metadata.TitleUnicode ?? Beatmap.Metadata.Title}",
$"{Beatmap.Metadata.Artist} - {Beatmap.Metadata.Title}")),
$"{Beatmap.Metadata.Artist} - {Beatmap.Metadata.Title}"),
Font = OsuFont.Torus.With(weight: FontWeight.Bold),
},
new FillFlowContainer

View File

@ -11,6 +11,7 @@ using osu.Framework.Graphics;
using osu.Framework.Graphics.Sprites;
using osu.Framework.Graphics.UserInterface;
using osu.Framework.Input.Events;
using osu.Framework.Localisation;
using osu.Game.Beatmaps;
using osu.Game.Graphics;
using osu.Game.Graphics.Containers;
@ -121,7 +122,7 @@ namespace osu.Game.Collections
Current.TriggerChange();
}
protected override string GenerateItemText(CollectionFilterMenuItem item) => item.CollectionName.Value;
protected override LocalisableString GenerateItemText(CollectionFilterMenuItem item) => item.CollectionName.Value;
protected sealed override DropdownHeader CreateHeader() => CreateCollectionHeader().With(d =>
{
@ -139,7 +140,7 @@ namespace osu.Game.Collections
public readonly Bindable<CollectionFilterMenuItem> SelectedItem = new Bindable<CollectionFilterMenuItem>();
private readonly Bindable<string> collectionName = new Bindable<string>();
protected override string Label
protected override LocalisableString Label
{
get => base.Label;
set { } // See updateText().

View File

@ -8,6 +8,7 @@ using System.Reflection;
using JetBrains.Annotations;
using osu.Framework.Bindables;
using osu.Framework.Graphics;
using osu.Framework.Localisation;
using osu.Game.Overlays.Settings;
namespace osu.Game.Configuration
@ -24,7 +25,7 @@ namespace osu.Game.Configuration
[AttributeUsage(AttributeTargets.Property)]
public class SettingSourceAttribute : Attribute
{
public string Label { get; }
public LocalisableString Label { get; }
public string Description { get; }

View File

@ -6,6 +6,7 @@ using osu.Framework.Graphics;
using osu.Framework.Graphics.Colour;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Sprites;
using osu.Framework.Localisation;
using osuTK;
namespace osu.Game.Graphics.Sprites
@ -14,7 +15,7 @@ namespace osu.Game.Graphics.Sprites
{
private readonly OsuSpriteText spriteText, blurredText;
public string Text
public LocalisableString Text
{
get => spriteText.Text;
set => blurredText.Text = spriteText.Text = value;

View File

@ -10,6 +10,7 @@ using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Sprites;
using osu.Framework.Graphics.UserInterface;
using osu.Framework.Input.Events;
using osu.Framework.Localisation;
using osu.Game.Graphics.Sprites;
using osuTK.Graphics;
@ -105,7 +106,7 @@ namespace osu.Game.Graphics.UserInterface
protected class TextContainer : Container, IHasText
{
public string Text
public LocalisableString Text
{
get => NormalText.Text;
set

View File

@ -11,6 +11,7 @@ using osu.Framework.Graphics.Shapes;
using osu.Framework.Graphics.Sprites;
using osu.Framework.Graphics.UserInterface;
using osu.Framework.Input.Events;
using osu.Framework.Localisation;
using osu.Game.Graphics.Sprites;
using osuTK.Graphics;
@ -21,9 +22,9 @@ namespace osu.Game.Graphics.UserInterface
/// </summary>
public class OsuButton : Button
{
public string Text
public LocalisableString Text
{
get => SpriteText?.Text;
get => SpriteText?.Text ?? default;
set
{
if (SpriteText != null)

View File

@ -9,6 +9,7 @@ using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Sprites;
using osu.Framework.Graphics.UserInterface;
using osu.Framework.Localisation;
using osu.Game.Graphics.Containers;
using osu.Game.Graphics.Sprites;
using osuTK;
@ -168,7 +169,7 @@ namespace osu.Game.Graphics.UserInterface
protected new class Content : FillFlowContainer, IHasText
{
public string Text
public LocalisableString Text
{
get => Label.Text;
set => Label.Text = value;
@ -215,7 +216,7 @@ namespace osu.Game.Graphics.UserInterface
{
protected readonly SpriteText Text;
protected override string Label
protected override LocalisableString Label
{
get => Text.Text;
set => Text.Text = value;

View File

@ -11,6 +11,7 @@ using osu.Game.Graphics.Sprites;
using osu.Framework.Graphics.Sprites;
using osu.Framework.Graphics.UserInterface;
using osu.Framework.Input.Events;
using osu.Framework.Localisation;
namespace osu.Game.Graphics.UserInterface
{
@ -35,7 +36,7 @@ namespace osu.Game.Graphics.UserInterface
}
}
public string Text
public LocalisableString Text
{
get => text.Text;
set => text.Text = value;

View File

@ -11,6 +11,7 @@ using osu.Game.Graphics.Sprites;
using osu.Game.Overlays;
using osuTK;
using System.Collections.Generic;
using osu.Framework.Localisation;
namespace osu.Game.Graphics.UserInterface
{
@ -18,7 +19,7 @@ namespace osu.Game.Graphics.UserInterface
{
private const int duration = 200;
public string Text
public LocalisableString Text
{
get => text.Text;
set => text.Text = value;

View File

@ -27,7 +27,7 @@ namespace osu.Game.Graphics.UserInterface
});
}
public virtual IEnumerable<string> FilterTerms => new[] { Text };
public virtual IEnumerable<string> FilterTerms => new[] { Text.ToString() };
public bool MatchingFilter
{

View File

@ -84,14 +84,14 @@ namespace osu.Game.Overlays.BeatmapListing.Panels
{
new OsuSpriteText
{
Text = new LocalisedString((SetInfo.Metadata.TitleUnicode, SetInfo.Metadata.Title)),
Text = new RomanisableString(SetInfo.Metadata.TitleUnicode, SetInfo.Metadata.Title),
Font = OsuFont.GetFont(size: 18, weight: FontWeight.Bold, italics: true)
},
}
},
new OsuSpriteText
{
Text = new LocalisedString((SetInfo.Metadata.ArtistUnicode, SetInfo.Metadata.Artist)),
Text = new RomanisableString(SetInfo.Metadata.ArtistUnicode, SetInfo.Metadata.Artist),
Font = OsuFont.GetFont(weight: FontWeight.Bold, italics: true)
},
},

View File

@ -107,14 +107,14 @@ namespace osu.Game.Overlays.BeatmapListing.Panels
{
new OsuSpriteText
{
Text = new LocalisedString((SetInfo.Metadata.TitleUnicode, SetInfo.Metadata.Title)),
Text = new RomanisableString(SetInfo.Metadata.TitleUnicode, SetInfo.Metadata.Title),
Font = OsuFont.GetFont(size: 18, weight: FontWeight.Bold, italics: true)
},
}
},
new OsuSpriteText
{
Text = new LocalisedString((SetInfo.Metadata.ArtistUnicode, SetInfo.Metadata.Artist)),
Text = new RomanisableString(SetInfo.Metadata.ArtistUnicode, SetInfo.Metadata.Artist),
Font = OsuFont.GetFont(weight: FontWeight.Bold, italics: true)
},
}

View File

@ -8,6 +8,7 @@ using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Cursor;
using osu.Framework.Graphics.Sprites;
using osu.Framework.Localisation;
using osu.Game.Beatmaps;
using osu.Game.Graphics;
using osu.Game.Graphics.Sprites;
@ -96,7 +97,7 @@ namespace osu.Game.Overlays.BeatmapSet
public string TooltipText { get; }
public string Value
public LocalisableString Value
{
get => value.Text;
set => this.value.Text = value;

View File

@ -9,7 +9,6 @@ using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Shapes;
using osu.Framework.Graphics.Sprites;
using osu.Framework.Localisation;
using osu.Game.Beatmaps;
using osu.Game.Graphics;
using osu.Game.Graphics.Sprites;
@ -204,7 +203,7 @@ namespace osu.Game.Overlays.BeatmapSet.Scores
this.text = text;
}
public LocalisedString Text
public string Text
{
set => text.Text = value;
}

View File

@ -4,19 +4,17 @@
using System;
using System.Collections.Generic;
using System.Linq;
using osuTK;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Game.Graphics;
using osu.Game.Graphics.Sprites;
using osu.Game.Online.Chat;
using osuTK;
namespace osu.Game.Overlays.Chat.Selection
{
public class ChannelSection : Container, IHasFilterableChildren
{
private readonly OsuSpriteText header;
public readonly FillFlowContainer<ChannelListItem> ChannelFlow;
public IEnumerable<IFilterable> FilterableChildren => ChannelFlow.Children;
@ -29,12 +27,6 @@ namespace osu.Game.Overlays.Chat.Selection
public bool FilteringActive { get; set; }
public string Header
{
get => header.Text;
set => header.Text = value.ToUpperInvariant();
}
public IEnumerable<Channel> Channels
{
set => ChannelFlow.ChildrenEnumerable = value.Select(c => new ChannelListItem(c));
@ -47,9 +39,10 @@ namespace osu.Game.Overlays.Chat.Selection
Children = new Drawable[]
{
header = new OsuSpriteText
new OsuSpriteText
{
Font = OsuFont.GetFont(size: 15, weight: FontWeight.Bold),
Text = "All Channels".ToUpperInvariant()
},
ChannelFlow = new FillFlowContainer<ChannelListItem>
{

View File

@ -131,11 +131,7 @@ namespace osu.Game.Overlays.Chat.Selection
{
sectionsFlow.ChildrenEnumerable = new[]
{
new ChannelSection
{
Header = "All Channels",
Channels = channels,
},
new ChannelSection { Channels = channels, },
};
foreach (ChannelSection s in sectionsFlow.Children)

View File

@ -6,6 +6,7 @@ using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Shapes;
using osu.Framework.Input.Events;
using osu.Framework.Localisation;
using osu.Game.Graphics;
using osu.Game.Graphics.Sprites;
using osu.Game.Graphics.UserInterface;
@ -16,7 +17,7 @@ namespace osu.Game.Overlays.Comments.Buttons
{
public abstract class CommentRepliesButton : CompositeDrawable
{
protected string Text
protected LocalisableString Text
{
get => text.Text;
set => text.Text = value;

View File

@ -51,7 +51,7 @@ namespace osu.Game.Overlays.KeyBinding
private FillFlowContainer cancelAndClearButtons;
private FillFlowContainer<KeyButton> buttons;
public IEnumerable<string> FilterTerms => bindings.Select(b => b.KeyCombination.ReadableString()).Prepend((string)text.Text);
public IEnumerable<string> FilterTerms => bindings.Select(b => b.KeyCombination.ReadableString()).Prepend(text.Text.ToString());
public KeyBindingRow(object action, IEnumerable<Framework.Input.Bindings.KeyBinding> bindings)
{

View File

@ -48,8 +48,8 @@ namespace osu.Game.Overlays.Music
artistColour = colours.Gray9;
HandleColour = colours.Gray5;
title = localisation.GetLocalisedString(new LocalisedString((Model.Metadata.TitleUnicode, Model.Metadata.Title)));
artist = localisation.GetLocalisedString(new LocalisedString((Model.Metadata.ArtistUnicode, Model.Metadata.Artist)));
title = localisation.GetLocalisedString(new RomanisableString(Model.Metadata.TitleUnicode, Model.Metadata.Title));
artist = localisation.GetLocalisedString(new RomanisableString(Model.Metadata.ArtistUnicode, Model.Metadata.Artist));
}
protected override void LoadComplete()

View File

@ -8,6 +8,7 @@ using osu.Framework.Allocation;
using osu.Framework.Extensions.IEnumerableExtensions;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Localisation;
using osu.Game.Graphics;
using osu.Game.Graphics.Sprites;
using osuTK;
@ -37,7 +38,7 @@ namespace osu.Game.Overlays.Notifications
public NotificationSection(string title, string clearButtonText)
{
this.clearButtonText = clearButtonText;
this.clearButtonText = clearButtonText.ToUpperInvariant();
titleText = title;
}
@ -138,10 +139,10 @@ namespace osu.Game.Overlays.Notifications
};
}
public string Text
public LocalisableString Text
{
get => text.Text;
set => text.Text = value.ToUpperInvariant();
set => text.Text = value;
}
}

View File

@ -293,8 +293,8 @@ namespace osu.Game.Overlays
else
{
BeatmapMetadata metadata = beatmap.Metadata;
title.Text = new LocalisedString((metadata.TitleUnicode, metadata.Title));
artist.Text = new LocalisedString((metadata.ArtistUnicode, metadata.Artist));
title.Text = new RomanisableString(metadata.TitleUnicode, metadata.Title);
artist.Text = new RomanisableString(metadata.ArtistUnicode, metadata.Artist);
}
});

View File

@ -17,6 +17,7 @@ using osu.Game.Overlays.Comments;
using JetBrains.Annotations;
using System;
using osu.Framework.Extensions;
using osu.Framework.Localisation;
namespace osu.Game.Overlays
{
@ -30,7 +31,7 @@ namespace osu.Game.Overlays
set => current.Current = value;
}
public string Title
public LocalisableString Title
{
get => text.Text;
set => text.Text = value;

View File

@ -5,7 +5,6 @@ using osu.Framework.Allocation;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Sprites;
using osu.Framework.Localisation;
using osu.Game.Beatmaps;
using osu.Game.Beatmaps.Drawables;
using osu.Game.Graphics;
@ -13,6 +12,7 @@ using osu.Game.Graphics.Containers;
using osu.Game.Graphics.Sprites;
using osuTK;
using osu.Framework.Graphics.Cursor;
using osu.Framework.Localisation;
namespace osu.Game.Overlays.Profile.Sections.Historical
{
@ -129,14 +129,14 @@ namespace osu.Game.Overlays.Profile.Sections.Historical
{
new OsuSpriteText
{
Text = new LocalisedString((
Text = new RomanisableString(
$"{beatmap.Metadata.TitleUnicode ?? beatmap.Metadata.Title} [{beatmap.Version}] ",
$"{beatmap.Metadata.Title ?? beatmap.Metadata.TitleUnicode} [{beatmap.Version}] ")),
$"{beatmap.Metadata.Title ?? beatmap.Metadata.TitleUnicode} [{beatmap.Version}] "),
Font = OsuFont.GetFont(weight: FontWeight.Bold)
},
new OsuSpriteText
{
Text = "by " + new LocalisedString((beatmap.Metadata.ArtistUnicode, beatmap.Metadata.Artist)),
Text = "by " + new RomanisableString(beatmap.Metadata.ArtistUnicode, beatmap.Metadata.Artist),
Font = OsuFont.GetFont(weight: FontWeight.Regular)
},
};

View File

@ -256,16 +256,16 @@ namespace osu.Game.Overlays.Profile.Sections.Ranks
{
Anchor = Anchor.BottomLeft,
Origin = Anchor.BottomLeft,
Text = new LocalisedString((
Text = new RomanisableString(
$"{beatmap.Metadata.TitleUnicode ?? beatmap.Metadata.Title} ",
$"{beatmap.Metadata.Title ?? beatmap.Metadata.TitleUnicode} ")),
$"{beatmap.Metadata.Title ?? beatmap.Metadata.TitleUnicode} "),
Font = OsuFont.GetFont(size: 14, weight: FontWeight.SemiBold, italics: true)
},
new OsuSpriteText
{
Anchor = Anchor.BottomLeft,
Origin = Anchor.BottomLeft,
Text = "by " + new LocalisedString((beatmap.Metadata.ArtistUnicode, beatmap.Metadata.Artist)),
Text = "by " + new RomanisableString(beatmap.Metadata.ArtistUnicode, beatmap.Metadata.Artist),
Font = OsuFont.GetFont(size: 12, italics: true)
},
};

View File

@ -6,6 +6,7 @@ using osu.Framework.Audio;
using osu.Framework.Graphics;
using System.Collections.Generic;
using System.Linq;
using osu.Framework.Localisation;
using osu.Game.Graphics.UserInterface;
namespace osu.Game.Overlays.Settings.Sections.Audio
@ -76,7 +77,7 @@ namespace osu.Game.Overlays.Settings.Sections.Audio
private class AudioDeviceDropdownControl : DropdownControl
{
protected override string GenerateItemText(string item)
protected override LocalisableString GenerateItemText(string item)
=> string.IsNullOrEmpty(item) ? "Default" : base.GenerateItemText(item);
}
}

View File

@ -11,6 +11,7 @@ using osu.Framework.Extensions.IEnumerableExtensions;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Shapes;
using osu.Framework.Localisation;
using osu.Framework.Platform;
using osu.Game.Configuration;
using osu.Game.Graphics.Containers;
@ -234,7 +235,7 @@ namespace osu.Game.Overlays.Settings.Sections.Graphics
private class ResolutionDropdownControl : DropdownControl
{
protected override string GenerateItemText(Size item)
protected override LocalisableString GenerateItemText(Size item)
{
if (item == new Size(9999, 9999))
return "Default";

View File

@ -8,6 +8,7 @@ using osu.Framework.Allocation;
using osu.Framework.Bindables;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Sprites;
using osu.Framework.Localisation;
using osu.Framework.Logging;
using osu.Game.Configuration;
using osu.Game.Graphics.UserInterface;
@ -178,7 +179,7 @@ namespace osu.Game.Overlays.Settings.Sections
private class SkinDropdownControl : DropdownControl
{
protected override string GenerateItemText(SkinInfo item) => item.ToString();
protected override LocalisableString GenerateItemText(SkinInfo item) => item.ToString();
}
}

View File

@ -2,20 +2,22 @@
// See the LICENCE file in the repository root for full licence text.
using osu.Framework.Graphics;
using osu.Framework.Localisation;
using osu.Game.Graphics.UserInterface;
namespace osu.Game.Overlays.Settings
{
public class SettingsCheckbox : SettingsItem<bool>
{
private string labelText;
private LocalisableString labelText;
protected override Drawable CreateControl() => new OsuCheckbox();
public override string LabelText
public override LocalisableString LabelText
{
get => labelText;
set => ((OsuCheckbox)Control).LabelText = labelText = value;
// checkbox doesn't properly support localisation yet.
set => ((OsuCheckbox)Control).LabelText = (labelText = value).ToString();
}
}
}

View File

@ -15,6 +15,7 @@ using osu.Framework.Graphics.Shapes;
using osu.Framework.Graphics.Sprites;
using osu.Framework.Graphics.UserInterface;
using osu.Framework.Input.Events;
using osu.Framework.Localisation;
using osu.Game.Graphics;
using osu.Game.Graphics.Sprites;
using osuTK;
@ -39,7 +40,7 @@ namespace osu.Game.Overlays.Settings
public string TooltipText { get; set; }
public virtual string LabelText
public virtual LocalisableString LabelText
{
get => labelText?.Text ?? string.Empty;
set
@ -69,7 +70,7 @@ namespace osu.Game.Overlays.Settings
set => controlWithCurrent.Current = value;
}
public virtual IEnumerable<string> FilterTerms => Keywords == null ? new[] { LabelText } : new List<string>(Keywords) { LabelText }.ToArray();
public virtual IEnumerable<string> FilterTerms => Keywords == null ? new[] { LabelText.ToString() } : new List<string>(Keywords) { LabelText.ToString() }.ToArray();
public IEnumerable<string> Keywords { get; set; }

View File

@ -12,6 +12,7 @@ using osu.Framework.Graphics.Sprites;
using osu.Framework.Graphics.Textures;
using osu.Framework.Input.Bindings;
using osu.Framework.Input.Events;
using osu.Framework.Localisation;
using osu.Game.Graphics;
using osu.Game.Graphics.Backgrounds;
using osu.Game.Graphics.Containers;
@ -43,19 +44,19 @@ namespace osu.Game.Overlays.Toolbar
Texture = textures.Get(texture),
});
public string Text
public LocalisableString Text
{
get => DrawableText.Text;
set => DrawableText.Text = value;
}
public string TooltipMain
public LocalisableString TooltipMain
{
get => tooltip1.Text;
set => tooltip1.Text = value;
}
public string TooltipSub
public LocalisableString TooltipSub
{
get => tooltip2.Text;
set => tooltip2.Text = value;

View File

@ -8,8 +8,8 @@ using osu.Game.Graphics.Sprites;
using osuTK;
using osu.Game.Graphics;
using osu.Framework.Bindables;
using osu.Game.Beatmaps;
using osu.Framework.Localisation;
using osu.Game.Beatmaps;
namespace osu.Game.Screens.Menu
{
@ -61,8 +61,8 @@ namespace osu.Game.Screens.Menu
{
var metadata = beatmap.Value.Metadata;
title.Text = new LocalisedString((metadata.TitleUnicode, metadata.Title));
artist.Text = new LocalisedString((metadata.ArtistUnicode, metadata.Artist));
title.Text = new RomanisableString(metadata.TitleUnicode, metadata.Title);
artist.Text = new RomanisableString(metadata.ArtistUnicode, metadata.Artist);
this.FadeInFromZero(fade_duration / 2f)
.Delay(4000)

View File

@ -73,7 +73,7 @@ namespace osu.Game.Screens.OnlinePlay.Components
{
new OsuSpriteText
{
Text = new LocalisedString((beatmap.Value.Metadata.ArtistUnicode, beatmap.Value.Metadata.Artist)),
Text = new RomanisableString(beatmap.Value.Metadata.ArtistUnicode, beatmap.Value.Metadata.Artist),
Font = OsuFont.GetFont(size: TextSize),
},
new OsuSpriteText
@ -83,7 +83,7 @@ namespace osu.Game.Screens.OnlinePlay.Components
},
new OsuSpriteText
{
Text = new LocalisedString((beatmap.Value.Metadata.TitleUnicode, beatmap.Value.Metadata.Title)),
Text = new RomanisableString(beatmap.Value.Metadata.TitleUnicode, beatmap.Value.Metadata.Title),
Font = OsuFont.GetFont(size: TextSize),
}
}, LinkAction.OpenBeatmap, beatmap.Value.OnlineBeatmapID.ToString(), "Open beatmap");

View File

@ -10,6 +10,7 @@ using osu.Framework.Extensions.Color4Extensions;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Shapes;
using osu.Framework.Localisation;
using osu.Game.Graphics;
using osu.Game.Graphics.Containers;
using osu.Game.Graphics.Sprites;
@ -362,7 +363,7 @@ namespace osu.Game.Screens.OnlinePlay.Playlists
Menu.MaxHeight = 100;
}
protected override string GenerateItemText(TimeSpan item) => item.Humanize();
protected override LocalisableString GenerateItemText(TimeSpan item) => item.Humanize();
}
}
}

View File

@ -73,7 +73,7 @@ namespace osu.Game.Screens.Play
}),
new OsuSpriteText
{
Text = new LocalisedString((metadata.TitleUnicode, metadata.Title)),
Text = new RomanisableString(metadata.TitleUnicode, metadata.Title),
Font = OsuFont.GetFont(size: 36, italics: true),
Origin = Anchor.TopCentre,
Anchor = Anchor.TopCentre,
@ -81,7 +81,7 @@ namespace osu.Game.Screens.Play
},
new OsuSpriteText
{
Text = new LocalisedString((metadata.ArtistUnicode, metadata.Artist)),
Text = new RomanisableString(metadata.ArtistUnicode, metadata.Artist),
Font = OsuFont.GetFont(size: 26, italics: true),
Origin = Anchor.TopCentre,
Anchor = Anchor.TopCentre,

View File

@ -101,7 +101,7 @@ namespace osu.Game.Screens.Ranking.Expanded
{
Anchor = Anchor.TopCentre,
Origin = Anchor.TopCentre,
Text = new LocalisedString((metadata.TitleUnicode, metadata.Title)),
Text = new RomanisableString(metadata.TitleUnicode, metadata.Title),
Font = OsuFont.Torus.With(size: 20, weight: FontWeight.SemiBold),
MaxWidth = ScorePanel.EXPANDED_WIDTH - padding * 2,
Truncate = true,
@ -110,7 +110,7 @@ namespace osu.Game.Screens.Ranking.Expanded
{
Anchor = Anchor.TopCentre,
Origin = Anchor.TopCentre,
Text = new LocalisedString((metadata.ArtistUnicode, metadata.Artist)),
Text = new RomanisableString(metadata.ArtistUnicode, metadata.Artist),
Font = OsuFont.Torus.With(size: 14, weight: FontWeight.SemiBold),
MaxWidth = ScorePanel.EXPANDED_WIDTH - padding * 2,
Truncate = true,

View File

@ -198,8 +198,8 @@ namespace osu.Game.Screens.Select
settingChangeTracker = new ModSettingChangeTracker(mods);
settingChangeTracker.SettingChanged += _ => updateBPM();
titleBinding = localisation.GetLocalisedString(new LocalisedString((metadata.TitleUnicode, metadata.Title)));
artistBinding = localisation.GetLocalisedString(new LocalisedString((metadata.ArtistUnicode, metadata.Artist)));
titleBinding = localisation.GetLocalisedString(new RomanisableString(metadata.TitleUnicode, metadata.Title));
artistBinding = localisation.GetLocalisedString(new RomanisableString(metadata.ArtistUnicode, metadata.Artist));
Children = new Drawable[]
{

View File

@ -41,13 +41,13 @@ namespace osu.Game.Screens.Select.Carousel
{
new OsuSpriteText
{
Text = new LocalisedString((beatmapSet.Metadata.TitleUnicode, beatmapSet.Metadata.Title)),
Text = new RomanisableString(beatmapSet.Metadata.TitleUnicode, beatmapSet.Metadata.Title),
Font = OsuFont.GetFont(weight: FontWeight.Bold, size: 22, italics: true),
Shadow = true,
},
new OsuSpriteText
{
Text = new LocalisedString((beatmapSet.Metadata.ArtistUnicode, beatmapSet.Metadata.Artist)),
Text = new RomanisableString(beatmapSet.Metadata.ArtistUnicode, beatmapSet.Metadata.Artist),
Font = OsuFont.GetFont(weight: FontWeight.SemiBold, size: 17, italics: true),
Shadow = true,
},

View File

@ -15,6 +15,7 @@ using System.Collections.Generic;
using osu.Game.Rulesets.Mods;
using System.Linq;
using System.Threading;
using osu.Framework.Localisation;
using osu.Framework.Threading;
using osu.Framework.Utils;
using osu.Game.Configuration;
@ -180,7 +181,7 @@ namespace osu.Game.Screens.Select.Details
[Resolved]
private OsuColour colours { get; set; }
public string Title
public LocalisableString Title
{
get => name.Text;
set => name.Text = value;

View File

@ -10,6 +10,7 @@ using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Shapes;
using osu.Framework.Graphics.Sprites;
using osu.Framework.Input.Events;
using osu.Framework.Localisation;
using osu.Game.Graphics.Sprites;
using osu.Game.Graphics.Containers;
@ -21,9 +22,9 @@ namespace osu.Game.Screens.Select
protected static readonly Vector2 SHEAR = new Vector2(SHEAR_WIDTH / Footer.HEIGHT, 0);
public string Text
public LocalisableString Text
{
get => SpriteText?.Text;
get => SpriteText?.Text ?? default;
set
{
if (SpriteText != null)

View File

@ -8,6 +8,7 @@ using osu.Framework.Graphics.Effects;
using osu.Framework.Graphics.Shapes;
using osu.Framework.Graphics.Sprites;
using osu.Framework.Input.Events;
using osu.Framework.Localisation;
using osu.Game.Graphics;
using osu.Game.Graphics.Sprites;
using osuTK;
@ -39,13 +40,13 @@ namespace osu.Game.Screens.Select.Options
set => iconText.Icon = value;
}
public string FirstLineText
public LocalisableString FirstLineText
{
get => firstLine.Text;
set => firstLine.Text = value;
}
public string SecondLineText
public LocalisableString SecondLineText
{
get => secondLine.Text;
set => secondLine.Text = value;

View File

@ -3,6 +3,7 @@
using System;
using osu.Framework.Graphics.Sprites;
using osu.Framework.Localisation;
namespace osu.Game.Skinning
{
@ -21,9 +22,9 @@ namespace osu.Game.Skinning
textDrawable.Text = Text;
}
private string text;
private LocalisableString text;
public string Text
public LocalisableString Text
{
get => text;
set

View File

@ -29,7 +29,7 @@
<PackageReference Include="Microsoft.Extensions.Configuration.Abstractions" Version="2.2.0" />
<PackageReference Include="Microsoft.NETCore.Targets" Version="3.1.0" />
<PackageReference Include="Newtonsoft.Json" Version="12.0.3" />
<PackageReference Include="ppy.osu.Framework" Version="2021.222.0" />
<PackageReference Include="ppy.osu.Framework" Version="2021.225.0" />
<PackageReference Include="ppy.osu.Game.Resources" Version="2021.211.1" />
<PackageReference Include="Sentry" Version="3.0.1" />
<PackageReference Include="SharpCompress" Version="0.27.1" />

View File

@ -70,7 +70,7 @@
<Reference Include="System.Net.Http" />
</ItemGroup>
<ItemGroup Label="Package References">
<PackageReference Include="ppy.osu.Framework.iOS" Version="2021.222.0" />
<PackageReference Include="ppy.osu.Framework.iOS" Version="2021.225.0" />
<PackageReference Include="ppy.osu.Game.Resources" Version="2021.211.1" />
</ItemGroup>
<!-- See https://github.com/dotnet/runtime/issues/35988 (can be removed after Xamarin uses net5.0 / net6.0) -->
@ -91,7 +91,7 @@
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="2.2.6" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite.Core" Version="2.2.6" />
<PackageReference Include="Newtonsoft.Json" Version="12.0.3" />
<PackageReference Include="ppy.osu.Framework" Version="2021.222.0" />
<PackageReference Include="ppy.osu.Framework" Version="2021.225.0" />
<PackageReference Include="SharpCompress" Version="0.27.1" />
<PackageReference Include="NUnit" Version="3.12.0" />
<PackageReference Include="SharpRaven" Version="2.4.0" />