diff --git a/osu.Desktop.VisualTests/Tests/TestCaseOptions.cs b/osu.Desktop.VisualTests/Tests/TestCaseOptions.cs
index 72cebe745d..781c3034fa 100644
--- a/osu.Desktop.VisualTests/Tests/TestCaseOptions.cs
+++ b/osu.Desktop.VisualTests/Tests/TestCaseOptions.cs
@@ -16,13 +16,13 @@ namespace osu.Desktop.VisualTests.Tests
public override string Description => @"Tests the options overlay";
- private Options options;
+ private OptionsOverlay options;
public override void Reset()
{
base.Reset();
- Children = new[] { options = new Options() };
+ Children = new[] { options = new OptionsOverlay() };
options.ToggleVisibility();
}
}
diff --git a/osu.Game/OsuGameBase.cs b/osu.Game/OsuGameBase.cs
index 8aa011f459..a506044bee 100644
--- a/osu.Game/OsuGameBase.cs
+++ b/osu.Game/OsuGameBase.cs
@@ -27,7 +27,7 @@ namespace osu.Game
protected override string MainResourceFile => @"osu.Game.Resources.dll";
- public Options Options;
+ public OptionsOverlay Options;
public APIAccess API;
protected override Container Content => ratioContainer;
@@ -44,7 +44,7 @@ namespace osu.Game
Children = new Drawable[]
{
- Options = new Options(),
+ Options = new OptionsOverlay(),
Cursor = new OsuCursorContainer()
};
diff --git a/osu.Game/Overlays/Options/GeneralOptions.cs b/osu.Game/Overlays/Options/GeneralOptions.cs
new file mode 100644
index 0000000000..b194303d22
--- /dev/null
+++ b/osu.Game/Overlays/Options/GeneralOptions.cs
@@ -0,0 +1,25 @@
+using System;
+using OpenTK.Graphics;
+using osu.Framework.Graphics;
+using osu.Framework.Graphics.Sprites;
+using osu.Framework.Graphics.UserInterface;
+using osu.Framework.Platform;
+using osu.Game.Online.API;
+
+namespace osu.Game.Overlays.Options
+{
+ public class GeneralOptions : OptionsSection
+ {
+ public GeneralOptions(BasicStorage storage, APIAccess api)
+ {
+ Header = "General";
+ Children = new Drawable[]
+ {
+ new LoginOptions(api),
+ new LanguageOptions(),
+ new UpdateOptions(storage),
+ };
+ }
+ }
+}
+
diff --git a/osu.Game/Overlays/Options/LanguageOptions.cs b/osu.Game/Overlays/Options/LanguageOptions.cs
new file mode 100644
index 0000000000..9ba66f55ce
--- /dev/null
+++ b/osu.Game/Overlays/Options/LanguageOptions.cs
@@ -0,0 +1,27 @@
+using System;
+using osu.Framework.Graphics;
+using osu.Framework.Graphics.Sprites;
+using osu.Framework.Graphics.UserInterface;
+
+namespace osu.Game.Overlays.Options
+{
+ public class LanguageOptions : OptionsSubsection
+ {
+ public LanguageOptions()
+ {
+ Header = "Language";
+ Children = new Drawable[]
+ {
+ new SpriteText { Text = "TODO: Dropdown" },
+ new BasicCheckBox
+ {
+ Children = new[] { new SpriteText { Text = "Prefer metadata in original language" } }
+ },
+ new BasicCheckBox
+ {
+ Children = new[] { new SpriteText { Text = "Use alternative font for chat display" } }
+ },
+ };
+ }
+ }
+}
\ No newline at end of file
diff --git a/osu.Game/Overlays/Options/LoginOptions.cs b/osu.Game/Overlays/Options/LoginOptions.cs
new file mode 100644
index 0000000000..3dc07cd4cd
--- /dev/null
+++ b/osu.Game/Overlays/Options/LoginOptions.cs
@@ -0,0 +1,64 @@
+using System;
+using OpenTK;
+using OpenTK.Graphics;
+using osu.Framework.Graphics;
+using osu.Framework.Graphics.Containers;
+using osu.Framework.Graphics.Sprites;
+using osu.Framework.Graphics.UserInterface;
+using osu.Game.Online.API;
+
+namespace osu.Game.Overlays.Options
+{
+ public class LoginOptions : OptionsSubsection
+ {
+ public LoginOptions(APIAccess api)
+ {
+ var state = api == null ? APIAccess.APIState.Offline : api.State;
+ Header = "Sign In";
+ Children = new[]
+ {
+ 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 Button
+ {
+ 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
new file mode 100644
index 0000000000..2c12a4ad5c
--- /dev/null
+++ b/osu.Game/Overlays/Options/UpdateOptions.cs
@@ -0,0 +1,29 @@
+using System;
+using OpenTK.Graphics;
+using osu.Framework.Graphics;
+using osu.Framework.Graphics.Sprites;
+using osu.Framework.Graphics.UserInterface;
+using osu.Framework.Platform;
+
+namespace osu.Game.Overlays.Options
+{
+ public class UpdateOptions : OptionsSubsection
+ {
+ public UpdateOptions(BasicStorage storage)
+ {
+ Header = "Updates";
+ Children = new Drawable[]
+ {
+ new SpriteText { Text = "TODO: Dropdown" },
+ new SpriteText { Text = "Your osu! is up to date" }, // TODO: map this to reality
+ new Button
+ {
+ RelativeSizeAxes = Axes.X,
+ Text = "Open osu! folder",
+ Action = storage.OpenInNativeExplorer,
+ }
+ };
+ }
+ }
+}
+
diff --git a/osu.Game/Overlays/Options.cs b/osu.Game/Overlays/OptionsOverlay.cs
similarity index 69%
rename from osu.Game/Overlays/Options.cs
rename to osu.Game/Overlays/OptionsOverlay.cs
index a7adf829cf..c053b98ecd 100644
--- a/osu.Game/Overlays/Options.cs
+++ b/osu.Game/Overlays/OptionsOverlay.cs
@@ -14,15 +14,20 @@ using osu.Framework.Graphics.Transformations;
using osu.Framework.Graphics.UserInterface;
using osu.Framework.Input;
using osu.Framework.Platform;
+using osu.Game.Configuration;
+using osu.Game.Online.API;
+using osu.Game.Overlays.Options;
namespace osu.Game.Overlays
{
- public class Options : OverlayContainer
+ public class OptionsOverlay : OverlayContainer
{
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)
{
@@ -30,6 +35,13 @@ namespace osu.Game.Overlays
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);
@@ -54,7 +66,7 @@ namespace osu.Game.Overlays
AutoSizeAxes = Axes.Y,
RelativeSizeAxes = Axes.X,
Direction = FlowDirection.VerticalOnly,
- Children = new[]
+ Children = new Drawable[]
{
new SpriteText
{
@@ -68,65 +80,13 @@ namespace osu.Game.Overlays
Text = "Change the way osu! behaves",
TextSize = 18,
Margin = new MarginPadding { Left = SideMargins, Bottom = 30 },
- }
+ },
+ new GeneralOptions(storage, api),
}
}
}
}
};
- addGeneral();
- }
-
- private void addGeneral()
- {
- optionsContainer.Add(new OptionsSection
- {
- Header = "General",
- Children = new[]
- {
- new OptionsSubsection
- {
- Header = "Sign In",
- Children = new[]
- {
- new SpriteText { Text = "TODO" }
- }
- },
- new OptionsSubsection
- {
- Header = "Language",
- Children = new Drawable[]
- {
- new SpriteText { Text = "TODO: Dropdown" },
- new BasicCheckBox
- {
- Children = new[] { new SpriteText { Text = "Prefer metadata in original language" } }
- },
- new BasicCheckBox
- {
- Children = new[] { new SpriteText { Text = "Use alternative font for chat display" } }
- },
- }
- },
- new OptionsSubsection
- {
- Header = "Updates",
- Children = new Drawable[]
- {
- new SpriteText { Text = "TODO: Dropdown" },
- new SpriteText { Text = "Your osu! is up to date" }, // TODO: map this to reality
- new Button
- {
- AutoSizeAxes = Axes.Y,
- RelativeSizeAxes = Axes.X,
- Colour = new Color4(14, 132, 165, 255),
- Text = "Open osu! folder",
- Action = storage.OpenInNativeExplorer,
- }
- }
- }
- }
- });
}
protected override bool OnKeyDown(InputState state, KeyDownEventArgs args)
@@ -153,7 +113,7 @@ namespace osu.Game.Overlays
}
}
- class OptionsSection : Container
+ public class OptionsSection : Container
{
private SpriteText header;
private FlowContainer content;
@@ -184,8 +144,8 @@ namespace osu.Game.Overlays
Padding = new MarginPadding
{
Top = 10 + borderSize,
- Left = Options.SideMargins,
- Right = Options.SideMargins,
+ Left = OptionsOverlay.SideMargins,
+ Right = OptionsOverlay.SideMargins,
},
RelativeSizeAxes = Axes.X,
AutoSizeAxes = Axes.Y,
@@ -210,7 +170,7 @@ namespace osu.Game.Overlays
}
}
- class OptionsSubsection : Container
+ public class OptionsSubsection : Container
{
private SpriteText header;
private Container content;
@@ -233,6 +193,7 @@ namespace osu.Game.Overlays
Direction = FlowDirection.VerticalOnly,
RelativeSizeAxes = Axes.X,
AutoSizeAxes = Axes.Y,
+ Spacing = new Vector2(0, 5),
Children = new[]
{
header = new SpriteText
diff --git a/osu.Game/osu.Game.csproj b/osu.Game/osu.Game.csproj
index b73bc8ffda..2f84188d0a 100644
--- a/osu.Game/osu.Game.csproj
+++ b/osu.Game/osu.Game.csproj
@@ -177,7 +177,7 @@
-
+
@@ -196,6 +196,10 @@
+
+
+
+
@@ -215,6 +219,9 @@
+
+
+