Make LoginOverlay mask better.

This commit is contained in:
Dean Herbert
2017-01-31 16:59:38 +09:00
parent 3476abc38b
commit 22ef576c64
6 changed files with 52 additions and 30 deletions

View File

@ -1,12 +1,7 @@
//Copyright (c) 2007-2016 ppy Pty Ltd <contact@ppy.sh>.
//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)