From 38a3c2a82076dbe2ecb0b05b4bb24033ee3e5e29 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Wed, 19 Sep 2018 14:57:32 +0900 Subject: [PATCH 1/4] Fix song select wedge sometimes not updating when localisation changes --- osu.Game/Screens/Select/BeatmapInfoWedge.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/osu.Game/Screens/Select/BeatmapInfoWedge.cs b/osu.Game/Screens/Select/BeatmapInfoWedge.cs index ae5134c0da..44622fa845 100644 --- a/osu.Game/Screens/Select/BeatmapInfoWedge.cs +++ b/osu.Game/Screens/Select/BeatmapInfoWedge.cs @@ -261,6 +261,8 @@ namespace osu.Game.Screens.Select } } }; + + titleBinding.BindValueChanged(value => setMetadata(metadata.Source)); artistBinding.BindValueChanged(value => setMetadata(metadata.Source), true); // no difficulty means it can't have a status to show From 7b8094d73129595bbb891d7b0e59e6f46eb8a72d Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Thu, 20 Sep 2018 12:35:07 +0900 Subject: [PATCH 2/4] Move text size/padding out of constructor --- .../Drawables/BeatmapSetOnlineStatusPill.cs | 20 +++++++++++++++---- osu.Game/Overlays/BeatmapSet/Header.cs | 4 +++- osu.Game/Overlays/Direct/DirectGridPanel.cs | 4 +++- osu.Game/Screens/Select/BeatmapInfoWedge.cs | 4 +++- .../Carousel/DrawableCarouselBeatmapSet.cs | 4 +++- 5 files changed, 28 insertions(+), 8 deletions(-) diff --git a/osu.Game/Beatmaps/Drawables/BeatmapSetOnlineStatusPill.cs b/osu.Game/Beatmaps/Drawables/BeatmapSetOnlineStatusPill.cs index 511ce9aa58..ab28ad0a2c 100644 --- a/osu.Game/Beatmaps/Drawables/BeatmapSetOnlineStatusPill.cs +++ b/osu.Game/Beatmaps/Drawables/BeatmapSetOnlineStatusPill.cs @@ -15,19 +15,33 @@ namespace osu.Game.Beatmaps.Drawables private readonly OsuSpriteText statusText; private BeatmapSetOnlineStatus status; + public BeatmapSetOnlineStatus Status { get => status; set { - if (value == status) return; + if (status == value) + return; status = value; statusText.Text = Enum.GetName(typeof(BeatmapSetOnlineStatus), Status)?.ToUpperInvariant(); } } - public BeatmapSetOnlineStatusPill(float textSize, MarginPadding textPadding) + public float TextSize + { + get => statusText.TextSize; + set => statusText.TextSize = value; + } + + public MarginPadding TextPadding + { + get => statusText.Padding; + set => statusText.Padding = value; + } + + public BeatmapSetOnlineStatusPill() { AutoSizeAxes = Axes.Both; Masking = true; @@ -45,8 +59,6 @@ namespace osu.Game.Beatmaps.Drawables Anchor = Anchor.Centre, Origin = Anchor.Centre, Font = @"Exo2.0-Bold", - TextSize = textSize, - Padding = textPadding, }, }; diff --git a/osu.Game/Overlays/BeatmapSet/Header.cs b/osu.Game/Overlays/BeatmapSet/Header.cs index afba99f928..6f01fae92d 100644 --- a/osu.Game/Overlays/BeatmapSet/Header.cs +++ b/osu.Game/Overlays/BeatmapSet/Header.cs @@ -230,10 +230,12 @@ namespace osu.Game.Overlays.BeatmapSet Spacing = new Vector2(10), Children = new Drawable[] { - onlineStatusPill = new BeatmapSetOnlineStatusPill(14, new MarginPadding { Horizontal = 25, Vertical = 8 }) + onlineStatusPill = new BeatmapSetOnlineStatusPill { Anchor = Anchor.TopRight, Origin = Anchor.TopRight, + TextSize = 14, + TextPadding = new MarginPadding { Horizontal = 25, Vertical = 8 } }, Details = new Details(), }, diff --git a/osu.Game/Overlays/Direct/DirectGridPanel.cs b/osu.Game/Overlays/Direct/DirectGridPanel.cs index eb940bff60..d8830cd092 100644 --- a/osu.Game/Overlays/Direct/DirectGridPanel.cs +++ b/osu.Game/Overlays/Direct/DirectGridPanel.cs @@ -217,8 +217,10 @@ namespace osu.Game.Overlays.Direct statusContainer.Add(new IconPill(FontAwesome.fa_image)); } - statusContainer.Add(new BeatmapSetOnlineStatusPill(12, new MarginPadding { Horizontal = 10, Vertical = 5 }) + statusContainer.Add(new BeatmapSetOnlineStatusPill { + TextSize = 12, + TextPadding = new MarginPadding { Horizontal = 10, Vertical = 5 }, Status = SetInfo.OnlineInfo?.Status ?? BeatmapSetOnlineStatus.None, }); diff --git a/osu.Game/Screens/Select/BeatmapInfoWedge.cs b/osu.Game/Screens/Select/BeatmapInfoWedge.cs index 44622fa845..02081cb17c 100644 --- a/osu.Game/Screens/Select/BeatmapInfoWedge.cs +++ b/osu.Game/Screens/Select/BeatmapInfoWedge.cs @@ -217,8 +217,10 @@ namespace osu.Game.Screens.Select AutoSizeAxes = Axes.Both, Children = new Drawable[] { - StatusPill = new BeatmapSetOnlineStatusPill(11, new MarginPadding { Horizontal = 8, Vertical = 2 }) + StatusPill = new BeatmapSetOnlineStatusPill { + TextSize = 11, + TextPadding = new MarginPadding { Horizontal = 8, Vertical = 2 }, Status = beatmapInfo.Status, } } diff --git a/osu.Game/Screens/Select/Carousel/DrawableCarouselBeatmapSet.cs b/osu.Game/Screens/Select/Carousel/DrawableCarouselBeatmapSet.cs index 52d34a935f..658ece740e 100644 --- a/osu.Game/Screens/Select/Carousel/DrawableCarouselBeatmapSet.cs +++ b/osu.Game/Screens/Select/Carousel/DrawableCarouselBeatmapSet.cs @@ -85,11 +85,13 @@ namespace osu.Game.Screens.Select.Carousel Margin = new MarginPadding { Top = 5 }, Children = new Drawable[] { - new BeatmapSetOnlineStatusPill(11, new MarginPadding { Horizontal = 8, Vertical = 2 }) + new BeatmapSetOnlineStatusPill { Origin = Anchor.CentreLeft, Anchor = Anchor.CentreLeft, Margin = new MarginPadding{ Right = 5 }, + TextSize = 11, + TextPadding = new MarginPadding { Horizontal = 8, Vertical = 2 }, Status = beatmapSet.Status }, new FillFlowContainer From 04cd68f97029ccac9ede8b8a5c0d3dd99b5e62de Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Thu, 20 Sep 2018 12:53:21 +0900 Subject: [PATCH 3/4] Hide status pill when status is none --- osu.Game/Beatmaps/Drawables/BeatmapSetOnlineStatusPill.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/osu.Game/Beatmaps/Drawables/BeatmapSetOnlineStatusPill.cs b/osu.Game/Beatmaps/Drawables/BeatmapSetOnlineStatusPill.cs index ab28ad0a2c..da281b4db3 100644 --- a/osu.Game/Beatmaps/Drawables/BeatmapSetOnlineStatusPill.cs +++ b/osu.Game/Beatmaps/Drawables/BeatmapSetOnlineStatusPill.cs @@ -1,7 +1,6 @@ // Copyright (c) 2007-2018 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE -using System; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; @@ -25,7 +24,8 @@ namespace osu.Game.Beatmaps.Drawables return; status = value; - statusText.Text = Enum.GetName(typeof(BeatmapSetOnlineStatus), Status)?.ToUpperInvariant(); + Alpha = value == BeatmapSetOnlineStatus.None ? 0 : 1; + statusText.Text = value.ToString().ToUpperInvariant(); } } From 62135c39aa435ea140e9e15a12548431d9069d9b Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Thu, 20 Sep 2018 12:56:39 +0900 Subject: [PATCH 4/4] Cleanup --- osu.Game/Screens/Select/Carousel/DrawableCarouselBeatmapSet.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Screens/Select/Carousel/DrawableCarouselBeatmapSet.cs b/osu.Game/Screens/Select/Carousel/DrawableCarouselBeatmapSet.cs index 658ece740e..d7f3a4cd54 100644 --- a/osu.Game/Screens/Select/Carousel/DrawableCarouselBeatmapSet.cs +++ b/osu.Game/Screens/Select/Carousel/DrawableCarouselBeatmapSet.cs @@ -89,7 +89,7 @@ namespace osu.Game.Screens.Select.Carousel { Origin = Anchor.CentreLeft, Anchor = Anchor.CentreLeft, - Margin = new MarginPadding{ Right = 5 }, + Margin = new MarginPadding { Right = 5 }, TextSize = 11, TextPadding = new MarginPadding { Horizontal = 8, Vertical = 2 }, Status = beatmapSet.Status