mirror of
https://github.com/osukey/osukey.git
synced 2025-07-03 01:09:57 +09:00
Update beatmap set status pill appearance
This commit is contained in:
@ -1,6 +1,9 @@
|
||||
// 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.
|
||||
|
||||
#nullable enable
|
||||
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Extensions;
|
||||
using osu.Framework.Extensions.LocalisationExtensions;
|
||||
using osu.Framework.Graphics;
|
||||
@ -8,15 +11,13 @@ using osu.Framework.Graphics.Containers;
|
||||
using osu.Framework.Graphics.Shapes;
|
||||
using osu.Game.Graphics;
|
||||
using osu.Game.Graphics.Sprites;
|
||||
using osu.Game.Overlays;
|
||||
using osuTK.Graphics;
|
||||
|
||||
namespace osu.Game.Beatmaps.Drawables
|
||||
{
|
||||
public class BeatmapSetOnlineStatusPill : CircularContainer
|
||||
{
|
||||
private readonly OsuSpriteText statusText;
|
||||
private readonly Box background;
|
||||
|
||||
private BeatmapSetOnlineStatus status;
|
||||
|
||||
public BeatmapSetOnlineStatus Status
|
||||
@ -29,8 +30,8 @@ namespace osu.Game.Beatmaps.Drawables
|
||||
|
||||
status = value;
|
||||
|
||||
Alpha = value == BeatmapSetOnlineStatus.None ? 0 : 1;
|
||||
statusText.Text = value.GetLocalisableDescription().ToUpper();
|
||||
if (IsLoaded)
|
||||
updateState();
|
||||
}
|
||||
}
|
||||
|
||||
@ -46,11 +47,14 @@ namespace osu.Game.Beatmaps.Drawables
|
||||
set => statusText.Padding = value;
|
||||
}
|
||||
|
||||
public Color4 BackgroundColour
|
||||
{
|
||||
get => background.Colour;
|
||||
set => background.Colour = value;
|
||||
}
|
||||
private readonly OsuSpriteText statusText;
|
||||
private readonly Box background;
|
||||
|
||||
[Resolved]
|
||||
private OsuColour colours { get; set; } = null!;
|
||||
|
||||
[Resolved(CanBeNull = true)]
|
||||
private OverlayColourProvider? colourProvider { get; set; }
|
||||
|
||||
public BeatmapSetOnlineStatusPill()
|
||||
{
|
||||
@ -63,7 +67,6 @@ namespace osu.Game.Beatmaps.Drawables
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Colour = Color4.Black,
|
||||
Alpha = 0.5f,
|
||||
},
|
||||
statusText = new OsuSpriteText
|
||||
{
|
||||
@ -74,6 +77,27 @@ namespace osu.Game.Beatmaps.Drawables
|
||||
};
|
||||
|
||||
Status = BeatmapSetOnlineStatus.None;
|
||||
TextPadding = new MarginPadding { Horizontal = 5, Bottom = 1 };
|
||||
}
|
||||
|
||||
protected override void LoadComplete()
|
||||
{
|
||||
base.LoadComplete();
|
||||
updateState();
|
||||
}
|
||||
|
||||
private void updateState()
|
||||
{
|
||||
Alpha = Status == BeatmapSetOnlineStatus.None ? 0 : 1;
|
||||
|
||||
statusText.Text = Status.GetLocalisableDescription().ToUpper();
|
||||
|
||||
if (colourProvider != null)
|
||||
statusText.Colour = status == BeatmapSetOnlineStatus.Graveyard ? colourProvider.Background1 : colourProvider.Background3;
|
||||
else
|
||||
statusText.Colour = status == BeatmapSetOnlineStatus.Graveyard ? colours.GreySeafoamLight : Color4.Black;
|
||||
|
||||
background.Colour = OsuColour.ForBeatmapSetOnlineStatus(Status) ?? colourProvider?.Light1 ?? colours.GreySeafoamLighter;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user