Move text display layout to Toast.

This commit is contained in:
Lucas A
2019-07-12 08:50:53 +02:00
parent 2c62891c48
commit 09d679de8d
3 changed files with 42 additions and 38 deletions

View File

@ -4,6 +4,9 @@
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Shapes;
using osu.Game.Graphics;
using osu.Game.Graphics.Sprites;
using osuTK;
using osuTK.Graphics;
namespace osu.Game.Overlays.OSD
@ -13,7 +16,7 @@ namespace osu.Game.Overlays.OSD
private readonly Container content;
protected override Container<Drawable> Content => content;
protected Toast()
protected Toast(string description, string value, string keybinding)
{
Anchor = Anchor.Centre;
Origin = Anchor.Centre;
@ -35,7 +38,35 @@ namespace osu.Game.Overlays.OSD
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
RelativeSizeAxes = Axes.Both,
}
},
new OsuSpriteText
{
Padding = new MarginPadding(10),
Name = "Description",
Font = OsuFont.GetFont(size: 14, weight: FontWeight.Black),
Spacing = new Vector2(1, 0),
Anchor = Anchor.TopCentre,
Origin = Anchor.TopCentre,
Text = description.ToUpperInvariant()
},
new OsuSpriteText
{
Font = OsuFont.GetFont(size: 24, weight: FontWeight.Light),
Padding = new MarginPadding { Left = 10, Right = 10 },
Name = "Value",
Anchor = Anchor.Centre,
Origin = Anchor.BottomCentre,
Text = value
},
new OsuSpriteText
{
Anchor = Anchor.BottomCentre,
Origin = Anchor.BottomCentre,
Name = "Shortcut",
Margin = new MarginPadding { Bottom = 15 },
Font = OsuFont.GetFont(size: 12, weight: FontWeight.Bold),
Text = string.IsNullOrEmpty(keybinding) ? "NO KEY BOUND" : keybinding.ToUpperInvariant()
},
};
}
}