Add proper toggling

This commit is contained in:
Andrew Hong 2022-08-09 14:43:37 -04:00
parent 7ed489b56d
commit 8c7ede6111
3 changed files with 20 additions and 3 deletions

View File

@ -1138,6 +1138,13 @@ namespace osu.Game
mouseDisableButtons.Value = !mouseDisableButtons.Value;
return true;
case GlobalAction.ToggleProfile:
if (userProfile.State.Value == Visibility.Visible)
return false;
ShowUser(new APIUser { Id = API.LocalUser.Value.Id });
return true;
case GlobalAction.RandomSkin:
// Don't allow random skin selection while in the skin editor.
// This is mainly to stop many "osu! default (modified)" skins being created via the SkinManager.EnsureMutableSkin() path.

View File

@ -15,7 +15,6 @@ using osu.Game.Localisation;
using osu.Game.Online.API;
using osu.Game.Online.API.Requests.Responses;
using osu.Game.Users.Drawables;
using osu.Game.Input.Bindings;
using osuTK;
using osuTK.Graphics;
@ -35,8 +34,6 @@ namespace osu.Game.Overlays.Toolbar
public ToolbarUserButton()
{
Hotkey = GlobalAction.ToggleProfile;
AutoSizeAxes = Axes.X;
}

View File

@ -19,6 +19,7 @@ using osu.Game.Overlays.Profile.Sections;
using osu.Game.Users;
using osuTK;
using osuTK.Graphics;
using osu.Game.Input.Bindings;
namespace osu.Game.Overlays
{
@ -41,6 +42,18 @@ namespace osu.Game.Overlays
protected override Color4 BackgroundColour => ColourProvider.Background6;
public override bool OnPressed(KeyBindingPressEvent<GlobalAction> e)
{
switch (e.Action)
{
case GlobalAction.ToggleProfile:
Hide();
return true;
}
return base.OnPressed(e);
}
public void ShowUser(IUser user)
{
if (user.OnlineID == APIUser.SYSTEM_USER_ID)