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.Graphics;
|
|
|
|
|
using osu.Framework.Graphics.Containers;
|
|
|
|
|
using osu.Framework.Graphics.Shapes;
|
2019-02-12 12:04:46 +08:00
|
|
|
|
using osu.Game.Graphics;
|
2018-04-13 17:19:50 +08:00
|
|
|
|
using osu.Game.Graphics.Sprites;
|
2018-11-20 15:51:59 +08:00
|
|
|
|
using osuTK.Graphics;
|
2018-04-13 17:19:50 +08:00
|
|
|
|
|
|
|
|
|
namespace osu.Game.Beatmaps.Drawables
|
|
|
|
|
{
|
|
|
|
|
public class BeatmapSetOnlineStatusPill : CircularContainer
|
|
|
|
|
{
|
|
|
|
|
private readonly OsuSpriteText statusText;
|
2020-02-05 23:31:14 +08:00
|
|
|
|
private readonly Box background;
|
2018-04-13 17:19:50 +08:00
|
|
|
|
|
2018-09-13 14:54:58 +08:00
|
|
|
|
private BeatmapSetOnlineStatus status;
|
2018-09-20 11:35:07 +08:00
|
|
|
|
|
2018-04-13 17:19:50 +08:00
|
|
|
|
public BeatmapSetOnlineStatus Status
|
|
|
|
|
{
|
2018-09-13 14:54:58 +08:00
|
|
|
|
get => status;
|
2018-04-13 17:19:50 +08:00
|
|
|
|
set
|
|
|
|
|
{
|
2018-09-20 11:35:07 +08:00
|
|
|
|
if (status == value)
|
|
|
|
|
return;
|
2019-02-28 12:31:40 +08:00
|
|
|
|
|
2018-04-13 17:19:50 +08:00
|
|
|
|
status = value;
|
|
|
|
|
|
2018-09-20 11:53:21 +08:00
|
|
|
|
Alpha = value == BeatmapSetOnlineStatus.None ? 0 : 1;
|
|
|
|
|
statusText.Text = value.ToString().ToUpperInvariant();
|
2018-04-13 17:19:50 +08:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2018-09-20 11:35:07 +08:00
|
|
|
|
public float TextSize
|
|
|
|
|
{
|
2019-02-12 12:04:46 +08:00
|
|
|
|
get => statusText.Font.Size;
|
2019-02-20 18:32:30 +08:00
|
|
|
|
set => statusText.Font = statusText.Font.With(size: value);
|
2018-09-20 11:35:07 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public MarginPadding TextPadding
|
|
|
|
|
{
|
|
|
|
|
get => statusText.Padding;
|
|
|
|
|
set => statusText.Padding = value;
|
|
|
|
|
}
|
|
|
|
|
|
2020-02-05 23:31:14 +08:00
|
|
|
|
public Color4 BackgroundColour
|
|
|
|
|
{
|
|
|
|
|
get => background.Colour;
|
|
|
|
|
set => background.Colour = value;
|
|
|
|
|
}
|
|
|
|
|
|
2018-09-20 11:35:07 +08:00
|
|
|
|
public BeatmapSetOnlineStatusPill()
|
2018-04-13 17:19:50 +08:00
|
|
|
|
{
|
|
|
|
|
AutoSizeAxes = Axes.Both;
|
|
|
|
|
Masking = true;
|
|
|
|
|
|
|
|
|
|
Children = new Drawable[]
|
|
|
|
|
{
|
2020-02-05 23:31:14 +08:00
|
|
|
|
background = new Box
|
2018-04-13 17:19:50 +08:00
|
|
|
|
{
|
|
|
|
|
RelativeSizeAxes = Axes.Both,
|
|
|
|
|
Colour = Color4.Black,
|
|
|
|
|
Alpha = 0.5f,
|
|
|
|
|
},
|
|
|
|
|
statusText = new OsuSpriteText
|
|
|
|
|
{
|
|
|
|
|
Anchor = Anchor.Centre,
|
|
|
|
|
Origin = Anchor.Centre,
|
2019-02-12 12:04:46 +08:00
|
|
|
|
Font = OsuFont.GetFont(weight: FontWeight.Bold)
|
2018-04-13 17:19:50 +08:00
|
|
|
|
},
|
|
|
|
|
};
|
2018-09-13 14:54:58 +08:00
|
|
|
|
|
|
|
|
|
Status = BeatmapSetOnlineStatus.None;
|
2018-04-13 17:19:50 +08:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|