mirror of
https://github.com/osukey/osukey.git
synced 2025-07-02 00:40:09 +09:00
Make LoginOverlay mask better.
This commit is contained in:
Submodule osu-framework updated: 2f03fae533...b10125a733
@ -63,14 +63,14 @@ namespace osu.Game.Overlays.Toolbar
|
|||||||
Direction = FlowDirection.HorizontalOnly,
|
Direction = FlowDirection.HorizontalOnly,
|
||||||
RelativeSizeAxes = Axes.Y,
|
RelativeSizeAxes = Axes.Y,
|
||||||
AutoSizeAxes = Axes.X,
|
AutoSizeAxes = Axes.X,
|
||||||
Children = new []
|
Children = new Drawable[]
|
||||||
{
|
{
|
||||||
new ToolbarMusicButton(),
|
new ToolbarMusicButton(),
|
||||||
new ToolbarButton
|
new ToolbarButton
|
||||||
{
|
{
|
||||||
Icon = FontAwesome.fa_search
|
Icon = FontAwesome.fa_search
|
||||||
},
|
},
|
||||||
new ToolbarUserButton(),
|
new ToolbarUserArea(),
|
||||||
new ToolbarButton
|
new ToolbarButton
|
||||||
{
|
{
|
||||||
Icon = FontAwesome.fa_bars
|
Icon = FontAwesome.fa_bars
|
||||||
|
@ -122,6 +122,7 @@ namespace osu.Game.Overlays.Toolbar
|
|||||||
};
|
};
|
||||||
|
|
||||||
RelativeSizeAxes = Axes.Y;
|
RelativeSizeAxes = Axes.Y;
|
||||||
|
AutoSizeAxes = Axes.X;
|
||||||
}
|
}
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
[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>.
|
//Copyright (c) 2007-2016 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 System.Collections.Generic;
|
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
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;
|
||||||
@ -16,14 +11,12 @@ using osu.Game.Online.API;
|
|||||||
using OpenTK;
|
using OpenTK;
|
||||||
using OpenTK.Graphics;
|
using OpenTK.Graphics;
|
||||||
using osu.Game.Graphics;
|
using osu.Game.Graphics;
|
||||||
using osu.Framework.Input;
|
|
||||||
|
|
||||||
namespace osu.Game.Overlays.Toolbar
|
namespace osu.Game.Overlays.Toolbar
|
||||||
{
|
{
|
||||||
class ToolbarUserButton : ToolbarButton, IOnlineComponent
|
class ToolbarUserButton : ToolbarButton, IOnlineComponent
|
||||||
{
|
{
|
||||||
private Avatar avatar;
|
private Avatar avatar;
|
||||||
private LoginOverlay loginOverlay;
|
|
||||||
|
|
||||||
public ToolbarUserButton()
|
public ToolbarUserButton()
|
||||||
{
|
{
|
||||||
@ -34,29 +27,10 @@ namespace osu.Game.Overlays.Toolbar
|
|||||||
Flow.Add(avatar = new Avatar());
|
Flow.Add(avatar = new Avatar());
|
||||||
}
|
}
|
||||||
|
|
||||||
public override bool Contains(Vector2 screenSpacePos) => base.Contains(screenSpacePos) || (loginOverlay.IsVisible && loginOverlay.Contains(screenSpacePos));
|
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
private void load(APIAccess api, OsuGameBase game)
|
private void load(APIAccess api)
|
||||||
{
|
{
|
||||||
api.Register(this);
|
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)
|
public void APIStateChanged(APIAccess api, APIState state)
|
||||||
|
@ -98,6 +98,7 @@
|
|||||||
<Compile Include="Overlays\Toolbar\ToolbarMusicButton.cs" />
|
<Compile Include="Overlays\Toolbar\ToolbarMusicButton.cs" />
|
||||||
<Compile Include="Overlays\Toolbar\ToolbarSettingsButton.cs" />
|
<Compile Include="Overlays\Toolbar\ToolbarSettingsButton.cs" />
|
||||||
<Compile Include="Overlays\Toolbar\ToolbarOverlayToggleButton.cs" />
|
<Compile Include="Overlays\Toolbar\ToolbarOverlayToggleButton.cs" />
|
||||||
|
<Compile Include="Overlays\Toolbar\ToolbarUserArea.cs" />
|
||||||
<Compile Include="Overlays\Toolbar\ToolbarUserButton.cs" />
|
<Compile Include="Overlays\Toolbar\ToolbarUserButton.cs" />
|
||||||
<Compile Include="Screens\BackgroundMode.cs" />
|
<Compile Include="Screens\BackgroundMode.cs" />
|
||||||
<Compile Include="Screens\Backgrounds\BackgroundModeBeatmap.cs" />
|
<Compile Include="Screens\Backgrounds\BackgroundModeBeatmap.cs" />
|
||||||
|
Reference in New Issue
Block a user