1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-16 15:37:44 +08:00
osu-lazer/osu.Game/Skinning/Components/TextElement.cs
Dean Herbert 92306b9123 Combine localisations for abstract skinnable components into a single file
Generally we don't want localisation files with only one to two
translations. It makes it harder for translators to handle in crowdin (a
lot of file changes for small results).

So for cases like this I believe we should be grouping translations
where it makes sense.

I've left individual components in their own files as I can see
potential for more settings to be added in the future. Plus it gives a
bit of extra context.
2023-02-03 16:02:18 +09:00

41 lines
1.3 KiB
C#

// 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 JetBrains.Annotations;
using osu.Framework.Bindables;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Sprites;
using osu.Game.Configuration;
using osu.Game.Graphics;
using osu.Game.Graphics.Sprites;
using osu.Game.Localisation.SkinComponents;
namespace osu.Game.Skinning.Components
{
[UsedImplicitly]
public partial class TextElement : FontAdjustableSkinComponent
{
[SettingSource(typeof(SkinnableComponentStrings), nameof(SkinnableComponentStrings.TextElementText), nameof(SkinnableComponentStrings.TextElementTextDescription))]
public Bindable<string> Text { get; } = new Bindable<string>("Circles!");
private readonly OsuSpriteText text;
public TextElement()
{
AutoSizeAxes = Axes.Both;
InternalChildren = new Drawable[]
{
text = new OsuSpriteText
{
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
Font = OsuFont.Default.With(size: 40)
}
};
text.Current.BindTo(Text);
}
protected override void SetFont(FontUsage font) => text.Font = font.With(size: 40);
}
}