mirror of
https://github.com/ppy/osu.git
synced 2025-01-14 19:22:56 +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.
|
// 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.
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
|
using System.Linq;
|
||||||
using NUnit.Framework;
|
using NUnit.Framework;
|
||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
using osu.Game.Graphics.UserInterface;
|
using osu.Game.Graphics.UserInterface;
|
||||||
@ -22,7 +23,7 @@ namespace osu.Game.Tests.Visual.UserInterface
|
|||||||
Child = new PopupScreenTitle
|
Child = new PopupScreenTitle
|
||||||
{
|
{
|
||||||
Title = "Popup Screen Title",
|
Title = "Popup Screen Title",
|
||||||
Description = "This is a description.",
|
Description = string.Join(" ", Enumerable.Repeat("This is a description.", 20)),
|
||||||
Close = () => { }
|
Close = () => { }
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
@ -12,6 +12,7 @@ using osu.Framework.Graphics.Effects;
|
|||||||
using osu.Framework.Graphics.Shapes;
|
using osu.Framework.Graphics.Shapes;
|
||||||
using osu.Framework.Graphics.Sprites;
|
using osu.Framework.Graphics.Sprites;
|
||||||
using osu.Framework.Localisation;
|
using osu.Framework.Localisation;
|
||||||
|
using osu.Game.Graphics.Containers;
|
||||||
using osu.Game.Graphics.Sprites;
|
using osu.Game.Graphics.Sprites;
|
||||||
using osu.Game.Overlays;
|
using osu.Game.Overlays;
|
||||||
using osuTK;
|
using osuTK;
|
||||||
@ -22,14 +23,12 @@ namespace osu.Game.Graphics.UserInterface
|
|||||||
{
|
{
|
||||||
public LocalisableString Title
|
public LocalisableString Title
|
||||||
{
|
{
|
||||||
get => titleSpriteText.Text;
|
|
||||||
set => titleSpriteText.Text = value;
|
set => titleSpriteText.Text = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
public LocalisableString Description
|
public LocalisableString Description
|
||||||
{
|
{
|
||||||
get => descriptionSpriteText.Text;
|
set => descriptionText.Text = value;
|
||||||
set => descriptionSpriteText.Text = value;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public Action? Close
|
public Action? Close
|
||||||
@ -46,7 +45,7 @@ namespace osu.Game.Graphics.UserInterface
|
|||||||
private readonly Container contentContainer;
|
private readonly Container contentContainer;
|
||||||
private readonly Box contentBackground;
|
private readonly Box contentBackground;
|
||||||
private readonly OsuSpriteText titleSpriteText;
|
private readonly OsuSpriteText titleSpriteText;
|
||||||
private readonly OsuSpriteText descriptionSpriteText;
|
private readonly OsuTextFlowContainer descriptionText;
|
||||||
private readonly IconButton closeButton;
|
private readonly IconButton closeButton;
|
||||||
|
|
||||||
public PopupScreenTitle()
|
public PopupScreenTitle()
|
||||||
@ -112,9 +111,13 @@ namespace osu.Game.Graphics.UserInterface
|
|||||||
{
|
{
|
||||||
Font = OsuFont.TorusAlternate.With(size: 20)
|
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