2019-01-24 08:43:03 +00: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 09:19:50 +00:00
|
|
|
|
|
2017-02-10 07:26:43 +00:00
|
|
|
|
using osu.Framework.Allocation;
|
|
|
|
|
using osu.Framework.Graphics;
|
2022-09-16 13:16:53 +00:00
|
|
|
|
using osu.Framework.Graphics.Colour;
|
2017-08-22 10:33:18 +00:00
|
|
|
|
using osu.Framework.Graphics.Containers;
|
2017-06-20 05:54:23 +00:00
|
|
|
|
using osu.Framework.Graphics.Shapes;
|
2019-03-27 10:29:27 +00:00
|
|
|
|
using osu.Framework.Graphics.Sprites;
|
2021-10-30 16:50:13 +00:00
|
|
|
|
using osu.Framework.Localisation;
|
2017-02-10 07:26:43 +00:00
|
|
|
|
using osu.Game.Graphics;
|
2017-12-25 15:44:35 +00:00
|
|
|
|
using osu.Game.Graphics.Containers;
|
2018-11-20 07:51:59 +00:00
|
|
|
|
using osuTK;
|
2018-04-13 09:19:50 +00:00
|
|
|
|
|
2017-02-10 07:26:43 +00:00
|
|
|
|
namespace osu.Game.Overlays.Notifications
|
|
|
|
|
{
|
|
|
|
|
public partial class SimpleNotification : Notification
|
|
|
|
|
{
|
2021-10-30 16:50:13 +00:00
|
|
|
|
private LocalisableString text;
|
2019-02-28 04:31:40 +00:00
|
|
|
|
|
2022-01-25 14:38:46 +00:00
|
|
|
|
public override LocalisableString Text
|
2017-02-12 05:50:42 +00:00
|
|
|
|
{
|
2019-02-28 04:58:19 +00:00
|
|
|
|
get => text;
|
2017-02-12 05:50:42 +00:00
|
|
|
|
set
|
|
|
|
|
{
|
|
|
|
|
text = value;
|
2022-08-30 08:33:08 +00:00
|
|
|
|
if (textDrawable != null)
|
|
|
|
|
textDrawable.Text = text;
|
2017-02-12 05:50:42 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
2018-04-13 09:19:50 +00:00
|
|
|
|
|
2019-04-02 10:55:24 +00:00
|
|
|
|
private IconUsage icon = FontAwesome.Solid.InfoCircle;
|
2019-02-28 04:31:40 +00:00
|
|
|
|
|
2019-03-27 10:29:27 +00:00
|
|
|
|
public IconUsage Icon
|
2017-02-10 07:26:43 +00:00
|
|
|
|
{
|
2019-02-28 04:58:19 +00:00
|
|
|
|
get => icon;
|
2017-02-12 05:50:42 +00:00
|
|
|
|
set
|
|
|
|
|
{
|
|
|
|
|
icon = value;
|
2022-08-30 08:33:08 +00:00
|
|
|
|
if (iconDrawable != null)
|
|
|
|
|
iconDrawable.Icon = icon;
|
2017-02-12 05:50:42 +00:00
|
|
|
|
}
|
2017-02-10 07:26:43 +00:00
|
|
|
|
}
|
2018-04-13 09:19:50 +00:00
|
|
|
|
|
2022-09-16 13:16:53 +00:00
|
|
|
|
public ColourInfo IconColour
|
|
|
|
|
{
|
|
|
|
|
get => IconContent.Colour;
|
|
|
|
|
set => IconContent.Colour = value;
|
|
|
|
|
}
|
|
|
|
|
|
2022-08-30 08:33:08 +00:00
|
|
|
|
private TextFlowContainer? textDrawable;
|
2018-04-13 09:19:50 +00:00
|
|
|
|
|
2022-08-30 08:33:08 +00:00
|
|
|
|
private SpriteIcon? iconDrawable;
|
|
|
|
|
|
|
|
|
|
[BackgroundDependencyLoader]
|
|
|
|
|
private void load(OsuColour colours, OverlayColourProvider colourProvider)
|
2017-02-10 07:26:43 +00:00
|
|
|
|
{
|
2022-08-30 08:33:08 +00:00
|
|
|
|
Light.Colour = colours.Green;
|
|
|
|
|
|
2017-07-11 13:58:06 +00:00
|
|
|
|
IconContent.AddRange(new Drawable[]
|
2017-02-10 07:26:43 +00:00
|
|
|
|
{
|
2022-08-30 08:40:35 +00:00
|
|
|
|
new Box
|
2017-02-10 07:26:43 +00:00
|
|
|
|
{
|
|
|
|
|
RelativeSizeAxes = Axes.Both,
|
2022-08-30 08:33:08 +00:00
|
|
|
|
Colour = colourProvider.Background5,
|
2017-02-10 07:26:43 +00:00
|
|
|
|
},
|
2017-08-03 05:36:21 +00:00
|
|
|
|
iconDrawable = new SpriteIcon
|
2017-02-10 07:26:43 +00:00
|
|
|
|
{
|
|
|
|
|
Anchor = Anchor.Centre,
|
2017-03-06 08:06:48 +00:00
|
|
|
|
Origin = Anchor.Centre,
|
2017-02-21 04:52:30 +00:00
|
|
|
|
Icon = icon,
|
2022-08-30 08:33:08 +00:00
|
|
|
|
Size = new Vector2(16),
|
2017-02-10 07:26:43 +00:00
|
|
|
|
}
|
|
|
|
|
});
|
2018-04-13 09:19:50 +00:00
|
|
|
|
|
2022-08-30 08:33:08 +00:00
|
|
|
|
Content.Add(textDrawable = new OsuTextFlowContainer(t => t.Font = t.Font.With(size: 14, weight: FontWeight.Medium))
|
2017-02-10 07:26:43 +00:00
|
|
|
|
{
|
|
|
|
|
AutoSizeAxes = Axes.Y,
|
|
|
|
|
RelativeSizeAxes = Axes.X,
|
|
|
|
|
Text = text
|
|
|
|
|
});
|
2017-02-12 10:39:54 +00:00
|
|
|
|
}
|
2018-04-13 09:19:50 +00:00
|
|
|
|
|
2017-02-10 07:26:43 +00:00
|
|
|
|
public override bool Read
|
|
|
|
|
{
|
2019-02-28 04:58:19 +00:00
|
|
|
|
get => base.Read;
|
2017-02-10 07:26:43 +00:00
|
|
|
|
set
|
|
|
|
|
{
|
2017-12-26 06:48:01 +00:00
|
|
|
|
if (value == base.Read) return;
|
2018-04-13 09:19:50 +00:00
|
|
|
|
|
2017-03-09 06:52:40 +00:00
|
|
|
|
base.Read = value;
|
2017-12-26 06:48:01 +00:00
|
|
|
|
Light.FadeTo(value ? 0 : 1, 100);
|
2017-02-10 07:26:43 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2017-12-25 15:44:35 +00:00
|
|
|
|
}
|