Rework notifications to be more flexible.

This commit is contained in:
Dean Herbert
2017-02-12 14:50:42 +09:00
parent a14b7eb598
commit ac548dc9ec
4 changed files with 113 additions and 55 deletions

View File

@ -12,12 +12,33 @@ namespace osu.Game.Overlays.Notifications
public class SimpleNotification : Notification
{
private string text;
public SimpleNotification(string text)
public string Text
{
this.text = text;
get { return text; }
set
{
text = value;
if (IsLoaded)
textDrawable.Text = text;
}
}
private FontAwesome icon = FontAwesome.fa_info_circle;
public FontAwesome Icon
{
get { return icon; }
set
{
icon = value;
if (IsLoaded)
iconDrawable.Icon = icon;
}
}
private SpriteText textDrawable;
private TextAwesome iconDrawable;
[BackgroundDependencyLoader]
private void load(OsuColour colours)
{
@ -28,14 +49,14 @@ namespace osu.Game.Overlays.Notifications
RelativeSizeAxes = Axes.Both,
ColourInfo = ColourInfo.GradientVertical(OsuColour.Gray(0.2f), OsuColour.Gray(0.5f))
},
new TextAwesome
iconDrawable = new TextAwesome
{
Anchor = Anchor.Centre,
Icon = FontAwesome.fa_info_circle,
Icon = icon ,
}
});
Content.Add(new SpriteText
Content.Add(textDrawable = new SpriteText
{
TextSize = 16,
Colour = OsuColour.Gray(128),