From 671177e87120e4cacba35f824950d0847cbeacf6 Mon Sep 17 00:00:00 2001 From: yesseruser Date: Tue, 21 Nov 2023 19:02:23 +0100 Subject: [PATCH 01/12] Renamed UpdateableFlag to ClickableUpdateableFlag. --- osu.Game.Tests/Visual/Menus/TestSceneLoginOverlay.cs | 2 +- osu.Game/Online/Leaderboards/LeaderboardScore.cs | 2 +- osu.Game/Overlays/BeatmapSet/Scores/ScoreTable.cs | 2 +- osu.Game/Overlays/BeatmapSet/Scores/TopScoreUserSection.cs | 4 ++-- osu.Game/Overlays/Profile/Header/TopHeaderContainer.cs | 4 ++-- osu.Game/Overlays/Rankings/CountryPill.cs | 4 ++-- osu.Game/Overlays/Rankings/Tables/RankingsTable.cs | 2 +- .../OnlinePlay/Multiplayer/Participants/ParticipantPanel.cs | 2 +- osu.Game/Screens/Play/HUD/PlayerFlag.cs | 4 ++-- .../{UpdateableFlag.cs => ClickableUpdateableFlag.cs} | 4 ++-- osu.Game/Users/ExtendedUserPanel.cs | 2 +- 11 files changed, 16 insertions(+), 16 deletions(-) rename osu.Game/Users/Drawables/{UpdateableFlag.cs => ClickableUpdateableFlag.cs} (91%) diff --git a/osu.Game.Tests/Visual/Menus/TestSceneLoginOverlay.cs b/osu.Game.Tests/Visual/Menus/TestSceneLoginOverlay.cs index 0bc71924ce..7a7679c376 100644 --- a/osu.Game.Tests/Visual/Menus/TestSceneLoginOverlay.cs +++ b/osu.Game.Tests/Visual/Menus/TestSceneLoginOverlay.cs @@ -80,7 +80,7 @@ namespace osu.Game.Tests.Visual.Menus AddStep("click on flag", () => { - InputManager.MoveMouseTo(loginOverlay.ChildrenOfType().First()); + InputManager.MoveMouseTo(loginOverlay.ChildrenOfType().First()); InputManager.Click(MouseButton.Left); }); AddAssert("login overlay is hidden", () => loginOverlay.State.Value == Visibility.Hidden); diff --git a/osu.Game/Online/Leaderboards/LeaderboardScore.cs b/osu.Game/Online/Leaderboards/LeaderboardScore.cs index 136c9cc8e7..114ef5db22 100644 --- a/osu.Game/Online/Leaderboards/LeaderboardScore.cs +++ b/osu.Game/Online/Leaderboards/LeaderboardScore.cs @@ -180,7 +180,7 @@ namespace osu.Game.Online.Leaderboards Masking = true, Children = new Drawable[] { - new UpdateableFlag(user.CountryCode) + new ClickableUpdateableFlag(user.CountryCode) { Anchor = Anchor.CentreLeft, Origin = Anchor.CentreLeft, diff --git a/osu.Game/Overlays/BeatmapSet/Scores/ScoreTable.cs b/osu.Game/Overlays/BeatmapSet/Scores/ScoreTable.cs index 1fc997fdad..e144a55a96 100644 --- a/osu.Game/Overlays/BeatmapSet/Scores/ScoreTable.cs +++ b/osu.Game/Overlays/BeatmapSet/Scores/ScoreTable.cs @@ -157,7 +157,7 @@ namespace osu.Game.Overlays.BeatmapSet.Scores Margin = new MarginPadding { Right = horizontal_inset }, Text = score.DisplayAccuracy, }, - new UpdateableFlag(score.User.CountryCode) + new ClickableUpdateableFlag(score.User.CountryCode) { Size = new Vector2(19, 14), ShowPlaceholderOnUnknown = false, diff --git a/osu.Game/Overlays/BeatmapSet/Scores/TopScoreUserSection.cs b/osu.Game/Overlays/BeatmapSet/Scores/TopScoreUserSection.cs index 9dc2ce204f..e38e6efd06 100644 --- a/osu.Game/Overlays/BeatmapSet/Scores/TopScoreUserSection.cs +++ b/osu.Game/Overlays/BeatmapSet/Scores/TopScoreUserSection.cs @@ -27,7 +27,7 @@ namespace osu.Game.Overlays.BeatmapSet.Scores private readonly UpdateableAvatar avatar; private readonly LinkFlowContainer usernameText; private readonly DrawableDate achievedOn; - private readonly UpdateableFlag flag; + private readonly ClickableUpdateableFlag flag; public TopScoreUserSection() { @@ -112,7 +112,7 @@ namespace osu.Game.Overlays.BeatmapSet.Scores }, } }, - flag = new UpdateableFlag + flag = new ClickableUpdateableFlag { Anchor = Anchor.CentreLeft, Origin = Anchor.CentreLeft, diff --git a/osu.Game/Overlays/Profile/Header/TopHeaderContainer.cs b/osu.Game/Overlays/Profile/Header/TopHeaderContainer.cs index 36bd8a5af5..15aaf333f4 100644 --- a/osu.Game/Overlays/Profile/Header/TopHeaderContainer.cs +++ b/osu.Game/Overlays/Profile/Header/TopHeaderContainer.cs @@ -41,7 +41,7 @@ namespace osu.Game.Overlays.Profile.Header private OsuSpriteText usernameText = null!; private ExternalLinkButton openUserExternally = null!; private OsuSpriteText titleText = null!; - private UpdateableFlag userFlag = null!; + private ClickableUpdateableFlag userFlag = null!; private OsuHoverContainer userCountryContainer = null!; private OsuSpriteText userCountryText = null!; private GroupBadgeFlow groupBadgeFlow = null!; @@ -162,7 +162,7 @@ namespace osu.Game.Overlays.Profile.Header Direction = FillDirection.Horizontal, Children = new Drawable[] { - userFlag = new UpdateableFlag + userFlag = new ClickableUpdateableFlag { Size = new Vector2(28, 20), ShowPlaceholderOnUnknown = false, diff --git a/osu.Game/Overlays/Rankings/CountryPill.cs b/osu.Game/Overlays/Rankings/CountryPill.cs index 294b6df34d..bfa7363de8 100644 --- a/osu.Game/Overlays/Rankings/CountryPill.cs +++ b/osu.Game/Overlays/Rankings/CountryPill.cs @@ -34,7 +34,7 @@ namespace osu.Game.Overlays.Rankings private readonly Container content; private readonly Box background; - private readonly UpdateableFlag flag; + private readonly ClickableUpdateableFlag flag; private readonly OsuSpriteText countryName; public CountryPill() @@ -74,7 +74,7 @@ namespace osu.Game.Overlays.Rankings Spacing = new Vector2(5, 0), Children = new Drawable[] { - flag = new UpdateableFlag + flag = new ClickableUpdateableFlag { Anchor = Anchor.Centre, Origin = Anchor.Centre, diff --git a/osu.Game/Overlays/Rankings/Tables/RankingsTable.cs b/osu.Game/Overlays/Rankings/Tables/RankingsTable.cs index 27d894cdc2..b68ecd709a 100644 --- a/osu.Game/Overlays/Rankings/Tables/RankingsTable.cs +++ b/osu.Game/Overlays/Rankings/Tables/RankingsTable.cs @@ -96,7 +96,7 @@ namespace osu.Game.Overlays.Rankings.Tables Margin = new MarginPadding { Bottom = row_spacing }, Children = new[] { - new UpdateableFlag(GetCountryCode(item)) + new ClickableUpdateableFlag(GetCountryCode(item)) { Size = new Vector2(28, 20), ShowPlaceholderOnUnknown = false, diff --git a/osu.Game/Screens/OnlinePlay/Multiplayer/Participants/ParticipantPanel.cs b/osu.Game/Screens/OnlinePlay/Multiplayer/Participants/ParticipantPanel.cs index c79c210e30..1f922073ec 100644 --- a/osu.Game/Screens/OnlinePlay/Multiplayer/Participants/ParticipantPanel.cs +++ b/osu.Game/Screens/OnlinePlay/Multiplayer/Participants/ParticipantPanel.cs @@ -123,7 +123,7 @@ namespace osu.Game.Screens.OnlinePlay.Multiplayer.Participants FillMode = FillMode.Fit, User = user }, - new UpdateableFlag + new ClickableUpdateableFlag { Anchor = Anchor.CentreLeft, Origin = Anchor.CentreLeft, diff --git a/osu.Game/Screens/Play/HUD/PlayerFlag.cs b/osu.Game/Screens/Play/HUD/PlayerFlag.cs index 85799c03d3..7234db71b5 100644 --- a/osu.Game/Screens/Play/HUD/PlayerFlag.cs +++ b/osu.Game/Screens/Play/HUD/PlayerFlag.cs @@ -12,14 +12,14 @@ namespace osu.Game.Screens.Play.HUD { public partial class PlayerFlag : CompositeDrawable, ISerialisableDrawable { - private readonly UpdateableFlag flag; + private readonly ClickableUpdateableFlag flag; private const float default_size = 40f; public PlayerFlag() { Size = new Vector2(default_size, default_size / 1.4f); - InternalChild = flag = new UpdateableFlag + InternalChild = flag = new ClickableUpdateableFlag { RelativeSizeAxes = Axes.Both, }; diff --git a/osu.Game/Users/Drawables/UpdateableFlag.cs b/osu.Game/Users/Drawables/ClickableUpdateableFlag.cs similarity index 91% rename from osu.Game/Users/Drawables/UpdateableFlag.cs rename to osu.Game/Users/Drawables/ClickableUpdateableFlag.cs index 8f8d7052e5..d19234fc17 100644 --- a/osu.Game/Users/Drawables/UpdateableFlag.cs +++ b/osu.Game/Users/Drawables/ClickableUpdateableFlag.cs @@ -11,7 +11,7 @@ using osu.Game.Overlays; namespace osu.Game.Users.Drawables { - public partial class UpdateableFlag : ModelBackedDrawable + public partial class ClickableUpdateableFlag : ModelBackedDrawable { public CountryCode CountryCode { @@ -30,7 +30,7 @@ namespace osu.Game.Users.Drawables /// public Action? Action; - public UpdateableFlag(CountryCode countryCode = CountryCode.Unknown) + public ClickableUpdateableFlag(CountryCode countryCode = CountryCode.Unknown) { CountryCode = countryCode; } diff --git a/osu.Game/Users/ExtendedUserPanel.cs b/osu.Game/Users/ExtendedUserPanel.cs index 3c1b68f9ef..e798c8cc11 100644 --- a/osu.Game/Users/ExtendedUserPanel.cs +++ b/osu.Game/Users/ExtendedUserPanel.cs @@ -52,7 +52,7 @@ namespace osu.Game.Users protected UpdateableAvatar CreateAvatar() => new UpdateableAvatar(User, false); - protected UpdateableFlag CreateFlag() => new UpdateableFlag(User.CountryCode) + protected ClickableUpdateableFlag CreateFlag() => new ClickableUpdateableFlag(User.CountryCode) { Size = new Vector2(36, 26), Action = Action, From cd7e0bf620c0fd1617f1d99038dbbb85e52acd39 Mon Sep 17 00:00:00 2001 From: yesseruser Date: Tue, 21 Nov 2023 19:27:33 +0100 Subject: [PATCH 02/12] Created and implemened a BaseUpdateableFlag. The tooltip still shows. --- osu.Game/Screens/Play/HUD/PlayerFlag.cs | 4 +- .../Users/Drawables/BaseUpdateableFlag.cs | 45 +++++++++++++++++++ .../Drawables/ClickableUpdateableFlag.cs | 13 +----- 3 files changed, 48 insertions(+), 14 deletions(-) create mode 100644 osu.Game/Users/Drawables/BaseUpdateableFlag.cs diff --git a/osu.Game/Screens/Play/HUD/PlayerFlag.cs b/osu.Game/Screens/Play/HUD/PlayerFlag.cs index 7234db71b5..f0fe8ad668 100644 --- a/osu.Game/Screens/Play/HUD/PlayerFlag.cs +++ b/osu.Game/Screens/Play/HUD/PlayerFlag.cs @@ -12,14 +12,14 @@ namespace osu.Game.Screens.Play.HUD { public partial class PlayerFlag : CompositeDrawable, ISerialisableDrawable { - private readonly ClickableUpdateableFlag flag; + private readonly BaseUpdateableFlag flag; private const float default_size = 40f; public PlayerFlag() { Size = new Vector2(default_size, default_size / 1.4f); - InternalChild = flag = new ClickableUpdateableFlag + InternalChild = flag = new BaseUpdateableFlag { RelativeSizeAxes = Axes.Both, }; diff --git a/osu.Game/Users/Drawables/BaseUpdateableFlag.cs b/osu.Game/Users/Drawables/BaseUpdateableFlag.cs new file mode 100644 index 0000000000..16a368c60c --- /dev/null +++ b/osu.Game/Users/Drawables/BaseUpdateableFlag.cs @@ -0,0 +1,45 @@ +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + +using osu.Framework.Graphics; +using osu.Framework.Graphics.Containers; + +namespace osu.Game.Users.Drawables +{ + public partial class BaseUpdateableFlag : ModelBackedDrawable + { + public CountryCode CountryCode + { + get => Model; + set => Model = value; + } + + /// + /// Whether to show a place holder on unknown country. + /// + public bool ShowPlaceholderOnUnknown = true; + + public BaseUpdateableFlag(CountryCode countryCode = CountryCode.Unknown) + { + CountryCode = countryCode; + } + + protected override Drawable? CreateDrawable(CountryCode countryCode) + { + if (countryCode == CountryCode.Unknown && !ShowPlaceholderOnUnknown) + return null; + + return new Container + { + RelativeSizeAxes = Axes.Both, + Children = new Drawable[] + { + new DrawableFlag(countryCode) + { + RelativeSizeAxes = Axes.Both + }, + } + }; + } + } +} diff --git a/osu.Game/Users/Drawables/ClickableUpdateableFlag.cs b/osu.Game/Users/Drawables/ClickableUpdateableFlag.cs index d19234fc17..e00fe3c009 100644 --- a/osu.Game/Users/Drawables/ClickableUpdateableFlag.cs +++ b/osu.Game/Users/Drawables/ClickableUpdateableFlag.cs @@ -11,19 +11,8 @@ using osu.Game.Overlays; namespace osu.Game.Users.Drawables { - public partial class ClickableUpdateableFlag : ModelBackedDrawable + public partial class ClickableUpdateableFlag : BaseUpdateableFlag { - public CountryCode CountryCode - { - get => Model; - set => Model = value; - } - - /// - /// Whether to show a place holder on unknown country. - /// - public bool ShowPlaceholderOnUnknown = true; - /// /// Perform an action in addition to showing the country ranking. /// This should be used to perform auxiliary tasks and not as a primary action for clicking a flag (to maintain a consistent UX). From b2f74325efb4f477b42320cca8cbd380895b12da Mon Sep 17 00:00:00 2001 From: yesseruser Date: Tue, 21 Nov 2023 19:51:35 +0100 Subject: [PATCH 03/12] Added a BaseDrawableFlag without a tooltip, and used it. The BaseDrawableFlag is used in a BaseUpdateableFlag so the tooltip is not shown, the ClickableUpdateableFlag still shows the tooltip. --- osu.Game/Users/Drawables/BaseDrawableFlag.cs | 29 +++++++++++++++++++ .../Users/Drawables/BaseUpdateableFlag.cs | 3 +- .../Drawables/ClickableUpdateableFlag.cs | 1 + osu.Game/Users/Drawables/DrawableFlag.cs | 14 +++------ 4 files changed, 36 insertions(+), 11 deletions(-) create mode 100644 osu.Game/Users/Drawables/BaseDrawableFlag.cs diff --git a/osu.Game/Users/Drawables/BaseDrawableFlag.cs b/osu.Game/Users/Drawables/BaseDrawableFlag.cs new file mode 100644 index 0000000000..90f8cd7b70 --- /dev/null +++ b/osu.Game/Users/Drawables/BaseDrawableFlag.cs @@ -0,0 +1,29 @@ +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + +using System; +using osu.Framework.Allocation; +using osu.Framework.Graphics.Sprites; +using osu.Framework.Graphics.Textures; + +namespace osu.Game.Users.Drawables +{ + public partial class BaseDrawableFlag : Sprite + { + protected readonly CountryCode CountryCode; + + public BaseDrawableFlag(CountryCode countryCode) + { + CountryCode = countryCode; + } + + [BackgroundDependencyLoader] + private void load(TextureStore ts) + { + ArgumentNullException.ThrowIfNull(ts); + + string textureName = CountryCode == CountryCode.Unknown ? "__" : CountryCode.ToString(); + Texture = ts.Get($@"Flags/{textureName}") ?? ts.Get(@"Flags/__"); + } + } +} diff --git a/osu.Game/Users/Drawables/BaseUpdateableFlag.cs b/osu.Game/Users/Drawables/BaseUpdateableFlag.cs index 16a368c60c..3a27238b19 100644 --- a/osu.Game/Users/Drawables/BaseUpdateableFlag.cs +++ b/osu.Game/Users/Drawables/BaseUpdateableFlag.cs @@ -34,7 +34,8 @@ namespace osu.Game.Users.Drawables RelativeSizeAxes = Axes.Both, Children = new Drawable[] { - new DrawableFlag(countryCode) + // This is a BaseDrawableFlag which does not show a tooltip. + new BaseDrawableFlag(countryCode) { RelativeSizeAxes = Axes.Both }, diff --git a/osu.Game/Users/Drawables/ClickableUpdateableFlag.cs b/osu.Game/Users/Drawables/ClickableUpdateableFlag.cs index e00fe3c009..2eaa3661d1 100644 --- a/osu.Game/Users/Drawables/ClickableUpdateableFlag.cs +++ b/osu.Game/Users/Drawables/ClickableUpdateableFlag.cs @@ -34,6 +34,7 @@ namespace osu.Game.Users.Drawables RelativeSizeAxes = Axes.Both, Children = new Drawable[] { + // This is a DrawableFlag which implements IHasTooltip, so a tooltip is shown. new DrawableFlag(countryCode) { RelativeSizeAxes = Axes.Both diff --git a/osu.Game/Users/Drawables/DrawableFlag.cs b/osu.Game/Users/Drawables/DrawableFlag.cs index 289f68ee7f..aef34c093f 100644 --- a/osu.Game/Users/Drawables/DrawableFlag.cs +++ b/osu.Game/Users/Drawables/DrawableFlag.cs @@ -5,29 +5,23 @@ using System; using osu.Framework.Allocation; using osu.Framework.Extensions; using osu.Framework.Graphics.Cursor; -using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.Textures; using osu.Framework.Localisation; namespace osu.Game.Users.Drawables { - public partial class DrawableFlag : Sprite, IHasTooltip + public partial class DrawableFlag : BaseDrawableFlag, IHasTooltip { - private readonly CountryCode countryCode; + public LocalisableString TooltipText => CountryCode == CountryCode.Unknown ? string.Empty : CountryCode.GetDescription(); - public LocalisableString TooltipText => countryCode == CountryCode.Unknown ? string.Empty : countryCode.GetDescription(); - - public DrawableFlag(CountryCode countryCode) - { - this.countryCode = countryCode; - } + public DrawableFlag(CountryCode countryCode) : base(countryCode) { } [BackgroundDependencyLoader] private void load(TextureStore ts) { ArgumentNullException.ThrowIfNull(ts); - string textureName = countryCode == CountryCode.Unknown ? "__" : countryCode.ToString(); + string textureName = CountryCode == CountryCode.Unknown ? "__" : CountryCode.ToString(); Texture = ts.Get($@"Flags/{textureName}") ?? ts.Get(@"Flags/__"); } } From 7bc304f20ee27d7314fc06620cf1250acebba89f Mon Sep 17 00:00:00 2001 From: yesseruser Date: Wed, 22 Nov 2023 15:25:17 +0100 Subject: [PATCH 04/12] Revert "Added a BaseDrawableFlag without a tooltip, and used it." This reverts commit b2f74325efb4f477b42320cca8cbd380895b12da. --- osu.Game/Users/Drawables/BaseDrawableFlag.cs | 29 ------------------- .../Users/Drawables/BaseUpdateableFlag.cs | 3 +- .../Drawables/ClickableUpdateableFlag.cs | 1 - osu.Game/Users/Drawables/DrawableFlag.cs | 14 ++++++--- 4 files changed, 11 insertions(+), 36 deletions(-) delete mode 100644 osu.Game/Users/Drawables/BaseDrawableFlag.cs diff --git a/osu.Game/Users/Drawables/BaseDrawableFlag.cs b/osu.Game/Users/Drawables/BaseDrawableFlag.cs deleted file mode 100644 index 90f8cd7b70..0000000000 --- a/osu.Game/Users/Drawables/BaseDrawableFlag.cs +++ /dev/null @@ -1,29 +0,0 @@ -// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. -// See the LICENCE file in the repository root for full licence text. - -using System; -using osu.Framework.Allocation; -using osu.Framework.Graphics.Sprites; -using osu.Framework.Graphics.Textures; - -namespace osu.Game.Users.Drawables -{ - public partial class BaseDrawableFlag : Sprite - { - protected readonly CountryCode CountryCode; - - public BaseDrawableFlag(CountryCode countryCode) - { - CountryCode = countryCode; - } - - [BackgroundDependencyLoader] - private void load(TextureStore ts) - { - ArgumentNullException.ThrowIfNull(ts); - - string textureName = CountryCode == CountryCode.Unknown ? "__" : CountryCode.ToString(); - Texture = ts.Get($@"Flags/{textureName}") ?? ts.Get(@"Flags/__"); - } - } -} diff --git a/osu.Game/Users/Drawables/BaseUpdateableFlag.cs b/osu.Game/Users/Drawables/BaseUpdateableFlag.cs index 3a27238b19..16a368c60c 100644 --- a/osu.Game/Users/Drawables/BaseUpdateableFlag.cs +++ b/osu.Game/Users/Drawables/BaseUpdateableFlag.cs @@ -34,8 +34,7 @@ namespace osu.Game.Users.Drawables RelativeSizeAxes = Axes.Both, Children = new Drawable[] { - // This is a BaseDrawableFlag which does not show a tooltip. - new BaseDrawableFlag(countryCode) + new DrawableFlag(countryCode) { RelativeSizeAxes = Axes.Both }, diff --git a/osu.Game/Users/Drawables/ClickableUpdateableFlag.cs b/osu.Game/Users/Drawables/ClickableUpdateableFlag.cs index 2eaa3661d1..e00fe3c009 100644 --- a/osu.Game/Users/Drawables/ClickableUpdateableFlag.cs +++ b/osu.Game/Users/Drawables/ClickableUpdateableFlag.cs @@ -34,7 +34,6 @@ namespace osu.Game.Users.Drawables RelativeSizeAxes = Axes.Both, Children = new Drawable[] { - // This is a DrawableFlag which implements IHasTooltip, so a tooltip is shown. new DrawableFlag(countryCode) { RelativeSizeAxes = Axes.Both diff --git a/osu.Game/Users/Drawables/DrawableFlag.cs b/osu.Game/Users/Drawables/DrawableFlag.cs index aef34c093f..289f68ee7f 100644 --- a/osu.Game/Users/Drawables/DrawableFlag.cs +++ b/osu.Game/Users/Drawables/DrawableFlag.cs @@ -5,23 +5,29 @@ using System; using osu.Framework.Allocation; using osu.Framework.Extensions; using osu.Framework.Graphics.Cursor; +using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.Textures; using osu.Framework.Localisation; namespace osu.Game.Users.Drawables { - public partial class DrawableFlag : BaseDrawableFlag, IHasTooltip + public partial class DrawableFlag : Sprite, IHasTooltip { - public LocalisableString TooltipText => CountryCode == CountryCode.Unknown ? string.Empty : CountryCode.GetDescription(); + private readonly CountryCode countryCode; - public DrawableFlag(CountryCode countryCode) : base(countryCode) { } + public LocalisableString TooltipText => countryCode == CountryCode.Unknown ? string.Empty : countryCode.GetDescription(); + + public DrawableFlag(CountryCode countryCode) + { + this.countryCode = countryCode; + } [BackgroundDependencyLoader] private void load(TextureStore ts) { ArgumentNullException.ThrowIfNull(ts); - string textureName = CountryCode == CountryCode.Unknown ? "__" : CountryCode.ToString(); + string textureName = countryCode == CountryCode.Unknown ? "__" : countryCode.ToString(); Texture = ts.Get($@"Flags/{textureName}") ?? ts.Get(@"Flags/__"); } } From be8b59e59d28ac99620e0252215ad7a4acf82604 Mon Sep 17 00:00:00 2001 From: yesseruser Date: Wed, 22 Nov 2023 15:25:35 +0100 Subject: [PATCH 05/12] Revert "Created and implemened a BaseUpdateableFlag." This reverts commit cd7e0bf620c0fd1617f1d99038dbbb85e52acd39. --- osu.Game/Screens/Play/HUD/PlayerFlag.cs | 4 +- .../Users/Drawables/BaseUpdateableFlag.cs | 45 ------------------- .../Drawables/ClickableUpdateableFlag.cs | 13 +++++- 3 files changed, 14 insertions(+), 48 deletions(-) delete mode 100644 osu.Game/Users/Drawables/BaseUpdateableFlag.cs diff --git a/osu.Game/Screens/Play/HUD/PlayerFlag.cs b/osu.Game/Screens/Play/HUD/PlayerFlag.cs index f0fe8ad668..7234db71b5 100644 --- a/osu.Game/Screens/Play/HUD/PlayerFlag.cs +++ b/osu.Game/Screens/Play/HUD/PlayerFlag.cs @@ -12,14 +12,14 @@ namespace osu.Game.Screens.Play.HUD { public partial class PlayerFlag : CompositeDrawable, ISerialisableDrawable { - private readonly BaseUpdateableFlag flag; + private readonly ClickableUpdateableFlag flag; private const float default_size = 40f; public PlayerFlag() { Size = new Vector2(default_size, default_size / 1.4f); - InternalChild = flag = new BaseUpdateableFlag + InternalChild = flag = new ClickableUpdateableFlag { RelativeSizeAxes = Axes.Both, }; diff --git a/osu.Game/Users/Drawables/BaseUpdateableFlag.cs b/osu.Game/Users/Drawables/BaseUpdateableFlag.cs deleted file mode 100644 index 16a368c60c..0000000000 --- a/osu.Game/Users/Drawables/BaseUpdateableFlag.cs +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. -// See the LICENCE file in the repository root for full licence text. - -using osu.Framework.Graphics; -using osu.Framework.Graphics.Containers; - -namespace osu.Game.Users.Drawables -{ - public partial class BaseUpdateableFlag : ModelBackedDrawable - { - public CountryCode CountryCode - { - get => Model; - set => Model = value; - } - - /// - /// Whether to show a place holder on unknown country. - /// - public bool ShowPlaceholderOnUnknown = true; - - public BaseUpdateableFlag(CountryCode countryCode = CountryCode.Unknown) - { - CountryCode = countryCode; - } - - protected override Drawable? CreateDrawable(CountryCode countryCode) - { - if (countryCode == CountryCode.Unknown && !ShowPlaceholderOnUnknown) - return null; - - return new Container - { - RelativeSizeAxes = Axes.Both, - Children = new Drawable[] - { - new DrawableFlag(countryCode) - { - RelativeSizeAxes = Axes.Both - }, - } - }; - } - } -} diff --git a/osu.Game/Users/Drawables/ClickableUpdateableFlag.cs b/osu.Game/Users/Drawables/ClickableUpdateableFlag.cs index e00fe3c009..d19234fc17 100644 --- a/osu.Game/Users/Drawables/ClickableUpdateableFlag.cs +++ b/osu.Game/Users/Drawables/ClickableUpdateableFlag.cs @@ -11,8 +11,19 @@ using osu.Game.Overlays; namespace osu.Game.Users.Drawables { - public partial class ClickableUpdateableFlag : BaseUpdateableFlag + public partial class ClickableUpdateableFlag : ModelBackedDrawable { + public CountryCode CountryCode + { + get => Model; + set => Model = value; + } + + /// + /// Whether to show a place holder on unknown country. + /// + public bool ShowPlaceholderOnUnknown = true; + /// /// Perform an action in addition to showing the country ranking. /// This should be used to perform auxiliary tasks and not as a primary action for clicking a flag (to maintain a consistent UX). From 08e0279d72d1f76f099c3cda6f6dd0c086123501 Mon Sep 17 00:00:00 2001 From: yesseruser Date: Wed, 22 Nov 2023 15:25:43 +0100 Subject: [PATCH 06/12] Revert "Renamed UpdateableFlag to ClickableUpdateableFlag." This reverts commit 671177e87120e4cacba35f824950d0847cbeacf6. --- osu.Game.Tests/Visual/Menus/TestSceneLoginOverlay.cs | 2 +- osu.Game/Online/Leaderboards/LeaderboardScore.cs | 2 +- osu.Game/Overlays/BeatmapSet/Scores/ScoreTable.cs | 2 +- osu.Game/Overlays/BeatmapSet/Scores/TopScoreUserSection.cs | 4 ++-- osu.Game/Overlays/Profile/Header/TopHeaderContainer.cs | 4 ++-- osu.Game/Overlays/Rankings/CountryPill.cs | 4 ++-- osu.Game/Overlays/Rankings/Tables/RankingsTable.cs | 2 +- .../OnlinePlay/Multiplayer/Participants/ParticipantPanel.cs | 2 +- osu.Game/Screens/Play/HUD/PlayerFlag.cs | 4 ++-- .../{ClickableUpdateableFlag.cs => UpdateableFlag.cs} | 4 ++-- osu.Game/Users/ExtendedUserPanel.cs | 2 +- 11 files changed, 16 insertions(+), 16 deletions(-) rename osu.Game/Users/Drawables/{ClickableUpdateableFlag.cs => UpdateableFlag.cs} (91%) diff --git a/osu.Game.Tests/Visual/Menus/TestSceneLoginOverlay.cs b/osu.Game.Tests/Visual/Menus/TestSceneLoginOverlay.cs index 7a7679c376..0bc71924ce 100644 --- a/osu.Game.Tests/Visual/Menus/TestSceneLoginOverlay.cs +++ b/osu.Game.Tests/Visual/Menus/TestSceneLoginOverlay.cs @@ -80,7 +80,7 @@ namespace osu.Game.Tests.Visual.Menus AddStep("click on flag", () => { - InputManager.MoveMouseTo(loginOverlay.ChildrenOfType().First()); + InputManager.MoveMouseTo(loginOverlay.ChildrenOfType().First()); InputManager.Click(MouseButton.Left); }); AddAssert("login overlay is hidden", () => loginOverlay.State.Value == Visibility.Hidden); diff --git a/osu.Game/Online/Leaderboards/LeaderboardScore.cs b/osu.Game/Online/Leaderboards/LeaderboardScore.cs index 114ef5db22..136c9cc8e7 100644 --- a/osu.Game/Online/Leaderboards/LeaderboardScore.cs +++ b/osu.Game/Online/Leaderboards/LeaderboardScore.cs @@ -180,7 +180,7 @@ namespace osu.Game.Online.Leaderboards Masking = true, Children = new Drawable[] { - new ClickableUpdateableFlag(user.CountryCode) + new UpdateableFlag(user.CountryCode) { Anchor = Anchor.CentreLeft, Origin = Anchor.CentreLeft, diff --git a/osu.Game/Overlays/BeatmapSet/Scores/ScoreTable.cs b/osu.Game/Overlays/BeatmapSet/Scores/ScoreTable.cs index e144a55a96..1fc997fdad 100644 --- a/osu.Game/Overlays/BeatmapSet/Scores/ScoreTable.cs +++ b/osu.Game/Overlays/BeatmapSet/Scores/ScoreTable.cs @@ -157,7 +157,7 @@ namespace osu.Game.Overlays.BeatmapSet.Scores Margin = new MarginPadding { Right = horizontal_inset }, Text = score.DisplayAccuracy, }, - new ClickableUpdateableFlag(score.User.CountryCode) + new UpdateableFlag(score.User.CountryCode) { Size = new Vector2(19, 14), ShowPlaceholderOnUnknown = false, diff --git a/osu.Game/Overlays/BeatmapSet/Scores/TopScoreUserSection.cs b/osu.Game/Overlays/BeatmapSet/Scores/TopScoreUserSection.cs index e38e6efd06..9dc2ce204f 100644 --- a/osu.Game/Overlays/BeatmapSet/Scores/TopScoreUserSection.cs +++ b/osu.Game/Overlays/BeatmapSet/Scores/TopScoreUserSection.cs @@ -27,7 +27,7 @@ namespace osu.Game.Overlays.BeatmapSet.Scores private readonly UpdateableAvatar avatar; private readonly LinkFlowContainer usernameText; private readonly DrawableDate achievedOn; - private readonly ClickableUpdateableFlag flag; + private readonly UpdateableFlag flag; public TopScoreUserSection() { @@ -112,7 +112,7 @@ namespace osu.Game.Overlays.BeatmapSet.Scores }, } }, - flag = new ClickableUpdateableFlag + flag = new UpdateableFlag { Anchor = Anchor.CentreLeft, Origin = Anchor.CentreLeft, diff --git a/osu.Game/Overlays/Profile/Header/TopHeaderContainer.cs b/osu.Game/Overlays/Profile/Header/TopHeaderContainer.cs index 15aaf333f4..36bd8a5af5 100644 --- a/osu.Game/Overlays/Profile/Header/TopHeaderContainer.cs +++ b/osu.Game/Overlays/Profile/Header/TopHeaderContainer.cs @@ -41,7 +41,7 @@ namespace osu.Game.Overlays.Profile.Header private OsuSpriteText usernameText = null!; private ExternalLinkButton openUserExternally = null!; private OsuSpriteText titleText = null!; - private ClickableUpdateableFlag userFlag = null!; + private UpdateableFlag userFlag = null!; private OsuHoverContainer userCountryContainer = null!; private OsuSpriteText userCountryText = null!; private GroupBadgeFlow groupBadgeFlow = null!; @@ -162,7 +162,7 @@ namespace osu.Game.Overlays.Profile.Header Direction = FillDirection.Horizontal, Children = new Drawable[] { - userFlag = new ClickableUpdateableFlag + userFlag = new UpdateableFlag { Size = new Vector2(28, 20), ShowPlaceholderOnUnknown = false, diff --git a/osu.Game/Overlays/Rankings/CountryPill.cs b/osu.Game/Overlays/Rankings/CountryPill.cs index bfa7363de8..294b6df34d 100644 --- a/osu.Game/Overlays/Rankings/CountryPill.cs +++ b/osu.Game/Overlays/Rankings/CountryPill.cs @@ -34,7 +34,7 @@ namespace osu.Game.Overlays.Rankings private readonly Container content; private readonly Box background; - private readonly ClickableUpdateableFlag flag; + private readonly UpdateableFlag flag; private readonly OsuSpriteText countryName; public CountryPill() @@ -74,7 +74,7 @@ namespace osu.Game.Overlays.Rankings Spacing = new Vector2(5, 0), Children = new Drawable[] { - flag = new ClickableUpdateableFlag + flag = new UpdateableFlag { Anchor = Anchor.Centre, Origin = Anchor.Centre, diff --git a/osu.Game/Overlays/Rankings/Tables/RankingsTable.cs b/osu.Game/Overlays/Rankings/Tables/RankingsTable.cs index b68ecd709a..27d894cdc2 100644 --- a/osu.Game/Overlays/Rankings/Tables/RankingsTable.cs +++ b/osu.Game/Overlays/Rankings/Tables/RankingsTable.cs @@ -96,7 +96,7 @@ namespace osu.Game.Overlays.Rankings.Tables Margin = new MarginPadding { Bottom = row_spacing }, Children = new[] { - new ClickableUpdateableFlag(GetCountryCode(item)) + new UpdateableFlag(GetCountryCode(item)) { Size = new Vector2(28, 20), ShowPlaceholderOnUnknown = false, diff --git a/osu.Game/Screens/OnlinePlay/Multiplayer/Participants/ParticipantPanel.cs b/osu.Game/Screens/OnlinePlay/Multiplayer/Participants/ParticipantPanel.cs index 1f922073ec..c79c210e30 100644 --- a/osu.Game/Screens/OnlinePlay/Multiplayer/Participants/ParticipantPanel.cs +++ b/osu.Game/Screens/OnlinePlay/Multiplayer/Participants/ParticipantPanel.cs @@ -123,7 +123,7 @@ namespace osu.Game.Screens.OnlinePlay.Multiplayer.Participants FillMode = FillMode.Fit, User = user }, - new ClickableUpdateableFlag + new UpdateableFlag { Anchor = Anchor.CentreLeft, Origin = Anchor.CentreLeft, diff --git a/osu.Game/Screens/Play/HUD/PlayerFlag.cs b/osu.Game/Screens/Play/HUD/PlayerFlag.cs index 7234db71b5..85799c03d3 100644 --- a/osu.Game/Screens/Play/HUD/PlayerFlag.cs +++ b/osu.Game/Screens/Play/HUD/PlayerFlag.cs @@ -12,14 +12,14 @@ namespace osu.Game.Screens.Play.HUD { public partial class PlayerFlag : CompositeDrawable, ISerialisableDrawable { - private readonly ClickableUpdateableFlag flag; + private readonly UpdateableFlag flag; private const float default_size = 40f; public PlayerFlag() { Size = new Vector2(default_size, default_size / 1.4f); - InternalChild = flag = new ClickableUpdateableFlag + InternalChild = flag = new UpdateableFlag { RelativeSizeAxes = Axes.Both, }; diff --git a/osu.Game/Users/Drawables/ClickableUpdateableFlag.cs b/osu.Game/Users/Drawables/UpdateableFlag.cs similarity index 91% rename from osu.Game/Users/Drawables/ClickableUpdateableFlag.cs rename to osu.Game/Users/Drawables/UpdateableFlag.cs index d19234fc17..8f8d7052e5 100644 --- a/osu.Game/Users/Drawables/ClickableUpdateableFlag.cs +++ b/osu.Game/Users/Drawables/UpdateableFlag.cs @@ -11,7 +11,7 @@ using osu.Game.Overlays; namespace osu.Game.Users.Drawables { - public partial class ClickableUpdateableFlag : ModelBackedDrawable + public partial class UpdateableFlag : ModelBackedDrawable { public CountryCode CountryCode { @@ -30,7 +30,7 @@ namespace osu.Game.Users.Drawables /// public Action? Action; - public ClickableUpdateableFlag(CountryCode countryCode = CountryCode.Unknown) + public UpdateableFlag(CountryCode countryCode = CountryCode.Unknown) { CountryCode = countryCode; } diff --git a/osu.Game/Users/ExtendedUserPanel.cs b/osu.Game/Users/ExtendedUserPanel.cs index e798c8cc11..3c1b68f9ef 100644 --- a/osu.Game/Users/ExtendedUserPanel.cs +++ b/osu.Game/Users/ExtendedUserPanel.cs @@ -52,7 +52,7 @@ namespace osu.Game.Users protected UpdateableAvatar CreateAvatar() => new UpdateableAvatar(User, false); - protected ClickableUpdateableFlag CreateFlag() => new ClickableUpdateableFlag(User.CountryCode) + protected UpdateableFlag CreateFlag() => new UpdateableFlag(User.CountryCode) { Size = new Vector2(36, 26), Action = Action, From 82fec4194d9cb676baa2ad8e35a863d21010394a Mon Sep 17 00:00:00 2001 From: yesseruser Date: Wed, 22 Nov 2023 15:45:32 +0100 Subject: [PATCH 07/12] Disabled RecievePositionalInputAtSubTree in PlayerFlag. --- osu.Game/Screens/Play/HUD/PlayerFlag.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/osu.Game/Screens/Play/HUD/PlayerFlag.cs b/osu.Game/Screens/Play/HUD/PlayerFlag.cs index 85799c03d3..70ad078e34 100644 --- a/osu.Game/Screens/Play/HUD/PlayerFlag.cs +++ b/osu.Game/Screens/Play/HUD/PlayerFlag.cs @@ -12,6 +12,8 @@ namespace osu.Game.Screens.Play.HUD { public partial class PlayerFlag : CompositeDrawable, ISerialisableDrawable { + protected override bool ReceivePositionalInputAtSubTree(Vector2 screenSpacePos) => false; + private readonly UpdateableFlag flag; private const float default_size = 40f; From 4edaaa30839a203eded9bfc16e1dee88b3fb6456 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bart=C5=82omiej=20Dach?= Date: Thu, 23 Nov 2023 09:45:38 +0900 Subject: [PATCH 08/12] Add test coverage of skin editor copy-paste --- .../Visual/Gameplay/TestSceneSkinEditor.cs | 34 +++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/osu.Game.Tests/Visual/Gameplay/TestSceneSkinEditor.cs b/osu.Game.Tests/Visual/Gameplay/TestSceneSkinEditor.cs index 9cd87932c8..3c97700fb0 100644 --- a/osu.Game.Tests/Visual/Gameplay/TestSceneSkinEditor.cs +++ b/osu.Game.Tests/Visual/Gameplay/TestSceneSkinEditor.cs @@ -335,6 +335,40 @@ namespace osu.Game.Tests.Visual.Gameplay AddAssert("value is less than default", () => hitErrorMeter.JudgementLineThickness.Value < hitErrorMeter.JudgementLineThickness.Default); } + [Test] + public void TestCopyPaste() + { + AddStep("paste", () => + { + InputManager.PressKey(Key.LControl); + InputManager.Key(Key.V); + InputManager.ReleaseKey(Key.LControl); + }); + // no assertions. just make sure nothing crashes. + + AddStep("select bar hit error blueprint", () => + { + var blueprint = skinEditor.ChildrenOfType().First(b => b.Item is BarHitErrorMeter); + skinEditor.SelectedComponents.Clear(); + skinEditor.SelectedComponents.Add(blueprint.Item); + }); + AddStep("copy", () => + { + InputManager.PressKey(Key.LControl); + InputManager.Key(Key.C); + InputManager.ReleaseKey(Key.LControl); + }); + AddStep("paste", () => + { + InputManager.PressKey(Key.LControl); + InputManager.Key(Key.V); + InputManager.ReleaseKey(Key.LControl); + }); + AddAssert("three hit error meters present", + () => skinEditor.ChildrenOfType().Count(b => b.Item is BarHitErrorMeter), + () => Is.EqualTo(3)); + } + protected override Ruleset CreatePlayerRuleset() => new OsuRuleset(); private partial class TestSkinEditorChangeHandler : SkinEditorChangeHandler From abbcdaa7f7ad076053daa246668e5020fd8e3462 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bart=C5=82omiej=20Dach?= Date: Thu, 23 Nov 2023 09:55:27 +0900 Subject: [PATCH 09/12] Fix skin editor crashing when pasting with nothing in clipboard --- osu.Game/Overlays/SkinEditor/SkinEditor.cs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/osu.Game/Overlays/SkinEditor/SkinEditor.cs b/osu.Game/Overlays/SkinEditor/SkinEditor.cs index a816031668..f972186333 100644 --- a/osu.Game/Overlays/SkinEditor/SkinEditor.cs +++ b/osu.Game/Overlays/SkinEditor/SkinEditor.cs @@ -510,6 +510,9 @@ namespace osu.Game.Overlays.SkinEditor protected void Paste() { + if (!canPaste.Value) + return; + changeHandler?.BeginChange(); var drawableInfo = JsonConvert.DeserializeObject(clipboard.Content.Value); From e8d3d26d1607d381718ae0bf3650aa6ad6239c80 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bart=C5=82omiej=20Dach?= Date: Thu, 23 Nov 2023 09:26:31 +0900 Subject: [PATCH 10/12] Fix slider length not updating when adding new anchor via ctrl-click --- .../Components/PathControlPointVisualiser.cs | 12 ++++----- .../Sliders/SliderSelectionBlueprint.cs | 27 +++++++++++++------ 2 files changed, 25 insertions(+), 14 deletions(-) diff --git a/osu.Game.Rulesets.Osu/Edit/Blueprints/Sliders/Components/PathControlPointVisualiser.cs b/osu.Game.Rulesets.Osu/Edit/Blueprints/Sliders/Components/PathControlPointVisualiser.cs index 1a94d6253d..3add95b2b2 100644 --- a/osu.Game.Rulesets.Osu/Edit/Blueprints/Sliders/Components/PathControlPointVisualiser.cs +++ b/osu.Game.Rulesets.Osu/Edit/Blueprints/Sliders/Components/PathControlPointVisualiser.cs @@ -159,9 +159,9 @@ namespace osu.Game.Rulesets.Osu.Edit.Blueprints.Sliders.Components if (allowSelection) d.RequestSelection = selectionRequested; - d.DragStarted = dragStarted; - d.DragInProgress = dragInProgress; - d.DragEnded = dragEnded; + d.DragStarted = DragStarted; + d.DragInProgress = DragInProgress; + d.DragEnded = DragEnded; })); Connections.Add(new PathControlPointConnectionPiece(hitObject, e.NewStartingIndex + i)); @@ -267,7 +267,7 @@ namespace osu.Game.Rulesets.Osu.Edit.Blueprints.Sliders.Components private int draggedControlPointIndex; private HashSet selectedControlPoints; - private void dragStarted(PathControlPoint controlPoint) + public void DragStarted(PathControlPoint controlPoint) { dragStartPositions = hitObject.Path.ControlPoints.Select(point => point.Position).ToArray(); dragPathTypes = hitObject.Path.ControlPoints.Select(point => point.Type).ToArray(); @@ -279,7 +279,7 @@ namespace osu.Game.Rulesets.Osu.Edit.Blueprints.Sliders.Components changeHandler?.BeginChange(); } - private void dragInProgress(DragEvent e) + public void DragInProgress(DragEvent e) { Vector2[] oldControlPoints = hitObject.Path.ControlPoints.Select(cp => cp.Position).ToArray(); var oldPosition = hitObject.Position; @@ -341,7 +341,7 @@ namespace osu.Game.Rulesets.Osu.Edit.Blueprints.Sliders.Components hitObject.Path.ControlPoints[i].Type = dragPathTypes[i]; } - private void dragEnded() => changeHandler?.EndChange(); + public void DragEnded() => changeHandler?.EndChange(); #endregion diff --git a/osu.Game.Rulesets.Osu/Edit/Blueprints/Sliders/SliderSelectionBlueprint.cs b/osu.Game.Rulesets.Osu/Edit/Blueprints/Sliders/SliderSelectionBlueprint.cs index 80c4cee7f2..a4b8064f05 100644 --- a/osu.Game.Rulesets.Osu/Edit/Blueprints/Sliders/SliderSelectionBlueprint.cs +++ b/osu.Game.Rulesets.Osu/Edit/Blueprints/Sliders/SliderSelectionBlueprint.cs @@ -39,9 +39,6 @@ namespace osu.Game.Rulesets.Osu.Edit.Blueprints.Sliders [CanBeNull] protected PathControlPointVisualiser ControlPointVisualiser { get; private set; } - [Resolved(CanBeNull = true)] - private IPositionSnapProvider positionSnapProvider { get; set; } - [Resolved(CanBeNull = true)] private IDistanceSnapProvider distanceSnapProvider { get; set; } @@ -191,15 +188,29 @@ namespace osu.Game.Rulesets.Osu.Edit.Blueprints.Sliders [CanBeNull] private PathControlPoint placementControlPoint; - protected override bool OnDragStart(DragStartEvent e) => placementControlPoint != null; + protected override bool OnDragStart(DragStartEvent e) + { + if (placementControlPoint == null) + return base.OnDragStart(e); + + ControlPointVisualiser?.DragStarted(placementControlPoint); + return true; + } protected override void OnDrag(DragEvent e) { + base.OnDrag(e); + if (placementControlPoint != null) - { - var result = positionSnapProvider?.FindSnappedPositionAndTime(ToScreenSpace(e.MousePosition)); - placementControlPoint.Position = ToLocalSpace(result?.ScreenSpacePosition ?? ToScreenSpace(e.MousePosition)) - HitObject.Position; - } + ControlPointVisualiser?.DragInProgress(e); + } + + protected override void OnDragEnd(DragEndEvent e) + { + base.OnDragEnd(e); + + if (placementControlPoint != null) + ControlPointVisualiser?.DragEnded(); } protected override void OnMouseUp(MouseUpEvent e) From 3da8a0cbed624319841b479e2cced91fa8608cd5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bart=C5=82omiej=20Dach?= Date: Thu, 23 Nov 2023 14:00:42 +0900 Subject: [PATCH 11/12] Fix undo being broken when ctrl-click and dragging new point --- .../Blueprints/Sliders/SliderSelectionBlueprint.cs | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/osu.Game.Rulesets.Osu/Edit/Blueprints/Sliders/SliderSelectionBlueprint.cs b/osu.Game.Rulesets.Osu/Edit/Blueprints/Sliders/SliderSelectionBlueprint.cs index a4b8064f05..b3efe1c495 100644 --- a/osu.Game.Rulesets.Osu/Edit/Blueprints/Sliders/SliderSelectionBlueprint.cs +++ b/osu.Game.Rulesets.Osu/Edit/Blueprints/Sliders/SliderSelectionBlueprint.cs @@ -205,18 +205,13 @@ namespace osu.Game.Rulesets.Osu.Edit.Blueprints.Sliders ControlPointVisualiser?.DragInProgress(e); } - protected override void OnDragEnd(DragEndEvent e) - { - base.OnDragEnd(e); - - if (placementControlPoint != null) - ControlPointVisualiser?.DragEnded(); - } - protected override void OnMouseUp(MouseUpEvent e) { if (placementControlPoint != null) { + if (IsDragged) + ControlPointVisualiser?.DragEnded(); + placementControlPoint = null; changeHandler?.EndChange(); } From 191e8c5487ccd4ea1b85aa7f47e6454f5a180c1d Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 23 Nov 2023 16:39:05 +0900 Subject: [PATCH 12/12] Add note about skin editor reload jank --- osu.Game/Overlays/SkinEditor/SkinEditorOverlay.cs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/osu.Game/Overlays/SkinEditor/SkinEditorOverlay.cs b/osu.Game/Overlays/SkinEditor/SkinEditorOverlay.cs index cbe122395c..d1e7b97efc 100644 --- a/osu.Game/Overlays/SkinEditor/SkinEditorOverlay.cs +++ b/osu.Game/Overlays/SkinEditor/SkinEditorOverlay.cs @@ -210,6 +210,9 @@ namespace osu.Game.Overlays.SkinEditor // The skin editor doesn't work well if beatmap skins are being applied to the player screen. // To keep things simple, disable the setting game-wide while using the skin editor. + // + // This causes a full reload of the skin, which is pretty ugly. + // TODO: Investigate if we can avoid this when a beatmap skin is not being applied by the current beatmap. leasedBeatmapSkins = beatmapSkins.BeginLease(true); leasedBeatmapSkins.Value = false; }