mirror of
https://github.com/ppy/osu.git
synced 2026-06-03 22:14:57 +08:00
Split main menu buttons into multiplayer section (#136)
Co-authored-by: Dean Herbert <pe@ppy.sh>
This commit is contained in:
committed by
GitHub
Unverified
parent
31188127ef
commit
449038d070
@@ -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,
|
||||
},
|
||||
},
|
||||
};
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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<MainMenuButton> buttonsTopLevel = new List<MainMenuButton>();
|
||||
private readonly List<MainMenuButton> buttonsPlay = new List<MainMenuButton>();
|
||||
private readonly List<MainMenuButton> buttonsMulti = new List<MainMenuButton>();
|
||||
private readonly List<MainMenuButton> buttonsEdit = new List<MainMenuButton>();
|
||||
|
||||
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,
|
||||
}
|
||||
|
||||
@@ -1,19 +0,0 @@
|
||||
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
||||
// See the LICENCE file in the repository root for full licence text.
|
||||
|
||||
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<MainMenuButton, UIEvent>? clickAction = null, params Key[] triggerKeys)
|
||||
: base("matchmaking", sampleName, FontAwesome.Solid.Newspaper, colour, clickAction, triggerKeys)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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),
|
||||
|
||||
Reference in New Issue
Block a user