From 9b9b8a597773e9a4dfab256422c268056ad6878d Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 23 Nov 2022 15:59:31 +0900 Subject: [PATCH 01/16] Add ability to seek between control points in editor using down/up arrows Matches stable. Addresses #21376. --- .../Visual/Editing/TestSceneEditorSeeking.cs | 21 +++++++++++++++++++ osu.Game/Screens/Edit/Editor.cs | 18 ++++++++++++++++ 2 files changed, 39 insertions(+) diff --git a/osu.Game.Tests/Visual/Editing/TestSceneEditorSeeking.cs b/osu.Game.Tests/Visual/Editing/TestSceneEditorSeeking.cs index 924396ce03..14679ae01d 100644 --- a/osu.Game.Tests/Visual/Editing/TestSceneEditorSeeking.cs +++ b/osu.Game.Tests/Visual/Editing/TestSceneEditorSeeking.cs @@ -25,6 +25,7 @@ namespace osu.Game.Tests.Visual.Editing beatmap.ControlPointInfo.Clear(); beatmap.ControlPointInfo.Add(0, new TimingControlPoint { BeatLength = 1000 }); beatmap.ControlPointInfo.Add(2000, new TimingControlPoint { BeatLength = 500 }); + beatmap.ControlPointInfo.Add(20000, new TimingControlPoint { BeatLength = 500 }); return beatmap; } @@ -116,6 +117,26 @@ namespace osu.Game.Tests.Visual.Editing pressAndCheckTime(Key.Right, 3000); } + [Test] + public void TestSeekBetweenControlPoints() + { + AddStep("seek to 0", () => EditorClock.Seek(0)); + AddAssert("time is 0", () => EditorClock.CurrentTime == 0); + + // already at first control point, noop + pressAndCheckTime(Key.Down, 0); + + pressAndCheckTime(Key.Up, 2000); + + pressAndCheckTime(Key.Up, 20000); + // at last control point, noop + pressAndCheckTime(Key.Up, 20000); + + pressAndCheckTime(Key.Down, 2000); + pressAndCheckTime(Key.Down, 0); + pressAndCheckTime(Key.Down, 0); + } + private void pressAndCheckTime(Key key, double expectedTime) { AddStep($"press {key}", () => InputManager.Key(key)); diff --git a/osu.Game/Screens/Edit/Editor.cs b/osu.Game/Screens/Edit/Editor.cs index 4c44117581..7c0e021ff9 100644 --- a/osu.Game/Screens/Edit/Editor.cs +++ b/osu.Game/Screens/Edit/Editor.cs @@ -499,6 +499,14 @@ namespace osu.Game.Screens.Edit seek(e, 1); return true; + case Key.Down: + seekControlPoint(-1); + return true; + + case Key.Up: + seekControlPoint(1); + return true; + // Track traversal keys. // Matching osu-stable implementations. case Key.Z: @@ -892,6 +900,16 @@ namespace osu.Game.Screens.Edit } } + private void seekControlPoint(int direction) + { + var found = direction < 1 + ? editorBeatmap.ControlPointInfo.AllControlPoints.LastOrDefault(p => p.Time < clock.CurrentTime) + : editorBeatmap.ControlPointInfo.AllControlPoints.FirstOrDefault(p => p.Time > clock.CurrentTime); + + if (found != null) + clock.Seek(found.Time); + } + private void seek(UIEvent e, int direction) { double amount = e.ShiftPressed ? 4 : 1; From 37f725bfa242982350f40326db6399a7835a936c Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 24 Nov 2022 13:55:58 +0900 Subject: [PATCH 02/16] Reverse directionality of up/down traversal keys to match scroll --- .../Visual/Editing/TestSceneEditorSeeking.cs | 18 +++++++++--------- osu.Game/Screens/Edit/Editor.cs | 5 +++-- 2 files changed, 12 insertions(+), 11 deletions(-) diff --git a/osu.Game.Tests/Visual/Editing/TestSceneEditorSeeking.cs b/osu.Game.Tests/Visual/Editing/TestSceneEditorSeeking.cs index 14679ae01d..8ef84fb094 100644 --- a/osu.Game.Tests/Visual/Editing/TestSceneEditorSeeking.cs +++ b/osu.Game.Tests/Visual/Editing/TestSceneEditorSeeking.cs @@ -124,17 +124,17 @@ namespace osu.Game.Tests.Visual.Editing AddAssert("time is 0", () => EditorClock.CurrentTime == 0); // already at first control point, noop - pressAndCheckTime(Key.Down, 0); - - pressAndCheckTime(Key.Up, 2000); - - pressAndCheckTime(Key.Up, 20000); - // at last control point, noop - pressAndCheckTime(Key.Up, 20000); + pressAndCheckTime(Key.Up, 0); pressAndCheckTime(Key.Down, 2000); - pressAndCheckTime(Key.Down, 0); - pressAndCheckTime(Key.Down, 0); + + pressAndCheckTime(Key.Down, 20000); + // at last control point, noop + pressAndCheckTime(Key.Down, 20000); + + pressAndCheckTime(Key.Up, 2000); + pressAndCheckTime(Key.Up, 0); + pressAndCheckTime(Key.Up, 0); } private void pressAndCheckTime(Key key, double expectedTime) diff --git a/osu.Game/Screens/Edit/Editor.cs b/osu.Game/Screens/Edit/Editor.cs index 7c0e021ff9..e40910e5c6 100644 --- a/osu.Game/Screens/Edit/Editor.cs +++ b/osu.Game/Screens/Edit/Editor.cs @@ -499,11 +499,12 @@ namespace osu.Game.Screens.Edit seek(e, 1); return true; - case Key.Down: + // Of those, these two keys are reversed from stable because it feels more natural (and matches mouse wheel scroll directionality). + case Key.Up: seekControlPoint(-1); return true; - case Key.Up: + case Key.Down: seekControlPoint(1); return true; From 40f706155f56603f86f8c1bbfc194330d0a83f29 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 24 Nov 2022 15:04:54 +0900 Subject: [PATCH 03/16] Update `RoundedButton` to have new triangles design --- .../UserInterface/TestSceneRoundedButton.cs | 2 +- osu.Game/Graphics/UserInterface/OsuButton.cs | 7 ++- .../Graphics/UserInterfaceV2/RoundedButton.cs | 61 +++++++++++++++++-- osu.Game/Overlays/Settings/SettingsButton.cs | 11 ---- 4 files changed, 63 insertions(+), 18 deletions(-) diff --git a/osu.Game.Tests/Visual/UserInterface/TestSceneRoundedButton.cs b/osu.Game.Tests/Visual/UserInterface/TestSceneRoundedButton.cs index 2587960275..178a68b599 100644 --- a/osu.Game.Tests/Visual/UserInterface/TestSceneRoundedButton.cs +++ b/osu.Game.Tests/Visual/UserInterface/TestSceneRoundedButton.cs @@ -37,7 +37,7 @@ namespace osu.Game.Tests.Visual.UserInterface }, new SettingsButton { - Text = "Test button", + Text = "Test settings button", Anchor = Anchor.Centre, Origin = Anchor.Centre, Enabled = { BindTarget = enabled }, diff --git a/osu.Game/Graphics/UserInterface/OsuButton.cs b/osu.Game/Graphics/UserInterface/OsuButton.cs index dae5de2d65..6f1312652b 100644 --- a/osu.Game/Graphics/UserInterface/OsuButton.cs +++ b/osu.Game/Graphics/UserInterface/OsuButton.cs @@ -37,7 +37,7 @@ namespace osu.Game.Graphics.UserInterface /// /// Sets a custom background colour to this button, replacing the provided default. /// - public Color4 BackgroundColour + public virtual Color4 BackgroundColour { get => backgroundColour ?? defaultBackgroundColour; set @@ -90,6 +90,7 @@ namespace osu.Game.Graphics.UserInterface Anchor = Anchor.Centre, Origin = Anchor.Centre, RelativeSizeAxes = Axes.Both, + Depth = float.MaxValue, }, Hover = new Box { @@ -141,13 +142,15 @@ namespace osu.Game.Graphics.UserInterface return base.OnClick(e); } + protected virtual float HoverLayerFinalAlpha => 0.1f; + protected override bool OnHover(HoverEvent e) { if (Enabled.Value) { Hover.FadeTo(0.2f, 40, Easing.OutQuint) .Then() - .FadeTo(0.1f, 800, Easing.OutQuint); + .FadeTo(HoverLayerFinalAlpha, 800, Easing.OutQuint); } return base.OnHover(e); diff --git a/osu.Game/Graphics/UserInterfaceV2/RoundedButton.cs b/osu.Game/Graphics/UserInterfaceV2/RoundedButton.cs index 4477633da1..3d970284ec 100644 --- a/osu.Game/Graphics/UserInterfaceV2/RoundedButton.cs +++ b/osu.Game/Graphics/UserInterfaceV2/RoundedButton.cs @@ -1,19 +1,28 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -#nullable disable - using System.Collections.Generic; using osu.Framework.Allocation; +using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; +using osu.Framework.Input.Events; using osu.Framework.Localisation; +using osu.Game.Graphics.Backgrounds; using osu.Game.Graphics.UserInterface; +using osu.Game.Overlays; +using osuTK.Graphics; namespace osu.Game.Graphics.UserInterfaceV2 { public class RoundedButton : OsuButton, IFilterable { + private TrianglesV2? triangles; + + protected override float HoverLayerFinalAlpha => 0; + + private Color4 triangleGradientSecondColour = Color4.Transparent; + public override float Height { get => base.Height; @@ -26,19 +35,63 @@ namespace osu.Game.Graphics.UserInterfaceV2 } } + public override Color4 BackgroundColour + { + get => base.BackgroundColour; + set + { + base.BackgroundColour = value; + triangleGradientSecondColour = BackgroundColour.Lighten(0.2f); + updateColours(); + } + } + [BackgroundDependencyLoader(true)] - private void load(OsuColour colours) + private void load(OverlayColourProvider? overlayColourProvider, OsuColour colours) { // According to flyte, buttons are supposed to have explicit colours for now. // Not sure this is the correct direction, but we haven't decided on an `OverlayColourProvider` stand-in yet. // This is a better default. See `SettingsButton` for an override which uses `OverlayColourProvider`. - DefaultBackgroundColour = colours.Blue3; + DefaultBackgroundColour = overlayColourProvider?.Colour3 ?? colours.Blue3; + triangleGradientSecondColour = overlayColourProvider?.Colour1 ?? colours.Blue3.Lighten(0.2f); } protected override void LoadComplete() { base.LoadComplete(); + updateCornerRadius(); + + Add(triangles = new TrianglesV2 + { + Thickness = 0.02f, + SpawnRatio = 0.6f, + RelativeSizeAxes = Axes.Both, + Depth = float.MaxValue, + }); + + updateColours(); + } + + private void updateColours() + { + if (triangles == null) + return; + + triangles.ColourTop = triangleGradientSecondColour; + triangles.ColourBottom = BackgroundColour; + } + + protected override bool OnHover(HoverEvent e) + { + Background.FadeColour(triangleGradientSecondColour, 300, Easing.OutQuint); + return base.OnHover(e); + } + + protected override void OnHoverLost(HoverLostEvent e) + { + Background.FadeColour(BackgroundColour, 300, Easing.OutQuint); + base.OnHoverLost(e); } private void updateCornerRadius() => Content.CornerRadius = DrawHeight / 2; diff --git a/osu.Game/Overlays/Settings/SettingsButton.cs b/osu.Game/Overlays/Settings/SettingsButton.cs index 5f2a416f58..10aea92b22 100644 --- a/osu.Game/Overlays/Settings/SettingsButton.cs +++ b/osu.Game/Overlays/Settings/SettingsButton.cs @@ -1,16 +1,11 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -#nullable disable - using System.Collections.Generic; using System.Linq; -using JetBrains.Annotations; -using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Cursor; using osu.Framework.Localisation; -using osu.Game.Graphics; using osu.Game.Graphics.UserInterfaceV2; namespace osu.Game.Overlays.Settings @@ -23,12 +18,6 @@ namespace osu.Game.Overlays.Settings Padding = new MarginPadding { Left = SettingsPanel.CONTENT_MARGINS, Right = SettingsPanel.CONTENT_MARGINS }; } - [BackgroundDependencyLoader(true)] - private void load([CanBeNull] OverlayColourProvider overlayColourProvider, OsuColour colours) - { - DefaultBackgroundColour = overlayColourProvider?.Highlight1 ?? colours.Blue3; - } - public LocalisableString TooltipText { get; set; } public override IEnumerable FilterTerms From 4fbca4037c45b67e192396903ffc8a448ff09ef9 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 24 Nov 2022 15:08:03 +0900 Subject: [PATCH 04/16] Update existing triangle buttons to use `RoundedButton` --- .../Graphics/UserInterface/TriangleButton.cs | 32 ++----------------- 1 file changed, 2 insertions(+), 30 deletions(-) diff --git a/osu.Game/Graphics/UserInterface/TriangleButton.cs b/osu.Game/Graphics/UserInterface/TriangleButton.cs index 60d1824e5a..891c8f779f 100644 --- a/osu.Game/Graphics/UserInterface/TriangleButton.cs +++ b/osu.Game/Graphics/UserInterface/TriangleButton.cs @@ -1,42 +1,14 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -#nullable disable - -using System.Collections.Generic; -using osu.Framework.Allocation; -using osu.Framework.Graphics; -using osu.Framework.Graphics.Containers; -using osu.Framework.Localisation; -using osu.Game.Graphics.Backgrounds; +using osu.Game.Graphics.UserInterfaceV2; namespace osu.Game.Graphics.UserInterface { /// /// A button with moving triangles in the background. /// - public class TriangleButton : OsuButton, IFilterable + public class TriangleButton : RoundedButton { - protected Triangles Triangles { get; private set; } - - [BackgroundDependencyLoader] - private void load(OsuColour colours) - { - Add(Triangles = new Triangles - { - RelativeSizeAxes = Axes.Both, - ColourDark = colours.BlueDarker, - ColourLight = colours.Blue, - }); - } - - public virtual IEnumerable FilterTerms => new[] { Text }; - - public bool MatchingFilter - { - set => this.FadeTo(value ? 1 : 0); - } - - public bool FilteringActive { get; set; } } } From bea2acc60ef93f5bed5896a83e8ccb8250d7aafc Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 24 Nov 2022 15:18:26 +0900 Subject: [PATCH 05/16] Remove local specifications of triangle colouring --- .../UserInterface/DangerousTriangleButton.cs | 2 -- .../Overlays/BeatmapSet/Buttons/HeaderButton.cs | 5 ----- .../Match/Components/CreateRoomButton.cs | 1 - .../Match/Components/PurpleTriangleButton.cs | 2 -- .../Match/MultiplayerMatchSettingsOverlay.cs | 2 -- .../Multiplayer/Match/MultiplayerReadyButton.cs | 7 ------- .../Multiplayer/Match/MultiplayerSpectateButton.cs | 14 ++------------ .../OnlinePlay/Playlists/PlaylistsReadyButton.cs | 2 -- .../Playlists/PlaylistsRoomSettingsOverlay.cs | 2 -- 9 files changed, 2 insertions(+), 35 deletions(-) diff --git a/osu.Game/Graphics/UserInterface/DangerousTriangleButton.cs b/osu.Game/Graphics/UserInterface/DangerousTriangleButton.cs index 1414979531..3c78cbb634 100644 --- a/osu.Game/Graphics/UserInterface/DangerousTriangleButton.cs +++ b/osu.Game/Graphics/UserInterface/DangerousTriangleButton.cs @@ -13,8 +13,6 @@ namespace osu.Game.Graphics.UserInterface private void load(OsuColour colours) { BackgroundColour = colours.PinkDark; - Triangles.ColourDark = colours.PinkDarker; - Triangles.ColourLight = colours.Pink; } } } diff --git a/osu.Game/Overlays/BeatmapSet/Buttons/HeaderButton.cs b/osu.Game/Overlays/BeatmapSet/Buttons/HeaderButton.cs index 25d11bd6d7..d6bf3464da 100644 --- a/osu.Game/Overlays/BeatmapSet/Buttons/HeaderButton.cs +++ b/osu.Game/Overlays/BeatmapSet/Buttons/HeaderButton.cs @@ -1,8 +1,6 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -#nullable disable - using osu.Framework.Allocation; using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Graphics; @@ -22,9 +20,6 @@ namespace osu.Game.Overlays.BeatmapSet.Buttons private void load() { BackgroundColour = Color4Extensions.FromHex(@"094c5f"); - Triangles.ColourLight = Color4Extensions.FromHex(@"0f7c9b"); - Triangles.ColourDark = Color4Extensions.FromHex(@"094c5f"); - Triangles.TriangleScale = 1.5f; } } } diff --git a/osu.Game/Screens/OnlinePlay/Match/Components/CreateRoomButton.cs b/osu.Game/Screens/OnlinePlay/Match/Components/CreateRoomButton.cs index 3d0c181d9d..20e4b78eb4 100644 --- a/osu.Game/Screens/OnlinePlay/Match/Components/CreateRoomButton.cs +++ b/osu.Game/Screens/OnlinePlay/Match/Components/CreateRoomButton.cs @@ -16,7 +16,6 @@ namespace osu.Game.Screens.OnlinePlay.Match.Components private void load() { SpriteText.Font = SpriteText.Font.With(size: 14); - Triangles.TriangleScale = 1.5f; } public bool OnPressed(KeyBindingPressEvent e) diff --git a/osu.Game/Screens/OnlinePlay/Match/Components/PurpleTriangleButton.cs b/osu.Game/Screens/OnlinePlay/Match/Components/PurpleTriangleButton.cs index 5c751f238f..c6df53c368 100644 --- a/osu.Game/Screens/OnlinePlay/Match/Components/PurpleTriangleButton.cs +++ b/osu.Game/Screens/OnlinePlay/Match/Components/PurpleTriangleButton.cs @@ -15,8 +15,6 @@ namespace osu.Game.Screens.OnlinePlay.Match.Components private void load() { BackgroundColour = Color4Extensions.FromHex(@"593790"); - Triangles.ColourLight = Color4Extensions.FromHex(@"7247b6"); - Triangles.ColourDark = Color4Extensions.FromHex(@"593790"); } } } diff --git a/osu.Game/Screens/OnlinePlay/Multiplayer/Match/MultiplayerMatchSettingsOverlay.cs b/osu.Game/Screens/OnlinePlay/Multiplayer/Match/MultiplayerMatchSettingsOverlay.cs index bbdfed0a00..17c361a420 100644 --- a/osu.Game/Screens/OnlinePlay/Multiplayer/Match/MultiplayerMatchSettingsOverlay.cs +++ b/osu.Game/Screens/OnlinePlay/Multiplayer/Match/MultiplayerMatchSettingsOverlay.cs @@ -475,8 +475,6 @@ namespace osu.Game.Screens.OnlinePlay.Multiplayer.Match private void load(OsuColour colours) { BackgroundColour = colours.Yellow; - Triangles.ColourLight = colours.YellowLight; - Triangles.ColourDark = colours.YellowDark; } } diff --git a/osu.Game/Screens/OnlinePlay/Multiplayer/Match/MultiplayerReadyButton.cs b/osu.Game/Screens/OnlinePlay/Multiplayer/Match/MultiplayerReadyButton.cs index b4ff34cbc2..5f2ae82f55 100644 --- a/osu.Game/Screens/OnlinePlay/Multiplayer/Match/MultiplayerReadyButton.cs +++ b/osu.Game/Screens/OnlinePlay/Multiplayer/Match/MultiplayerReadyButton.cs @@ -12,7 +12,6 @@ using osu.Framework.Audio.Sample; using osu.Framework.Localisation; using osu.Framework.Threading; using osu.Game.Graphics; -using osu.Game.Graphics.Backgrounds; using osu.Game.Online.Multiplayer; using osu.Game.Screens.OnlinePlay.Components; @@ -20,8 +19,6 @@ namespace osu.Game.Screens.OnlinePlay.Multiplayer.Match { public class MultiplayerReadyButton : ReadyButton { - public new Triangles Triangles => base.Triangles; - [Resolved] private MultiplayerClient multiplayerClient { get; set; } @@ -212,15 +209,11 @@ namespace osu.Game.Screens.OnlinePlay.Multiplayer.Match void setYellow() { BackgroundColour = colours.YellowDark; - Triangles.ColourDark = colours.YellowDark; - Triangles.ColourLight = colours.Yellow; } void setGreen() { BackgroundColour = colours.Green; - Triangles.ColourDark = colours.Green; - Triangles.ColourLight = colours.GreenLight; } } diff --git a/osu.Game/Screens/OnlinePlay/Multiplayer/Match/MultiplayerSpectateButton.cs b/osu.Game/Screens/OnlinePlay/Multiplayer/Match/MultiplayerSpectateButton.cs index b55a7d0731..51f11341cc 100644 --- a/osu.Game/Screens/OnlinePlay/Multiplayer/Match/MultiplayerSpectateButton.cs +++ b/osu.Game/Screens/OnlinePlay/Multiplayer/Match/MultiplayerSpectateButton.cs @@ -7,7 +7,6 @@ using osu.Framework.Allocation; using osu.Framework.Bindables; using osu.Framework.Graphics; using osu.Game.Graphics; -using osu.Game.Graphics.Backgrounds; using osu.Game.Graphics.UserInterface; using osu.Game.Online.Multiplayer; using osuTK; @@ -24,11 +23,11 @@ namespace osu.Game.Screens.OnlinePlay.Multiplayer.Match private IBindable operationInProgress; - private readonly ButtonWithTrianglesExposed button; + private readonly TriangleButton button; public MultiplayerSpectateButton() { - InternalChild = button = new ButtonWithTrianglesExposed + InternalChild = button = new TriangleButton { RelativeSizeAxes = Axes.Both, Size = Vector2.One, @@ -67,15 +66,11 @@ namespace osu.Game.Screens.OnlinePlay.Multiplayer.Match default: button.Text = "Spectate"; button.BackgroundColour = colours.BlueDark; - button.Triangles.ColourDark = colours.BlueDarker; - button.Triangles.ColourLight = colours.Blue; break; case MultiplayerUserState.Spectating: button.Text = "Stop spectating"; button.BackgroundColour = colours.Gray4; - button.Triangles.ColourDark = colours.Gray5; - button.Triangles.ColourLight = colours.Gray6; break; } @@ -83,10 +78,5 @@ namespace osu.Game.Screens.OnlinePlay.Multiplayer.Match && Client.Room.State != MultiplayerRoomState.Closed && !operationInProgress.Value; } - - private class ButtonWithTrianglesExposed : TriangleButton - { - public new Triangles Triangles => base.Triangles; - } } } diff --git a/osu.Game/Screens/OnlinePlay/Playlists/PlaylistsReadyButton.cs b/osu.Game/Screens/OnlinePlay/Playlists/PlaylistsReadyButton.cs index b8ab514721..79933e606e 100644 --- a/osu.Game/Screens/OnlinePlay/Playlists/PlaylistsReadyButton.cs +++ b/osu.Game/Screens/OnlinePlay/Playlists/PlaylistsReadyButton.cs @@ -38,8 +38,6 @@ namespace osu.Game.Screens.OnlinePlay.Playlists private void load(OsuColour colours) { BackgroundColour = colours.Green; - Triangles.ColourDark = colours.Green; - Triangles.ColourLight = colours.GreenLight; } private bool hasRemainingAttempts = true; diff --git a/osu.Game/Screens/OnlinePlay/Playlists/PlaylistsRoomSettingsOverlay.cs b/osu.Game/Screens/OnlinePlay/Playlists/PlaylistsRoomSettingsOverlay.cs index cd52981528..3c57ea5a3b 100644 --- a/osu.Game/Screens/OnlinePlay/Playlists/PlaylistsRoomSettingsOverlay.cs +++ b/osu.Game/Screens/OnlinePlay/Playlists/PlaylistsRoomSettingsOverlay.cs @@ -425,8 +425,6 @@ namespace osu.Game.Screens.OnlinePlay.Playlists private void load(OsuColour colours) { BackgroundColour = colours.Yellow; - Triangles.ColourLight = colours.YellowLight; - Triangles.ColourDark = colours.YellowDark; } } From 53b03df93d60da4b8d0c395ff997ca265f51ba59 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 24 Nov 2022 16:26:57 +0900 Subject: [PATCH 06/16] Combine `TriangleButton` and `RoundedButton` classes --- .../TestScenePlaylistsMatchSettingsOverlay.cs | 3 ++- .../Visual/UserInterface/TestSceneLoadingLayer.cs | 5 +++-- .../Visual/UserInterface/TestSceneOsuPopover.cs | 8 ++++---- .../TestSceneScreenBreadcrumbControl.cs | 3 ++- .../Screens/Setup/ActionableInfo.cs | 2 +- .../Screens/Setup/StablePathSelectScreen.cs | 4 ++-- .../Screens/Setup/TournamentSwitcher.cs | 3 ++- ...TriangleButton.cs => DangerousRoundedButton.cs} | 3 ++- osu.Game/Graphics/UserInterface/TriangleButton.cs | 14 -------------- .../Overlays/BeatmapSet/Buttons/HeaderButton.cs | 4 ++-- .../Overlays/Dashboard/CurrentlyPlayingDisplay.cs | 2 +- .../Settings/Sections/Input/KeyBindingRow.cs | 5 +++-- .../Sections/Maintenance/DirectorySelectScreen.cs | 5 ++--- osu.Game/Screens/Import/FileImportScreen.cs | 5 ++--- .../Components/MatchBeatmapDetailArea.cs | 4 ++-- .../Screens/OnlinePlay/Components/ReadyButton.cs | 4 ++-- .../OnlinePlay/Lounge/DrawableLoungeRoom.cs | 4 ++-- .../Match/Components/CreateRoomButton.cs | 2 +- ...pleTriangleButton.cs => PurpleRoundedButton.cs} | 6 ++---- .../Screens/OnlinePlay/Match/DrawableMatchRoom.cs | 2 +- osu.Game/Screens/OnlinePlay/Match/RoomSubScreen.cs | 2 +- .../Match/MultiplayerMatchSettingsOverlay.cs | 7 ++++--- .../Multiplayer/Match/MultiplayerSpectateButton.cs | 6 +++--- .../Multiplayer/MultiplayerMatchSubScreen.cs | 2 +- .../Playlists/PlaylistsRoomSettingsOverlay.cs | 9 +++++---- osu.Game/Screens/Play/SoloSpectator.cs | 6 +++--- .../Tests/Visual/OsuManualInputManagerTestScene.cs | 10 +++++----- 27 files changed, 60 insertions(+), 70 deletions(-) rename osu.Game/Graphics/UserInterface/{DangerousTriangleButton.cs => DangerousRoundedButton.cs} (80%) delete mode 100644 osu.Game/Graphics/UserInterface/TriangleButton.cs rename osu.Game/Screens/OnlinePlay/Match/Components/{PurpleTriangleButton.cs => PurpleRoundedButton.cs} (80%) diff --git a/osu.Game.Tests/Visual/Playlists/TestScenePlaylistsMatchSettingsOverlay.cs b/osu.Game.Tests/Visual/Playlists/TestScenePlaylistsMatchSettingsOverlay.cs index c71bdb3a06..811135435c 100644 --- a/osu.Game.Tests/Visual/Playlists/TestScenePlaylistsMatchSettingsOverlay.cs +++ b/osu.Game.Tests/Visual/Playlists/TestScenePlaylistsMatchSettingsOverlay.cs @@ -10,6 +10,7 @@ using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Game.Graphics.Sprites; using osu.Game.Graphics.UserInterface; +using osu.Game.Graphics.UserInterfaceV2; using osu.Game.Online.Rooms; using osu.Game.Screens.OnlinePlay; using osu.Game.Screens.OnlinePlay.Playlists; @@ -148,7 +149,7 @@ namespace osu.Game.Tests.Visual.Playlists private class TestRoomSettings : PlaylistsRoomSettingsOverlay { - public TriangleButton ApplyButton => ((MatchSettings)Settings).ApplyButton; + public RoundedButton ApplyButton => ((MatchSettings)Settings).ApplyButton; public OsuTextBox NameField => ((MatchSettings)Settings).NameField; public OsuDropdown DurationField => ((MatchSettings)Settings).DurationField; diff --git a/osu.Game.Tests/Visual/UserInterface/TestSceneLoadingLayer.cs b/osu.Game.Tests/Visual/UserInterface/TestSceneLoadingLayer.cs index 2fc6405b88..9afb93236e 100644 --- a/osu.Game.Tests/Visual/UserInterface/TestSceneLoadingLayer.cs +++ b/osu.Game.Tests/Visual/UserInterface/TestSceneLoadingLayer.cs @@ -10,6 +10,7 @@ using osu.Framework.Graphics.Shapes; using osu.Framework.Utils; using osu.Game.Graphics.Sprites; using osu.Game.Graphics.UserInterface; +using osu.Game.Graphics.UserInterfaceV2; using osuTK; using osuTK.Graphics; @@ -49,8 +50,8 @@ namespace osu.Game.Tests.Visual.UserInterface Children = new Drawable[] { new OsuSpriteText { Text = "Sample content" }, - new TriangleButton { Text = "can't puush me", Width = 200, }, - new TriangleButton { Text = "puush me", Width = 200, Action = () => { } }, + new RoundedButton { Text = "can't puush me", Width = 200, }, + new RoundedButton { Text = "puush me", Width = 200, Action = () => { } }, } }, overlay = new TestLoadingLayer(true), diff --git a/osu.Game.Tests/Visual/UserInterface/TestSceneOsuPopover.cs b/osu.Game.Tests/Visual/UserInterface/TestSceneOsuPopover.cs index 6cc89a6df8..e286578f56 100644 --- a/osu.Game.Tests/Visual/UserInterface/TestSceneOsuPopover.cs +++ b/osu.Game.Tests/Visual/UserInterface/TestSceneOsuPopover.cs @@ -33,7 +33,7 @@ namespace osu.Game.Tests.Visual.UserInterface Text = @"No OverlayColourProvider", Font = OsuFont.Default.With(size: 40) }, - new TriangleButtonWithPopover() + new RoundedButtonWithPopover() } }; @@ -50,15 +50,15 @@ namespace osu.Game.Tests.Visual.UserInterface Text = @"With OverlayColourProvider (orange)", Font = OsuFont.Default.With(size: 40) }, - new TriangleButtonWithPopover() + new RoundedButtonWithPopover() } } }; } - private class TriangleButtonWithPopover : TriangleButton, IHasPopover + private class RoundedButtonWithPopover : RoundedButton, IHasPopover { - public TriangleButtonWithPopover() + public RoundedButtonWithPopover() { Width = 100; Height = 30; diff --git a/osu.Game.Tests/Visual/UserInterface/TestSceneScreenBreadcrumbControl.cs b/osu.Game.Tests/Visual/UserInterface/TestSceneScreenBreadcrumbControl.cs index b3ee0af78b..7cfcc9de1f 100644 --- a/osu.Game.Tests/Visual/UserInterface/TestSceneScreenBreadcrumbControl.cs +++ b/osu.Game.Tests/Visual/UserInterface/TestSceneScreenBreadcrumbControl.cs @@ -11,6 +11,7 @@ using osu.Framework.Screens; using osu.Game.Graphics; using osu.Game.Graphics.Sprites; using osu.Game.Graphics.UserInterface; +using osu.Game.Graphics.UserInterfaceV2; using osu.Game.Screens; using osuTK; @@ -109,7 +110,7 @@ namespace osu.Game.Tests.Visual.UserInterface Origin = Anchor.TopCentre, Text = Title, }, - new TriangleButton + new RoundedButton { Anchor = Anchor.TopCentre, Origin = Anchor.TopCentre, diff --git a/osu.Game.Tournament/Screens/Setup/ActionableInfo.cs b/osu.Game.Tournament/Screens/Setup/ActionableInfo.cs index a9ac21284e..1172c26ffa 100644 --- a/osu.Game.Tournament/Screens/Setup/ActionableInfo.cs +++ b/osu.Game.Tournament/Screens/Setup/ActionableInfo.cs @@ -61,7 +61,7 @@ namespace osu.Game.Tournament.Screens.Setup Spacing = new Vector2(10, 0), Children = new Drawable[] { - Button = new TriangleButton + Button = new RoundedButton { Size = new Vector2(100, 40), Action = () => Action?.Invoke() diff --git a/osu.Game.Tournament/Screens/Setup/StablePathSelectScreen.cs b/osu.Game.Tournament/Screens/Setup/StablePathSelectScreen.cs index fac488fcf5..32ac75178e 100644 --- a/osu.Game.Tournament/Screens/Setup/StablePathSelectScreen.cs +++ b/osu.Game.Tournament/Screens/Setup/StablePathSelectScreen.cs @@ -93,7 +93,7 @@ namespace osu.Game.Tournament.Screens.Setup Spacing = new Vector2(20), Children = new Drawable[] { - new TriangleButton + new RoundedButton { Anchor = Anchor.Centre, Origin = Anchor.Centre, @@ -101,7 +101,7 @@ namespace osu.Game.Tournament.Screens.Setup Text = "Select stable path", Action = ChangePath }, - new TriangleButton + new RoundedButton { Anchor = Anchor.Centre, Origin = Anchor.Centre, diff --git a/osu.Game.Tournament/Screens/Setup/TournamentSwitcher.cs b/osu.Game.Tournament/Screens/Setup/TournamentSwitcher.cs index 447d6f44ce..1a1c90e96a 100644 --- a/osu.Game.Tournament/Screens/Setup/TournamentSwitcher.cs +++ b/osu.Game.Tournament/Screens/Setup/TournamentSwitcher.cs @@ -6,6 +6,7 @@ using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Game.Graphics.UserInterface; +using osu.Game.Graphics.UserInterfaceV2; using osu.Game.Tournament.IO; namespace osu.Game.Tournament.Screens.Setup @@ -37,7 +38,7 @@ namespace osu.Game.Tournament.Screens.Setup { var drawable = base.CreateComponent(); - FlowContainer.Insert(-1, folderButton = new TriangleButton + FlowContainer.Insert(-1, folderButton = new RoundedButton { Text = "Open folder", Width = 100 diff --git a/osu.Game/Graphics/UserInterface/DangerousTriangleButton.cs b/osu.Game/Graphics/UserInterface/DangerousRoundedButton.cs similarity index 80% rename from osu.Game/Graphics/UserInterface/DangerousTriangleButton.cs rename to osu.Game/Graphics/UserInterface/DangerousRoundedButton.cs index 3c78cbb634..265ac01253 100644 --- a/osu.Game/Graphics/UserInterface/DangerousTriangleButton.cs +++ b/osu.Game/Graphics/UserInterface/DangerousRoundedButton.cs @@ -4,10 +4,11 @@ #nullable disable using osu.Framework.Allocation; +using osu.Game.Graphics.UserInterfaceV2; namespace osu.Game.Graphics.UserInterface { - public class DangerousTriangleButton : TriangleButton + public class DangerousRoundedButton : RoundedButton { [BackgroundDependencyLoader] private void load(OsuColour colours) diff --git a/osu.Game/Graphics/UserInterface/TriangleButton.cs b/osu.Game/Graphics/UserInterface/TriangleButton.cs deleted file mode 100644 index 891c8f779f..0000000000 --- a/osu.Game/Graphics/UserInterface/TriangleButton.cs +++ /dev/null @@ -1,14 +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.Game.Graphics.UserInterfaceV2; - -namespace osu.Game.Graphics.UserInterface -{ - /// - /// A button with moving triangles in the background. - /// - public class TriangleButton : RoundedButton - { - } -} diff --git a/osu.Game/Overlays/BeatmapSet/Buttons/HeaderButton.cs b/osu.Game/Overlays/BeatmapSet/Buttons/HeaderButton.cs index d6bf3464da..3b22ff594c 100644 --- a/osu.Game/Overlays/BeatmapSet/Buttons/HeaderButton.cs +++ b/osu.Game/Overlays/BeatmapSet/Buttons/HeaderButton.cs @@ -4,11 +4,11 @@ using osu.Framework.Allocation; using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Graphics; -using osu.Game.Graphics.UserInterface; +using osu.Game.Graphics.UserInterfaceV2; namespace osu.Game.Overlays.BeatmapSet.Buttons { - public class HeaderButton : TriangleButton + public class HeaderButton : RoundedButton { public HeaderButton() { diff --git a/osu.Game/Overlays/Dashboard/CurrentlyPlayingDisplay.cs b/osu.Game/Overlays/Dashboard/CurrentlyPlayingDisplay.cs index aae4932c22..571393f617 100644 --- a/osu.Game/Overlays/Dashboard/CurrentlyPlayingDisplay.cs +++ b/osu.Game/Overlays/Dashboard/CurrentlyPlayingDisplay.cs @@ -203,7 +203,7 @@ namespace osu.Game.Overlays.Dashboard Anchor = Anchor.TopCentre, Origin = Anchor.TopCentre, }, - new PurpleTriangleButton + new PurpleRoundedButton { RelativeSizeAxes = Axes.X, Text = "Spectate", diff --git a/osu.Game/Overlays/Settings/Sections/Input/KeyBindingRow.cs b/osu.Game/Overlays/Settings/Sections/Input/KeyBindingRow.cs index 25ab8cfad2..386fee9d55 100644 --- a/osu.Game/Overlays/Settings/Sections/Input/KeyBindingRow.cs +++ b/osu.Game/Overlays/Settings/Sections/Input/KeyBindingRow.cs @@ -22,6 +22,7 @@ using osu.Game.Database; using osu.Game.Graphics; using osu.Game.Graphics.Sprites; using osu.Game.Graphics.UserInterface; +using osu.Game.Graphics.UserInterfaceV2; using osu.Game.Input; using osu.Game.Input.Bindings; using osu.Game.Resources.Localisation.Web; @@ -446,7 +447,7 @@ namespace osu.Game.Overlays.Settings.Sections.Input isDefault.Value = bindings.Select(b => b.KeyCombination).SequenceEqual(Defaults); } - private class CancelButton : TriangleButton + private class CancelButton : RoundedButton { public CancelButton() { @@ -455,7 +456,7 @@ namespace osu.Game.Overlays.Settings.Sections.Input } } - public class ClearButton : DangerousTriangleButton + public class ClearButton : DangerousRoundedButton { public ClearButton() { diff --git a/osu.Game/Overlays/Settings/Sections/Maintenance/DirectorySelectScreen.cs b/osu.Game/Overlays/Settings/Sections/Maintenance/DirectorySelectScreen.cs index 1c9a758c6f..539600c7ca 100644 --- a/osu.Game/Overlays/Settings/Sections/Maintenance/DirectorySelectScreen.cs +++ b/osu.Game/Overlays/Settings/Sections/Maintenance/DirectorySelectScreen.cs @@ -13,7 +13,6 @@ using osuTK; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; using osu.Framework.Localisation; -using osu.Game.Graphics.UserInterface; using osu.Framework.Screens; using osu.Game.Graphics.Containers; using osu.Game.Localisation; @@ -22,7 +21,7 @@ namespace osu.Game.Overlays.Settings.Sections.Maintenance { public abstract class DirectorySelectScreen : OsuScreen { - private TriangleButton selectionButton; + private RoundedButton selectionButton; private OsuDirectorySelector directorySelector; @@ -101,7 +100,7 @@ namespace osu.Game.Overlays.Settings.Sections.Maintenance }, new Drawable[] { - selectionButton = new TriangleButton + selectionButton = new RoundedButton { Anchor = Anchor.Centre, Origin = Anchor.Centre, diff --git a/osu.Game/Screens/Import/FileImportScreen.cs b/osu.Game/Screens/Import/FileImportScreen.cs index e3d8de2dfd..e63fb95fc0 100644 --- a/osu.Game/Screens/Import/FileImportScreen.cs +++ b/osu.Game/Screens/Import/FileImportScreen.cs @@ -14,7 +14,6 @@ using osu.Framework.Graphics.Shapes; using osu.Framework.Screens; using osu.Game.Graphics; using osu.Game.Graphics.Containers; -using osu.Game.Graphics.UserInterface; using osu.Game.Graphics.UserInterfaceV2; using osuTK; @@ -28,7 +27,7 @@ namespace osu.Game.Screens.Import private Container contentContainer; private TextFlowContainer currentFileText; - private TriangleButton importButton; + private RoundedButton importButton; private const float duration = 300; private const float button_height = 50; @@ -100,7 +99,7 @@ namespace osu.Game.Screens.Import } }, }, - importButton = new TriangleButton + importButton = new RoundedButton { Text = "Import", Anchor = Anchor.BottomCentre, diff --git a/osu.Game/Screens/OnlinePlay/Components/MatchBeatmapDetailArea.cs b/osu.Game/Screens/OnlinePlay/Components/MatchBeatmapDetailArea.cs index 9a48769405..6d477be568 100644 --- a/osu.Game/Screens/OnlinePlay/Components/MatchBeatmapDetailArea.cs +++ b/osu.Game/Screens/OnlinePlay/Components/MatchBeatmapDetailArea.cs @@ -9,7 +9,7 @@ using osu.Framework.Allocation; using osu.Framework.Bindables; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; -using osu.Game.Graphics.UserInterface; +using osu.Game.Graphics.UserInterfaceV2; using osu.Game.Online.Rooms; using osu.Game.Screens.OnlinePlay.Playlists; using osu.Game.Screens.Select; @@ -54,7 +54,7 @@ namespace osu.Game.Screens.OnlinePlay.Components }, new Drawable[] { - new TriangleButton + new RoundedButton { Text = "Add new playlist entry", RelativeSizeAxes = Axes.Both, diff --git a/osu.Game/Screens/OnlinePlay/Components/ReadyButton.cs b/osu.Game/Screens/OnlinePlay/Components/ReadyButton.cs index 0871fc9a72..ae0f8cb3e4 100644 --- a/osu.Game/Screens/OnlinePlay/Components/ReadyButton.cs +++ b/osu.Game/Screens/OnlinePlay/Components/ReadyButton.cs @@ -7,13 +7,13 @@ using osu.Framework.Allocation; using osu.Framework.Bindables; using osu.Framework.Graphics.Cursor; using osu.Framework.Localisation; -using osu.Game.Graphics.UserInterface; +using osu.Game.Graphics.UserInterfaceV2; using osu.Game.Online; using osu.Game.Online.Rooms; namespace osu.Game.Screens.OnlinePlay.Components { - public abstract class ReadyButton : TriangleButton, IHasTooltip + public abstract class ReadyButton : RoundedButton, IHasTooltip { public new readonly BindableBool Enabled = new BindableBool(); diff --git a/osu.Game/Screens/OnlinePlay/Lounge/DrawableLoungeRoom.cs b/osu.Game/Screens/OnlinePlay/Lounge/DrawableLoungeRoom.cs index 8a2aeb9e5e..c53324288d 100644 --- a/osu.Game/Screens/OnlinePlay/Lounge/DrawableLoungeRoom.cs +++ b/osu.Game/Screens/OnlinePlay/Lounge/DrawableLoungeRoom.cs @@ -197,7 +197,7 @@ namespace osu.Game.Screens.OnlinePlay.Lounge } private OsuPasswordTextBox passwordTextBox; - private TriangleButton joinButton; + private RoundedButton joinButton; private OsuSpriteText errorText; private Sample sampleJoinFail; @@ -226,7 +226,7 @@ namespace osu.Game.Screens.OnlinePlay.Lounge Width = 200, PlaceholderText = "password", }, - joinButton = new TriangleButton + joinButton = new RoundedButton { Width = 80, Text = "Join Room", diff --git a/osu.Game/Screens/OnlinePlay/Match/Components/CreateRoomButton.cs b/osu.Game/Screens/OnlinePlay/Match/Components/CreateRoomButton.cs index 20e4b78eb4..4f42540146 100644 --- a/osu.Game/Screens/OnlinePlay/Match/Components/CreateRoomButton.cs +++ b/osu.Game/Screens/OnlinePlay/Match/Components/CreateRoomButton.cs @@ -10,7 +10,7 @@ using osu.Framework.Input.Events; namespace osu.Game.Screens.OnlinePlay.Match.Components { - public abstract class CreateRoomButton : PurpleTriangleButton, IKeyBindingHandler + public abstract class CreateRoomButton : PurpleRoundedButton, IKeyBindingHandler { [BackgroundDependencyLoader] private void load() diff --git a/osu.Game/Screens/OnlinePlay/Match/Components/PurpleTriangleButton.cs b/osu.Game/Screens/OnlinePlay/Match/Components/PurpleRoundedButton.cs similarity index 80% rename from osu.Game/Screens/OnlinePlay/Match/Components/PurpleTriangleButton.cs rename to osu.Game/Screens/OnlinePlay/Match/Components/PurpleRoundedButton.cs index c6df53c368..869806d21f 100644 --- a/osu.Game/Screens/OnlinePlay/Match/Components/PurpleTriangleButton.cs +++ b/osu.Game/Screens/OnlinePlay/Match/Components/PurpleRoundedButton.cs @@ -1,15 +1,13 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -#nullable disable - using osu.Framework.Allocation; using osu.Framework.Extensions.Color4Extensions; -using osu.Game.Graphics.UserInterface; +using osu.Game.Graphics.UserInterfaceV2; namespace osu.Game.Screens.OnlinePlay.Match.Components { - public class PurpleTriangleButton : TriangleButton + public class PurpleRoundedButton : RoundedButton { [BackgroundDependencyLoader] private void load() diff --git a/osu.Game/Screens/OnlinePlay/Match/DrawableMatchRoom.cs b/osu.Game/Screens/OnlinePlay/Match/DrawableMatchRoom.cs index 7c444b9bbd..7b0b0bdaa4 100644 --- a/osu.Game/Screens/OnlinePlay/Match/DrawableMatchRoom.cs +++ b/osu.Game/Screens/OnlinePlay/Match/DrawableMatchRoom.cs @@ -48,7 +48,7 @@ namespace osu.Game.Screens.OnlinePlay.Match { if (allowEdit) { - ButtonsContainer.Add(editButton = new PurpleTriangleButton + ButtonsContainer.Add(editButton = new PurpleRoundedButton { RelativeSizeAxes = Axes.Y, Size = new Vector2(100, 1), diff --git a/osu.Game/Screens/OnlinePlay/Match/RoomSubScreen.cs b/osu.Game/Screens/OnlinePlay/Match/RoomSubScreen.cs index 00c819e5e4..a4ef0297cf 100644 --- a/osu.Game/Screens/OnlinePlay/Match/RoomSubScreen.cs +++ b/osu.Game/Screens/OnlinePlay/Match/RoomSubScreen.cs @@ -517,7 +517,7 @@ namespace osu.Game.Screens.OnlinePlay.Match /// The room to change the settings of. protected abstract RoomSettingsOverlay CreateRoomSettingsOverlay(Room room); - public class UserModSelectButton : PurpleTriangleButton, IKeyBindingHandler + public class UserModSelectButton : PurpleRoundedButton, IKeyBindingHandler { public bool OnPressed(KeyBindingPressEvent e) { diff --git a/osu.Game/Screens/OnlinePlay/Multiplayer/Match/MultiplayerMatchSettingsOverlay.cs b/osu.Game/Screens/OnlinePlay/Multiplayer/Match/MultiplayerMatchSettingsOverlay.cs index 17c361a420..6e0c81ab21 100644 --- a/osu.Game/Screens/OnlinePlay/Multiplayer/Match/MultiplayerMatchSettingsOverlay.cs +++ b/osu.Game/Screens/OnlinePlay/Multiplayer/Match/MultiplayerMatchSettingsOverlay.cs @@ -16,6 +16,7 @@ using osu.Game.Graphics; using osu.Game.Graphics.Containers; using osu.Game.Graphics.Sprites; using osu.Game.Graphics.UserInterface; +using osu.Game.Graphics.UserInterfaceV2; using osu.Game.Online.Multiplayer; using osu.Game.Online.Rooms; using osu.Game.Overlays; @@ -64,7 +65,7 @@ namespace osu.Game.Screens.OnlinePlay.Multiplayer.Match public OsuEnumDropdown QueueModeDropdown = null!; public OsuTextBox PasswordTextBox = null!; public OsuCheckbox AutoSkipCheckbox = null!; - public TriangleButton ApplyButton = null!; + public RoundedButton ApplyButton = null!; public OsuSpriteText ErrorText = null!; @@ -274,7 +275,7 @@ namespace osu.Game.Screens.OnlinePlay.Multiplayer.Match RelativeSizeAxes = Axes.X, Height = DrawableRoomPlaylistItem.HEIGHT }, - new PurpleTriangleButton + new PurpleRoundedButton { RelativeSizeAxes = Axes.X, Height = 40, @@ -460,7 +461,7 @@ namespace osu.Game.Screens.OnlinePlay.Multiplayer.Match }); } - public class CreateOrUpdateButton : TriangleButton + public class CreateOrUpdateButton : RoundedButton { [Resolved(typeof(Room), nameof(Room.RoomID))] private Bindable roomId { get; set; } = null!; diff --git a/osu.Game/Screens/OnlinePlay/Multiplayer/Match/MultiplayerSpectateButton.cs b/osu.Game/Screens/OnlinePlay/Multiplayer/Match/MultiplayerSpectateButton.cs index 51f11341cc..89b3e980e6 100644 --- a/osu.Game/Screens/OnlinePlay/Multiplayer/Match/MultiplayerSpectateButton.cs +++ b/osu.Game/Screens/OnlinePlay/Multiplayer/Match/MultiplayerSpectateButton.cs @@ -7,7 +7,7 @@ using osu.Framework.Allocation; using osu.Framework.Bindables; using osu.Framework.Graphics; using osu.Game.Graphics; -using osu.Game.Graphics.UserInterface; +using osu.Game.Graphics.UserInterfaceV2; using osu.Game.Online.Multiplayer; using osuTK; @@ -23,11 +23,11 @@ namespace osu.Game.Screens.OnlinePlay.Multiplayer.Match private IBindable operationInProgress; - private readonly TriangleButton button; + private readonly RoundedButton button; public MultiplayerSpectateButton() { - InternalChild = button = new TriangleButton + InternalChild = button = new RoundedButton { RelativeSizeAxes = Axes.Both, Size = Vector2.One, diff --git a/osu.Game/Screens/OnlinePlay/Multiplayer/MultiplayerMatchSubScreen.cs b/osu.Game/Screens/OnlinePlay/Multiplayer/MultiplayerMatchSubScreen.cs index db752f2b42..969b8e61d3 100644 --- a/osu.Game/Screens/OnlinePlay/Multiplayer/MultiplayerMatchSubScreen.cs +++ b/osu.Game/Screens/OnlinePlay/Multiplayer/MultiplayerMatchSubScreen.cs @@ -430,7 +430,7 @@ namespace osu.Game.Screens.OnlinePlay.Multiplayer modSettingChangeTracker?.Dispose(); } - public class AddItemButton : PurpleTriangleButton + public class AddItemButton : PurpleRoundedButton { } } diff --git a/osu.Game/Screens/OnlinePlay/Playlists/PlaylistsRoomSettingsOverlay.cs b/osu.Game/Screens/OnlinePlay/Playlists/PlaylistsRoomSettingsOverlay.cs index 3c57ea5a3b..e4fcf0cbac 100644 --- a/osu.Game/Screens/OnlinePlay/Playlists/PlaylistsRoomSettingsOverlay.cs +++ b/osu.Game/Screens/OnlinePlay/Playlists/PlaylistsRoomSettingsOverlay.cs @@ -16,6 +16,7 @@ using osu.Game.Graphics; using osu.Game.Graphics.Containers; using osu.Game.Graphics.Sprites; using osu.Game.Graphics.UserInterface; +using osu.Game.Graphics.UserInterfaceV2; using osu.Game.Online.API; using osu.Game.Online.API.Requests.Responses; using osu.Game.Online.Rooms; @@ -58,7 +59,7 @@ namespace osu.Game.Screens.OnlinePlay.Playlists public OsuTextBox NameField = null!, MaxParticipantsField = null!, MaxAttemptsField = null!; public OsuDropdown DurationField = null!; public RoomAvailabilityPicker AvailabilityPicker = null!; - public TriangleButton ApplyButton = null!; + public RoundedButton ApplyButton = null!; public bool IsLoading => loadingLayer.State.Value == Visibility.Visible; @@ -68,7 +69,7 @@ namespace osu.Game.Screens.OnlinePlay.Playlists private DrawableRoomPlaylist playlist = null!; private OsuSpriteText playlistLength = null!; - private PurpleTriangleButton editPlaylistButton = null!; + private PurpleRoundedButton editPlaylistButton = null!; [Resolved] private IRoomManager? manager { get; set; } @@ -222,7 +223,7 @@ namespace osu.Game.Screens.OnlinePlay.Playlists }, new Drawable[] { - editPlaylistButton = new PurpleTriangleButton + editPlaylistButton = new PurpleRoundedButton { RelativeSizeAxes = Axes.X, Height = 40, @@ -414,7 +415,7 @@ namespace osu.Game.Screens.OnlinePlay.Playlists } } - public class CreateRoomButton : TriangleButton + public class CreateRoomButton : RoundedButton { public CreateRoomButton() { diff --git a/osu.Game/Screens/Play/SoloSpectator.cs b/osu.Game/Screens/Play/SoloSpectator.cs index 9ef05c3a05..2f1c86e639 100644 --- a/osu.Game/Screens/Play/SoloSpectator.cs +++ b/osu.Game/Screens/Play/SoloSpectator.cs @@ -18,7 +18,7 @@ using osu.Game.Beatmaps.Drawables.Cards; using osu.Game.Configuration; using osu.Game.Graphics; using osu.Game.Graphics.Sprites; -using osu.Game.Graphics.UserInterface; +using osu.Game.Graphics.UserInterfaceV2; using osu.Game.Online.API; using osu.Game.Online.API.Requests; using osu.Game.Online.API.Requests.Responses; @@ -54,7 +54,7 @@ namespace osu.Game.Screens.Play private OverlayColourProvider colourProvider = new OverlayColourProvider(OverlayColourScheme.Purple); private Container beatmapPanelContainer; - private TriangleButton watchButton; + private RoundedButton watchButton; private SettingsCheckbox automaticDownload; /// @@ -147,7 +147,7 @@ namespace osu.Game.Screens.Play Anchor = Anchor.Centre, Origin = Anchor.Centre, }, - watchButton = new PurpleTriangleButton + watchButton = new PurpleRoundedButton { Text = "Start Watching", Width = 250, diff --git a/osu.Game/Tests/Visual/OsuManualInputManagerTestScene.cs b/osu.Game/Tests/Visual/OsuManualInputManagerTestScene.cs index e56c546bac..3c569038b4 100644 --- a/osu.Game/Tests/Visual/OsuManualInputManagerTestScene.cs +++ b/osu.Game/Tests/Visual/OsuManualInputManagerTestScene.cs @@ -12,7 +12,7 @@ using osu.Framework.Testing; using osu.Framework.Testing.Input; using osu.Game.Graphics.Cursor; using osu.Game.Graphics.Sprites; -using osu.Game.Graphics.UserInterface; +using osu.Game.Graphics.UserInterfaceV2; using osu.Game.Input.Bindings; using osuTK; using osuTK.Graphics; @@ -27,8 +27,8 @@ namespace osu.Game.Tests.Visual protected readonly ManualInputManager InputManager; - private readonly TriangleButton buttonTest; - private readonly TriangleButton buttonLocal; + private readonly RoundedButton buttonTest; + private readonly RoundedButton buttonLocal; /// /// Whether to create a nested container to handle s that result from local (manual) test input. @@ -110,13 +110,13 @@ namespace osu.Game.Tests.Visual Children = new Drawable[] { - buttonLocal = new TriangleButton + buttonLocal = new RoundedButton { Text = "local", Size = new Vector2(50, 30), Action = returnUserInput }, - buttonTest = new TriangleButton + buttonTest = new RoundedButton { Text = "test", Size = new Vector2(50, 30), From 6ad432b311a457d90bebf0fe55304fde76c8d005 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 24 Nov 2022 16:33:01 +0900 Subject: [PATCH 07/16] Use `RoundedButton` in more places --- osu.Game/Graphics/UserInterfaceV2/RoundedButton.cs | 13 +++++++++---- .../Multiplayer/Match/MultiplayerCountdownButton.cs | 4 ++-- .../Match/MultiplayerMatchSettingsOverlay.cs | 2 +- 3 files changed, 12 insertions(+), 7 deletions(-) diff --git a/osu.Game/Graphics/UserInterfaceV2/RoundedButton.cs b/osu.Game/Graphics/UserInterfaceV2/RoundedButton.cs index 3d970284ec..4de4a14042 100644 --- a/osu.Game/Graphics/UserInterfaceV2/RoundedButton.cs +++ b/osu.Game/Graphics/UserInterfaceV2/RoundedButton.cs @@ -2,6 +2,7 @@ // See the LICENCE file in the repository root for full licence text. using System.Collections.Generic; +using System.Diagnostics; using osu.Framework.Allocation; using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Graphics; @@ -21,7 +22,7 @@ namespace osu.Game.Graphics.UserInterfaceV2 protected override float HoverLayerFinalAlpha => 0; - private Color4 triangleGradientSecondColour = Color4.Transparent; + private Color4? triangleGradientSecondColour; public override float Height { @@ -53,7 +54,7 @@ namespace osu.Game.Graphics.UserInterfaceV2 // Not sure this is the correct direction, but we haven't decided on an `OverlayColourProvider` stand-in yet. // This is a better default. See `SettingsButton` for an override which uses `OverlayColourProvider`. DefaultBackgroundColour = overlayColourProvider?.Colour3 ?? colours.Blue3; - triangleGradientSecondColour = overlayColourProvider?.Colour1 ?? colours.Blue3.Lighten(0.2f); + triangleGradientSecondColour ??= overlayColourProvider?.Colour1 ?? colours.Blue3.Lighten(0.2f); } protected override void LoadComplete() @@ -78,13 +79,17 @@ namespace osu.Game.Graphics.UserInterfaceV2 if (triangles == null) return; - triangles.ColourTop = triangleGradientSecondColour; + Debug.Assert(triangleGradientSecondColour != null); + + triangles.ColourTop = triangleGradientSecondColour.Value; triangles.ColourBottom = BackgroundColour; } protected override bool OnHover(HoverEvent e) { - Background.FadeColour(triangleGradientSecondColour, 300, Easing.OutQuint); + Debug.Assert(triangleGradientSecondColour != null); + + Background.FadeColour(triangleGradientSecondColour.Value, 300, Easing.OutQuint); return base.OnHover(e); } diff --git a/osu.Game/Screens/OnlinePlay/Multiplayer/Match/MultiplayerCountdownButton.cs b/osu.Game/Screens/OnlinePlay/Multiplayer/Match/MultiplayerCountdownButton.cs index cd94b47d9e..c28e6d36e9 100644 --- a/osu.Game/Screens/OnlinePlay/Multiplayer/Match/MultiplayerCountdownButton.cs +++ b/osu.Game/Screens/OnlinePlay/Multiplayer/Match/MultiplayerCountdownButton.cs @@ -109,7 +109,7 @@ namespace osu.Game.Screens.OnlinePlay.Multiplayer.Match foreach (var duration in available_delays) { - flow.Add(new OsuButton + flow.Add(new RoundedButton { RelativeSizeAxes = Axes.X, Text = $"Start match in {duration.Humanize()}", @@ -124,7 +124,7 @@ namespace osu.Game.Screens.OnlinePlay.Multiplayer.Match if (multiplayerClient.Room?.ActiveCountdowns.Any(c => c is MatchStartCountdown) == true && multiplayerClient.IsHost) { - flow.Add(new OsuButton + flow.Add(new RoundedButton { RelativeSizeAxes = Axes.X, Text = "Stop countdown", diff --git a/osu.Game/Screens/OnlinePlay/Multiplayer/Match/MultiplayerMatchSettingsOverlay.cs b/osu.Game/Screens/OnlinePlay/Multiplayer/Match/MultiplayerMatchSettingsOverlay.cs index 6e0c81ab21..7c4b71b920 100644 --- a/osu.Game/Screens/OnlinePlay/Multiplayer/Match/MultiplayerMatchSettingsOverlay.cs +++ b/osu.Game/Screens/OnlinePlay/Multiplayer/Match/MultiplayerMatchSettingsOverlay.cs @@ -275,7 +275,7 @@ namespace osu.Game.Screens.OnlinePlay.Multiplayer.Match RelativeSizeAxes = Axes.X, Height = DrawableRoomPlaylistItem.HEIGHT }, - new PurpleRoundedButton + new RoundedButton { RelativeSizeAxes = Axes.X, Height = 40, From ba0990d43e217fc4a7be954366549b4cdd2fe873 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 25 Nov 2022 01:44:52 +0900 Subject: [PATCH 08/16] Update test assumptions --- .../Visual/UserInterface/TestSceneRoundedButton.cs | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/osu.Game.Tests/Visual/UserInterface/TestSceneRoundedButton.cs b/osu.Game.Tests/Visual/UserInterface/TestSceneRoundedButton.cs index 178a68b599..6a8fe83176 100644 --- a/osu.Game.Tests/Visual/UserInterface/TestSceneRoundedButton.cs +++ b/osu.Game.Tests/Visual/UserInterface/TestSceneRoundedButton.cs @@ -9,7 +9,6 @@ using osu.Framework.Bindables; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Testing; -using osu.Game.Graphics; using osu.Game.Graphics.UserInterfaceV2; using osu.Game.Overlays; using osu.Game.Overlays.Settings; @@ -56,8 +55,8 @@ namespace osu.Game.Tests.Visual.UserInterface public void TestBackgroundColour() { AddStep("set red scheme", () => CreateThemedContent(OverlayColourScheme.Red)); - AddAssert("rounded button has correct colour", () => Cell(0, 1).ChildrenOfType().First().BackgroundColour == new OsuColour().Blue3); - AddAssert("settings button has correct colour", () => Cell(0, 1).ChildrenOfType().First().BackgroundColour == new OverlayColourProvider(OverlayColourScheme.Red).Highlight1); + AddAssert("rounded button has correct colour", () => Cell(0, 1).ChildrenOfType().First().BackgroundColour == new OverlayColourProvider(OverlayColourScheme.Red).Colour3); + AddAssert("settings button has correct colour", () => Cell(0, 1).ChildrenOfType().First().BackgroundColour == new OverlayColourProvider(OverlayColourScheme.Red).Colour3); } } } From 25410c9962ab4fb8d4e45314630987f3b0de0c76 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 25 Nov 2022 19:47:55 +0900 Subject: [PATCH 09/16] Avoid changing ruleset when presenting a beatmap if it can be converted Closes #21415. --- osu.Game/OsuGame.cs | 26 ++++++++++++++++++++++---- 1 file changed, 22 insertions(+), 4 deletions(-) diff --git a/osu.Game/OsuGame.cs b/osu.Game/OsuGame.cs index a93c187e53..7eae27eabd 100644 --- a/osu.Game/OsuGame.cs +++ b/osu.Game/OsuGame.cs @@ -520,11 +520,29 @@ namespace osu.Game } else { - Logger.Log($"Completing {nameof(PresentBeatmap)} with beatmap {beatmap} ruleset {selection.Ruleset}"); - Ruleset.Value = selection.Ruleset; - Beatmap.Value = BeatmapManager.GetWorkingBeatmap(selection); + // Don't change the local ruleset if the user is on another ruleset and is showing converted beatmaps at song select. + // Eventually we probably want to check whether conversion is actually possible for the current ruleset. + bool requiresRulesetSwitch = !selection.Ruleset.Equals(Ruleset.Value) + && (selection.Ruleset.OnlineID > 0 || !LocalConfig.Get(OsuSetting.ShowConvertedBeatmaps)); + + if (requiresRulesetSwitch) + { + Ruleset.Value = selection.Ruleset; + Beatmap.Value = BeatmapManager.GetWorkingBeatmap(selection); + + Logger.Log($"Completing {nameof(PresentBeatmap)} with beatmap {beatmap} ruleset {selection.Ruleset}"); + } + else + { + Beatmap.Value = BeatmapManager.GetWorkingBeatmap(selection); + + Logger.Log($"Completing {nameof(PresentBeatmap)} with beatmap {beatmap} (maintaining ruleset)"); + } } - }, validScreens: new[] { typeof(SongSelect), typeof(IHandlePresentBeatmap) }); + }, validScreens: new[] + { + typeof(SongSelect), typeof(IHandlePresentBeatmap) + }); } /// From 2425878e676c10205f54d74388630ebba518b237 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 25 Nov 2022 20:06:36 +0900 Subject: [PATCH 10/16] Add test coverage --- .../Navigation/TestScenePresentBeatmap.cs | 66 ++++++++++++++----- 1 file changed, 51 insertions(+), 15 deletions(-) diff --git a/osu.Game.Tests/Visual/Navigation/TestScenePresentBeatmap.cs b/osu.Game.Tests/Visual/Navigation/TestScenePresentBeatmap.cs index 02b348b439..ce8c8d4af5 100644 --- a/osu.Game.Tests/Visual/Navigation/TestScenePresentBeatmap.cs +++ b/osu.Game.Tests/Visual/Navigation/TestScenePresentBeatmap.cs @@ -9,8 +9,10 @@ using NUnit.Framework; using osu.Framework.Screens; using osu.Framework.Testing; using osu.Game.Beatmaps; +using osu.Game.Configuration; using osu.Game.Extensions; using osu.Game.Rulesets; +using osu.Game.Rulesets.Catch; using osu.Game.Rulesets.Mania; using osu.Game.Rulesets.Osu; using osu.Game.Screens.Menu; @@ -71,17 +73,51 @@ namespace osu.Game.Tests.Visual.Navigation } [Test] - public void TestFromSongSelectDifferentRuleset() + public void TestFromSongSelectDifferentRulesetWithConvertDisallowed() { - var firstImport = importBeatmap(1); - presentAndConfirm(firstImport); + AddStep("Set converts disallowed", () => Game.LocalConfig.SetValue(OsuSetting.ShowConvertedBeatmaps, false)); - var secondImport = importBeatmap(3, new ManiaRuleset().RulesetInfo); - confirmBeatmapInSongSelect(secondImport); - presentAndConfirm(secondImport); + var osuImport = importBeatmap(1); + presentAndConfirm(osuImport); - presentSecondDifficultyAndConfirm(firstImport, 1); - presentSecondDifficultyAndConfirm(secondImport, 3); + var maniaImport = importBeatmap(2, new ManiaRuleset().RulesetInfo); + confirmBeatmapInSongSelect(maniaImport); + presentAndConfirm(maniaImport); + + var catchImport = importBeatmap(3, new CatchRuleset().RulesetInfo); + confirmBeatmapInSongSelect(catchImport); + presentAndConfirm(catchImport); + + // Ruleset is always changed. + presentSecondDifficultyAndConfirm(maniaImport, 2); + presentSecondDifficultyAndConfirm(osuImport, 1); + presentSecondDifficultyAndConfirm(catchImport, 3); + } + + [Test] + public void TestFromSongSelectDifferentRulesetWithConvertAllowed() + { + AddStep("Set converts allowed", () => Game.LocalConfig.SetValue(OsuSetting.ShowConvertedBeatmaps, true)); + + var osuImport = importBeatmap(1); + presentAndConfirm(osuImport); + + var maniaImport = importBeatmap(2, new ManiaRuleset().RulesetInfo); + confirmBeatmapInSongSelect(maniaImport); + presentAndConfirm(maniaImport); + + var catchImport = importBeatmap(3, new CatchRuleset().RulesetInfo); + confirmBeatmapInSongSelect(catchImport); + presentAndConfirm(catchImport); + + // force ruleset to osu!mania + presentSecondDifficultyAndConfirm(maniaImport, 2); + + // ruleset is not changed as we can convert osu! beatmap. + presentSecondDifficultyAndConfirm(osuImport, 1, expectedRulesetOnlineID: 3); + + // ruleset is changed as we cannot convert. + presentSecondDifficultyAndConfirm(catchImport, 3); } private void returnToMenu() @@ -112,19 +148,19 @@ namespace osu.Game.Tests.Visual.Navigation imported = Game.BeatmapManager.Import(new BeatmapSetInfo { Hash = Guid.NewGuid().ToString(), - OnlineID = i, + OnlineID = i * 1024, Beatmaps = { new BeatmapInfo { - OnlineID = i * 1024, + OnlineID = i * 1024 + 1, Metadata = metadata, Difficulty = new BeatmapDifficulty(), Ruleset = ruleset ?? new OsuRuleset().RulesetInfo }, new BeatmapInfo { - OnlineID = i * 2048, + OnlineID = i * 1024 + 2, Metadata = metadata, Difficulty = new BeatmapDifficulty(), Ruleset = ruleset ?? new OsuRuleset().RulesetInfo @@ -156,14 +192,14 @@ namespace osu.Game.Tests.Visual.Navigation AddAssert("correct ruleset selected", () => Game.Ruleset.Value, () => Is.EqualTo(getImport().Beatmaps.First().Ruleset)); } - private void presentSecondDifficultyAndConfirm(Func getImport, int importedID) + private void presentSecondDifficultyAndConfirm(Func getImport, int importedID, int? expectedRulesetOnlineID = null) { - Predicate pred = b => b.OnlineID == importedID * 2048; + Predicate pred = b => b.OnlineID == importedID * 1024 + 2; AddStep("present difficulty", () => Game.PresentBeatmap(getImport(), pred)); AddUntilStep("wait for song select", () => Game.ScreenStack.CurrentScreen is Screens.Select.SongSelect songSelect && songSelect.IsLoaded); - AddUntilStep("correct beatmap displayed", () => Game.Beatmap.Value.BeatmapInfo.OnlineID, () => Is.EqualTo(importedID * 2048)); - AddAssert("correct ruleset selected", () => Game.Ruleset.Value, () => Is.EqualTo(getImport().Beatmaps.First().Ruleset)); + AddUntilStep("correct beatmap displayed", () => Game.Beatmap.Value.BeatmapInfo.OnlineID, () => Is.EqualTo(importedID * 1024 + 2)); + AddAssert("correct ruleset selected", () => Game.Ruleset.Value.OnlineID, () => Is.EqualTo(expectedRulesetOnlineID ?? getImport().Beatmaps.First().Ruleset.OnlineID)); } } } From 4cb068ceb9f495cbd311c57aa33d50959eef1984 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 25 Nov 2022 20:10:04 +0900 Subject: [PATCH 11/16] Change `AimCount` to not consider height --- osu.Game/Graphics/Backgrounds/TrianglesV2.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Graphics/Backgrounds/TrianglesV2.cs b/osu.Game/Graphics/Backgrounds/TrianglesV2.cs index 5fc32ff704..02ab9a9367 100644 --- a/osu.Game/Graphics/Backgrounds/TrianglesV2.cs +++ b/osu.Game/Graphics/Backgrounds/TrianglesV2.cs @@ -172,7 +172,7 @@ namespace osu.Game.Graphics.Backgrounds // Limited by the maximum size of QuadVertexBuffer for safety. const int max_triangles = ushort.MaxValue / (IRenderer.VERTICES_PER_QUAD + 2); - AimCount = (int)Math.Min(max_triangles, DrawWidth * DrawHeight * 0.0005f * SpawnRatio); + AimCount = (int)Math.Min(max_triangles, DrawWidth * 0.02f * SpawnRatio); int currentCount = parts.Count; From b0f14d49633ecf9febd4fa90cb3e6ce08c5d8d36 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 25 Nov 2022 20:14:21 +0900 Subject: [PATCH 12/16] Clamp `AimCount` to ensure at least one triangle is spawned --- osu.Game/Graphics/Backgrounds/TrianglesV2.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Graphics/Backgrounds/TrianglesV2.cs b/osu.Game/Graphics/Backgrounds/TrianglesV2.cs index 02ab9a9367..77d30d50d6 100644 --- a/osu.Game/Graphics/Backgrounds/TrianglesV2.cs +++ b/osu.Game/Graphics/Backgrounds/TrianglesV2.cs @@ -172,7 +172,7 @@ namespace osu.Game.Graphics.Backgrounds // Limited by the maximum size of QuadVertexBuffer for safety. const int max_triangles = ushort.MaxValue / (IRenderer.VERTICES_PER_QUAD + 2); - AimCount = (int)Math.Min(max_triangles, DrawWidth * 0.02f * SpawnRatio); + AimCount = (int)Math.Clamp(DrawWidth * 0.02f * SpawnRatio, 1, max_triangles); int currentCount = parts.Count; From d0c46376837c1e7cda2f771428eadda7d63cc44b Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 25 Nov 2022 20:18:21 +0900 Subject: [PATCH 13/16] Lighten colour of multiplayer create game button --- .../Multiplayer/Match/MultiplayerMatchSettingsOverlay.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Screens/OnlinePlay/Multiplayer/Match/MultiplayerMatchSettingsOverlay.cs b/osu.Game/Screens/OnlinePlay/Multiplayer/Match/MultiplayerMatchSettingsOverlay.cs index 7c4b71b920..ea4df23c4a 100644 --- a/osu.Game/Screens/OnlinePlay/Multiplayer/Match/MultiplayerMatchSettingsOverlay.cs +++ b/osu.Game/Screens/OnlinePlay/Multiplayer/Match/MultiplayerMatchSettingsOverlay.cs @@ -475,7 +475,7 @@ namespace osu.Game.Screens.OnlinePlay.Multiplayer.Match [BackgroundDependencyLoader] private void load(OsuColour colours) { - BackgroundColour = colours.Yellow; + BackgroundColour = colours.YellowDark; } } From 76e9382e0be1812f50e9c5147717cf524bf0aca7 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 25 Nov 2022 20:18:35 +0900 Subject: [PATCH 14/16] Fix triangles showing on `ExpandableButton`s when in contracted state --- osu.Game/Graphics/UserInterfaceV2/RoundedButton.cs | 10 +++++----- osu.Game/Rulesets/Edit/ExpandableButton.cs | 2 ++ 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/osu.Game/Graphics/UserInterfaceV2/RoundedButton.cs b/osu.Game/Graphics/UserInterfaceV2/RoundedButton.cs index 4de4a14042..c40622190f 100644 --- a/osu.Game/Graphics/UserInterfaceV2/RoundedButton.cs +++ b/osu.Game/Graphics/UserInterfaceV2/RoundedButton.cs @@ -18,7 +18,7 @@ namespace osu.Game.Graphics.UserInterfaceV2 { public class RoundedButton : OsuButton, IFilterable { - private TrianglesV2? triangles; + protected TrianglesV2? Triangles { get; private set; } protected override float HoverLayerFinalAlpha => 0; @@ -63,7 +63,7 @@ namespace osu.Game.Graphics.UserInterfaceV2 updateCornerRadius(); - Add(triangles = new TrianglesV2 + Add(Triangles = new TrianglesV2 { Thickness = 0.02f, SpawnRatio = 0.6f, @@ -76,13 +76,13 @@ namespace osu.Game.Graphics.UserInterfaceV2 private void updateColours() { - if (triangles == null) + if (Triangles == null) return; Debug.Assert(triangleGradientSecondColour != null); - triangles.ColourTop = triangleGradientSecondColour.Value; - triangles.ColourBottom = BackgroundColour; + Triangles.ColourTop = triangleGradientSecondColour.Value; + Triangles.ColourBottom = BackgroundColour; } protected override bool OnHover(HoverEvent e) diff --git a/osu.Game/Rulesets/Edit/ExpandableButton.cs b/osu.Game/Rulesets/Edit/ExpandableButton.cs index a66600bd58..91bcc21c1b 100644 --- a/osu.Game/Rulesets/Edit/ExpandableButton.cs +++ b/osu.Game/Rulesets/Edit/ExpandableButton.cs @@ -86,6 +86,7 @@ namespace osu.Game.Rulesets.Edit SpriteText.Font = OsuFont.GetFont(weight: FontWeight.Bold); base.Height = actualHeight; Background.Show(); + Triangles?.Show(); } else { @@ -94,6 +95,7 @@ namespace osu.Game.Rulesets.Edit SpriteText.Font = OsuFont.GetFont(weight: FontWeight.Regular); base.Height = actualHeight / 2; Background.Hide(); + Triangles?.Hide(); } }, true); } From 5ada9efa60cbb984957d12869a2090441ca14d7e Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 25 Nov 2022 22:10:20 +0900 Subject: [PATCH 15/16] Update outdated comment regarding colour choices --- osu.Game/Graphics/UserInterfaceV2/RoundedButton.cs | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/osu.Game/Graphics/UserInterfaceV2/RoundedButton.cs b/osu.Game/Graphics/UserInterfaceV2/RoundedButton.cs index c40622190f..fef9993932 100644 --- a/osu.Game/Graphics/UserInterfaceV2/RoundedButton.cs +++ b/osu.Game/Graphics/UserInterfaceV2/RoundedButton.cs @@ -50,9 +50,7 @@ namespace osu.Game.Graphics.UserInterfaceV2 [BackgroundDependencyLoader(true)] private void load(OverlayColourProvider? overlayColourProvider, OsuColour colours) { - // According to flyte, buttons are supposed to have explicit colours for now. - // Not sure this is the correct direction, but we haven't decided on an `OverlayColourProvider` stand-in yet. - // This is a better default. See `SettingsButton` for an override which uses `OverlayColourProvider`. + // Many buttons have local colours, but this provides a sane default for all other cases. DefaultBackgroundColour = overlayColourProvider?.Colour3 ?? colours.Blue3; triangleGradientSecondColour ??= overlayColourProvider?.Colour1 ?? colours.Blue3.Lighten(0.2f); } From bbbc1d0428c2aad95e138e8411520b50974d1fb0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bart=C5=82omiej=20Dach?= Date: Fri, 25 Nov 2022 18:23:28 +0100 Subject: [PATCH 16/16] Darken colour of playlists create button To match d0c46376837c1e7cda2f771428eadda7d63cc44b. --- .../OnlinePlay/Playlists/PlaylistsRoomSettingsOverlay.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Screens/OnlinePlay/Playlists/PlaylistsRoomSettingsOverlay.cs b/osu.Game/Screens/OnlinePlay/Playlists/PlaylistsRoomSettingsOverlay.cs index e4fcf0cbac..2ee55da77b 100644 --- a/osu.Game/Screens/OnlinePlay/Playlists/PlaylistsRoomSettingsOverlay.cs +++ b/osu.Game/Screens/OnlinePlay/Playlists/PlaylistsRoomSettingsOverlay.cs @@ -425,7 +425,7 @@ namespace osu.Game.Screens.OnlinePlay.Playlists [BackgroundDependencyLoader] private void load(OsuColour colours) { - BackgroundColour = colours.Yellow; + BackgroundColour = colours.YellowDark; } }