diff --git a/osu-framework b/osu-framework index 9e9145afcd..478d0dd295 160000 --- a/osu-framework +++ b/osu-framework @@ -1 +1 @@ -Subproject commit 9e9145afcd1d37c56f89a6ae6e7b59e43d51037e +Subproject commit 478d0dd295a66c99556ca8039453e0f806ff4e9b diff --git a/osu.Desktop.VisualTests/Program.cs b/osu.Desktop.VisualTests/Program.cs index 9b2d00a219..ffcbcc48e7 100644 --- a/osu.Desktop.VisualTests/Program.cs +++ b/osu.Desktop.VisualTests/Program.cs @@ -13,9 +13,11 @@ namespace osu.Desktop.VisualTests [STAThread] public static void Main(string[] args) { - BasicGameHost host = Host.GetSuitableHost(@"osu-visual-tests"); - host.Add(new VisualTestGame()); - host.Run(); + using (BasicGameHost host = Host.GetSuitableHost(@"osu-visual-tests")) + { + host.Add(new VisualTestGame()); + host.Run(); + } } } } diff --git a/osu.Desktop/Program.cs b/osu.Desktop/Program.cs index 8586e3a2a9..18009417cb 100644 --- a/osu.Desktop/Program.cs +++ b/osu.Desktop/Program.cs @@ -18,25 +18,25 @@ namespace osu.Desktop [STAThread] public static int Main(string[] args) { - DesktopGameHost host = Host.GetSuitableHost(@"osu", true); - - if (!host.IsPrimaryInstance) + using (DesktopGameHost host = Host.GetSuitableHost(@"osu", true)) { - var importer = new BeatmapImporter(host); - - foreach (var file in args) - if (!importer.Import(file).Wait(1000)) - throw new TimeoutException(@"IPC took too long to send"); - Console.WriteLine(@"Sent import requests to running instance"); - } - else - { - BaseGame osu = new OsuGame(args); - host.Add(osu); - host.Run(); - } + if (!host.IsPrimaryInstance) + { + var importer = new BeatmapImporter(host); - return 0; + foreach (var file in args) + if (!importer.Import(file).Wait(1000)) + throw new TimeoutException(@"IPC took too long to send"); + Console.WriteLine(@"Sent import requests to running instance"); + } + else + { + BaseGame osu = new OsuGame(args); + host.Add(osu); + host.Run(); + } + return 0; + } } } } diff --git a/osu.Game/Configuration/OsuConfigManager.cs b/osu.Game/Configuration/OsuConfigManager.cs index 319f565938..6c05603285 100644 --- a/osu.Game/Configuration/OsuConfigManager.cs +++ b/osu.Game/Configuration/OsuConfigManager.cs @@ -163,7 +163,16 @@ namespace osu.Game.Configuration Set(OsuConfig.LetterboxPositionX, 0, -100, 100); Set(OsuConfig.LetterboxPositionY, 0, -100, 100); //Set(OsuConfig.FrameSync, FrameSync.Limit120); - //Set(OsuConfig.ShowUnicode, unicodeDefault); + bool unicodeDefault = false; + switch (Get(OsuConfig.Language)) + { + case @"zh": + case @"ja": + case @"ko": + unicodeDefault = true; + break; + } + Set(OsuConfig.ShowUnicode, unicodeDefault); Set(OsuConfig.PermanentSongInfo, false); Set(OsuConfig.Ticker, false); Set(OsuConfig.CompatibilityContext, false); diff --git a/osu.Game/Overlays/Options/AlertsPrivacyOptions.cs b/osu.Game/Overlays/Options/AlertsPrivacyOptions.cs deleted file mode 100644 index 61dec55107..0000000000 --- a/osu.Game/Overlays/Options/AlertsPrivacyOptions.cs +++ /dev/null @@ -1,30 +0,0 @@ -using System; -using osu.Framework.Graphics; -using osu.Framework.Graphics.UserInterface; - -namespace osu.Game.Overlays.Options -{ - public class AlertsPrivacyOptions : OptionsSubsection - { - protected override string Header => "Alerts & Privacy"; - - public AlertsPrivacyOptions() - { - // TODO: this should probably be split into Alerts and Privacy - Children = new Drawable[] - { - new BasicCheckBox { LabelText = "Chat ticker" }, - new BasicCheckBox { LabelText = "Automatically hide chat during gameplay" }, - new BasicCheckBox { LabelText = "Show a notification popup when someone says your name" }, - new BasicCheckBox { LabelText = "Show chat message notifications" }, - new BasicCheckBox { LabelText = "Play a sound when someone says your name" }, - new BasicCheckBox { LabelText = "Share your city location with others" }, - new BasicCheckBox { LabelText = "Show spectators" }, - new BasicCheckBox { LabelText = "Automatically link beatmaps to spectators" }, - new BasicCheckBox { LabelText = "Show notification popups instantly during gameplay" }, - new BasicCheckBox { LabelText = "Show notification popups when friends change status" }, - new BasicCheckBox { LabelText = "Allow multiplayer game invites from all users" }, - }; - } - } -} \ No newline at end of file diff --git a/osu.Game/Overlays/Options/AudioDevicesOptions.cs b/osu.Game/Overlays/Options/Audio/AudioDevicesOptions.cs similarity index 77% rename from osu.Game/Overlays/Options/AudioDevicesOptions.cs rename to osu.Game/Overlays/Options/Audio/AudioDevicesOptions.cs index 99636fe4f5..6dfeee855d 100644 --- a/osu.Game/Overlays/Options/AudioDevicesOptions.cs +++ b/osu.Game/Overlays/Options/Audio/AudioDevicesOptions.cs @@ -1,7 +1,6 @@ -using System; -using osu.Framework.Graphics.Sprites; +using osu.Framework.Graphics.Sprites; -namespace osu.Game.Overlays.Options +namespace osu.Game.Overlays.Options.Audio { public class AudioDevicesOptions : OptionsSubsection { diff --git a/osu.Game/Overlays/Options/AudioOptions.cs b/osu.Game/Overlays/Options/Audio/AudioSection.cs similarity index 53% rename from osu.Game/Overlays/Options/AudioOptions.cs rename to osu.Game/Overlays/Options/Audio/AudioSection.cs index f0d2eeebd0..5a7e2c31f7 100644 --- a/osu.Game/Overlays/Options/AudioOptions.cs +++ b/osu.Game/Overlays/Options/Audio/AudioSection.cs @@ -1,13 +1,14 @@ -using System; -using osu.Framework.Graphics; +using osu.Framework.Graphics; +using osu.Game.Graphics; -namespace osu.Game.Overlays.Options +namespace osu.Game.Overlays.Options.Audio { - public class AudioOptions : OptionsSection + public class AudioSection : OptionsSection { protected override string Header => "Audio"; + public override FontAwesome Icon => FontAwesome.fa_headphones; - public AudioOptions() + public AudioSection() { Children = new Drawable[] { diff --git a/osu.Game/Overlays/Options/OffsetAdjustmentOptions.cs b/osu.Game/Overlays/Options/Audio/OffsetAdjustmentOptions.cs similarity index 87% rename from osu.Game/Overlays/Options/OffsetAdjustmentOptions.cs rename to osu.Game/Overlays/Options/Audio/OffsetAdjustmentOptions.cs index 62e124fa4f..5115c001ae 100644 --- a/osu.Game/Overlays/Options/OffsetAdjustmentOptions.cs +++ b/osu.Game/Overlays/Options/Audio/OffsetAdjustmentOptions.cs @@ -1,9 +1,8 @@ -using System; -using osu.Framework.Graphics; +using osu.Framework.Graphics; using osu.Framework.Graphics.Sprites; using osu.Game.Graphics.UserInterface; -namespace osu.Game.Overlays.Options +namespace osu.Game.Overlays.Options.Audio { public class OffsetAdjustmentOptions : OptionsSubsection { diff --git a/osu.Game/Overlays/Options/VolumeOptions.cs b/osu.Game/Overlays/Options/Audio/VolumeOptions.cs similarity index 87% rename from osu.Game/Overlays/Options/VolumeOptions.cs rename to osu.Game/Overlays/Options/Audio/VolumeOptions.cs index 654841d177..d42184e636 100644 --- a/osu.Game/Overlays/Options/VolumeOptions.cs +++ b/osu.Game/Overlays/Options/Audio/VolumeOptions.cs @@ -1,9 +1,8 @@ -using System; -using osu.Framework.Graphics; +using osu.Framework.Graphics; using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.UserInterface; -namespace osu.Game.Overlays.Options +namespace osu.Game.Overlays.Options.Audio { public class VolumeOptions : OptionsSubsection { diff --git a/osu.Game/Overlays/Options/CheckBoxOption.cs b/osu.Game/Overlays/Options/CheckBoxOption.cs new file mode 100644 index 0000000000..f6b1f37e66 --- /dev/null +++ b/osu.Game/Overlays/Options/CheckBoxOption.cs @@ -0,0 +1,53 @@ +using System; +using osu.Framework.Configuration; +using osu.Framework.Graphics.UserInterface; + +namespace osu.Game.Overlays.Options +{ + public class CheckBoxOption : BasicCheckBox + { + private Bindable bindable; + + public Bindable Bindable + { + set + { + if (bindable != null) + bindable.ValueChanged -= bindableValueChanged; + bindable = value; + if (bindable != null) + { + bool state = State == CheckBoxState.Checked; + if (state != bindable.Value) + State = bindable.Value ? CheckBoxState.Checked : CheckBoxState.Unchecked; + bindable.ValueChanged += bindableValueChanged; + } + } + } + private void bindableValueChanged(object sender, EventArgs e) + { + State = bindable.Value ? CheckBoxState.Checked : CheckBoxState.Unchecked; + } + + protected override void Dispose(bool isDisposing) + { + if (bindable != null) + bindable.ValueChanged -= bindableValueChanged; + base.Dispose(isDisposing); + } + + protected override void OnChecked() + { + if (bindable != null) + bindable.Value = true; + base.OnChecked(); + } + + protected override void OnUnchecked() + { + if (bindable != null) + bindable.Value = false; + base.OnChecked(); + } + } +} \ No newline at end of file diff --git a/osu.Game/Overlays/Options/EditorOptions.cs b/osu.Game/Overlays/Options/EditorSection.cs similarity index 79% rename from osu.Game/Overlays/Options/EditorOptions.cs rename to osu.Game/Overlays/Options/EditorSection.cs index 2b3f1a9743..ee71fec40f 100644 --- a/osu.Game/Overlays/Options/EditorOptions.cs +++ b/osu.Game/Overlays/Options/EditorSection.cs @@ -1,15 +1,16 @@ -using System; -using OpenTK; +using OpenTK; using osu.Framework.Graphics; using osu.Framework.Graphics.UserInterface; +using osu.Game.Graphics; namespace osu.Game.Overlays.Options { - public class EditorOptions : OptionsSection + public class EditorSection : OptionsSection { protected override string Header => "Editor"; + public override FontAwesome Icon => FontAwesome.fa_pencil; - public EditorOptions() + public EditorSection() { content.Spacing = new Vector2(0, 5); Children = new Drawable[] diff --git a/osu.Game/Overlays/Options/GameplayOptions.cs b/osu.Game/Overlays/Options/Gameplay/GameplaySection.cs similarity index 50% rename from osu.Game/Overlays/Options/GameplayOptions.cs rename to osu.Game/Overlays/Options/Gameplay/GameplaySection.cs index 41f811708a..d020737851 100644 --- a/osu.Game/Overlays/Options/GameplayOptions.cs +++ b/osu.Game/Overlays/Options/Gameplay/GameplaySection.cs @@ -1,13 +1,14 @@ -using System; -using osu.Framework.Graphics; +using osu.Framework.Graphics; +using osu.Game.Graphics; -namespace osu.Game.Overlays.Options +namespace osu.Game.Overlays.Options.Gameplay { - public class GameplayOptions : OptionsSection + public class GameplaySection : OptionsSection { protected override string Header => "Gameplay"; + public override FontAwesome Icon => FontAwesome.fa_circle_o; - public GameplayOptions() + public GameplaySection() { Children = new Drawable[] { diff --git a/osu.Game/Overlays/Options/GeneralGameplayOptions.cs b/osu.Game/Overlays/Options/Gameplay/GeneralGameplayOptions.cs similarity index 92% rename from osu.Game/Overlays/Options/GeneralGameplayOptions.cs rename to osu.Game/Overlays/Options/Gameplay/GeneralGameplayOptions.cs index 920c8b3a49..94a8747488 100644 --- a/osu.Game/Overlays/Options/GeneralGameplayOptions.cs +++ b/osu.Game/Overlays/Options/Gameplay/GeneralGameplayOptions.cs @@ -1,9 +1,8 @@ -using System; -using osu.Framework.Graphics; +using osu.Framework.Graphics; using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.UserInterface; -namespace osu.Game.Overlays.Options +namespace osu.Game.Overlays.Options.Gameplay { public class GeneralGameplayOptions : OptionsSubsection { diff --git a/osu.Game/Overlays/Options/SongSelectGameplayOptions.cs b/osu.Game/Overlays/Options/Gameplay/SongSelectGameplayOptions.cs similarity index 84% rename from osu.Game/Overlays/Options/SongSelectGameplayOptions.cs rename to osu.Game/Overlays/Options/Gameplay/SongSelectGameplayOptions.cs index edbb1d43c5..d863ae29f4 100644 --- a/osu.Game/Overlays/Options/SongSelectGameplayOptions.cs +++ b/osu.Game/Overlays/Options/Gameplay/SongSelectGameplayOptions.cs @@ -1,8 +1,7 @@ -using System; -using osu.Framework.Graphics; +using osu.Framework.Graphics; using osu.Framework.Graphics.Sprites; -namespace osu.Game.Overlays.Options +namespace osu.Game.Overlays.Options.Gameplay { public class SongSelectGameplayOptions : OptionsSubsection { diff --git a/osu.Game/Overlays/Options/General/GeneralSection.cs b/osu.Game/Overlays/Options/General/GeneralSection.cs new file mode 100644 index 0000000000..e08bffbd3a --- /dev/null +++ b/osu.Game/Overlays/Options/General/GeneralSection.cs @@ -0,0 +1,22 @@ +using osu.Framework.Graphics; +using osu.Game.Graphics; + +namespace osu.Game.Overlays.Options.General +{ + public class GeneralSection : OptionsSection + { + protected override string Header => "General"; + public override FontAwesome Icon => FontAwesome.fa_gear; + + public GeneralSection() + { + Children = new Drawable[] + { + new LoginOptions(), + new LanguageOptions(), + new UpdateOptions(), + }; + } + } +} + diff --git a/osu.Game/Overlays/Options/General/LanguageOptions.cs b/osu.Game/Overlays/Options/General/LanguageOptions.cs new file mode 100644 index 0000000000..18ff055a92 --- /dev/null +++ b/osu.Game/Overlays/Options/General/LanguageOptions.cs @@ -0,0 +1,33 @@ +using osu.Framework; +using osu.Framework.Graphics; +using osu.Framework.Graphics.Sprites; + +namespace osu.Game.Overlays.Options.General +{ + public class LanguageOptions : OptionsSubsection + { + protected override string Header => "Language"; + private CheckBoxOption showUnicode, altChatFont; + + public LanguageOptions() + { + Children = new Drawable[] + { + new SpriteText { Text = "TODO: Dropdown" }, + showUnicode = new CheckBoxOption { LabelText = "Prefer metadata in original language" }, + altChatFont = new CheckBoxOption { LabelText = "Use alternative font for chat display" }, + }; + } + + protected override void Load(BaseGame game) + { + base.Load(game); + var osuGame = game as OsuGameBase; + if (osuGame != null) + { + showUnicode.Bindable = osuGame.Config.GetBindable(Configuration.OsuConfig.ShowUnicode); + altChatFont.Bindable = osuGame.Config.GetBindable(Configuration.OsuConfig.AlternativeChatFont); + } + } + } +} diff --git a/osu.Game/Overlays/Options/LoginOptions.cs b/osu.Game/Overlays/Options/General/LoginOptions.cs similarity index 95% rename from osu.Game/Overlays/Options/LoginOptions.cs rename to osu.Game/Overlays/Options/General/LoginOptions.cs index a6ae1775cd..83e25f9aaf 100644 --- a/osu.Game/Overlays/Options/LoginOptions.cs +++ b/osu.Game/Overlays/Options/General/LoginOptions.cs @@ -1,6 +1,4 @@ -using System; -using OpenTK; -using OpenTK.Graphics; +using OpenTK; using osu.Framework; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; @@ -9,7 +7,7 @@ using osu.Framework.Graphics.UserInterface; using osu.Game.Graphics.UserInterface; using osu.Game.Online.API; -namespace osu.Game.Overlays.Options +namespace osu.Game.Overlays.Options.General { public class LoginOptions : OptionsSubsection { diff --git a/osu.Game/Overlays/Options/UpdateOptions.cs b/osu.Game/Overlays/Options/General/UpdateOptions.cs similarity index 86% rename from osu.Game/Overlays/Options/UpdateOptions.cs rename to osu.Game/Overlays/Options/General/UpdateOptions.cs index 000d38cfb3..f7b33462b4 100644 --- a/osu.Game/Overlays/Options/UpdateOptions.cs +++ b/osu.Game/Overlays/Options/General/UpdateOptions.cs @@ -1,13 +1,10 @@ -using System; -using OpenTK.Graphics; -using osu.Framework; +using osu.Framework; using osu.Framework.Graphics; using osu.Framework.Graphics.Sprites; -using osu.Framework.Graphics.UserInterface; using osu.Framework.Platform; using osu.Game.Graphics.UserInterface; -namespace osu.Game.Overlays.Options +namespace osu.Game.Overlays.Options.General { public class UpdateOptions : OptionsSubsection { diff --git a/osu.Game/Overlays/Options/GeneralOptions.cs b/osu.Game/Overlays/Options/GeneralOptions.cs deleted file mode 100644 index 46adbe53d6..0000000000 --- a/osu.Game/Overlays/Options/GeneralOptions.cs +++ /dev/null @@ -1,26 +0,0 @@ -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 - { - protected override string Header => "General"; - - public GeneralOptions() - { - Children = new Drawable[] - { - new LoginOptions(), - new LanguageOptions(), - new UpdateOptions(), - }; - } - } -} - diff --git a/osu.Game/Overlays/Options/DetailOptions.cs b/osu.Game/Overlays/Options/Graphics/DetailOptions.cs similarity index 90% rename from osu.Game/Overlays/Options/DetailOptions.cs rename to osu.Game/Overlays/Options/Graphics/DetailOptions.cs index 482b9c86cd..5ae7497407 100644 --- a/osu.Game/Overlays/Options/DetailOptions.cs +++ b/osu.Game/Overlays/Options/Graphics/DetailOptions.cs @@ -1,9 +1,8 @@ -using System; -using osu.Framework.Graphics; +using osu.Framework.Graphics; using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.UserInterface; -namespace osu.Game.Overlays.Options +namespace osu.Game.Overlays.Options.Graphics { public class DetailOptions : OptionsSubsection { diff --git a/osu.Game/Overlays/Options/GraphicsOptions.cs b/osu.Game/Overlays/Options/Graphics/GraphicsSection.cs similarity index 58% rename from osu.Game/Overlays/Options/GraphicsOptions.cs rename to osu.Game/Overlays/Options/Graphics/GraphicsSection.cs index 8051a815aa..64b5ef4fa1 100644 --- a/osu.Game/Overlays/Options/GraphicsOptions.cs +++ b/osu.Game/Overlays/Options/Graphics/GraphicsSection.cs @@ -1,13 +1,14 @@ -using System; -using osu.Framework.Graphics; +using osu.Framework.Graphics; +using osu.Game.Graphics; -namespace osu.Game.Overlays.Options +namespace osu.Game.Overlays.Options.Graphics { - public class GraphicsOptions : OptionsSection + public class GraphicsSection : OptionsSection { protected override string Header => "Graphics"; + public override FontAwesome Icon => FontAwesome.fa_laptop; - public GraphicsOptions() + public GraphicsSection() { Children = new Drawable[] { diff --git a/osu.Game/Overlays/Options/LayoutOptions.cs b/osu.Game/Overlays/Options/Graphics/LayoutOptions.cs similarity index 89% rename from osu.Game/Overlays/Options/LayoutOptions.cs rename to osu.Game/Overlays/Options/Graphics/LayoutOptions.cs index 1d0d503549..72031cc757 100644 --- a/osu.Game/Overlays/Options/LayoutOptions.cs +++ b/osu.Game/Overlays/Options/Graphics/LayoutOptions.cs @@ -1,9 +1,8 @@ -using System; -using osu.Framework.Graphics; +using osu.Framework.Graphics; using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.UserInterface; -namespace osu.Game.Overlays.Options +namespace osu.Game.Overlays.Options.Graphics { public class LayoutOptions : OptionsSubsection { diff --git a/osu.Game/Overlays/Options/MainMenuOptions.cs b/osu.Game/Overlays/Options/Graphics/MainMenuOptions.cs similarity index 85% rename from osu.Game/Overlays/Options/MainMenuOptions.cs rename to osu.Game/Overlays/Options/Graphics/MainMenuOptions.cs index 6b575431f7..0827402dc6 100644 --- a/osu.Game/Overlays/Options/MainMenuOptions.cs +++ b/osu.Game/Overlays/Options/Graphics/MainMenuOptions.cs @@ -1,7 +1,6 @@ -using System; -using osu.Framework.Graphics.UserInterface; +using osu.Framework.Graphics.UserInterface; -namespace osu.Game.Overlays.Options +namespace osu.Game.Overlays.Options.Graphics { public class MainMenuOptions : OptionsSubsection { diff --git a/osu.Game/Overlays/Options/RendererOptions.cs b/osu.Game/Overlays/Options/Graphics/RendererOptions.cs similarity index 88% rename from osu.Game/Overlays/Options/RendererOptions.cs rename to osu.Game/Overlays/Options/Graphics/RendererOptions.cs index bee07de2e3..1a27c1718d 100644 --- a/osu.Game/Overlays/Options/RendererOptions.cs +++ b/osu.Game/Overlays/Options/Graphics/RendererOptions.cs @@ -1,9 +1,8 @@ -using System; -using osu.Framework.Graphics; +using osu.Framework.Graphics; using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.UserInterface; -namespace osu.Game.Overlays.Options +namespace osu.Game.Overlays.Options.Graphics { public class RendererOptions : OptionsSubsection { diff --git a/osu.Game/Overlays/Options/SongSelectGraphicsOptions.cs b/osu.Game/Overlays/Options/Graphics/SongSelectGraphicsOptions.cs similarity index 77% rename from osu.Game/Overlays/Options/SongSelectGraphicsOptions.cs rename to osu.Game/Overlays/Options/Graphics/SongSelectGraphicsOptions.cs index b6a6e0f51e..003afe8a0a 100644 --- a/osu.Game/Overlays/Options/SongSelectGraphicsOptions.cs +++ b/osu.Game/Overlays/Options/Graphics/SongSelectGraphicsOptions.cs @@ -1,7 +1,6 @@ -using System; -using osu.Framework.Graphics.UserInterface; +using osu.Framework.Graphics.UserInterface; -namespace osu.Game.Overlays.Options +namespace osu.Game.Overlays.Options.Graphics { public class SongSelectGraphicsOptions : OptionsSubsection { diff --git a/osu.Game/Overlays/Options/InputOptions.cs b/osu.Game/Overlays/Options/Input/InputSection.cs similarity index 52% rename from osu.Game/Overlays/Options/InputOptions.cs rename to osu.Game/Overlays/Options/Input/InputSection.cs index 189beb86c9..ca722b1a08 100644 --- a/osu.Game/Overlays/Options/InputOptions.cs +++ b/osu.Game/Overlays/Options/Input/InputSection.cs @@ -1,13 +1,14 @@ -using System; -using osu.Framework.Graphics; +using osu.Framework.Graphics; +using osu.Game.Graphics; -namespace osu.Game.Overlays.Options +namespace osu.Game.Overlays.Options.Input { - public class InputOptions : OptionsSection + public class InputSection : OptionsSection { protected override string Header => "Input"; + public override FontAwesome Icon => FontAwesome.fa_keyboard_o; - public InputOptions() + public InputSection() { Children = new Drawable[] { diff --git a/osu.Game/Overlays/Options/KeyboardOptions.cs b/osu.Game/Overlays/Options/Input/KeyboardOptions.cs similarity index 87% rename from osu.Game/Overlays/Options/KeyboardOptions.cs rename to osu.Game/Overlays/Options/Input/KeyboardOptions.cs index fbcc97bebb..71e41cad39 100644 --- a/osu.Game/Overlays/Options/KeyboardOptions.cs +++ b/osu.Game/Overlays/Options/Input/KeyboardOptions.cs @@ -1,8 +1,7 @@ -using System; -using osu.Framework.Graphics; +using osu.Framework.Graphics; using osu.Game.Graphics.UserInterface; -namespace osu.Game.Overlays.Options +namespace osu.Game.Overlays.Options.Input { public class KeyboardOptions : OptionsSubsection { diff --git a/osu.Game/Overlays/Options/MouseOptions.cs b/osu.Game/Overlays/Options/Input/MouseOptions.cs similarity index 90% rename from osu.Game/Overlays/Options/MouseOptions.cs rename to osu.Game/Overlays/Options/Input/MouseOptions.cs index a6236d515d..64ac31c57b 100644 --- a/osu.Game/Overlays/Options/MouseOptions.cs +++ b/osu.Game/Overlays/Options/Input/MouseOptions.cs @@ -1,9 +1,8 @@ -using System; -using osu.Framework.Graphics; +using osu.Framework.Graphics; using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.UserInterface; -namespace osu.Game.Overlays.Options +namespace osu.Game.Overlays.Options.Input { public class MouseOptions : OptionsSubsection { diff --git a/osu.Game/Overlays/Options/OtherInputOptions.cs b/osu.Game/Overlays/Options/Input/OtherInputOptions.cs similarity index 84% rename from osu.Game/Overlays/Options/OtherInputOptions.cs rename to osu.Game/Overlays/Options/Input/OtherInputOptions.cs index c91dc82e20..4fef737f37 100644 --- a/osu.Game/Overlays/Options/OtherInputOptions.cs +++ b/osu.Game/Overlays/Options/Input/OtherInputOptions.cs @@ -1,8 +1,7 @@ -using System; -using osu.Framework.Graphics; +using osu.Framework.Graphics; using osu.Framework.Graphics.UserInterface; -namespace osu.Game.Overlays.Options +namespace osu.Game.Overlays.Options.Input { public class OtherInputOptions : OptionsSubsection { diff --git a/osu.Game/Overlays/Options/LanguageOptions.cs b/osu.Game/Overlays/Options/LanguageOptions.cs deleted file mode 100644 index c5363c3457..0000000000 --- a/osu.Game/Overlays/Options/LanguageOptions.cs +++ /dev/null @@ -1,22 +0,0 @@ -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 - { - protected override string Header => "Language"; - - public LanguageOptions() - { - Children = new Drawable[] - { - new SpriteText { Text = "TODO: Dropdown" }, - new BasicCheckBox { LabelText = "Prefer metadata in original language" }, - new BasicCheckBox { LabelText = "Use alternative font for chat display" }, - }; - } - } -} \ No newline at end of file diff --git a/osu.Game/Overlays/Options/MaintenanceOptions.cs b/osu.Game/Overlays/Options/MaintenanceSection.cs similarity index 85% rename from osu.Game/Overlays/Options/MaintenanceOptions.cs rename to osu.Game/Overlays/Options/MaintenanceSection.cs index c139804f4c..aa4c74c605 100644 --- a/osu.Game/Overlays/Options/MaintenanceOptions.cs +++ b/osu.Game/Overlays/Options/MaintenanceSection.cs @@ -1,16 +1,17 @@ -using System; -using OpenTK; +using OpenTK; using osu.Framework.Graphics; using osu.Framework.Graphics.Sprites; +using osu.Game.Graphics; using osu.Game.Graphics.UserInterface; namespace osu.Game.Overlays.Options { - public class MaintenanceOptions : OptionsSection + public class MaintenanceSection : OptionsSection { protected override string Header => "Maintenance"; + public override FontAwesome Icon => FontAwesome.fa_wrench; - public MaintenanceOptions() + public MaintenanceSection() { content.Spacing = new Vector2(0, 5); Children = new Drawable[] diff --git a/osu.Game/Overlays/Options/InGameChatOptions.cs b/osu.Game/Overlays/Options/Online/InGameChatOptions.cs similarity index 91% rename from osu.Game/Overlays/Options/InGameChatOptions.cs rename to osu.Game/Overlays/Options/Online/InGameChatOptions.cs index 32ca68758b..08545dfc08 100644 --- a/osu.Game/Overlays/Options/InGameChatOptions.cs +++ b/osu.Game/Overlays/Options/Online/InGameChatOptions.cs @@ -1,9 +1,8 @@ -using System; -using osu.Framework.Graphics; +using osu.Framework.Graphics; using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.UserInterface; -namespace osu.Game.Overlays.Options +namespace osu.Game.Overlays.Options.Online { public class InGameChatOptions : OptionsSubsection { diff --git a/osu.Game/Overlays/Options/Online/NotificationsOptions.cs b/osu.Game/Overlays/Options/Online/NotificationsOptions.cs new file mode 100644 index 0000000000..3960560190 --- /dev/null +++ b/osu.Game/Overlays/Options/Online/NotificationsOptions.cs @@ -0,0 +1,23 @@ +using osu.Framework.Graphics; +using osu.Framework.Graphics.UserInterface; + +namespace osu.Game.Overlays.Options.Online +{ + public class NotificationsOptions : OptionsSubsection + { + protected override string Header => "Notifications"; + + public NotificationsOptions() + { + Children = new Drawable[] + { + new BasicCheckBox { LabelText = "Enable chat ticker" }, + new BasicCheckBox { LabelText = "Show a notification popup when someone says your name" }, + new BasicCheckBox { LabelText = "Show chat message notifications" }, + new BasicCheckBox { LabelText = "Play a sound when someone says your name" }, + new BasicCheckBox { LabelText = "Show notification popups instantly during gameplay" }, + new BasicCheckBox { LabelText = "Show notification popups when friends change status" }, + }; + } + } +} \ No newline at end of file diff --git a/osu.Game/Overlays/Options/OnlineIntegrationOptions.cs b/osu.Game/Overlays/Options/Online/OnlineIntegrationOptions.cs similarity index 88% rename from osu.Game/Overlays/Options/OnlineIntegrationOptions.cs rename to osu.Game/Overlays/Options/Online/OnlineIntegrationOptions.cs index 2fe2bb2e70..cd2516dd79 100644 --- a/osu.Game/Overlays/Options/OnlineIntegrationOptions.cs +++ b/osu.Game/Overlays/Options/Online/OnlineIntegrationOptions.cs @@ -1,8 +1,7 @@ -using System; -using osu.Framework.Graphics; +using osu.Framework.Graphics; using osu.Framework.Graphics.UserInterface; -namespace osu.Game.Overlays.Options +namespace osu.Game.Overlays.Options.Online { public class OnlineIntegrationOptions : OptionsSubsection { diff --git a/osu.Game/Overlays/Options/Online/OnlineSection.cs b/osu.Game/Overlays/Options/Online/OnlineSection.cs new file mode 100644 index 0000000000..8524f33042 --- /dev/null +++ b/osu.Game/Overlays/Options/Online/OnlineSection.cs @@ -0,0 +1,22 @@ +using osu.Framework.Graphics; +using osu.Game.Graphics; + +namespace osu.Game.Overlays.Options.Online +{ + public class OnlineSection : OptionsSection + { + protected override string Header => "Online"; + public override FontAwesome Icon => FontAwesome.fa_globe; + + public OnlineSection() + { + Children = new Drawable[] + { + new InGameChatOptions(), + new PrivacyOptions(), + new NotificationsOptions(), + new OnlineIntegrationOptions(), + }; + } + } +} \ No newline at end of file diff --git a/osu.Game/Overlays/Options/Online/PrivacyOptions.cs b/osu.Game/Overlays/Options/Online/PrivacyOptions.cs new file mode 100644 index 0000000000..2179d694ee --- /dev/null +++ b/osu.Game/Overlays/Options/Online/PrivacyOptions.cs @@ -0,0 +1,20 @@ +using osu.Framework.Graphics; +using osu.Framework.Graphics.UserInterface; + +namespace osu.Game.Overlays.Options.Online +{ + public class PrivacyOptions : OptionsSubsection + { + protected override string Header => "Privacy"; + + public PrivacyOptions() + { + Children = new Drawable[] + { + new BasicCheckBox { LabelText = "Share your city location with others" }, + new BasicCheckBox { LabelText = "Allow multiplayer game invites from all users" }, + new BasicCheckBox { LabelText = "Block private messages from non-friends" }, + }; + } + } +} \ No newline at end of file diff --git a/osu.Game/Overlays/Options/OnlineOptions.cs b/osu.Game/Overlays/Options/OnlineOptions.cs deleted file mode 100644 index a22d416ab5..0000000000 --- a/osu.Game/Overlays/Options/OnlineOptions.cs +++ /dev/null @@ -1,20 +0,0 @@ -using System; -using osu.Framework.Graphics; - -namespace osu.Game.Overlays.Options -{ - public class OnlineOptions : OptionsSection - { - protected override string Header => "Online"; - - public OnlineOptions() - { - Children = new Drawable[] - { - new AlertsPrivacyOptions(), - new OnlineIntegrationOptions(), - new InGameChatOptions(), - }; - } - } -} \ No newline at end of file diff --git a/osu.Game/Overlays/Options/OptionsSection.cs b/osu.Game/Overlays/Options/OptionsSection.cs index 56b6148d2a..e395de0679 100644 --- a/osu.Game/Overlays/Options/OptionsSection.cs +++ b/osu.Game/Overlays/Options/OptionsSection.cs @@ -1,10 +1,10 @@ -using System; -using OpenTK; +using OpenTK; using OpenTK.Graphics; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Primitives; using osu.Framework.Graphics.Sprites; +using osu.Game.Graphics; namespace osu.Game.Overlays.Options { @@ -13,6 +13,7 @@ namespace osu.Game.Overlays.Options protected FlowContainer content; protected override Container Content => content; + public abstract FontAwesome Icon { get; } protected abstract string Header { get; } public OptionsSection() @@ -25,7 +26,7 @@ namespace osu.Game.Overlays.Options { new Box { - Colour = new Color4(3, 3, 3, 255), + Colour = new Color4(30, 30, 30, 255), RelativeSizeAxes = Axes.X, Height = borderSize, }, diff --git a/osu.Game/Overlays/Options/OptionsSideNav.cs b/osu.Game/Overlays/Options/OptionsSideNav.cs new file mode 100644 index 0000000000..c578d138a6 --- /dev/null +++ b/osu.Game/Overlays/Options/OptionsSideNav.cs @@ -0,0 +1,92 @@ +using System; +using OpenTK; +using OpenTK.Graphics; +using osu.Framework.Graphics; +using osu.Framework.Graphics.Containers; +using osu.Framework.Graphics.Sprites; +using osu.Framework.Input; +using osu.Game.Graphics; + +namespace osu.Game.Overlays.Options +{ + public class OptionsSideNav : Container + { + private FlowContainer content; + protected override Container Content => content; + + public OptionsSideNav() + { + RelativeSizeAxes = Axes.Y; + InternalChildren = new Drawable[] + { + content = new FlowContainer + { + AutoSizeAxes = Axes.Y, + RelativeSizeAxes = Axes.X, + Origin = Anchor.CentreLeft, + Anchor = Anchor.CentreLeft, + Direction = FlowDirection.VerticalOnly + }, + new Box + { + Colour = new Color4(30, 30, 30, 255), + RelativeSizeAxes = Axes.Y, + Width = 2, + Origin = Anchor.TopRight, + Anchor = Anchor.TopRight, + } + }; + } + + public class SidebarButton : Container + { + private TextAwesome drawableIcon; + private Box backgroundBox; + public Action Action; + + public FontAwesome Icon + { + get { return drawableIcon.Icon; } + set { drawableIcon.Icon = value; } + } + + public SidebarButton() + { + Size = new Vector2(60); + Children = new Drawable[] + { + backgroundBox = new Box + { + RelativeSizeAxes = Axes.Both, + BlendingMode = BlendingMode.Additive, + Colour = new Color4(60, 60, 60, 255), + Alpha = 0, + }, + drawableIcon = new TextAwesome + { + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + }, + }; + } + + protected override bool OnMouseDown(InputState state, MouseDownEventArgs e) + { + Action?.Invoke(); + backgroundBox.FlashColour(Color4.White, 400); + return true; + } + + protected override bool OnHover(InputState state) + { + backgroundBox.FadeTo(0.4f, 200); + return true; + } + + protected override void OnHoverLost(InputState state) + { + backgroundBox.FadeTo(0, 200); + } + } + } +} \ No newline at end of file diff --git a/osu.Game/Overlays/Options/OptionsSubsection.cs b/osu.Game/Overlays/Options/OptionsSubsection.cs index c867b8b7cf..8dc9e1d4be 100644 --- a/osu.Game/Overlays/Options/OptionsSubsection.cs +++ b/osu.Game/Overlays/Options/OptionsSubsection.cs @@ -1,5 +1,4 @@ -using System; -using OpenTK; +using OpenTK; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Sprites; diff --git a/osu.Game/Overlays/Options/SkinOptions.cs b/osu.Game/Overlays/Options/SkinSection.cs similarity index 88% rename from osu.Game/Overlays/Options/SkinOptions.cs rename to osu.Game/Overlays/Options/SkinSection.cs index ae7ae3f2ab..ca80aa891b 100644 --- a/osu.Game/Overlays/Options/SkinOptions.cs +++ b/osu.Game/Overlays/Options/SkinSection.cs @@ -1,17 +1,18 @@ -using System; -using OpenTK; +using OpenTK; using osu.Framework.Graphics; using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.UserInterface; +using osu.Game.Graphics; using osu.Game.Graphics.UserInterface; namespace osu.Game.Overlays.Options { - public class SkinOptions : OptionsSection + public class SkinSection : OptionsSection { protected override string Header => "Skin"; + public override FontAwesome Icon => FontAwesome.fa_paint_brush; - public SkinOptions() + public SkinSection() { content.Spacing = new Vector2(0, 5); Children = new Drawable[] diff --git a/osu.Game/Overlays/OptionsOverlay.cs b/osu.Game/Overlays/OptionsOverlay.cs index 3774b71254..c8d0dbac31 100644 --- a/osu.Game/Overlays/OptionsOverlay.cs +++ b/osu.Game/Overlays/OptionsOverlay.cs @@ -2,21 +2,23 @@ //Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using System.Diagnostics; +using System.Linq; using OpenTK; using OpenTK.Graphics; using OpenTK.Input; -using osu.Framework; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Primitives; using osu.Framework.Graphics.Sprites; 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; +using osu.Game.Overlays.Options.Audio; +using osu.Game.Overlays.Options.Gameplay; +using osu.Game.Overlays.Options.General; +using osu.Game.Overlays.Options.Graphics; +using osu.Game.Overlays.Options.Input; +using osu.Game.Overlays.Options.Online; namespace osu.Game.Overlays { @@ -24,6 +26,11 @@ namespace osu.Game.Overlays { internal const float SideMargins = 10; private const float width = 400; + private const float sideNavWidth = 60; + private const float sideNavPadding = 0; + + private ScrollContainer scrollContainer; + private FlowContainer flowContainer; public OptionsOverlay() { @@ -32,6 +39,19 @@ namespace osu.Game.Overlays Size = new Vector2(width, 1); Position = new Vector2(-width, 0); + var sections = new OptionsSection[] + { + new GeneralSection(), + new GraphicsSection(), + new GameplaySection(), + new AudioSection(), + new SkinSection(), + new InputSection(), + new EditorSection(), + new OnlineSection(), + new MaintenanceSection(), + }; + Children = new Drawable[] { new Box @@ -40,11 +60,12 @@ namespace osu.Game.Overlays Colour = Color4.Black, Alpha = 0.8f, }, - // TODO: Links on the side to jump to a section - new ScrollContainer + scrollContainer = new ScrollContainer { - RelativeSizeAxes = Axes.Both, ScrollDraggerAnchor = Anchor.TopLeft, + RelativeSizeAxes = Axes.Y, + Width = width - (sideNavWidth + sideNavPadding * 2), + Position = new Vector2(sideNavWidth + sideNavPadding * 2, 0), Children = new[] { new FlowContainer @@ -67,20 +88,30 @@ namespace osu.Game.Overlays TextSize = 18, Margin = new MarginPadding { Left = SideMargins, Bottom = 30 }, }, - new GeneralOptions(), - new GraphicsOptions(), - new GameplayOptions(), - new AudioOptions(), - new SkinOptions(), - new InputOptions(), - new EditorOptions(), - new OnlineOptions(), - new MaintenanceOptions(), + flowContainer = new FlowContainer + { + AutoSizeAxes = Axes.Y, + RelativeSizeAxes = Axes.X, + Direction = FlowDirection.VerticalOnly, + } } } } + }, + new OptionsSideNav + { + Padding = new MarginPadding { Left = sideNavPadding, Right = sideNavPadding }, + Width = sideNavWidth + sideNavPadding * 2, + Children = sections.Select(section => + new OptionsSideNav.SidebarButton + { + Icon = section.Icon, + Action = () => scrollContainer.ScrollIntoView(section) + } + ) } }; + flowContainer.Add(sections); } protected override bool OnMouseDown(InputState state, MouseDownEventArgs args) => true; @@ -91,8 +122,7 @@ namespace osu.Game.Overlays { case Key.Escape: if (State == Visibility.Hidden) return false; - - State = Visibility.Hidden; + Hide(); return true; } return base.OnKeyDown(state, args); diff --git a/osu.Game/Overlays/ToolbarButton.cs b/osu.Game/Overlays/ToolbarButton.cs index 65004a78da..dcf6b19a3d 100644 --- a/osu.Game/Overlays/ToolbarButton.cs +++ b/osu.Game/Overlays/ToolbarButton.cs @@ -102,7 +102,7 @@ namespace osu.Game.Overlays Alpha = 0, Children = new[] { - tooltip1 = new SpriteText() + tooltip1 = new SpriteText { TextSize = 22, }, @@ -126,7 +126,7 @@ namespace osu.Game.Overlays Size = new Vector2(WIDTH + (DrawableText.IsVisible ? DrawableText.DrawSize.X : 0), 1); } - protected override bool OnClick(InputState state) + protected override bool OnMouseDown(InputState state, MouseDownEventArgs e) { Action?.Invoke(); HoverBackground.FlashColour(Color4.White, 400); diff --git a/osu.Game/osu.Game.csproj b/osu.Game/osu.Game.csproj index 92679b7d58..18bf9c1b34 100644 --- a/osu.Game/osu.Game.csproj +++ b/osu.Game/osu.Game.csproj @@ -197,38 +197,41 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -250,6 +253,12 @@ + + + + + + - \ No newline at end of file +