mirror of
https://github.com/ppy/osu.git
synced 2025-01-13 13:32:54 +08:00
Refactor login panel to not inherit FillFlowContainer
This commit is contained in:
parent
4a3b8c405e
commit
4582faee79
@ -11,6 +11,7 @@ using osu.Framework.Input.Events;
|
||||
using osu.Game.Configuration;
|
||||
using osu.Game.Graphics;
|
||||
using osu.Game.Graphics.Containers;
|
||||
using osu.Game.Graphics.Sprites;
|
||||
using osu.Game.Graphics.UserInterface;
|
||||
using osu.Game.Online.API;
|
||||
using osu.Game.Overlays.Settings;
|
||||
@ -56,6 +57,11 @@ namespace osu.Game.Overlays.Login
|
||||
|
||||
Children = new Drawable[]
|
||||
{
|
||||
new OsuSpriteText
|
||||
{
|
||||
Text = LoginPanelStrings.Account.ToUpper(),
|
||||
Font = OsuFont.GetFont(weight: FontWeight.Bold),
|
||||
},
|
||||
username = new OsuTextBox
|
||||
{
|
||||
PlaceholderText = UsersStrings.LoginUsername.ToLower(),
|
||||
|
@ -22,7 +22,7 @@ using osuTK;
|
||||
|
||||
namespace osu.Game.Overlays.Login
|
||||
{
|
||||
public partial class LoginPanel : FillFlowContainer
|
||||
public partial class LoginPanel : Container
|
||||
{
|
||||
private bool bounding = true;
|
||||
private LoginForm form;
|
||||
@ -59,8 +59,6 @@ namespace osu.Game.Overlays.Login
|
||||
{
|
||||
RelativeSizeAxes = Axes.X;
|
||||
AutoSizeAxes = Axes.Y;
|
||||
Direction = FillDirection.Vertical;
|
||||
Spacing = new Vector2(0f, 5f);
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
@ -77,18 +75,9 @@ namespace osu.Game.Overlays.Login
|
||||
switch (state.NewValue)
|
||||
{
|
||||
case APIState.Offline:
|
||||
Children = new Drawable[]
|
||||
{
|
||||
new OsuSpriteText
|
||||
{
|
||||
Text = LoginPanelStrings.Account.ToUpper(),
|
||||
Margin = new MarginPadding { Bottom = 5 },
|
||||
Font = OsuFont.GetFont(weight: FontWeight.Bold),
|
||||
},
|
||||
form = new LoginForm
|
||||
Child = form = new LoginForm
|
||||
{
|
||||
RequestHide = RequestHide
|
||||
}
|
||||
};
|
||||
break;
|
||||
|
||||
@ -96,6 +85,12 @@ namespace osu.Game.Overlays.Login
|
||||
case APIState.Connecting:
|
||||
LinkFlowContainer linkFlow;
|
||||
|
||||
Child = new FillFlowContainer
|
||||
{
|
||||
RelativeSizeAxes = Axes.X,
|
||||
AutoSizeAxes = Axes.Y,
|
||||
Direction = FillDirection.Vertical,
|
||||
Spacing = new Vector2(0f, 5f),
|
||||
Children = new Drawable[]
|
||||
{
|
||||
new LoadingSpinner
|
||||
@ -113,15 +108,14 @@ namespace osu.Game.Overlays.Login
|
||||
Text = state.NewValue == APIState.Failing ? ToolbarStrings.AttemptingToReconnect : ToolbarStrings.Connecting,
|
||||
Margin = new MarginPadding { Top = 10, Bottom = 10 },
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
linkFlow.AddLink(Resources.Localisation.Web.CommonStrings.ButtonsCancel.ToLower(), api.Logout, string.Empty);
|
||||
break;
|
||||
|
||||
case APIState.Online:
|
||||
Children = new Drawable[]
|
||||
{
|
||||
new FillFlowContainer
|
||||
Child = new FillFlowContainer
|
||||
{
|
||||
RelativeSizeAxes = Axes.X,
|
||||
AutoSizeAxes = Axes.Y,
|
||||
@ -153,7 +147,6 @@ namespace osu.Game.Overlays.Login
|
||||
},
|
||||
dropdown = new UserDropdown { RelativeSizeAxes = Axes.X },
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
panel.Status.BindTo(api.LocalUser.Value.Status);
|
||||
|
Loading…
Reference in New Issue
Block a user