Hide the login overlay when the user panel container by it is clicked

This commit is contained in:
Dean Herbert 2017-07-13 14:46:17 +09:00
parent d1a5a042d7
commit b13e8599f1
2 changed files with 13 additions and 1 deletions

View File

@ -46,6 +46,7 @@ namespace osu.Game.Overlays
settingsSection = new LoginSettings settingsSection = new LoginSettings
{ {
Padding = new MarginPadding(10), Padding = new MarginPadding(10),
RequestHide = Hide,
}, },
new Box new Box
{ {

View File

@ -1,6 +1,7 @@
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>. // Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using System;
using osu.Framework.Allocation; using osu.Framework.Allocation;
using osu.Framework.Graphics; using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Containers;
@ -31,6 +32,11 @@ namespace osu.Game.Overlays.Settings.Sections.General
private UserPanel panel; private UserPanel panel;
private UserDropdown dropdown; private UserDropdown dropdown;
/// <summary>
/// Called to request a hide of a parent displaying this container.
/// </summary>
public Action RequestHide;
public override RectangleF BoundingBox => bounding ? base.BoundingBox : RectangleF.Empty; public override RectangleF BoundingBox => bounding ? base.BoundingBox : RectangleF.Empty;
public bool Bounding public bool Bounding
@ -58,6 +64,7 @@ namespace osu.Game.Overlays.Settings.Sections.General
{ {
this.inputManager = inputManager; this.inputManager = inputManager;
this.colours = colours; this.colours = colours;
api?.Register(this); api?.Register(this);
} }
@ -129,7 +136,11 @@ namespace osu.Game.Overlays.Settings.Sections.General
}, },
}, },
}, },
panel = new UserPanel(api.LocalUser.Value) { RelativeSizeAxes = Axes.X }, panel = new UserPanel(api.LocalUser.Value)
{
RelativeSizeAxes = Axes.X,
Action = RequestHide
},
dropdown = new UserDropdown { RelativeSizeAxes = Axes.X }, dropdown = new UserDropdown { RelativeSizeAxes = Axes.X },
}, },
}, },