1
0
mirror of https://github.com/ppy/osu.git synced 2025-02-15 14:03:01 +08:00

Expose method to adjust header text, not whole drawable

This commit is contained in:
Dean Herbert 2021-05-17 16:40:42 +09:00
parent 6f248db519
commit baa4089364
2 changed files with 13 additions and 12 deletions

View File

@ -10,6 +10,7 @@ using osu.Game.Screens;
using osuTK;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Shapes;
using osu.Framework.Localisation;
using osu.Game.Graphics.Sprites;
using osu.Game.Graphics.UserInterface;
using osu.Framework.Screens;
@ -22,7 +23,10 @@ namespace osu.Game.Overlays.Settings.Sections.Maintenance
private DirectorySelector directorySelector;
protected abstract OsuSpriteText CreateHeader();
/// <summary>
/// Text to display in the header to inform the user of what they are selecting.
/// </summary>
public abstract LocalisableString HeaderText { get; }
/// <summary>
/// Called upon selection of a directory by the user.
@ -73,11 +77,13 @@ namespace osu.Game.Overlays.Settings.Sections.Maintenance
{
new Drawable[]
{
CreateHeader().With(header =>
new OsuSpriteText
{
header.Origin = Anchor.Centre;
header.Anchor = Anchor.Centre;
})
Text = HeaderText,
Font = OsuFont.Default.With(size: 40),
Origin = Anchor.Centre,
Anchor = Anchor.Centre,
}
},
new Drawable[]
{

View File

@ -4,11 +4,10 @@
using System;
using System.IO;
using osu.Framework.Allocation;
using osu.Framework.Localisation;
using osu.Framework.Logging;
using osu.Framework.Platform;
using osu.Framework.Screens;
using osu.Game.Graphics;
using osu.Game.Graphics.Sprites;
namespace osu.Game.Overlays.Settings.Sections.Maintenance
{
@ -25,11 +24,7 @@ namespace osu.Game.Overlays.Settings.Sections.Maintenance
public override bool HideOverlaysOnEnter => true;
protected override OsuSpriteText CreateHeader() => new OsuSpriteText
{
Text = "Please select a new location",
Font = OsuFont.Default.With(size: 40)
};
public override LocalisableString HeaderText => "Please select a new location";
protected override void OnSelection(DirectoryInfo directory)
{