diff --git a/osu.Game/Graphics/UserInterface/LoadingAnimation.cs b/osu.Game/Graphics/UserInterface/LoadingAnimation.cs
new file mode 100644
index 0000000000..2edc5397f4
--- /dev/null
+++ b/osu.Game/Graphics/UserInterface/LoadingAnimation.cs
@@ -0,0 +1,13 @@
+using System;
+using osu.Framework.Graphics.Sprites;
+
+namespace osu.Game.Graphics.UserInterface
+{
+ public class LoadingAnimation : SpriteText
+ {
+ public LoadingAnimation()
+ {
+ Text = "Loading";
+ }
+ }
+}
\ No newline at end of file
diff --git a/osu.Game/Overlays/Options/GeneralOptions.cs b/osu.Game/Overlays/Options/GeneralOptions.cs
index b194303d22..278231fa5a 100644
--- a/osu.Game/Overlays/Options/GeneralOptions.cs
+++ b/osu.Game/Overlays/Options/GeneralOptions.cs
@@ -10,14 +10,14 @@ namespace osu.Game.Overlays.Options
{
public class GeneralOptions : OptionsSection
{
- public GeneralOptions(BasicStorage storage, APIAccess api)
+ public GeneralOptions()
{
Header = "General";
Children = new Drawable[]
{
- new LoginOptions(api),
+ new LoginOptions(),
new LanguageOptions(),
- new UpdateOptions(storage),
+ new UpdateOptions(),
};
}
}
diff --git a/osu.Game/Overlays/Options/LoginOptions.cs b/osu.Game/Overlays/Options/LoginOptions.cs
index dfbde0fc5e..942ac34ff3 100644
--- a/osu.Game/Overlays/Options/LoginOptions.cs
+++ b/osu.Game/Overlays/Options/LoginOptions.cs
@@ -1,6 +1,7 @@
using System;
using OpenTK;
using OpenTK.Graphics;
+using osu.Framework;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Sprites;
@@ -12,54 +13,56 @@ namespace osu.Game.Overlays.Options
{
public class LoginOptions : OptionsSubsection
{
- public LoginOptions(APIAccess api)
+ private Container loginForm;
+
+ public LoginOptions()
{
- var state = api == null ? APIAccess.APIState.Offline : api.State;
Header = "Sign In";
Children = new[]
{
- new Container
+ loginForm = new Container
{
- Alpha = state == APIAccess.APIState.Online ? 1 : 0,
RelativeSizeAxes = Axes.X,
AutoSizeAxes = Axes.Y,
- Children = new[]
- {
- new SpriteText { Text = $"Logged in as {api?.Username}" }
- }
- },
- new Container
- {
- Alpha = state == APIAccess.APIState.Offline ? 1 : 0,
- RelativeSizeAxes = Axes.X,
- AutoSizeAxes = Axes.Y,
- Children = new[] { new LoginForm() }
- },
- };
- }
- }
-
- public class LoginForm : FlowContainer
- {
- public LoginForm()
- {
- Direction = FlowDirection.VerticalOnly;
- AutoSizeAxes = Axes.Y;
- RelativeSizeAxes = Axes.X;
- Spacing = new Vector2(0, 5);
- // TODO: Wire things up
- Children = new Drawable[]
- {
- new SpriteText { Text = "Username" },
- new TextBox { Height = 20, RelativeSizeAxes = Axes.X },
- new SpriteText { Text = "Password" },
- new TextBox { Height = 20, RelativeSizeAxes = Axes.X },
- new OsuButton
- {
- RelativeSizeAxes = Axes.X,
- Text = "Log in",
+ Children = new[] { new LoadingAnimation() }
}
};
}
+
+ protected override void Load(BaseGame game)
+ {
+ base.Load(game);
+ var osuGame = game as OsuGameBase;
+ if (osuGame == null)
+ return;
+ loginForm.Children = new Drawable[]
+ {
+ 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[]
+ {
+ 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",
+ }
+ };
+ }
+ }
}
}
\ No newline at end of file
diff --git a/osu.Game/Overlays/Options/UpdateOptions.cs b/osu.Game/Overlays/Options/UpdateOptions.cs
index 0eda049854..4d523cf079 100644
--- a/osu.Game/Overlays/Options/UpdateOptions.cs
+++ b/osu.Game/Overlays/Options/UpdateOptions.cs
@@ -1,5 +1,6 @@
using System;
using OpenTK.Graphics;
+using osu.Framework;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Sprites;
using osu.Framework.Graphics.UserInterface;
@@ -10,7 +11,9 @@ namespace osu.Game.Overlays.Options
{
public class UpdateOptions : OptionsSubsection
{
- public UpdateOptions(BasicStorage storage)
+ private BasicStorage storage;
+
+ public UpdateOptions()
{
Header = "Updates";
Children = new Drawable[]
@@ -21,10 +24,16 @@ namespace osu.Game.Overlays.Options
{
RelativeSizeAxes = Axes.X,
Text = "Open osu! folder",
- Action = storage.OpenInNativeExplorer,
+ Action = () => storage?.OpenInNativeExplorer(),
}
};
}
+
+ protected override void Load(BaseGame game)
+ {
+ base.Load(game);
+ this.storage = game.Host.Storage;
+ }
}
}
diff --git a/osu.Game/Overlays/OptionsOverlay.cs b/osu.Game/Overlays/OptionsOverlay.cs
index 70e6a18e3b..31c329e381 100644
--- a/osu.Game/Overlays/OptionsOverlay.cs
+++ b/osu.Game/Overlays/OptionsOverlay.cs
@@ -24,24 +24,9 @@ namespace osu.Game.Overlays
{
internal const float SideMargins = 10;
private const float width = 400;
- private FlowContainer optionsContainer;
- private BasicStorage storage;
- private OsuConfigManager configManager;
- private APIAccess api;
-
- protected override void Load(BaseGame game)
+
+ public OptionsOverlay()
{
- base.Load(game);
-
- storage = game.Host.Storage;
-
- var osuGame = game as OsuGameBase;
- if (osuGame != null)
- {
- configManager = osuGame.Config;
- api = osuGame.API;
- }
-
Depth = float.MaxValue;
RelativeSizeAxes = Axes.Y;
Size = new Vector2(width, 1);
@@ -61,7 +46,7 @@ namespace osu.Game.Overlays
ScrollDraggerOnLeft = true,
Children = new[]
{
- optionsContainer = new FlowContainer
+ new FlowContainer
{
AutoSizeAxes = Axes.Y,
RelativeSizeAxes = Axes.X,
@@ -81,7 +66,7 @@ namespace osu.Game.Overlays
TextSize = 18,
Margin = new MarginPadding { Left = SideMargins, Bottom = 30 },
},
- new GeneralOptions(storage, api),
+ new GeneralOptions(),
new GraphicsOptions(),
new GameplayOptions(),
new AudioOptions(),
diff --git a/osu.Game/osu.Game.csproj b/osu.Game/osu.Game.csproj
index 13deda788e..b2a8cee6a5 100644
--- a/osu.Game/osu.Game.csproj
+++ b/osu.Game/osu.Game.csproj
@@ -227,6 +227,7 @@
+