1
0
mirror of https://github.com/ppy/osu.git synced 2024-09-23 20:07:26 +08:00
osu-lazer/osu.Game/Overlays/Options/LoginOptions.cs

68 lines
2.0 KiB
C#
Raw Normal View History

2016-11-03 10:22:34 +08:00
using System;
using OpenTK;
using OpenTK.Graphics;
2016-11-04 10:43:00 +08:00
using osu.Framework;
2016-11-03 10:22:34 +08:00
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Sprites;
using osu.Framework.Graphics.UserInterface;
2016-11-03 10:27:39 +08:00
using osu.Game.Graphics.UserInterface;
2016-11-03 10:22:34 +08:00
using osu.Game.Online.API;
namespace osu.Game.Overlays.Options
{
public class LoginOptions : OptionsSubsection
{
2016-11-04 10:43:00 +08:00
private Container loginForm;
protected override string Header => "Sign In";
2016-11-04 10:43:00 +08:00
public LoginOptions()
2016-11-03 10:22:34 +08:00
{
Children = new[]
{
2016-11-04 10:43:00 +08:00
loginForm = new Container
2016-11-03 10:22:34 +08:00
{
RelativeSizeAxes = Axes.X,
AutoSizeAxes = Axes.Y,
2016-11-04 10:43:00 +08:00
Children = new[] { new LoadingAnimation() }
}
2016-11-03 10:22:34 +08:00
};
}
2016-11-04 10:43:00 +08:00
protected override void Load(BaseGame game)
2016-11-03 10:22:34 +08:00
{
2016-11-04 10:43:00 +08:00
base.Load(game);
var osuGame = game as OsuGameBase;
if (osuGame == null)
return;
loginForm.Children = new Drawable[]
2016-11-03 10:22:34 +08:00
{
2016-11-04 10:43:00 +08:00
new LoginForm(osuGame.API)
};
}
class LoginForm : FlowContainer
{
public LoginForm(APIAccess api)
{
Direction = FlowDirection.VerticalOnly;
AutoSizeAxes = Axes.Y;
RelativeSizeAxes = Axes.X;
Spacing = new Vector2(0, 5);
// TODO: Wire things up
Children = new Drawable[]
2016-11-03 10:22:34 +08:00
{
2016-11-04 10:43:00 +08:00
new SpriteText { Text = "Username" },
new TextBox { Height = 20, RelativeSizeAxes = Axes.X, Text = api?.Username ?? string.Empty },
new SpriteText { Text = "Password" },
new TextBox { Height = 20, RelativeSizeAxes = Axes.X },
new OsuButton
{
RelativeSizeAxes = Axes.X,
Text = "Log in",
}
};
}
2016-11-03 10:22:34 +08:00
}
}
}