mirror of
https://github.com/ppy/osu
synced 2025-03-20 09:57:01 +00:00
Fix login overlay behavior
This commit is contained in:
parent
fc59e6dec5
commit
53f3dacdfb
@ -62,6 +62,8 @@ namespace osu.Game
|
|||||||
|
|
||||||
private NotificationOverlay notifications;
|
private NotificationOverlay notifications;
|
||||||
|
|
||||||
|
public LoginOverlay loginOverlay;
|
||||||
|
|
||||||
private DialogOverlay dialogOverlay;
|
private DialogOverlay dialogOverlay;
|
||||||
|
|
||||||
private AccountCreationOverlay accountCreation;
|
private AccountCreationOverlay accountCreation;
|
||||||
@ -446,6 +448,14 @@ namespace osu.Game
|
|||||||
Origin = Anchor.TopRight,
|
Origin = Anchor.TopRight,
|
||||||
}, floatingOverlayContent.Add);
|
}, floatingOverlayContent.Add);
|
||||||
|
|
||||||
|
loadComponentSingleFile(loginOverlay = new LoginOverlay
|
||||||
|
{
|
||||||
|
GetToolbarHeight = () => ToolbarOffset,
|
||||||
|
Position = new Vector2(-ToolbarButton.WIDTH, 0),
|
||||||
|
Anchor = Anchor.TopRight,
|
||||||
|
Origin = Anchor.TopRight,
|
||||||
|
}, floatingOverlayContent.Add);
|
||||||
|
|
||||||
loadComponentSingleFile(accountCreation = new AccountCreationOverlay(), topMostOverlayContent.Add);
|
loadComponentSingleFile(accountCreation = new AccountCreationOverlay(), topMostOverlayContent.Add);
|
||||||
|
|
||||||
loadComponentSingleFile(dialogOverlay = new DialogOverlay(), topMostOverlayContent.Add);
|
loadComponentSingleFile(dialogOverlay = new DialogOverlay(), topMostOverlayContent.Add);
|
||||||
@ -463,6 +473,7 @@ namespace osu.Game
|
|||||||
dependencies.Cache(musicController);
|
dependencies.Cache(musicController);
|
||||||
dependencies.Cache(beatmapSetOverlay);
|
dependencies.Cache(beatmapSetOverlay);
|
||||||
dependencies.Cache(notifications);
|
dependencies.Cache(notifications);
|
||||||
|
dependencies.Cache(loginOverlay);
|
||||||
dependencies.Cache(dialogOverlay);
|
dependencies.Cache(dialogOverlay);
|
||||||
dependencies.Cache(accountCreation);
|
dependencies.Cache(accountCreation);
|
||||||
|
|
||||||
|
@ -10,6 +10,7 @@ using osuTK.Graphics;
|
|||||||
using osu.Framework.Graphics.Shapes;
|
using osu.Framework.Graphics.Shapes;
|
||||||
using osu.Game.Graphics.Containers;
|
using osu.Game.Graphics.Containers;
|
||||||
using osu.Game.Graphics.Cursor;
|
using osu.Game.Graphics.Cursor;
|
||||||
|
using System;
|
||||||
|
|
||||||
namespace osu.Game.Overlays
|
namespace osu.Game.Overlays
|
||||||
{
|
{
|
||||||
@ -19,6 +20,11 @@ namespace osu.Game.Overlays
|
|||||||
|
|
||||||
private const float transition_time = 400;
|
private const float transition_time = 400;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Provide a source for the toolbar height.
|
||||||
|
/// </summary>
|
||||||
|
public Func<float> GetToolbarHeight;
|
||||||
|
|
||||||
public LoginOverlay()
|
public LoginOverlay()
|
||||||
{
|
{
|
||||||
AutoSizeAxes = Axes.Both;
|
AutoSizeAxes = Axes.Both;
|
||||||
@ -88,5 +94,13 @@ namespace osu.Game.Overlays
|
|||||||
settingsSection.Bounding = false;
|
settingsSection.Bounding = false;
|
||||||
this.FadeOut(transition_time);
|
this.FadeOut(transition_time);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected override void UpdateAfterChildren()
|
||||||
|
{
|
||||||
|
base.UpdateAfterChildren();
|
||||||
|
|
||||||
|
Padding = new MarginPadding { Top = GetToolbarHeight?.Invoke() ?? 0 };
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -22,7 +22,7 @@ namespace osu.Game.Overlays.Toolbar
|
|||||||
|
|
||||||
public Action OnHome;
|
public Action OnHome;
|
||||||
|
|
||||||
private ToolbarUserArea userArea;
|
private ToolbarUserButton userButton;
|
||||||
|
|
||||||
protected override bool BlockPositionalInput => false;
|
protected override bool BlockPositionalInput => false;
|
||||||
|
|
||||||
@ -77,7 +77,7 @@ namespace osu.Game.Overlays.Toolbar
|
|||||||
//{
|
//{
|
||||||
// Icon = FontAwesome.fa_search
|
// Icon = FontAwesome.fa_search
|
||||||
//},
|
//},
|
||||||
userArea = new ToolbarUserArea(),
|
userButton = new ToolbarUserButton(),
|
||||||
new ToolbarNotificationButton(),
|
new ToolbarNotificationButton(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -143,7 +143,7 @@ namespace osu.Game.Overlays.Toolbar
|
|||||||
|
|
||||||
protected override void PopOut()
|
protected override void PopOut()
|
||||||
{
|
{
|
||||||
userArea?.LoginOverlay.Hide();
|
userButton?.StateContainer.Hide();
|
||||||
|
|
||||||
this.MoveToY(-DrawSize.Y, transition_time, Easing.OutQuint);
|
this.MoveToY(-DrawSize.Y, transition_time, Easing.OutQuint);
|
||||||
this.FadeOut(transition_time);
|
this.FadeOut(transition_time);
|
||||||
|
@ -1,42 +0,0 @@
|
|||||||
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
|
||||||
// See the LICENCE file in the repository root for full licence text.
|
|
||||||
|
|
||||||
using osu.Framework.Allocation;
|
|
||||||
using osu.Framework.Graphics;
|
|
||||||
using osu.Framework.Graphics.Containers;
|
|
||||||
using osuTK;
|
|
||||||
using RectangleF = osu.Framework.Graphics.Primitives.RectangleF;
|
|
||||||
|
|
||||||
namespace osu.Game.Overlays.Toolbar
|
|
||||||
{
|
|
||||||
public class ToolbarUserArea : Container
|
|
||||||
{
|
|
||||||
public LoginOverlay LoginOverlay;
|
|
||||||
private ToolbarUserButton button;
|
|
||||||
|
|
||||||
public override RectangleF BoundingBox => button.BoundingBox;
|
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
|
||||||
private void load()
|
|
||||||
{
|
|
||||||
RelativeSizeAxes = Axes.Y;
|
|
||||||
AutoSizeAxes = Axes.X;
|
|
||||||
|
|
||||||
Children = new Drawable[]
|
|
||||||
{
|
|
||||||
button = new ToolbarUserButton
|
|
||||||
{
|
|
||||||
Action = () => LoginOverlay.ToggleVisibility(),
|
|
||||||
},
|
|
||||||
LoginOverlay = new LoginOverlay
|
|
||||||
{
|
|
||||||
BypassAutoSizeAxes = Axes.Both,
|
|
||||||
Position = new Vector2(0, 1),
|
|
||||||
RelativePositionAxes = Axes.Y,
|
|
||||||
Anchor = Anchor.TopRight,
|
|
||||||
Origin = Anchor.TopRight,
|
|
||||||
}
|
|
||||||
};
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -13,7 +13,7 @@ using osuTK.Graphics;
|
|||||||
|
|
||||||
namespace osu.Game.Overlays.Toolbar
|
namespace osu.Game.Overlays.Toolbar
|
||||||
{
|
{
|
||||||
public class ToolbarUserButton : ToolbarButton, IOnlineComponent
|
public class ToolbarUserButton : ToolbarOverlayToggleButton, IOnlineComponent
|
||||||
{
|
{
|
||||||
private readonly UpdateableAvatar avatar;
|
private readonly UpdateableAvatar avatar;
|
||||||
|
|
||||||
@ -42,10 +42,12 @@ namespace osu.Game.Overlays.Toolbar
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader(true)]
|
||||||
private void load(IAPIProvider api)
|
private void load(IAPIProvider api, LoginOverlay login)
|
||||||
{
|
{
|
||||||
api.Register(this);
|
api.Register(this);
|
||||||
|
|
||||||
|
StateContainer = login;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void APIStateChanged(IAPIProvider api, APIState state)
|
public void APIStateChanged(IAPIProvider api, APIState state)
|
||||||
|
Loading…
Reference in New Issue
Block a user