1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-12 23:12:56 +08:00

Add button to main menu

This commit is contained in:
smoogipoo 2020-12-21 18:38:44 +09:00
parent 9fa1f60b7d
commit 0566ed1a9b
2 changed files with 8 additions and 8 deletions

View File

@ -42,8 +42,7 @@ namespace osu.Game.Screens.Menu
public Action OnBeatmapListing; public Action OnBeatmapListing;
public Action OnSolo; public Action OnSolo;
public Action OnSettings; public Action OnSettings;
public Action OnMulti; public Action<bool> OnMulti;
public Action OnChart;
public const float BUTTON_WIDTH = 140f; public const float BUTTON_WIDTH = 140f;
public const float WEDGE_WIDTH = 20; public const float WEDGE_WIDTH = 20;
@ -124,8 +123,8 @@ namespace osu.Game.Screens.Menu
private void load(AudioManager audio, IdleTracker idleTracker, GameHost host) private void load(AudioManager audio, IdleTracker idleTracker, GameHost host)
{ {
buttonsPlay.Add(new Button(@"solo", @"button-solo-select", FontAwesome.Solid.User, new Color4(102, 68, 204, 255), () => OnSolo?.Invoke(), WEDGE_WIDTH, Key.P)); buttonsPlay.Add(new Button(@"solo", @"button-solo-select", FontAwesome.Solid.User, new Color4(102, 68, 204, 255), () => OnSolo?.Invoke(), WEDGE_WIDTH, Key.P));
buttonsPlay.Add(new Button(@"multi", @"button-generic-select", FontAwesome.Solid.Users, new Color4(94, 63, 186, 255), onMulti, 0, Key.M)); buttonsPlay.Add(new Button(@"multi", @"button-generic-select", OsuIcon.Charts, new Color4(94, 63, 186, 255), () => onMulti(true), 0, Key.M));
buttonsPlay.Add(new Button(@"chart", @"button-generic-select", OsuIcon.Charts, new Color4(80, 53, 160, 255), () => OnChart?.Invoke())); buttonsPlay.Add(new Button(@"timeshift", @"button-generic-select", FontAwesome.Solid.Users, new Color4(94, 63, 186, 255), () => onMulti(false), 0, Key.L));
buttonsPlay.ForEach(b => b.VisibleState = ButtonSystemState.Play); buttonsPlay.ForEach(b => b.VisibleState = ButtonSystemState.Play);
buttonsTopLevel.Add(new Button(@"play", @"button-play-select", OsuIcon.Logo, new Color4(102, 68, 204, 255), () => State = ButtonSystemState.Play, WEDGE_WIDTH, Key.P)); buttonsTopLevel.Add(new Button(@"play", @"button-play-select", OsuIcon.Logo, new Color4(102, 68, 204, 255), () => State = ButtonSystemState.Play, WEDGE_WIDTH, Key.P));
@ -154,7 +153,7 @@ namespace osu.Game.Screens.Menu
sampleBack = audio.Samples.Get(@"Menu/button-back-select"); sampleBack = audio.Samples.Get(@"Menu/button-back-select");
} }
private void onMulti() private void onMulti(bool realtime)
{ {
if (!api.IsLoggedIn) if (!api.IsLoggedIn)
{ {
@ -172,7 +171,7 @@ namespace osu.Game.Screens.Menu
return; return;
} }
OnMulti?.Invoke(); OnMulti?.Invoke(realtime);
} }
private void updateIdleState(bool isIdle) private void updateIdleState(bool isIdle)

View File

@ -17,6 +17,8 @@ using osu.Game.Online.API;
using osu.Game.Overlays; using osu.Game.Overlays;
using osu.Game.Screens.Backgrounds; using osu.Game.Screens.Backgrounds;
using osu.Game.Screens.Edit; using osu.Game.Screens.Edit;
using osu.Game.Screens.Multi;
using osu.Game.Screens.Multi.RealtimeMultiplayer;
using osu.Game.Screens.Multi.Timeshift; using osu.Game.Screens.Multi.Timeshift;
using osu.Game.Screens.Select; using osu.Game.Screens.Select;
@ -104,7 +106,7 @@ namespace osu.Game.Screens.Menu
this.Push(new Editor()); this.Push(new Editor());
}, },
OnSolo = onSolo, OnSolo = onSolo,
OnMulti = delegate { this.Push(new TimeshiftMultiplayer()); }, OnMulti = realtime => this.Push(realtime ? (Multiplayer)new RealtimeMultiplayer() : new TimeshiftMultiplayer()),
OnExit = confirmAndExit, OnExit = confirmAndExit,
} }
} }
@ -136,7 +138,6 @@ namespace osu.Game.Screens.Menu
buttons.OnSettings = () => settings?.ToggleVisibility(); buttons.OnSettings = () => settings?.ToggleVisibility();
buttons.OnBeatmapListing = () => beatmapListing?.ToggleVisibility(); buttons.OnBeatmapListing = () => beatmapListing?.ToggleVisibility();
buttons.OnChart = () => rankings?.ShowSpotlights();
LoadComponentAsync(background = new BackgroundScreenDefault()); LoadComponentAsync(background = new BackgroundScreenDefault());
preloadSongSelect(); preloadSongSelect();