1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-28 04:42:58 +08:00

Refactor login panel to not inherit FillFlowContainer

This commit is contained in:
Joseph Madamba 2023-06-25 12:06:02 -07:00
parent 4a3b8c405e
commit 4582faee79
No known key found for this signature in database
GPG Key ID: 8B746C7BDDF0BD76
2 changed files with 53 additions and 54 deletions

View File

@ -11,6 +11,7 @@ using osu.Framework.Input.Events;
using osu.Game.Configuration; using osu.Game.Configuration;
using osu.Game.Graphics; using osu.Game.Graphics;
using osu.Game.Graphics.Containers; using osu.Game.Graphics.Containers;
using osu.Game.Graphics.Sprites;
using osu.Game.Graphics.UserInterface; using osu.Game.Graphics.UserInterface;
using osu.Game.Online.API; using osu.Game.Online.API;
using osu.Game.Overlays.Settings; using osu.Game.Overlays.Settings;
@ -56,6 +57,11 @@ namespace osu.Game.Overlays.Login
Children = new Drawable[] Children = new Drawable[]
{ {
new OsuSpriteText
{
Text = LoginPanelStrings.Account.ToUpper(),
Font = OsuFont.GetFont(weight: FontWeight.Bold),
},
username = new OsuTextBox username = new OsuTextBox
{ {
PlaceholderText = UsersStrings.LoginUsername.ToLower(), PlaceholderText = UsersStrings.LoginUsername.ToLower(),

View File

@ -22,7 +22,7 @@ using osuTK;
namespace osu.Game.Overlays.Login namespace osu.Game.Overlays.Login
{ {
public partial class LoginPanel : FillFlowContainer public partial class LoginPanel : Container
{ {
private bool bounding = true; private bool bounding = true;
private LoginForm form; private LoginForm form;
@ -59,8 +59,6 @@ namespace osu.Game.Overlays.Login
{ {
RelativeSizeAxes = Axes.X; RelativeSizeAxes = Axes.X;
AutoSizeAxes = Axes.Y; AutoSizeAxes = Axes.Y;
Direction = FillDirection.Vertical;
Spacing = new Vector2(0f, 5f);
} }
[BackgroundDependencyLoader] [BackgroundDependencyLoader]
@ -77,18 +75,9 @@ namespace osu.Game.Overlays.Login
switch (state.NewValue) switch (state.NewValue)
{ {
case APIState.Offline: case APIState.Offline:
Children = new Drawable[] Child = form = new LoginForm
{ {
new OsuSpriteText RequestHide = RequestHide
{
Text = LoginPanelStrings.Account.ToUpper(),
Margin = new MarginPadding { Bottom = 5 },
Font = OsuFont.GetFont(weight: FontWeight.Bold),
},
form = new LoginForm
{
RequestHide = RequestHide
}
}; };
break; break;
@ -96,22 +85,29 @@ namespace osu.Game.Overlays.Login
case APIState.Connecting: case APIState.Connecting:
LinkFlowContainer linkFlow; LinkFlowContainer linkFlow;
Children = new Drawable[] Child = new FillFlowContainer
{ {
new LoadingSpinner RelativeSizeAxes = Axes.X,
AutoSizeAxes = Axes.Y,
Direction = FillDirection.Vertical,
Spacing = new Vector2(0f, 5f),
Children = new Drawable[]
{ {
State = { Value = Visibility.Visible }, new LoadingSpinner
Anchor = Anchor.TopCentre, {
Origin = Anchor.TopCentre, State = { Value = Visibility.Visible },
}, Anchor = Anchor.TopCentre,
linkFlow = new LinkFlowContainer Origin = Anchor.TopCentre,
{ },
Anchor = Anchor.TopCentre, linkFlow = new LinkFlowContainer
Origin = Anchor.TopCentre, {
TextAnchor = Anchor.TopCentre, Anchor = Anchor.TopCentre,
AutoSizeAxes = Axes.Both, Origin = Anchor.TopCentre,
Text = state.NewValue == APIState.Failing ? ToolbarStrings.AttemptingToReconnect : ToolbarStrings.Connecting, TextAnchor = Anchor.TopCentre,
Margin = new MarginPadding { Top = 10, Bottom = 10 }, AutoSizeAxes = Axes.Both,
Text = state.NewValue == APIState.Failing ? ToolbarStrings.AttemptingToReconnect : ToolbarStrings.Connecting,
Margin = new MarginPadding { Top = 10, Bottom = 10 },
},
}, },
}; };
@ -119,40 +115,37 @@ namespace osu.Game.Overlays.Login
break; break;
case APIState.Online: case APIState.Online:
Children = new Drawable[] Child = new FillFlowContainer
{ {
new FillFlowContainer RelativeSizeAxes = Axes.X,
AutoSizeAxes = Axes.Y,
Padding = new MarginPadding { Left = 20, Right = 20 },
Direction = FillDirection.Vertical,
Spacing = new Vector2(0f, 10f),
Children = new Drawable[]
{ {
RelativeSizeAxes = Axes.X, new Container
AutoSizeAxes = Axes.Y,
Padding = new MarginPadding { Left = 20, Right = 20 },
Direction = FillDirection.Vertical,
Spacing = new Vector2(0f, 10f),
Children = new Drawable[]
{ {
new Container RelativeSizeAxes = Axes.X,
AutoSizeAxes = Axes.Y,
Children = new[]
{ {
RelativeSizeAxes = Axes.X, new OsuSpriteText
AutoSizeAxes = Axes.Y,
Children = new[]
{ {
new OsuSpriteText Anchor = Anchor.Centre,
{ Origin = Anchor.Centre,
Anchor = Anchor.Centre, Text = LoginPanelStrings.SignedIn,
Origin = Anchor.Centre, Font = OsuFont.GetFont(size: 18, weight: FontWeight.Bold),
Text = LoginPanelStrings.SignedIn, Margin = new MarginPadding { Top = 5, Bottom = 5 },
Font = OsuFont.GetFont(size: 18, weight: FontWeight.Bold),
Margin = new MarginPadding { Top = 5, Bottom = 5 },
},
}, },
}, },
panel = new UserGridPanel(api.LocalUser.Value)
{
RelativeSizeAxes = Axes.X,
Action = RequestHide
},
dropdown = new UserDropdown { RelativeSizeAxes = Axes.X },
}, },
panel = new UserGridPanel(api.LocalUser.Value)
{
RelativeSizeAxes = Axes.X,
Action = RequestHide
},
dropdown = new UserDropdown { RelativeSizeAxes = Axes.X },
}, },
}; };