From 449038d07000f3e9dfed4d29abe2b6aa3f331806 Mon Sep 17 00:00:00 2001 From: Dan Balasescu Date: Mon, 8 Sep 2025 13:54:06 +0900 Subject: [PATCH] Split main menu buttons into multiplayer section (#136) Co-authored-by: Dean Herbert --- .../UserInterface/TestSceneMainMenuButton.cs | 23 ------------- osu.Game/Screens/Menu/ButtonSystem.cs | 34 +++++++++++++++++-- osu.Game/Screens/Menu/MatchmakingButton.cs | 19 ----------- .../Screens/MatchmakingIntroScreen.cs | 2 +- 4 files changed, 32 insertions(+), 46 deletions(-) delete mode 100644 osu.Game/Screens/Menu/MatchmakingButton.cs diff --git a/osu.Game.Tests/Visual/UserInterface/TestSceneMainMenuButton.cs b/osu.Game.Tests/Visual/UserInterface/TestSceneMainMenuButton.cs index 793bc3cd66..86659675a0 100644 --- a/osu.Game.Tests/Visual/UserInterface/TestSceneMainMenuButton.cs +++ b/osu.Game.Tests/Visual/UserInterface/TestSceneMainMenuButton.cs @@ -177,28 +177,5 @@ namespace osu.Game.Tests.Visual.UserInterface })); AddAssert("no notification posted", () => notificationOverlay.AllNotifications.Count(), () => Is.Zero); } - - [Test] - public void TestMatchmaking() - { - AddStep("add content", () => - { - Children = new Drawable[] - { - new DependencyProvidingContainer - { - Anchor = Anchor.Centre, - Origin = Anchor.Centre, - AutoSizeAxes = Axes.Both, - Child = new MatchmakingButton(@"button-default-select", new Color4(102, 68, 204, 255), (_, _) => { }, 0, Key.D) - { - Anchor = Anchor.Centre, - Origin = Anchor.Centre, - ButtonSystemState = ButtonSystemState.TopLevel, - }, - }, - }; - }); - } } } diff --git a/osu.Game/Screens/Menu/ButtonSystem.cs b/osu.Game/Screens/Menu/ButtonSystem.cs index 48d745562c..ea36532db5 100644 --- a/osu.Game/Screens/Menu/ButtonSystem.cs +++ b/osu.Game/Screens/Menu/ButtonSystem.cs @@ -13,6 +13,7 @@ using osu.Framework.Extensions.IEnumerableExtensions; using osu.Framework.Extensions.LocalisationExtensions; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; +using osu.Framework.Graphics.Sprites; using osu.Framework.Input.Bindings; using osu.Framework.Input.Events; using osu.Framework.Logging; @@ -85,6 +86,7 @@ namespace osu.Game.Screens.Menu private readonly List buttonsTopLevel = new List(); private readonly List buttonsPlay = new List(); + private readonly List buttonsMulti = new List(); private readonly List buttonsEdit = new List(); private Sample? sampleBackToLogo; @@ -110,7 +112,19 @@ namespace osu.Game.Screens.Menu { Padding = new MarginPadding { Right = WEDGE_WIDTH }, }, - backButton = new MainMenuButton(ButtonSystemStrings.Back, @"back-to-top", OsuIcon.PrevCircle, new Color4(51, 58, 94, 255), (_, _) => State = ButtonSystemState.TopLevel) + backButton = new MainMenuButton(ButtonSystemStrings.Back, @"back-to-top", OsuIcon.PrevCircle, new Color4(51, 58, 94, 255), (_, _) => + { + switch (State) + { + case ButtonSystemState.Multi: + State = ButtonSystemState.Play; + break; + + default: + State = ButtonSystemState.TopLevel; + break; + } + }) { Padding = new MarginPadding { Right = WEDGE_WIDTH }, VisibleStateMin = ButtonSystemState.Play, @@ -138,12 +152,18 @@ namespace osu.Game.Screens.Menu { Padding = new MarginPadding { Left = WEDGE_WIDTH }, }); - buttonsPlay.Add(new MainMenuButton(ButtonSystemStrings.Multi, @"button-default-select", OsuIcon.Online, new Color4(94, 63, 186, 255), onMultiplayer, Key.M)); - buttonsPlay.Add(new MatchmakingButton(@"button-default-select", new Color4(94, 63, 186, 255), onMatchmaking, Key.N)); + buttonsPlay.Add(new MainMenuButton(ButtonSystemStrings.Multi, @"button-default-select", OsuIcon.Online, new Color4(94, 63, 186, 255), (_, _) => State = ButtonSystemState.Multi, Key.M)); buttonsPlay.Add(new MainMenuButton(ButtonSystemStrings.Playlists, @"button-default-select", OsuIcon.Tournament, new Color4(94, 63, 186, 255), onPlaylists, Key.L)); buttonsPlay.Add(new DailyChallengeButton(@"button-daily-select", new Color4(94, 63, 186, 255), onDailyChallenge, Key.D)); buttonsPlay.ForEach(b => b.VisibleState = ButtonSystemState.Play); + buttonsMulti.Add(new MainMenuButton("lounge", @"button-default-select", FontAwesome.Solid.Couch, new Color4(94, 63, 186, 255), onMultiplayer, Key.B) + { + Padding = new MarginPadding { Left = WEDGE_WIDTH } + }); + buttonsMulti.Add(new MainMenuButton("quick play", @"button-default-select", FontAwesome.Solid.Bolt, new Color4(94, 63, 186, 255), onMatchmaking, Key.Q)); + buttonsMulti.ForEach(b => b.VisibleState = ButtonSystemState.Multi); + buttonsEdit.Add(new MainMenuButton(EditorStrings.BeatmapEditor.ToLower(), @"button-default-select", OsuIcon.Beatmap, new Color4(238, 170, 0, 255), (_, _) => OnEditBeatmap?.Invoke(), Key.B, Key.E) { @@ -164,6 +184,7 @@ namespace osu.Game.Screens.Menu if (host.CanExit) buttonsTopLevel.Add(new MainMenuButton(ButtonSystemStrings.Exit, string.Empty, OsuIcon.CrossCircle, new Color4(238, 51, 153, 255), (_, e) => OnExit?.Invoke(e), Key.Q)); + buttonArea.AddRange(buttonsMulti); buttonArea.AddRange(buttonsPlay); buttonArea.AddRange(buttonsEdit); buttonArea.AddRange(buttonsTopLevel); @@ -331,6 +352,7 @@ namespace osu.Game.Screens.Menu case ButtonSystemState.Edit: case ButtonSystemState.Play: + case ButtonSystemState.Multi: StopSamplePlayback(); backButton.TriggerClick(); return true; @@ -343,6 +365,7 @@ namespace osu.Game.Screens.Menu public void StopSamplePlayback() { buttonsPlay.ForEach(button => button.StopSamplePlayback()); + buttonsMulti.ForEach(button => button.StopSamplePlayback()); buttonsTopLevel.ForEach(button => button.StopSamplePlayback()); logo?.StopSamplePlayback(); } @@ -366,6 +389,10 @@ namespace osu.Game.Screens.Menu buttonsPlay.First().TriggerClick(); return false; + case ButtonSystemState.Multi: + buttonsPlay.First().TriggerClick(); + return false; + case ButtonSystemState.Edit: buttonsEdit.First().TriggerClick(); return false; @@ -487,6 +514,7 @@ namespace osu.Game.Screens.Menu Initial, TopLevel, Play, + Multi, Edit, EnteringMode, } diff --git a/osu.Game/Screens/Menu/MatchmakingButton.cs b/osu.Game/Screens/Menu/MatchmakingButton.cs deleted file mode 100644 index b65f08fe03..0000000000 --- a/osu.Game/Screens/Menu/MatchmakingButton.cs +++ /dev/null @@ -1,19 +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.Graphics.Sprites; -using osu.Framework.Input.Events; -using osuTK.Graphics; -using osuTK.Input; - -namespace osu.Game.Screens.Menu -{ - public partial class MatchmakingButton : MainMenuButton - { - public MatchmakingButton(string sampleName, Color4 colour, Action? clickAction = null, params Key[] triggerKeys) - : base("matchmaking", sampleName, FontAwesome.Solid.Newspaper, colour, clickAction, triggerKeys) - { - } - } -} diff --git a/osu.Game/Screens/OnlinePlay/Matchmaking/Screens/MatchmakingIntroScreen.cs b/osu.Game/Screens/OnlinePlay/Matchmaking/Screens/MatchmakingIntroScreen.cs index 3fabd95e6c..8a42712905 100644 --- a/osu.Game/Screens/OnlinePlay/Matchmaking/Screens/MatchmakingIntroScreen.cs +++ b/osu.Game/Screens/OnlinePlay/Matchmaking/Screens/MatchmakingIntroScreen.cs @@ -96,7 +96,7 @@ namespace osu.Game.Screens.OnlinePlay.Matchmaking.Screens { Anchor = Anchor.Centre, Origin = Anchor.Centre, - Text = "Matchmaking", + Text = "Quick Play", Margin = new MarginPadding { Horizontal = 10f, Vertical = 5f }, Shear = -OsuGame.SHEAR, Font = OsuFont.GetFont(size: 32, weight: FontWeight.Light, typeface: Typeface.TorusAlternate),