diff --git a/osu-framework b/osu-framework index 2f03fae533..b10125a733 160000 --- a/osu-framework +++ b/osu-framework @@ -1 +1 @@ -Subproject commit 2f03fae533293bf255a942569c07396f853378f3 +Subproject commit b10125a7334c07221503163a289522bddf6b793d diff --git a/osu.Game/Overlays/Toolbar/Toolbar.cs b/osu.Game/Overlays/Toolbar/Toolbar.cs index 35a6586260..224c897875 100644 --- a/osu.Game/Overlays/Toolbar/Toolbar.cs +++ b/osu.Game/Overlays/Toolbar/Toolbar.cs @@ -63,14 +63,14 @@ namespace osu.Game.Overlays.Toolbar Direction = FlowDirection.HorizontalOnly, RelativeSizeAxes = Axes.Y, AutoSizeAxes = Axes.X, - Children = new [] + Children = new Drawable[] { new ToolbarMusicButton(), new ToolbarButton { Icon = FontAwesome.fa_search }, - new ToolbarUserButton(), + new ToolbarUserArea(), new ToolbarButton { Icon = FontAwesome.fa_bars diff --git a/osu.Game/Overlays/Toolbar/ToolbarButton.cs b/osu.Game/Overlays/Toolbar/ToolbarButton.cs index bd404a0e84..cfdb71f3ce 100644 --- a/osu.Game/Overlays/Toolbar/ToolbarButton.cs +++ b/osu.Game/Overlays/Toolbar/ToolbarButton.cs @@ -122,6 +122,7 @@ namespace osu.Game.Overlays.Toolbar }; RelativeSizeAxes = Axes.Y; + AutoSizeAxes = Axes.X; } [BackgroundDependencyLoader] diff --git a/osu.Game/Overlays/Toolbar/ToolbarUserArea.cs b/osu.Game/Overlays/Toolbar/ToolbarUserArea.cs new file mode 100644 index 0000000000..a6feffab65 --- /dev/null +++ b/osu.Game/Overlays/Toolbar/ToolbarUserArea.cs @@ -0,0 +1,46 @@ +//Copyright (c) 2007-2016 ppy Pty Ltd . +//Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using osu.Framework.Graphics; +using osu.Framework.Graphics.Containers; +using osu.Framework.Graphics.Primitives; +using OpenTK; + +namespace osu.Game.Overlays.Toolbar +{ + class ToolbarUserArea : Container + { + private LoginOverlay loginOverlay; + private ToolbarUserButton button; + + public override RectangleF BoundingBox => button.BoundingBox; + + public override bool Contains(Vector2 screenSpacePos) => true; + + public override Vector2 Size => button.Size; + + public ToolbarUserArea() + { + RelativeSizeAxes = Axes.Y; + + Children = new Drawable[] { + button = new ToolbarUserButton + { + Action = toggle, + }, + loginOverlay = new LoginOverlay + { + Position = new Vector2(0, 1), + RelativePositionAxes = Axes.Y, + Anchor = Anchor.TopRight, + Origin = Anchor.TopRight, + } + }; + } + + private void toggle() + { + loginOverlay.ToggleVisibility(); + } + } +} \ No newline at end of file diff --git a/osu.Game/Overlays/Toolbar/ToolbarUserButton.cs b/osu.Game/Overlays/Toolbar/ToolbarUserButton.cs index e20795e8ad..d1af30e88d 100644 --- a/osu.Game/Overlays/Toolbar/ToolbarUserButton.cs +++ b/osu.Game/Overlays/Toolbar/ToolbarUserButton.cs @@ -1,12 +1,7 @@ //Copyright (c) 2007-2016 ppy Pty Ltd . //Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE -using System; -using System.Collections.Generic; using System.Diagnostics; -using System.Linq; -using System.Text; -using System.Threading.Tasks; using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; @@ -16,14 +11,12 @@ using osu.Game.Online.API; using OpenTK; using OpenTK.Graphics; using osu.Game.Graphics; -using osu.Framework.Input; namespace osu.Game.Overlays.Toolbar { class ToolbarUserButton : ToolbarButton, IOnlineComponent { private Avatar avatar; - private LoginOverlay loginOverlay; public ToolbarUserButton() { @@ -34,29 +27,10 @@ namespace osu.Game.Overlays.Toolbar Flow.Add(avatar = new Avatar()); } - public override bool Contains(Vector2 screenSpacePos) => base.Contains(screenSpacePos) || (loginOverlay.IsVisible && loginOverlay.Contains(screenSpacePos)); - [BackgroundDependencyLoader] - private void load(APIAccess api, OsuGameBase game) + private void load(APIAccess api) { api.Register(this); - - (loginOverlay = new LoginOverlay - { - Position = new Vector2(0, 1), - RelativePositionAxes = Axes.Y, - Anchor = Anchor.TopRight, - Origin = Anchor.TopRight, - }).Preload(game, Add); - } - - protected override bool OnClick(InputState state) - { - if (!base.Contains(state.Mouse.NativeState.Position)) return false; - - loginOverlay.ToggleVisibility(); - - return base.OnClick(state); } public void APIStateChanged(APIAccess api, APIState state) diff --git a/osu.Game/osu.Game.csproj b/osu.Game/osu.Game.csproj index cfbb83e2a6..e525317736 100644 --- a/osu.Game/osu.Game.csproj +++ b/osu.Game/osu.Game.csproj @@ -98,6 +98,7 @@ +