1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-28 03:22:54 +08:00

Add background and improve layout

This commit is contained in:
Dean Herbert 2023-12-28 16:16:27 +09:00
parent a1867afbb4
commit 222459d921
No known key found for this signature in database
2 changed files with 24 additions and 10 deletions

View File

@ -165,7 +165,7 @@ namespace osu.Game.Screens.Menu
Direction = FillDirection.Vertical, Direction = FillDirection.Vertical,
Anchor = Anchor.BottomCentre, Anchor = Anchor.BottomCentre,
Origin = Anchor.BottomCentre, Origin = Anchor.BottomCentre,
Spacing = new Vector2(15), Spacing = new Vector2(5),
Children = new Drawable[] Children = new Drawable[]
{ {
menuTip = new MenuTip menuTip = new MenuTip

View File

@ -4,12 +4,14 @@
using osu.Framework.Allocation; using osu.Framework.Allocation;
using osu.Framework.Graphics; using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Shapes;
using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.Sprites;
using osu.Framework.Utils; using osu.Framework.Utils;
using osu.Game.Configuration; using osu.Game.Configuration;
using osu.Game.Graphics; using osu.Game.Graphics;
using osu.Game.Graphics.Containers; using osu.Game.Graphics.Containers;
using osuTK; using osuTK;
using osuTK.Graphics;
namespace osu.Game.Screens.Menu namespace osu.Game.Screens.Menu
{ {
@ -27,14 +29,29 @@ namespace osu.Game.Screens.Menu
InternalChildren = new Drawable[] InternalChildren = new Drawable[]
{ {
new Container
{
RelativeSizeAxes = Axes.Both,
Masking = true,
CornerExponent = 2.5f,
CornerRadius = 15,
Children = new Drawable[]
{
new Box
{
Colour = Color4.Black,
RelativeSizeAxes = Axes.Both,
Alpha = 0.4f,
},
}
},
textFlow = new LinkFlowContainer textFlow = new LinkFlowContainer
{ {
Width = 700, Width = 600,
AutoSizeAxes = Axes.Y, AutoSizeAxes = Axes.Y,
TextAnchor = Anchor.TopCentre, TextAnchor = Anchor.TopCentre,
Anchor = Anchor.TopCentre,
Origin = Anchor.TopCentre,
Spacing = new Vector2(0, 2), Spacing = new Vector2(0, 2),
Margin = new MarginPadding(10)
}, },
}; };
} }
@ -43,13 +60,11 @@ namespace osu.Game.Screens.Menu
{ {
if (!config.Get<bool>(OsuSetting.MenuTips)) return; if (!config.Get<bool>(OsuSetting.MenuTips)) return;
static void formatRegular(SpriteText t) => t.Font = OsuFont.GetFont(size: 20, weight: FontWeight.Regular); static void formatRegular(SpriteText t) => t.Font = OsuFont.GetFont(size: 16, weight: FontWeight.Regular);
static void formatSemiBold(SpriteText t) => t.Font = OsuFont.GetFont(size: 20, weight: FontWeight.SemiBold); static void formatSemiBold(SpriteText t) => t.Font = OsuFont.GetFont(size: 16, weight: FontWeight.SemiBold);
string tip = getRandomTip(); string tip = getRandomTip();
AutoSizeAxes = Axes.Both;
textFlow.Clear(); textFlow.Clear();
textFlow.AddParagraph("a tip for you:", formatSemiBold); textFlow.AddParagraph("a tip for you:", formatSemiBold);
textFlow.AddParagraph(tip, formatRegular); textFlow.AddParagraph(tip, formatRegular);
@ -57,8 +72,7 @@ namespace osu.Game.Screens.Menu
this.FadeInFromZero(200, Easing.OutQuint) this.FadeInFromZero(200, Easing.OutQuint)
.Delay(1000 + 80 * tip.Length) .Delay(1000 + 80 * tip.Length)
.Then() .Then()
.FadeOutFromOne(2000, Easing.OutQuint) .FadeOutFromOne(2000, Easing.OutQuint);
.Finally(_ => AutoSizeAxes = Axes.X);
} }
private string getRandomTip() private string getRandomTip()