mirror of
https://github.com/ppy/osu.git
synced 2024-11-06 09:47:52 +08:00
Use text flow container in popup screen title
This commit is contained in:
parent
df0617f34c
commit
54275813b5
@ -1,6 +1,7 @@
|
||||
// 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 System.Linq;
|
||||
using NUnit.Framework;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Game.Graphics.UserInterface;
|
||||
@ -22,7 +23,7 @@ namespace osu.Game.Tests.Visual.UserInterface
|
||||
Child = new PopupScreenTitle
|
||||
{
|
||||
Title = "Popup Screen Title",
|
||||
Description = "This is a description.",
|
||||
Description = string.Join(" ", Enumerable.Repeat("This is a description.", 20)),
|
||||
Close = () => { }
|
||||
};
|
||||
});
|
||||
|
@ -12,6 +12,7 @@ using osu.Framework.Graphics.Effects;
|
||||
using osu.Framework.Graphics.Shapes;
|
||||
using osu.Framework.Graphics.Sprites;
|
||||
using osu.Framework.Localisation;
|
||||
using osu.Game.Graphics.Containers;
|
||||
using osu.Game.Graphics.Sprites;
|
||||
using osu.Game.Overlays;
|
||||
using osuTK;
|
||||
@ -22,14 +23,12 @@ namespace osu.Game.Graphics.UserInterface
|
||||
{
|
||||
public LocalisableString Title
|
||||
{
|
||||
get => titleSpriteText.Text;
|
||||
set => titleSpriteText.Text = value;
|
||||
}
|
||||
|
||||
public LocalisableString Description
|
||||
{
|
||||
get => descriptionSpriteText.Text;
|
||||
set => descriptionSpriteText.Text = value;
|
||||
set => descriptionText.Text = value;
|
||||
}
|
||||
|
||||
public Action? Close
|
||||
@ -46,7 +45,7 @@ namespace osu.Game.Graphics.UserInterface
|
||||
private readonly Container contentContainer;
|
||||
private readonly Box contentBackground;
|
||||
private readonly OsuSpriteText titleSpriteText;
|
||||
private readonly OsuSpriteText descriptionSpriteText;
|
||||
private readonly OsuTextFlowContainer descriptionText;
|
||||
private readonly IconButton closeButton;
|
||||
|
||||
public PopupScreenTitle()
|
||||
@ -112,9 +111,13 @@ namespace osu.Game.Graphics.UserInterface
|
||||
{
|
||||
Font = OsuFont.TorusAlternate.With(size: 20)
|
||||
},
|
||||
descriptionSpriteText = new OsuSpriteText
|
||||
descriptionText = new OsuTextFlowContainer(t =>
|
||||
{
|
||||
Font = OsuFont.Default.With(size: 12)
|
||||
t.Font = OsuFont.Default.With(size: 12);
|
||||
})
|
||||
{
|
||||
RelativeSizeAxes = Axes.X,
|
||||
AutoSizeAxes = Axes.Y
|
||||
}
|
||||
}
|
||||
},
|
||||
|
Loading…
Reference in New Issue
Block a user