mirror of
https://github.com/ppy/osu.git
synced 2025-02-20 05:36:05 +08:00
Make LoginOverlay mask better.
This commit is contained in:
parent
3476abc38b
commit
22ef576c64
@ -1 +1 @@
|
||||
Subproject commit 2f03fae533293bf255a942569c07396f853378f3
|
||||
Subproject commit b10125a7334c07221503163a289522bddf6b793d
|
@ -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
|
||||
|
@ -122,6 +122,7 @@ namespace osu.Game.Overlays.Toolbar
|
||||
};
|
||||
|
||||
RelativeSizeAxes = Axes.Y;
|
||||
AutoSizeAxes = Axes.X;
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
|
46
osu.Game/Overlays/Toolbar/ToolbarUserArea.cs
Normal file
46
osu.Game/Overlays/Toolbar/ToolbarUserArea.cs
Normal file
@ -0,0 +1,46 @@
|
||||
//Copyright (c) 2007-2016 ppy Pty Ltd <contact@ppy.sh>.
|
||||
//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();
|
||||
}
|
||||
}
|
||||
}
|
@ -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)
|
||||
|
@ -98,6 +98,7 @@
|
||||
<Compile Include="Overlays\Toolbar\ToolbarMusicButton.cs" />
|
||||
<Compile Include="Overlays\Toolbar\ToolbarSettingsButton.cs" />
|
||||
<Compile Include="Overlays\Toolbar\ToolbarOverlayToggleButton.cs" />
|
||||
<Compile Include="Overlays\Toolbar\ToolbarUserArea.cs" />
|
||||
<Compile Include="Overlays\Toolbar\ToolbarUserButton.cs" />
|
||||
<Compile Include="Screens\BackgroundMode.cs" />
|
||||
<Compile Include="Screens\Backgrounds\BackgroundModeBeatmap.cs" />
|
||||
|
Loading…
Reference in New Issue
Block a user