2019-01-24 16:43:03 +08:00
|
|
|
|
// 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.
|
2018-04-13 17:19:50 +08:00
|
|
|
|
|
|
|
|
|
using osu.Framework.Allocation;
|
|
|
|
|
using osu.Framework.Graphics;
|
|
|
|
|
using osu.Framework.Graphics.Colour;
|
|
|
|
|
using osu.Framework.Graphics.Containers;
|
|
|
|
|
using osu.Framework.Graphics.Shapes;
|
|
|
|
|
using osu.Game.Graphics;
|
|
|
|
|
using osu.Game.Graphics.Containers;
|
2018-11-20 15:51:59 +08:00
|
|
|
|
using osuTK;
|
2018-04-13 17:19:50 +08:00
|
|
|
|
|
|
|
|
|
namespace osu.Game.Overlays.Notifications
|
|
|
|
|
{
|
|
|
|
|
public class SimpleNotification : Notification
|
|
|
|
|
{
|
|
|
|
|
private string text = string.Empty;
|
|
|
|
|
public string Text
|
|
|
|
|
{
|
|
|
|
|
get { return text; }
|
|
|
|
|
set
|
|
|
|
|
{
|
|
|
|
|
text = value;
|
|
|
|
|
textDrawable.Text = text;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private FontAwesome icon = FontAwesome.fa_info_circle;
|
|
|
|
|
public FontAwesome Icon
|
|
|
|
|
{
|
|
|
|
|
get { return icon; }
|
|
|
|
|
set
|
|
|
|
|
{
|
|
|
|
|
icon = value;
|
|
|
|
|
iconDrawable.Icon = icon;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private readonly TextFlowContainer textDrawable;
|
|
|
|
|
private readonly SpriteIcon iconDrawable;
|
|
|
|
|
|
|
|
|
|
protected Box IconBackgound;
|
|
|
|
|
|
|
|
|
|
public SimpleNotification()
|
|
|
|
|
{
|
|
|
|
|
IconContent.AddRange(new Drawable[]
|
|
|
|
|
{
|
|
|
|
|
IconBackgound = new Box
|
|
|
|
|
{
|
|
|
|
|
RelativeSizeAxes = Axes.Both,
|
|
|
|
|
Colour = ColourInfo.GradientVertical(OsuColour.Gray(0.2f), OsuColour.Gray(0.6f))
|
|
|
|
|
},
|
|
|
|
|
iconDrawable = new SpriteIcon
|
|
|
|
|
{
|
|
|
|
|
Anchor = Anchor.Centre,
|
|
|
|
|
Origin = Anchor.Centre,
|
|
|
|
|
Icon = icon,
|
|
|
|
|
Size = new Vector2(20),
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
2018-06-21 13:43:02 +08:00
|
|
|
|
Content.Add(textDrawable = new OsuTextFlowContainer(t => t.TextSize = 14)
|
2018-04-13 17:19:50 +08:00
|
|
|
|
{
|
|
|
|
|
Colour = OsuColour.Gray(128),
|
|
|
|
|
AutoSizeAxes = Axes.Y,
|
|
|
|
|
RelativeSizeAxes = Axes.X,
|
|
|
|
|
Text = text
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[BackgroundDependencyLoader]
|
|
|
|
|
private void load(OsuColour colours)
|
|
|
|
|
{
|
|
|
|
|
Light.Colour = colours.Green;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public override bool Read
|
|
|
|
|
{
|
|
|
|
|
get
|
|
|
|
|
{
|
|
|
|
|
return base.Read;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
set
|
|
|
|
|
{
|
|
|
|
|
if (value == base.Read) return;
|
|
|
|
|
|
|
|
|
|
base.Read = value;
|
|
|
|
|
Light.FadeTo(value ? 0 : 1, 100);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|