mirror of
https://github.com/osukey/osukey.git
synced 2025-07-02 00:40:09 +09:00
Block going into multiplayer while logged out
This commit is contained in:
@ -17,7 +17,9 @@ using osu.Framework.Threading;
|
|||||||
using osu.Game.Graphics;
|
using osu.Game.Graphics;
|
||||||
using osu.Game.Input;
|
using osu.Game.Input;
|
||||||
using osu.Game.Input.Bindings;
|
using osu.Game.Input.Bindings;
|
||||||
|
using osu.Game.Online.API;
|
||||||
using osu.Game.Overlays;
|
using osu.Game.Overlays;
|
||||||
|
using osu.Game.Overlays.Notifications;
|
||||||
using osuTK;
|
using osuTK;
|
||||||
using osuTK.Graphics;
|
using osuTK.Graphics;
|
||||||
using osuTK.Input;
|
using osuTK.Input;
|
||||||
@ -90,7 +92,7 @@ namespace osu.Game.Screens.Menu
|
|||||||
buttonArea.Flow.CentreTarget = iconFacade;
|
buttonArea.Flow.CentreTarget = iconFacade;
|
||||||
|
|
||||||
buttonsPlay.Add(new Button(@"solo", @"button-solo-select", FontAwesome.fa_user, new Color4(102, 68, 204, 255), () => OnSolo?.Invoke(), WEDGE_WIDTH, Key.P));
|
buttonsPlay.Add(new Button(@"solo", @"button-solo-select", FontAwesome.fa_user, new Color4(102, 68, 204, 255), () => OnSolo?.Invoke(), WEDGE_WIDTH, Key.P));
|
||||||
buttonsPlay.Add(new Button(@"multi", @"button-generic-select", FontAwesome.fa_users, new Color4(94, 63, 186, 255), () => OnMulti?.Invoke(), 0, Key.M));
|
buttonsPlay.Add(new Button(@"multi", @"button-generic-select", FontAwesome.fa_users, new Color4(94, 63, 186, 255), onMulti, 0, Key.M));
|
||||||
buttonsPlay.Add(new Button(@"chart", @"button-generic-select", FontAwesome.fa_osu_charts, new Color4(80, 53, 160, 255), () => OnChart?.Invoke()));
|
buttonsPlay.Add(new Button(@"chart", @"button-generic-select", FontAwesome.fa_osu_charts, new Color4(80, 53, 160, 255), () => OnChart?.Invoke()));
|
||||||
buttonsPlay.ForEach(b => b.VisibleState = ButtonSystemState.Play);
|
buttonsPlay.ForEach(b => b.VisibleState = ButtonSystemState.Play);
|
||||||
|
|
||||||
@ -103,19 +105,40 @@ namespace osu.Game.Screens.Menu
|
|||||||
buttonArea.AddRange(buttonsTopLevel);
|
buttonArea.AddRange(buttonsTopLevel);
|
||||||
}
|
}
|
||||||
|
|
||||||
private OsuGame game;
|
[Resolved]
|
||||||
|
private OsuGame game { get; set; }
|
||||||
|
|
||||||
|
[Resolved]
|
||||||
|
private APIAccess api { get; set; }
|
||||||
|
|
||||||
|
[Resolved]
|
||||||
|
private NotificationOverlay notifications { get; set; }
|
||||||
|
|
||||||
[BackgroundDependencyLoader(true)]
|
[BackgroundDependencyLoader(true)]
|
||||||
private void load(AudioManager audio, OsuGame game, IdleTracker idleTracker)
|
private void load(AudioManager audio, IdleTracker idleTracker)
|
||||||
{
|
{
|
||||||
this.game = game;
|
|
||||||
|
|
||||||
isIdle.ValueChanged += updateIdleState;
|
isIdle.ValueChanged += updateIdleState;
|
||||||
|
|
||||||
if (idleTracker != null) isIdle.BindTo(idleTracker.IsIdle);
|
if (idleTracker != null) isIdle.BindTo(idleTracker.IsIdle);
|
||||||
|
|
||||||
sampleBack = audio.Sample.Get(@"Menu/button-back-select");
|
sampleBack = audio.Sample.Get(@"Menu/button-back-select");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void onMulti()
|
||||||
|
{
|
||||||
|
if (!api.IsLoggedIn)
|
||||||
|
{
|
||||||
|
notifications.Post(new SimpleNotification
|
||||||
|
{
|
||||||
|
Text = "You gotta be logged in to multi 'yo!",
|
||||||
|
Icon = FontAwesome.fa_globe
|
||||||
|
});
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
OnMulti?.Invoke();
|
||||||
|
}
|
||||||
|
|
||||||
private void updateIdleState(bool isIdle)
|
private void updateIdleState(bool isIdle)
|
||||||
{
|
{
|
||||||
if (isIdle && State != ButtonSystemState.Exit)
|
if (isIdle && State != ButtonSystemState.Exit)
|
||||||
|
Reference in New Issue
Block a user