From a350e95e406606931a384a644c037e2452c96b0f Mon Sep 17 00:00:00 2001 From: Drew DeVault Date: Wed, 30 Nov 2016 09:08:11 -0500 Subject: [PATCH 01/15] Add OptionsSlider and wire up volume sliders --- .../Overlays/Options/Audio/VolumeOptions.cs | 17 +++---- osu.Game/Overlays/Options/OptionsSlider.cs | 48 +++++++++++++++++++ osu.Game/osu.Game.csproj | 1 + 3 files changed, 55 insertions(+), 11 deletions(-) create mode 100644 osu.Game/Overlays/Options/OptionsSlider.cs diff --git a/osu.Game/Overlays/Options/Audio/VolumeOptions.cs b/osu.Game/Overlays/Options/Audio/VolumeOptions.cs index 2216602a5f..f7d2614a96 100644 --- a/osu.Game/Overlays/Options/Audio/VolumeOptions.cs +++ b/osu.Game/Overlays/Options/Audio/VolumeOptions.cs @@ -3,6 +3,7 @@ using osu.Framework; using osu.Framework.Allocation; +using osu.Framework.Audio; using osu.Framework.Graphics; using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.UserInterface; @@ -14,21 +15,15 @@ namespace osu.Game.Overlays.Options.Audio { protected override string Header => "Volume"; - private CheckBoxOption ignoreHitsounds; - - public VolumeOptions() - { - } - [BackgroundDependencyLoader] - private void load(OsuConfigManager config) + private void load(OsuConfigManager config, AudioManager audio) { Children = new Drawable[] { - new SpriteText { Text = "Master: TODO slider" }, - new SpriteText { Text = "Music: TODO slider" }, - new SpriteText { Text = "Effect: TODO slider" }, - ignoreHitsounds = new CheckBoxOption + new OptionsSlider { Label = "Master", Bindable = audio.Volume }, + new OptionsSlider { Label = "Effect", Bindable = audio.VolumeSample }, + new OptionsSlider { Label = "Music", Bindable = audio.VolumeTrack }, + new CheckBoxOption { LabelText = "Ignore beatmap hitsounds", Bindable = config.GetBindable(OsuConfig.IgnoreBeatmapSamples) diff --git a/osu.Game/Overlays/Options/OptionsSlider.cs b/osu.Game/Overlays/Options/OptionsSlider.cs new file mode 100644 index 0000000000..a8d0a3da6f --- /dev/null +++ b/osu.Game/Overlays/Options/OptionsSlider.cs @@ -0,0 +1,48 @@ +using System; +using OpenTK.Graphics; +using osu.Framework.Configuration; +using osu.Framework.Graphics; +using osu.Framework.Graphics.Containers; +using osu.Framework.Graphics.Primitives; +using osu.Framework.Graphics.Sprites; +using osu.Framework.Graphics.UserInterface; + +namespace osu.Game.Overlays.Options +{ + public class OptionsSlider : FlowContainer + { + private SliderBar slider; + private SpriteText text; + + public string Label + { + get { return text.Text; } + set { text.Text = value; } + } + + public BindableDouble Bindable + { + get { return slider.Bindable; } + set { slider.Bindable = value; } + } + + public OptionsSlider() + { + Direction = FlowDirection.VerticalOnly; + RelativeSizeAxes = Axes.X; + AutoSizeAxes = Axes.Y; + Children = new Drawable[] + { + text = new SpriteText(), + slider = new SliderBar + { + Margin = new MarginPadding { Top = 5 }, + Height = 10, + RelativeSizeAxes = Axes.X, + Color = Color4.White, + SelectionColor = new Color4(255, 102, 170, 255), + } + }; + } + } +} \ No newline at end of file diff --git a/osu.Game/osu.Game.csproj b/osu.Game/osu.Game.csproj index c4915b7567..e03f8f3337 100644 --- a/osu.Game/osu.Game.csproj +++ b/osu.Game/osu.Game.csproj @@ -222,6 +222,7 @@ + From 3aefa4d6a5602e37ca26cfa98f8f8188873c6308 Mon Sep 17 00:00:00 2001 From: Drew DeVault Date: Wed, 30 Nov 2016 10:32:07 -0500 Subject: [PATCH 02/15] Wire up remaining sliders, except for ints --- osu.Game/Configuration/OsuConfigManager.cs | 1 + .../Options/Audio/OffsetAdjustmentOptions.cs | 37 ++++--- .../Gameplay/GeneralGameplayOptions.cs | 104 ++++++++++-------- .../Gameplay/SongSelectGameplayOptions.cs | 50 +++++++-- .../Options/Graphics/LayoutOptions.cs | 18 ++- osu.Game/Overlays/Options/OptionsSlider.cs | 8 +- 6 files changed, 143 insertions(+), 75 deletions(-) diff --git a/osu.Game/Configuration/OsuConfigManager.cs b/osu.Game/Configuration/OsuConfigManager.cs index 8e5fbfad42..ef95a3ac3f 100644 --- a/osu.Game/Configuration/OsuConfigManager.cs +++ b/osu.Game/Configuration/OsuConfigManager.cs @@ -96,6 +96,7 @@ namespace osu.Game.Configuration Set(OsuConfig.MouseDisableWheel, false); Set(OsuConfig.MouseSpeed, 1, 0.4, 6); Set(OsuConfig.Offset, 0, -300, 300); + Set(OsuConfig.ScoreMeterScale, 1, 0.5, 2); //Set(OsuConfig.ScoreMeterScale, 1, 0.5, OsuGame.Tournament ? 10 : 2); Set(OsuConfig.DistanceSpacing, 0.8, 0.1, 6); Set(OsuConfig.EditorBeatDivisor, 1, 1, 16); diff --git a/osu.Game/Overlays/Options/Audio/OffsetAdjustmentOptions.cs b/osu.Game/Overlays/Options/Audio/OffsetAdjustmentOptions.cs index 29cf7ef589..4d9598fabe 100644 --- a/osu.Game/Overlays/Options/Audio/OffsetAdjustmentOptions.cs +++ b/osu.Game/Overlays/Options/Audio/OffsetAdjustmentOptions.cs @@ -1,8 +1,11 @@ //Copyright (c) 2007-2016 ppy Pty Ltd . //Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE +using osu.Framework.Allocation; +using osu.Framework.Configuration; using osu.Framework.Graphics; using osu.Framework.Graphics.Sprites; +using osu.Game.Configuration; using osu.Game.Graphics.UserInterface; namespace osu.Game.Overlays.Options.Audio @@ -10,18 +13,26 @@ namespace osu.Game.Overlays.Options.Audio public class OffsetAdjustmentOptions : OptionsSubsection { protected override string Header => "Offset Adjustment"; - - public OffsetAdjustmentOptions() - { - Children = new Drawable[] - { - new SpriteText { Text = "Universal Offset: TODO slider" }, - new OsuButton - { - RelativeSizeAxes = Axes.X, - Text = "Offset wizard" - } - }; + + [BackgroundDependencyLoader] + private void load(OsuConfigManager config) + { + Children = new Drawable[] + { + // TODO: bindable int crap + /* + new OptionsSlider + { + Label = "Universal Offset", + Bindable = (BindableDouble)config.GetBindable(OsuConfig.Offset) + }, + */ + new OsuButton + { + RelativeSizeAxes = Axes.X, + Text = "Offset wizard" + } + }; } } -} \ No newline at end of file +} diff --git a/osu.Game/Overlays/Options/Gameplay/GeneralGameplayOptions.cs b/osu.Game/Overlays/Options/Gameplay/GeneralGameplayOptions.cs index d8fc71fb02..81143c6127 100644 --- a/osu.Game/Overlays/Options/Gameplay/GeneralGameplayOptions.cs +++ b/osu.Game/Overlays/Options/Gameplay/GeneralGameplayOptions.cs @@ -1,49 +1,61 @@ //Copyright (c) 2007-2016 ppy Pty Ltd . //Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE -using osu.Framework; -using osu.Framework.Allocation; -using osu.Framework.Graphics; -using osu.Framework.Graphics.Sprites; -using osu.Framework.Graphics.UserInterface; -using osu.Game.Configuration; - -namespace osu.Game.Overlays.Options.Gameplay -{ - public class GeneralGameplayOptions : OptionsSubsection - { - protected override string Header => "General"; - - [BackgroundDependencyLoader] - private void load(OsuConfigManager config) - { - Children = new Drawable[] - { - new SpriteText { Text = "Background dim: TODO slider" }, - new SpriteText { Text = "Progress display: TODO dropdown" }, - new SpriteText { Text = "Score meter type: TODO dropdown" }, - new SpriteText { Text = "Score meter size: TODO slider" }, - new CheckBoxOption - { - LabelText = "Always show key overlay", - Bindable = config.GetBindable(OsuConfig.KeyOverlay) - }, - new CheckBoxOption - { - LabelText = "Show approach circle on first \"Hidden\" object", - Bindable = config.GetBindable(OsuConfig.HiddenShowFirstApproach) - }, - new CheckBoxOption - { - LabelText = "Scale osu!mania scroll speed with BPM", - Bindable = config.GetBindable(OsuConfig.ManiaSpeedBPMScale) - }, - new CheckBoxOption - { - LabelText = "Remember osu!mania scroll speed per beatmap", - Bindable = config.GetBindable(OsuConfig.UsePerBeatmapManiaSpeed) - }, - }; - } - } -} \ No newline at end of file +using osu.Framework; +using osu.Framework.Allocation; +using osu.Framework.Configuration; +using osu.Framework.Graphics; +using osu.Framework.Graphics.Sprites; +using osu.Framework.Graphics.UserInterface; +using osu.Game.Configuration; + +namespace osu.Game.Overlays.Options.Gameplay +{ + public class GeneralGameplayOptions : OptionsSubsection + { + protected override string Header => "General"; + + [BackgroundDependencyLoader] + private void load(OsuConfigManager config) + { + Children = new Drawable[] + { + // TODO: bindable int stuff + /* + new OptionsSlider + { + Label = "Background dim", + Bindable = (BindableDouble)config.GetBindable(OsuConfig.DimLevel) + }, + */ + new SpriteText { Text = "Progress display: TODO dropdown" }, + new SpriteText { Text = "Score meter type: TODO dropdown" }, + new OptionsSlider + { + Label = "Score meter size", + Bindable = (BindableDouble)config.GetBindable(OsuConfig.ScoreMeterScale) + }, + new CheckBoxOption + { + LabelText = "Always show key overlay", + Bindable = config.GetBindable(OsuConfig.KeyOverlay) + }, + new CheckBoxOption + { + LabelText = "Show approach circle on first \"Hidden\" object", + Bindable = config.GetBindable(OsuConfig.HiddenShowFirstApproach) + }, + new CheckBoxOption + { + LabelText = "Scale osu!mania scroll speed with BPM", + Bindable = config.GetBindable(OsuConfig.ManiaSpeedBPMScale) + }, + new CheckBoxOption + { + LabelText = "Remember osu!mania scroll speed per beatmap", + Bindable = config.GetBindable(OsuConfig.UsePerBeatmapManiaSpeed) + }, + }; + } + } +} diff --git a/osu.Game/Overlays/Options/Gameplay/SongSelectGameplayOptions.cs b/osu.Game/Overlays/Options/Gameplay/SongSelectGameplayOptions.cs index 2a650ee177..c4591976e3 100644 --- a/osu.Game/Overlays/Options/Gameplay/SongSelectGameplayOptions.cs +++ b/osu.Game/Overlays/Options/Gameplay/SongSelectGameplayOptions.cs @@ -1,23 +1,53 @@ //Copyright (c) 2007-2016 ppy Pty Ltd . //Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE +using System; +using osu.Framework.Allocation; +using osu.Framework.Configuration; using osu.Framework.Graphics; using osu.Framework.Graphics.Sprites; +using osu.Game.Configuration; +using osu.Game.Graphics.UserInterface; namespace osu.Game.Overlays.Options.Gameplay { public class SongSelectGameplayOptions : OptionsSubsection { - protected override string Header => "Song Select"; - - public SongSelectGameplayOptions() - { - Children = new Drawable[] - { - new SpriteText { Text = "Display beatmaps from: TODO slider" }, - new SpriteText { Text = "up to: TODO slider" }, - }; - } + protected override string Header => "Song Select"; + + //private BindableInt starMinimum, starMaximum; + //private StarCounter counterMin, counterMax; + + [BackgroundDependencyLoader] + private void load(OsuConfigManager config) + { + // TODO: Deal with bindable ints + /* + starMinimum = config.GetBindable(OsuConfig.DisplayStarsMinimum); + starMaximum = config.GetBindable(OsuConfig.DisplayStarsMaximum); + Children = new Drawable[] + { + new OptionsSlider { Label = "Display beatmaps from", Bindable = starMinimum }, + counterMin = new StarCounter { Count = starMinimum.Value }, + new OptionsSlider { Label = "up to", Bindable = starMaximum }, + counterMax = new StarCounter { Count = starMaximum.Value }, + }; + starMinimum.ValueChanged += starValueChanged; + starMaximum.ValueChanged += starValueChanged;*/ + } + + private void starValueChanged(object sender, EventArgs e) + { + //counterMin.Count = starMinimum.Value; + //counterMax.Count = starMaximum.Value; + } + + protected override void Dispose(bool isDisposing) + { + //starMinimum.ValueChanged -= starValueChanged; + //starMaximum.ValueChanged -= starValueChanged; + base.Dispose(isDisposing); + } } } diff --git a/osu.Game/Overlays/Options/Graphics/LayoutOptions.cs b/osu.Game/Overlays/Options/Graphics/LayoutOptions.cs index 06e2be25d1..d4243a24b1 100644 --- a/osu.Game/Overlays/Options/Graphics/LayoutOptions.cs +++ b/osu.Game/Overlays/Options/Graphics/LayoutOptions.cs @@ -3,6 +3,7 @@ using osu.Framework; using osu.Framework.Allocation; +using osu.Framework.Configuration; using osu.Framework.Graphics; using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.UserInterface; @@ -30,10 +31,19 @@ namespace osu.Game.Overlays.Options.Graphics LabelText = "Letterboxing", Bindable = config.GetBindable(OsuConfig.Letterboxing), }, - new SpriteText { Text = "Horizontal position" }, - new SpriteText { Text = "TODO: slider" }, - new SpriteText { Text = "Vertical position" }, - new SpriteText { Text = "TODO: slider" }, + // TODO: deal with bindable ints + /* + new OptionsSlider + { + Label = "Horizontal position", + Bindable = config.GetBindable(OsuConfig.LetterboxPositionX) + }, + new OptionsSlider + { + Label = "Vertical position", + Bindable = config.GetBindable(OsuConfig.LetterboxPositionY) + }, + */ }; } } diff --git a/osu.Game/Overlays/Options/OptionsSlider.cs b/osu.Game/Overlays/Options/OptionsSlider.cs index a8d0a3da6f..9f6e4e1552 100644 --- a/osu.Game/Overlays/Options/OptionsSlider.cs +++ b/osu.Game/Overlays/Options/OptionsSlider.cs @@ -17,7 +17,11 @@ namespace osu.Game.Overlays.Options public string Label { get { return text.Text; } - set { text.Text = value; } + set + { + text.Text = value; + text.Alpha = string.IsNullOrEmpty(value) ? 0 : 1; + } } public BindableDouble Bindable @@ -33,7 +37,7 @@ namespace osu.Game.Overlays.Options AutoSizeAxes = Axes.Y; Children = new Drawable[] { - text = new SpriteText(), + text = new SpriteText { Alpha = 0 }, slider = new SliderBar { Margin = new MarginPadding { Top = 5 }, From 92cf8415897a0d59f655f364649ce3eb13dec462 Mon Sep 17 00:00:00 2001 From: Drew DeVault Date: Thu, 1 Dec 2016 16:14:28 -0500 Subject: [PATCH 03/15] Add and wire up all sliderbar-based options --- .../Options/Audio/OffsetAdjustmentOptions.cs | 7 ++---- .../Overlays/Options/Audio/VolumeOptions.cs | 6 ++--- .../Gameplay/GeneralGameplayOptions.cs | 9 +++---- .../Gameplay/SongSelectGameplayOptions.cs | 24 +++++++++---------- .../Options/Graphics/LayoutOptions.cs | 11 ++++----- osu.Game/Overlays/Options/OptionsSlider.cs | 9 +++---- 6 files changed, 28 insertions(+), 38 deletions(-) diff --git a/osu.Game/Overlays/Options/Audio/OffsetAdjustmentOptions.cs b/osu.Game/Overlays/Options/Audio/OffsetAdjustmentOptions.cs index 4d9598fabe..edb22f2ed4 100644 --- a/osu.Game/Overlays/Options/Audio/OffsetAdjustmentOptions.cs +++ b/osu.Game/Overlays/Options/Audio/OffsetAdjustmentOptions.cs @@ -19,14 +19,11 @@ namespace osu.Game.Overlays.Options.Audio { Children = new Drawable[] { - // TODO: bindable int crap - /* - new OptionsSlider + new OptionsSlider { Label = "Universal Offset", - Bindable = (BindableDouble)config.GetBindable(OsuConfig.Offset) + Bindable = (BindableInt)config.GetBindable(OsuConfig.Offset) }, - */ new OsuButton { RelativeSizeAxes = Axes.X, diff --git a/osu.Game/Overlays/Options/Audio/VolumeOptions.cs b/osu.Game/Overlays/Options/Audio/VolumeOptions.cs index f7d2614a96..f5c209da22 100644 --- a/osu.Game/Overlays/Options/Audio/VolumeOptions.cs +++ b/osu.Game/Overlays/Options/Audio/VolumeOptions.cs @@ -20,9 +20,9 @@ namespace osu.Game.Overlays.Options.Audio { Children = new Drawable[] { - new OptionsSlider { Label = "Master", Bindable = audio.Volume }, - new OptionsSlider { Label = "Effect", Bindable = audio.VolumeSample }, - new OptionsSlider { Label = "Music", Bindable = audio.VolumeTrack }, + new OptionsSlider { Label = "Master", Bindable = audio.Volume }, + new OptionsSlider { Label = "Effect", Bindable = audio.VolumeSample }, + new OptionsSlider { Label = "Music", Bindable = audio.VolumeTrack }, new CheckBoxOption { LabelText = "Ignore beatmap hitsounds", diff --git a/osu.Game/Overlays/Options/Gameplay/GeneralGameplayOptions.cs b/osu.Game/Overlays/Options/Gameplay/GeneralGameplayOptions.cs index 81143c6127..1fc06afa2a 100644 --- a/osu.Game/Overlays/Options/Gameplay/GeneralGameplayOptions.cs +++ b/osu.Game/Overlays/Options/Gameplay/GeneralGameplayOptions.cs @@ -20,17 +20,14 @@ namespace osu.Game.Overlays.Options.Gameplay { Children = new Drawable[] { - // TODO: bindable int stuff - /* - new OptionsSlider + new OptionsSlider { Label = "Background dim", - Bindable = (BindableDouble)config.GetBindable(OsuConfig.DimLevel) + Bindable = (BindableInt)config.GetBindable(OsuConfig.DimLevel) }, - */ new SpriteText { Text = "Progress display: TODO dropdown" }, new SpriteText { Text = "Score meter type: TODO dropdown" }, - new OptionsSlider + new OptionsSlider { Label = "Score meter size", Bindable = (BindableDouble)config.GetBindable(OsuConfig.ScoreMeterScale) diff --git a/osu.Game/Overlays/Options/Gameplay/SongSelectGameplayOptions.cs b/osu.Game/Overlays/Options/Gameplay/SongSelectGameplayOptions.cs index c4591976e3..638d12fd4a 100644 --- a/osu.Game/Overlays/Options/Gameplay/SongSelectGameplayOptions.cs +++ b/osu.Game/Overlays/Options/Gameplay/SongSelectGameplayOptions.cs @@ -15,37 +15,35 @@ namespace osu.Game.Overlays.Options.Gameplay { protected override string Header => "Song Select"; - //private BindableInt starMinimum, starMaximum; - //private StarCounter counterMin, counterMax; + private BindableInt starMinimum, starMaximum; + private StarCounter counterMin, counterMax; [BackgroundDependencyLoader] private void load(OsuConfigManager config) { - // TODO: Deal with bindable ints - /* - starMinimum = config.GetBindable(OsuConfig.DisplayStarsMinimum); - starMaximum = config.GetBindable(OsuConfig.DisplayStarsMaximum); + starMinimum = (BindableInt)config.GetBindable(OsuConfig.DisplayStarsMinimum); + starMaximum = (BindableInt)config.GetBindable(OsuConfig.DisplayStarsMaximum); Children = new Drawable[] { - new OptionsSlider { Label = "Display beatmaps from", Bindable = starMinimum }, + new OptionsSlider { Label = "Display beatmaps from", Bindable = starMinimum }, counterMin = new StarCounter { Count = starMinimum.Value }, - new OptionsSlider { Label = "up to", Bindable = starMaximum }, + new OptionsSlider { Label = "up to", Bindable = starMaximum }, counterMax = new StarCounter { Count = starMaximum.Value }, }; starMinimum.ValueChanged += starValueChanged; - starMaximum.ValueChanged += starValueChanged;*/ + starMaximum.ValueChanged += starValueChanged; } private void starValueChanged(object sender, EventArgs e) { - //counterMin.Count = starMinimum.Value; - //counterMax.Count = starMaximum.Value; + counterMin.Count = starMinimum.Value; + counterMax.Count = starMaximum.Value; } protected override void Dispose(bool isDisposing) { - //starMinimum.ValueChanged -= starValueChanged; - //starMaximum.ValueChanged -= starValueChanged; + starMinimum.ValueChanged -= starValueChanged; + starMaximum.ValueChanged -= starValueChanged; base.Dispose(isDisposing); } } diff --git a/osu.Game/Overlays/Options/Graphics/LayoutOptions.cs b/osu.Game/Overlays/Options/Graphics/LayoutOptions.cs index d4243a24b1..cd98eacd10 100644 --- a/osu.Game/Overlays/Options/Graphics/LayoutOptions.cs +++ b/osu.Game/Overlays/Options/Graphics/LayoutOptions.cs @@ -31,19 +31,16 @@ namespace osu.Game.Overlays.Options.Graphics LabelText = "Letterboxing", Bindable = config.GetBindable(OsuConfig.Letterboxing), }, - // TODO: deal with bindable ints - /* - new OptionsSlider + new OptionsSlider { Label = "Horizontal position", - Bindable = config.GetBindable(OsuConfig.LetterboxPositionX) + Bindable = (BindableInt)config.GetBindable(OsuConfig.LetterboxPositionX) }, - new OptionsSlider + new OptionsSlider { Label = "Vertical position", - Bindable = config.GetBindable(OsuConfig.LetterboxPositionY) + Bindable = (BindableInt)config.GetBindable(OsuConfig.LetterboxPositionY) }, - */ }; } } diff --git a/osu.Game/Overlays/Options/OptionsSlider.cs b/osu.Game/Overlays/Options/OptionsSlider.cs index 9f6e4e1552..5f335974be 100644 --- a/osu.Game/Overlays/Options/OptionsSlider.cs +++ b/osu.Game/Overlays/Options/OptionsSlider.cs @@ -9,9 +9,10 @@ using osu.Framework.Graphics.UserInterface; namespace osu.Game.Overlays.Options { - public class OptionsSlider : FlowContainer + public class OptionsSlider : FlowContainer where T : struct, + IComparable, IFormattable, IConvertible, IComparable, IEquatable { - private SliderBar slider; + private SliderBar slider; private SpriteText text; public string Label @@ -24,7 +25,7 @@ namespace osu.Game.Overlays.Options } } - public BindableDouble Bindable + public BindableNumber Bindable { get { return slider.Bindable; } set { slider.Bindable = value; } @@ -38,7 +39,7 @@ namespace osu.Game.Overlays.Options Children = new Drawable[] { text = new SpriteText { Alpha = 0 }, - slider = new SliderBar + slider = new SliderBar { Margin = new MarginPadding { Top = 5 }, Height = 10, From b97902d006fec571f324a660af08bde50692b3cd Mon Sep 17 00:00:00 2001 From: Drew DeVault Date: Thu, 1 Dec 2016 17:30:53 -0500 Subject: [PATCH 04/15] Add missing sliders --- osu.Game/Overlays/Options/Input/MouseOptions.cs | 6 ++++++ osu.Game/Overlays/Options/SkinSection.cs | 6 ++++++ 2 files changed, 12 insertions(+) diff --git a/osu.Game/Overlays/Options/Input/MouseOptions.cs b/osu.Game/Overlays/Options/Input/MouseOptions.cs index 4e57d262f6..785c55e148 100644 --- a/osu.Game/Overlays/Options/Input/MouseOptions.cs +++ b/osu.Game/Overlays/Options/Input/MouseOptions.cs @@ -3,6 +3,7 @@ using osu.Framework; using osu.Framework.Allocation; +using osu.Framework.Configuration; using osu.Framework.Graphics; using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.UserInterface; @@ -26,6 +27,11 @@ namespace osu.Game.Overlays.Options.Input Children = new Drawable[] { new SpriteText { Text = "Sensitivity: TODO slider" }, + new OptionsSlider + { + Label = "Sensitivity", + Bindable = (BindableDouble)config.GetBindable(OsuConfig.MouseSpeed), + }, rawInput = new CheckBoxOption { LabelText = "Raw input", diff --git a/osu.Game/Overlays/Options/SkinSection.cs b/osu.Game/Overlays/Options/SkinSection.cs index e552b54160..e69cc1f119 100644 --- a/osu.Game/Overlays/Options/SkinSection.cs +++ b/osu.Game/Overlays/Options/SkinSection.cs @@ -4,6 +4,7 @@ using OpenTK; using osu.Framework; using osu.Framework.Allocation; +using osu.Framework.Configuration; using osu.Framework.Graphics; using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.UserInterface; @@ -62,6 +63,11 @@ namespace osu.Game.Overlays.Options Bindable = config.GetBindable(OsuConfig.UseSkinCursor) }, new SpriteText { Text = "Cursor size: TODO slider" }, + new OptionsSlider + { + Label = "Cursor size", + Bindable = (BindableDouble)config.GetBindable(OsuConfig.CursorSize) + }, new CheckBoxOption { LabelText = "Automatic cursor size", From ff7ec88e66fa50a31cb3e5d0c11d3af2edf10dbb Mon Sep 17 00:00:00 2001 From: Drew DeVault Date: Thu, 1 Dec 2016 17:31:21 -0500 Subject: [PATCH 05/15] s/OptionsSlider/SliderOption/g --- .../Overlays/Options/Audio/OffsetAdjustmentOptions.cs | 4 ++-- osu.Game/Overlays/Options/Audio/VolumeOptions.cs | 6 +++--- .../Overlays/Options/Gameplay/GeneralGameplayOptions.cs | 8 ++++---- .../Options/Gameplay/SongSelectGameplayOptions.cs | 4 ++-- osu.Game/Overlays/Options/Graphics/LayoutOptions.cs | 8 ++++---- osu.Game/Overlays/Options/Input/MouseOptions.cs | 4 ++-- osu.Game/Overlays/Options/SkinSection.cs | 4 ++-- .../Options/{OptionsSlider.cs => SliderOption.cs} | 6 +++--- osu.Game/osu.Game.csproj | 2 +- 9 files changed, 23 insertions(+), 23 deletions(-) rename osu.Game/Overlays/Options/{OptionsSlider.cs => SliderOption.cs} (91%) diff --git a/osu.Game/Overlays/Options/Audio/OffsetAdjustmentOptions.cs b/osu.Game/Overlays/Options/Audio/OffsetAdjustmentOptions.cs index edb22f2ed4..df1d6aa9f9 100644 --- a/osu.Game/Overlays/Options/Audio/OffsetAdjustmentOptions.cs +++ b/osu.Game/Overlays/Options/Audio/OffsetAdjustmentOptions.cs @@ -19,9 +19,9 @@ namespace osu.Game.Overlays.Options.Audio { Children = new Drawable[] { - new OptionsSlider + new SliderOption { - Label = "Universal Offset", + LabelText = "Universal Offset", Bindable = (BindableInt)config.GetBindable(OsuConfig.Offset) }, new OsuButton diff --git a/osu.Game/Overlays/Options/Audio/VolumeOptions.cs b/osu.Game/Overlays/Options/Audio/VolumeOptions.cs index f5c209da22..216e2e866d 100644 --- a/osu.Game/Overlays/Options/Audio/VolumeOptions.cs +++ b/osu.Game/Overlays/Options/Audio/VolumeOptions.cs @@ -20,9 +20,9 @@ namespace osu.Game.Overlays.Options.Audio { Children = new Drawable[] { - new OptionsSlider { Label = "Master", Bindable = audio.Volume }, - new OptionsSlider { Label = "Effect", Bindable = audio.VolumeSample }, - new OptionsSlider { Label = "Music", Bindable = audio.VolumeTrack }, + new SliderOption { LabelText = "Master", Bindable = audio.Volume }, + new SliderOption { LabelText = "Effect", Bindable = audio.VolumeSample }, + new SliderOption { LabelText = "Music", Bindable = audio.VolumeTrack }, new CheckBoxOption { LabelText = "Ignore beatmap hitsounds", diff --git a/osu.Game/Overlays/Options/Gameplay/GeneralGameplayOptions.cs b/osu.Game/Overlays/Options/Gameplay/GeneralGameplayOptions.cs index 1fc06afa2a..15607c9bde 100644 --- a/osu.Game/Overlays/Options/Gameplay/GeneralGameplayOptions.cs +++ b/osu.Game/Overlays/Options/Gameplay/GeneralGameplayOptions.cs @@ -20,16 +20,16 @@ namespace osu.Game.Overlays.Options.Gameplay { Children = new Drawable[] { - new OptionsSlider + new SliderOption { - Label = "Background dim", + LabelText = "Background dim", Bindable = (BindableInt)config.GetBindable(OsuConfig.DimLevel) }, new SpriteText { Text = "Progress display: TODO dropdown" }, new SpriteText { Text = "Score meter type: TODO dropdown" }, - new OptionsSlider + new SliderOption { - Label = "Score meter size", + LabelText = "Score meter size", Bindable = (BindableDouble)config.GetBindable(OsuConfig.ScoreMeterScale) }, new CheckBoxOption diff --git a/osu.Game/Overlays/Options/Gameplay/SongSelectGameplayOptions.cs b/osu.Game/Overlays/Options/Gameplay/SongSelectGameplayOptions.cs index 638d12fd4a..63453f336d 100644 --- a/osu.Game/Overlays/Options/Gameplay/SongSelectGameplayOptions.cs +++ b/osu.Game/Overlays/Options/Gameplay/SongSelectGameplayOptions.cs @@ -25,9 +25,9 @@ namespace osu.Game.Overlays.Options.Gameplay starMaximum = (BindableInt)config.GetBindable(OsuConfig.DisplayStarsMaximum); Children = new Drawable[] { - new OptionsSlider { Label = "Display beatmaps from", Bindable = starMinimum }, + new SliderOption { LabelText = "Display beatmaps from", Bindable = starMinimum }, counterMin = new StarCounter { Count = starMinimum.Value }, - new OptionsSlider { Label = "up to", Bindable = starMaximum }, + new SliderOption { LabelText = "up to", Bindable = starMaximum }, counterMax = new StarCounter { Count = starMaximum.Value }, }; starMinimum.ValueChanged += starValueChanged; diff --git a/osu.Game/Overlays/Options/Graphics/LayoutOptions.cs b/osu.Game/Overlays/Options/Graphics/LayoutOptions.cs index cd98eacd10..e050f7c70c 100644 --- a/osu.Game/Overlays/Options/Graphics/LayoutOptions.cs +++ b/osu.Game/Overlays/Options/Graphics/LayoutOptions.cs @@ -31,14 +31,14 @@ namespace osu.Game.Overlays.Options.Graphics LabelText = "Letterboxing", Bindable = config.GetBindable(OsuConfig.Letterboxing), }, - new OptionsSlider + new SliderOption { - Label = "Horizontal position", + LabelText = "Horizontal position", Bindable = (BindableInt)config.GetBindable(OsuConfig.LetterboxPositionX) }, - new OptionsSlider + new SliderOption { - Label = "Vertical position", + LabelText = "Vertical position", Bindable = (BindableInt)config.GetBindable(OsuConfig.LetterboxPositionY) }, }; diff --git a/osu.Game/Overlays/Options/Input/MouseOptions.cs b/osu.Game/Overlays/Options/Input/MouseOptions.cs index 785c55e148..b1a1dfa5bc 100644 --- a/osu.Game/Overlays/Options/Input/MouseOptions.cs +++ b/osu.Game/Overlays/Options/Input/MouseOptions.cs @@ -27,9 +27,9 @@ namespace osu.Game.Overlays.Options.Input Children = new Drawable[] { new SpriteText { Text = "Sensitivity: TODO slider" }, - new OptionsSlider + new SliderOption { - Label = "Sensitivity", + LabelText = "Sensitivity", Bindable = (BindableDouble)config.GetBindable(OsuConfig.MouseSpeed), }, rawInput = new CheckBoxOption diff --git a/osu.Game/Overlays/Options/SkinSection.cs b/osu.Game/Overlays/Options/SkinSection.cs index e69cc1f119..de88570a0e 100644 --- a/osu.Game/Overlays/Options/SkinSection.cs +++ b/osu.Game/Overlays/Options/SkinSection.cs @@ -63,9 +63,9 @@ namespace osu.Game.Overlays.Options Bindable = config.GetBindable(OsuConfig.UseSkinCursor) }, new SpriteText { Text = "Cursor size: TODO slider" }, - new OptionsSlider + new SliderOption { - Label = "Cursor size", + LabelText = "Cursor size", Bindable = (BindableDouble)config.GetBindable(OsuConfig.CursorSize) }, new CheckBoxOption diff --git a/osu.Game/Overlays/Options/OptionsSlider.cs b/osu.Game/Overlays/Options/SliderOption.cs similarity index 91% rename from osu.Game/Overlays/Options/OptionsSlider.cs rename to osu.Game/Overlays/Options/SliderOption.cs index 5f335974be..d00eeebe35 100644 --- a/osu.Game/Overlays/Options/OptionsSlider.cs +++ b/osu.Game/Overlays/Options/SliderOption.cs @@ -9,13 +9,13 @@ using osu.Framework.Graphics.UserInterface; namespace osu.Game.Overlays.Options { - public class OptionsSlider : FlowContainer where T : struct, + public class SliderOption : FlowContainer where T : struct, IComparable, IFormattable, IConvertible, IComparable, IEquatable { private SliderBar slider; private SpriteText text; - public string Label + public string LabelText { get { return text.Text; } set @@ -31,7 +31,7 @@ namespace osu.Game.Overlays.Options set { slider.Bindable = value; } } - public OptionsSlider() + public SliderOption() { Direction = FlowDirection.VerticalOnly; RelativeSizeAxes = Axes.X; diff --git a/osu.Game/osu.Game.csproj b/osu.Game/osu.Game.csproj index e03f8f3337..2e5367d44b 100644 --- a/osu.Game/osu.Game.csproj +++ b/osu.Game/osu.Game.csproj @@ -222,7 +222,7 @@ - + From 9daf52412091741cff8628a2b406e234aa50f0d3 Mon Sep 17 00:00:00 2001 From: Drew DeVault Date: Thu, 1 Dec 2016 16:36:04 -0500 Subject: [PATCH 06/15] Add OptionsDropdown and wire up one example --- osu.Game/Configuration/OsuConfigManager.cs | 2 +- osu.Game/Configuration/ProgressBarType.cs | 12 ++++ .../Gameplay/GeneralGameplayOptions.cs | 6 +- osu.Game/Overlays/Options/OptionsDropdown.cs | 70 +++++++++++++++++++ osu.Game/osu.Game.csproj | 4 +- 5 files changed, 91 insertions(+), 3 deletions(-) create mode 100644 osu.Game/Configuration/ProgressBarType.cs create mode 100644 osu.Game/Overlays/Options/OptionsDropdown.cs diff --git a/osu.Game/Configuration/OsuConfigManager.cs b/osu.Game/Configuration/OsuConfigManager.cs index ef95a3ac3f..5a1d6e79ef 100644 --- a/osu.Game/Configuration/OsuConfigManager.cs +++ b/osu.Game/Configuration/OsuConfigManager.cs @@ -110,7 +110,7 @@ namespace osu.Game.Configuration Set(OsuConfig.NotifyFriends, true); Set(OsuConfig.NotifySubmittedThread, true); Set(OsuConfig.PopupDuringGameplay, true); - //Set(OsuConfig.ProgressBarType, ProgressBarTypes.Pie); + Set(OsuConfig.ProgressBarType, ProgressBarType.Pie); //Set(OsuConfig.RankType, RankingType.Top); Set(OsuConfig.RefreshRate, 60); Set(OsuConfig.OverrideRefreshRate, Get(OsuConfig.RefreshRate) != 60); diff --git a/osu.Game/Configuration/ProgressBarType.cs b/osu.Game/Configuration/ProgressBarType.cs new file mode 100644 index 0000000000..15f1e35712 --- /dev/null +++ b/osu.Game/Configuration/ProgressBarType.cs @@ -0,0 +1,12 @@ +using System; +namespace osu.Game.Configuration +{ + public enum ProgressBarType + { + Off, + Pie, + TopRight, + BottomRight, + Bottom + } +} \ No newline at end of file diff --git a/osu.Game/Overlays/Options/Gameplay/GeneralGameplayOptions.cs b/osu.Game/Overlays/Options/Gameplay/GeneralGameplayOptions.cs index 15607c9bde..be791161ec 100644 --- a/osu.Game/Overlays/Options/Gameplay/GeneralGameplayOptions.cs +++ b/osu.Game/Overlays/Options/Gameplay/GeneralGameplayOptions.cs @@ -25,7 +25,11 @@ namespace osu.Game.Overlays.Options.Gameplay LabelText = "Background dim", Bindable = (BindableInt)config.GetBindable(OsuConfig.DimLevel) }, - new SpriteText { Text = "Progress display: TODO dropdown" }, + new OptionsDropdown + { + Label = "Progress display", + Bindable = config.GetBindable(OsuConfig.ProgressBarType) + }, new SpriteText { Text = "Score meter type: TODO dropdown" }, new SliderOption { diff --git a/osu.Game/Overlays/Options/OptionsDropdown.cs b/osu.Game/Overlays/Options/OptionsDropdown.cs new file mode 100644 index 0000000000..d1641cd8cf --- /dev/null +++ b/osu.Game/Overlays/Options/OptionsDropdown.cs @@ -0,0 +1,70 @@ +using System; +using System.Linq; +using OpenTK.Graphics; +using osu.Framework.Configuration; +using osu.Framework.Graphics; +using osu.Framework.Graphics.Containers; +using osu.Framework.Graphics.Primitives; +using osu.Framework.Graphics.Sprites; +using osu.Framework.Graphics.UserInterface; + +namespace osu.Game.Overlays.Options +{ + public class OptionsDropdown : FlowContainer + { + private DropDownMenu dropdown; + private SpriteText text; + + public string Label + { + get { return text.Text; } + set + { + text.Text = value; + text.Alpha = string.IsNullOrEmpty(value) ? 0 : 1; + } + } + + public Bindable Bindable + { + get { return bindable; } + set + { + if (bindable != null) + bindable.ValueChanged -= Bindable_ValueChanged; + bindable = value; + bindable.ValueChanged += Bindable_ValueChanged; + Bindable_ValueChanged(null, null); + } + } + + private Bindable bindable; + + void Bindable_ValueChanged(object sender, EventArgs e) + { + dropdown.SelectedValue = bindable.Value; + } + + public OptionsDropdown() + { + if (!typeof(T).IsEnum) + throw new InvalidOperationException("OptionsDropdown only supports enums as the generic type argument"); + Direction = FlowDirection.VerticalOnly; + RelativeSizeAxes = Axes.X; + AutoSizeAxes = Axes.Y; + var items = Enum.GetNames(typeof(T)).Zip( + (T[])Enum.GetValues(typeof(T)), (a, b) => new Tuple(a, b)); + Children = new Drawable[] + { + text = new SpriteText { Alpha = 0 }, + dropdown = new DropDownMenu + { + Margin = new MarginPadding { Top = 5 }, + Height = 10, + RelativeSizeAxes = Axes.X, + Items = items.Select(item => new DropDownMenuItem(item.Item1, item.Item2)) + } + }; + } + } +} \ No newline at end of file diff --git a/osu.Game/osu.Game.csproj b/osu.Game/osu.Game.csproj index 2e5367d44b..eda53c848b 100644 --- a/osu.Game/osu.Game.csproj +++ b/osu.Game/osu.Game.csproj @@ -223,6 +223,8 @@ + + @@ -251,4 +253,4 @@ --> - \ No newline at end of file + From 0378de83466810fce0c867514e7a7e02da949d38 Mon Sep 17 00:00:00 2001 From: Drew DeVault Date: Thu, 1 Dec 2016 16:45:43 -0500 Subject: [PATCH 07/15] Add DisplayName --- osu.Game/Configuration/DisplayNameAttribute.cs | 15 +++++++++++++++ osu.Game/Configuration/ProgressBarType.cs | 5 ++++- osu.Game/Overlays/Options/OptionsDropdown.cs | 7 +++++-- osu.Game/osu.Game.csproj | 1 + 4 files changed, 25 insertions(+), 3 deletions(-) create mode 100644 osu.Game/Configuration/DisplayNameAttribute.cs diff --git a/osu.Game/Configuration/DisplayNameAttribute.cs b/osu.Game/Configuration/DisplayNameAttribute.cs new file mode 100644 index 0000000000..1665dec2dd --- /dev/null +++ b/osu.Game/Configuration/DisplayNameAttribute.cs @@ -0,0 +1,15 @@ +using System; +namespace osu.Game.Configuration +{ + [AttributeUsage(AttributeTargets.Field | AttributeTargets.Property)] + public class DisplayNameAttribute : Attribute + { + public string Name { get; set; } + + public DisplayNameAttribute(string name) + { + Name = name; + } + } +} + diff --git a/osu.Game/Configuration/ProgressBarType.cs b/osu.Game/Configuration/ProgressBarType.cs index 15f1e35712..06db19d392 100644 --- a/osu.Game/Configuration/ProgressBarType.cs +++ b/osu.Game/Configuration/ProgressBarType.cs @@ -1,11 +1,14 @@ -using System; +using System; + namespace osu.Game.Configuration { public enum ProgressBarType { Off, Pie, + [DisplayName("Top Right")] TopRight, + [DisplayName("Bottom Right")] BottomRight, Bottom } diff --git a/osu.Game/Overlays/Options/OptionsDropdown.cs b/osu.Game/Overlays/Options/OptionsDropdown.cs index d1641cd8cf..8e5a14e32f 100644 --- a/osu.Game/Overlays/Options/OptionsDropdown.cs +++ b/osu.Game/Overlays/Options/OptionsDropdown.cs @@ -1,5 +1,6 @@ using System; using System.Linq; +using System.Reflection; using OpenTK.Graphics; using osu.Framework.Configuration; using osu.Framework.Graphics; @@ -7,6 +8,7 @@ using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Primitives; using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.UserInterface; +using osu.Game.Configuration; namespace osu.Game.Overlays.Options { @@ -52,8 +54,9 @@ namespace osu.Game.Overlays.Options Direction = FlowDirection.VerticalOnly; RelativeSizeAxes = Axes.X; AutoSizeAxes = Axes.Y; - var items = Enum.GetNames(typeof(T)).Zip( - (T[])Enum.GetValues(typeof(T)), (a, b) => new Tuple(a, b)); + var items = typeof(T).GetFields().Where(f => !f.IsSpecialName).Zip( + (T[])Enum.GetValues(typeof(T)), (a, b) => new Tuple( + a.GetCustomAttribute()?.Name ?? a.Name, b)); Children = new Drawable[] { text = new SpriteText { Alpha = 0 }, diff --git a/osu.Game/osu.Game.csproj b/osu.Game/osu.Game.csproj index eda53c848b..11dfe0eebe 100644 --- a/osu.Game/osu.Game.csproj +++ b/osu.Game/osu.Game.csproj @@ -225,6 +225,7 @@ + From 4757a1c4338cb2ba67a9e552c733f8db4623326c Mon Sep 17 00:00:00 2001 From: Drew DeVault Date: Thu, 1 Dec 2016 17:28:20 -0500 Subject: [PATCH 08/15] Wire up enum-backed dropdowns --- osu.Game/Configuration/ConfineMouseMode.cs | 10 +++++++++ osu.Game/Configuration/FrameSync.cs | 12 ++++++++++ osu.Game/Configuration/HiddenAttribute.cs | 10 +++++++++ osu.Game/Configuration/OsuConfigManager.cs | 16 ++++++++++---- osu.Game/Configuration/RankingType.cs | 14 ++++++++++++ osu.Game/Configuration/ReleaseStream.cs | 11 ++++++++++ osu.Game/Configuration/ScoreMeterType.cs | 10 +++++++++ osu.Game/Configuration/ScreenshotFormat.cs | 12 ++++++++++ .../Gameplay/GeneralGameplayOptions.cs | 8 +++++-- .../Overlays/Options/General/UpdateOptions.cs | 9 ++++++-- .../Options/Graphics/DetailOptions.cs | 6 ++++- .../Options/Graphics/RendererOptions.cs | 7 +++++- .../Overlays/Options/Input/MouseOptions.cs | 22 +++++++++---------- osu.Game/osu.Game.csproj | 6 +++++ 14 files changed, 131 insertions(+), 22 deletions(-) create mode 100644 osu.Game/Configuration/ConfineMouseMode.cs create mode 100644 osu.Game/Configuration/FrameSync.cs create mode 100644 osu.Game/Configuration/HiddenAttribute.cs create mode 100644 osu.Game/Configuration/RankingType.cs create mode 100644 osu.Game/Configuration/ReleaseStream.cs create mode 100644 osu.Game/Configuration/ScoreMeterType.cs create mode 100644 osu.Game/Configuration/ScreenshotFormat.cs diff --git a/osu.Game/Configuration/ConfineMouseMode.cs b/osu.Game/Configuration/ConfineMouseMode.cs new file mode 100644 index 0000000000..1af9f86d35 --- /dev/null +++ b/osu.Game/Configuration/ConfineMouseMode.cs @@ -0,0 +1,10 @@ +using System; +namespace osu.Game.Configuration +{ + public enum ConfineMouseMode + { + Never, + Fullscreen, + Always + } +} \ No newline at end of file diff --git a/osu.Game/Configuration/FrameSync.cs b/osu.Game/Configuration/FrameSync.cs new file mode 100644 index 0000000000..fc8a26db04 --- /dev/null +++ b/osu.Game/Configuration/FrameSync.cs @@ -0,0 +1,12 @@ +using System; +namespace osu.Game.Configuration +{ + public enum FrameSync + { + VSync = 1, + Limit120 = 0, + Unlimited = 2, + CompletelyUnlimited = 4, + Custom = 5 + } +} \ No newline at end of file diff --git a/osu.Game/Configuration/HiddenAttribute.cs b/osu.Game/Configuration/HiddenAttribute.cs new file mode 100644 index 0000000000..b8763a3fdd --- /dev/null +++ b/osu.Game/Configuration/HiddenAttribute.cs @@ -0,0 +1,10 @@ +using System; +namespace osu.Game.Configuration +{ + public class HiddenAttribute + { + public HiddenAttribute() + { + } + } +} \ No newline at end of file diff --git a/osu.Game/Configuration/OsuConfigManager.cs b/osu.Game/Configuration/OsuConfigManager.cs index 5a1d6e79ef..ccfa323a8a 100644 --- a/osu.Game/Configuration/OsuConfigManager.cs +++ b/osu.Game/Configuration/OsuConfigManager.cs @@ -1,6 +1,7 @@ //Copyright (c) 2007-2016 ppy Pty Ltd . //Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE +using System; using osu.Framework.Configuration; using osu.Framework.Platform; using osu.Game.Modes; @@ -11,6 +12,7 @@ namespace osu.Game.Configuration { protected override void InitialiseDefaults() { +#pragma warning disable CS0612 // Type or member is obsolete Set(OsuConfig.Width, 1366, 640); Set(OsuConfig.Height, 768, 480); Set(OsuConfig.MouseSpeed, 1.0); @@ -111,17 +113,18 @@ namespace osu.Game.Configuration Set(OsuConfig.NotifySubmittedThread, true); Set(OsuConfig.PopupDuringGameplay, true); Set(OsuConfig.ProgressBarType, ProgressBarType.Pie); - //Set(OsuConfig.RankType, RankingType.Top); + Set(OsuConfig.RankType, RankingType.Top); Set(OsuConfig.RefreshRate, 60); Set(OsuConfig.OverrideRefreshRate, Get(OsuConfig.RefreshRate) != 60); //Set(OsuConfig.ScaleMode, ScaleMode.WidescreenConservative); Set(OsuConfig.ScoreboardVisible, true); + Set(OsuConfig.ScoreMeter, ScoreMeterType.Error); //Set(OsuConfig.ScoreMeter, OsuGame.Tournament ? ScoreMeterType.Colour : ScoreMeterType.Error); Set(OsuConfig.ScreenshotId, 0); Set(OsuConfig.MenuSnow, false); Set(OsuConfig.MenuTriangles, true); Set(OsuConfig.SongSelectThumbnails, true); - //Set(OsuConfig.ScreenshotFormat, ImageFileFormat.Jpg); + Set(OsuConfig.ScreenshotFormat, ScreenshotFormat.Jpg); Set(OsuConfig.ShowReplayComments, true); Set(OsuConfig.ShowSpectators, true); Set(OsuConfig.ShowStoryboard, true); @@ -154,7 +157,7 @@ namespace osu.Game.Configuration Set(OsuConfig.DisplayStarsMaximum, 10, 0, 10); Set(OsuConfig.DisplayStarsMinimum, 0, 0, 10); Set(OsuConfig.AudioDevice, string.Empty); - //Set(OsuConfig.ReleaseStream, ReleaseStream.Lazer, true); + Set(OsuConfig.ReleaseStream, ReleaseStream.Lazer); Set(OsuConfig.UpdateFailCount, 0); Set(OsuConfig.SavePassword, false); Set(OsuConfig.SaveUsername, true); @@ -163,7 +166,7 @@ namespace osu.Game.Configuration Set(OsuConfig.Letterboxing, Get(OsuConfig.Fullscreen)); Set(OsuConfig.LetterboxPositionX, 0, -100, 100); Set(OsuConfig.LetterboxPositionY, 0, -100, 100); - //Set(OsuConfig.FrameSync, FrameSync.Limit120); + Set(OsuConfig.FrameSync, FrameSync.Limit120); bool unicodeDefault = false; switch (Get(OsuConfig.Language)) { @@ -178,6 +181,9 @@ namespace osu.Game.Configuration Set(OsuConfig.Ticker, false); Set(OsuConfig.CompatibilityContext, false); Set(OsuConfig.CanForceOptimusCompatibility, true); + Set(OsuConfig.ConfineMouse, Get(OsuConfig.ConfineMouseToFullscreen) ? + ConfineMouseMode.Fullscreen : ConfineMouseMode.Never); +#pragma warning restore CS0612 // Type or member is obsolete } //todo: make a UnicodeString class/struct rather than requiring this helper method. @@ -322,6 +328,8 @@ namespace osu.Game.Configuration RawInput, AbsoluteToOsuWindow, ConfineMouse, + [Obsolete] + ConfineMouseToFullscreen, ShowMenuTips, HiddenShowFirstApproach, ComboColourSliderBall, diff --git a/osu.Game/Configuration/RankingType.cs b/osu.Game/Configuration/RankingType.cs new file mode 100644 index 0000000000..5cfc7df549 --- /dev/null +++ b/osu.Game/Configuration/RankingType.cs @@ -0,0 +1,14 @@ +using System; +namespace osu.Game.Configuration +{ + public enum RankingType + { + Local, + [DisplayName("Global")] + Top, + [DisplayName("Selected Mods")] + SelectedMod, + Friends, + Country + } +} \ No newline at end of file diff --git a/osu.Game/Configuration/ReleaseStream.cs b/osu.Game/Configuration/ReleaseStream.cs new file mode 100644 index 0000000000..a03b2376a3 --- /dev/null +++ b/osu.Game/Configuration/ReleaseStream.cs @@ -0,0 +1,11 @@ +using System; +namespace osu.Game.Configuration +{ + public enum ReleaseStream + { + Lazer, + //Stable40, + //Beta40, + //Stable + } +} \ No newline at end of file diff --git a/osu.Game/Configuration/ScoreMeterType.cs b/osu.Game/Configuration/ScoreMeterType.cs new file mode 100644 index 0000000000..786de6b6bf --- /dev/null +++ b/osu.Game/Configuration/ScoreMeterType.cs @@ -0,0 +1,10 @@ +using System; +namespace osu.Game.Configuration +{ + public enum ScoreMeterType + { + None, + Colour, + Error + } +} \ No newline at end of file diff --git a/osu.Game/Configuration/ScreenshotFormat.cs b/osu.Game/Configuration/ScreenshotFormat.cs new file mode 100644 index 0000000000..81a734283c --- /dev/null +++ b/osu.Game/Configuration/ScreenshotFormat.cs @@ -0,0 +1,12 @@ +using System; +namespace osu.Game.Configuration +{ + public enum ScreenshotFormat + { + Bmp = 0, // TODO: Figure out the best way to hide this from the dropdown + [DisplayName("JPG (web-friendly)")] + Jpg = 1, + [DisplayName("PNG (lossless)")] + Png = 2 + } +} \ No newline at end of file diff --git a/osu.Game/Overlays/Options/Gameplay/GeneralGameplayOptions.cs b/osu.Game/Overlays/Options/Gameplay/GeneralGameplayOptions.cs index be791161ec..e5b1ed2d90 100644 --- a/osu.Game/Overlays/Options/Gameplay/GeneralGameplayOptions.cs +++ b/osu.Game/Overlays/Options/Gameplay/GeneralGameplayOptions.cs @@ -30,7 +30,11 @@ namespace osu.Game.Overlays.Options.Gameplay Label = "Progress display", Bindable = config.GetBindable(OsuConfig.ProgressBarType) }, - new SpriteText { Text = "Score meter type: TODO dropdown" }, + new OptionsDropdown + { + Label = "Score meter type", + Bindable = config.GetBindable(OsuConfig.ScoreMeter) + }, new SliderOption { LabelText = "Score meter size", @@ -59,4 +63,4 @@ namespace osu.Game.Overlays.Options.Gameplay }; } } -} +} diff --git a/osu.Game/Overlays/Options/General/UpdateOptions.cs b/osu.Game/Overlays/Options/General/UpdateOptions.cs index f7dfc2d813..6401afc734 100644 --- a/osu.Game/Overlays/Options/General/UpdateOptions.cs +++ b/osu.Game/Overlays/Options/General/UpdateOptions.cs @@ -6,6 +6,7 @@ using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Sprites; using osu.Framework.Platform; +using osu.Game.Configuration; using osu.Game.Graphics.UserInterface; namespace osu.Game.Overlays.Options.General @@ -15,11 +16,15 @@ namespace osu.Game.Overlays.Options.General protected override string Header => "Updates"; [BackgroundDependencyLoader] - private void load(BasicStorage storage) + private void load(BasicStorage storage, OsuConfigManager config) { Children = new Drawable[] { - new SpriteText { Text = "TODO: Dropdown" }, + new OptionsDropdown + { + Label = "Release stream", + Bindable = config.GetBindable(OsuConfig.ReleaseStream), + }, new SpriteText { Text = "Your osu! is up to date" }, // TODO: map this to reality new OsuButton { diff --git a/osu.Game/Overlays/Options/Graphics/DetailOptions.cs b/osu.Game/Overlays/Options/Graphics/DetailOptions.cs index a885b99b1c..e37d718e3e 100644 --- a/osu.Game/Overlays/Options/Graphics/DetailOptions.cs +++ b/osu.Game/Overlays/Options/Graphics/DetailOptions.cs @@ -57,7 +57,11 @@ namespace osu.Game.Overlays.Options.Graphics LabelText = "Softening filter", Bindable = config.GetBindable(OsuConfig.BloomSoftening) }, - new SpriteText { Text = "Screenshot format TODO: dropdown" } + new OptionsDropdown + { + Label = "Screenshot", + Bindable = config.GetBindable(OsuConfig.ScreenshotFormat) + } }; } } diff --git a/osu.Game/Overlays/Options/Graphics/RendererOptions.cs b/osu.Game/Overlays/Options/Graphics/RendererOptions.cs index b9d81944d4..0c269d90c3 100644 --- a/osu.Game/Overlays/Options/Graphics/RendererOptions.cs +++ b/osu.Game/Overlays/Options/Graphics/RendererOptions.cs @@ -20,7 +20,12 @@ namespace osu.Game.Overlays.Options.Graphics // NOTE: Compatability mode omitted Children = new Drawable[] { - new SpriteText { Text = "Frame limiter: TODO dropdown" }, + // TODO: this needs to be a custom dropdown at some point + new OptionsDropdown + { + Label = "Frame limiter", + Bindable = config.GetBindable(OsuConfig.FrameSync) + }, new CheckBoxOption { LabelText = "Show FPS counter", diff --git a/osu.Game/Overlays/Options/Input/MouseOptions.cs b/osu.Game/Overlays/Options/Input/MouseOptions.cs index b1a1dfa5bc..3ab4959fbe 100644 --- a/osu.Game/Overlays/Options/Input/MouseOptions.cs +++ b/osu.Game/Overlays/Options/Input/MouseOptions.cs @@ -15,12 +15,6 @@ namespace osu.Game.Overlays.Options.Input { protected override string Header => "Mouse"; - private CheckBoxOption rawInput, mapRawInput, disableWheel, disableButtons, enableRipples; - - public MouseOptions() - { - } - [BackgroundDependencyLoader] private void load(OsuConfigManager config) { @@ -32,28 +26,32 @@ namespace osu.Game.Overlays.Options.Input LabelText = "Sensitivity", Bindable = (BindableDouble)config.GetBindable(OsuConfig.MouseSpeed), }, - rawInput = new CheckBoxOption + new CheckBoxOption { LabelText = "Raw input", Bindable = config.GetBindable(OsuConfig.RawInput) }, - mapRawInput = new CheckBoxOption + new CheckBoxOption { LabelText = "Map absolute raw input to the osu! window", Bindable = config.GetBindable(OsuConfig.AbsoluteToOsuWindow) }, - new SpriteText { Text = "Confine mouse cursor: TODO dropdown" }, - disableWheel = new CheckBoxOption + new OptionsDropdown + { + Label = "Confine mouse cursor", + Bindable = config.GetBindable(OsuConfig.ConfineMouse), + }, + new CheckBoxOption { LabelText = "Disable mouse wheel in play mode", Bindable = config.GetBindable(OsuConfig.MouseDisableWheel) }, - disableButtons = new CheckBoxOption + new CheckBoxOption { LabelText = "Disable mouse buttons in play mode", Bindable = config.GetBindable(OsuConfig.MouseDisableButtons) }, - enableRipples = new CheckBoxOption + new CheckBoxOption { LabelText = "Cursor ripples", Bindable = config.GetBindable(OsuConfig.CursorRipple) diff --git a/osu.Game/osu.Game.csproj b/osu.Game/osu.Game.csproj index 11dfe0eebe..a078a78baa 100644 --- a/osu.Game/osu.Game.csproj +++ b/osu.Game/osu.Game.csproj @@ -226,6 +226,12 @@ + + + + + + From 5456e0102c78ee6807b0677b4f291f111867284f Mon Sep 17 00:00:00 2001 From: Drew DeVault Date: Thu, 1 Dec 2016 17:33:30 -0500 Subject: [PATCH 09/15] s/OptionsDropdown/DropdownOption/g --- .../Options/{OptionsDropdown.cs => DropdownOption.cs} | 6 +++--- .../Overlays/Options/Gameplay/GeneralGameplayOptions.cs | 8 ++++---- osu.Game/Overlays/Options/General/UpdateOptions.cs | 2 +- osu.Game/Overlays/Options/Graphics/DetailOptions.cs | 4 ++-- osu.Game/Overlays/Options/Graphics/RendererOptions.cs | 4 ++-- osu.Game/Overlays/Options/Input/MouseOptions.cs | 4 ++-- osu.Game/osu.Game.csproj | 2 +- 7 files changed, 15 insertions(+), 15 deletions(-) rename osu.Game/Overlays/Options/{OptionsDropdown.cs => DropdownOption.cs} (92%) diff --git a/osu.Game/Overlays/Options/OptionsDropdown.cs b/osu.Game/Overlays/Options/DropdownOption.cs similarity index 92% rename from osu.Game/Overlays/Options/OptionsDropdown.cs rename to osu.Game/Overlays/Options/DropdownOption.cs index 8e5a14e32f..71fb4720c3 100644 --- a/osu.Game/Overlays/Options/OptionsDropdown.cs +++ b/osu.Game/Overlays/Options/DropdownOption.cs @@ -12,12 +12,12 @@ using osu.Game.Configuration; namespace osu.Game.Overlays.Options { - public class OptionsDropdown : FlowContainer + public class DropdownOption : FlowContainer { private DropDownMenu dropdown; private SpriteText text; - public string Label + public string LabelText { get { return text.Text; } set @@ -47,7 +47,7 @@ namespace osu.Game.Overlays.Options dropdown.SelectedValue = bindable.Value; } - public OptionsDropdown() + public DropdownOption() { if (!typeof(T).IsEnum) throw new InvalidOperationException("OptionsDropdown only supports enums as the generic type argument"); diff --git a/osu.Game/Overlays/Options/Gameplay/GeneralGameplayOptions.cs b/osu.Game/Overlays/Options/Gameplay/GeneralGameplayOptions.cs index e5b1ed2d90..15ee80102d 100644 --- a/osu.Game/Overlays/Options/Gameplay/GeneralGameplayOptions.cs +++ b/osu.Game/Overlays/Options/Gameplay/GeneralGameplayOptions.cs @@ -25,14 +25,14 @@ namespace osu.Game.Overlays.Options.Gameplay LabelText = "Background dim", Bindable = (BindableInt)config.GetBindable(OsuConfig.DimLevel) }, - new OptionsDropdown + new DropdownOption { - Label = "Progress display", + LabelText = "Progress display", Bindable = config.GetBindable(OsuConfig.ProgressBarType) }, - new OptionsDropdown + new DropdownOption { - Label = "Score meter type", + LabelText = "Score meter type", Bindable = config.GetBindable(OsuConfig.ScoreMeter) }, new SliderOption diff --git a/osu.Game/Overlays/Options/General/UpdateOptions.cs b/osu.Game/Overlays/Options/General/UpdateOptions.cs index 6401afc734..e00790765c 100644 --- a/osu.Game/Overlays/Options/General/UpdateOptions.cs +++ b/osu.Game/Overlays/Options/General/UpdateOptions.cs @@ -20,7 +20,7 @@ namespace osu.Game.Overlays.Options.General { Children = new Drawable[] { - new OptionsDropdown + new DropdownOption { Label = "Release stream", Bindable = config.GetBindable(OsuConfig.ReleaseStream), diff --git a/osu.Game/Overlays/Options/Graphics/DetailOptions.cs b/osu.Game/Overlays/Options/Graphics/DetailOptions.cs index e37d718e3e..51720410a9 100644 --- a/osu.Game/Overlays/Options/Graphics/DetailOptions.cs +++ b/osu.Game/Overlays/Options/Graphics/DetailOptions.cs @@ -57,9 +57,9 @@ namespace osu.Game.Overlays.Options.Graphics LabelText = "Softening filter", Bindable = config.GetBindable(OsuConfig.BloomSoftening) }, - new OptionsDropdown + new DropdownOption { - Label = "Screenshot", + LabelText = "Screenshot", Bindable = config.GetBindable(OsuConfig.ScreenshotFormat) } }; diff --git a/osu.Game/Overlays/Options/Graphics/RendererOptions.cs b/osu.Game/Overlays/Options/Graphics/RendererOptions.cs index 0c269d90c3..6dce562c4b 100644 --- a/osu.Game/Overlays/Options/Graphics/RendererOptions.cs +++ b/osu.Game/Overlays/Options/Graphics/RendererOptions.cs @@ -21,9 +21,9 @@ namespace osu.Game.Overlays.Options.Graphics Children = new Drawable[] { // TODO: this needs to be a custom dropdown at some point - new OptionsDropdown + new DropdownOption { - Label = "Frame limiter", + LabelText = "Frame limiter", Bindable = config.GetBindable(OsuConfig.FrameSync) }, new CheckBoxOption diff --git a/osu.Game/Overlays/Options/Input/MouseOptions.cs b/osu.Game/Overlays/Options/Input/MouseOptions.cs index 3ab4959fbe..9d0823ce07 100644 --- a/osu.Game/Overlays/Options/Input/MouseOptions.cs +++ b/osu.Game/Overlays/Options/Input/MouseOptions.cs @@ -36,9 +36,9 @@ namespace osu.Game.Overlays.Options.Input LabelText = "Map absolute raw input to the osu! window", Bindable = config.GetBindable(OsuConfig.AbsoluteToOsuWindow) }, - new OptionsDropdown + new DropdownOption { - Label = "Confine mouse cursor", + LabelText = "Confine mouse cursor", Bindable = config.GetBindable(OsuConfig.ConfineMouse), }, new CheckBoxOption diff --git a/osu.Game/osu.Game.csproj b/osu.Game/osu.Game.csproj index a078a78baa..affbbad2fe 100644 --- a/osu.Game/osu.Game.csproj +++ b/osu.Game/osu.Game.csproj @@ -224,7 +224,7 @@ - + From cf60c52f0066535d0cced2921b8c779992c507ae Mon Sep 17 00:00:00 2001 From: Drew DeVault Date: Thu, 1 Dec 2016 17:45:31 -0500 Subject: [PATCH 10/15] Switch to System.ComponentModel.Description --- osu.Game/Configuration/DisplayNameAttribute.cs | 15 --------------- osu.Game/Configuration/HiddenAttribute.cs | 10 ---------- osu.Game/Configuration/ProgressBarType.cs | 5 +++-- osu.Game/Configuration/RankingType.cs | 6 ++++-- osu.Game/Configuration/ScreenshotFormat.cs | 6 ++++-- osu.Game/Overlays/Options/DropdownOption.cs | 3 ++- .../Overlays/Options/General/UpdateOptions.cs | 2 +- osu.Game/osu.Game.csproj | 1 - 8 files changed, 14 insertions(+), 34 deletions(-) delete mode 100644 osu.Game/Configuration/DisplayNameAttribute.cs delete mode 100644 osu.Game/Configuration/HiddenAttribute.cs diff --git a/osu.Game/Configuration/DisplayNameAttribute.cs b/osu.Game/Configuration/DisplayNameAttribute.cs deleted file mode 100644 index 1665dec2dd..0000000000 --- a/osu.Game/Configuration/DisplayNameAttribute.cs +++ /dev/null @@ -1,15 +0,0 @@ -using System; -namespace osu.Game.Configuration -{ - [AttributeUsage(AttributeTargets.Field | AttributeTargets.Property)] - public class DisplayNameAttribute : Attribute - { - public string Name { get; set; } - - public DisplayNameAttribute(string name) - { - Name = name; - } - } -} - diff --git a/osu.Game/Configuration/HiddenAttribute.cs b/osu.Game/Configuration/HiddenAttribute.cs deleted file mode 100644 index b8763a3fdd..0000000000 --- a/osu.Game/Configuration/HiddenAttribute.cs +++ /dev/null @@ -1,10 +0,0 @@ -using System; -namespace osu.Game.Configuration -{ - public class HiddenAttribute - { - public HiddenAttribute() - { - } - } -} \ No newline at end of file diff --git a/osu.Game/Configuration/ProgressBarType.cs b/osu.Game/Configuration/ProgressBarType.cs index 06db19d392..e252c84558 100644 --- a/osu.Game/Configuration/ProgressBarType.cs +++ b/osu.Game/Configuration/ProgressBarType.cs @@ -1,4 +1,5 @@ using System; +using System.ComponentModel; namespace osu.Game.Configuration { @@ -6,9 +7,9 @@ namespace osu.Game.Configuration { Off, Pie, - [DisplayName("Top Right")] + [Description("Top Right")] TopRight, - [DisplayName("Bottom Right")] + [Description("Bottom Right")] BottomRight, Bottom } diff --git a/osu.Game/Configuration/RankingType.cs b/osu.Game/Configuration/RankingType.cs index 5cfc7df549..e2f0b4cd00 100644 --- a/osu.Game/Configuration/RankingType.cs +++ b/osu.Game/Configuration/RankingType.cs @@ -1,12 +1,14 @@ using System; +using System.ComponentModel; + namespace osu.Game.Configuration { public enum RankingType { Local, - [DisplayName("Global")] + [Description("Global")] Top, - [DisplayName("Selected Mods")] + [Description("Selected Mods")] SelectedMod, Friends, Country diff --git a/osu.Game/Configuration/ScreenshotFormat.cs b/osu.Game/Configuration/ScreenshotFormat.cs index 81a734283c..993678f0b9 100644 --- a/osu.Game/Configuration/ScreenshotFormat.cs +++ b/osu.Game/Configuration/ScreenshotFormat.cs @@ -1,12 +1,14 @@ using System; +using System.ComponentModel; + namespace osu.Game.Configuration { public enum ScreenshotFormat { Bmp = 0, // TODO: Figure out the best way to hide this from the dropdown - [DisplayName("JPG (web-friendly)")] + [Description("JPG (web-friendly)")] Jpg = 1, - [DisplayName("PNG (lossless)")] + [Description("PNG (lossless)")] Png = 2 } } \ No newline at end of file diff --git a/osu.Game/Overlays/Options/DropdownOption.cs b/osu.Game/Overlays/Options/DropdownOption.cs index 71fb4720c3..a75824ddd5 100644 --- a/osu.Game/Overlays/Options/DropdownOption.cs +++ b/osu.Game/Overlays/Options/DropdownOption.cs @@ -1,4 +1,5 @@ using System; +using System.ComponentModel; using System.Linq; using System.Reflection; using OpenTK.Graphics; @@ -56,7 +57,7 @@ namespace osu.Game.Overlays.Options AutoSizeAxes = Axes.Y; var items = typeof(T).GetFields().Where(f => !f.IsSpecialName).Zip( (T[])Enum.GetValues(typeof(T)), (a, b) => new Tuple( - a.GetCustomAttribute()?.Name ?? a.Name, b)); + a.GetCustomAttribute()?.Description ?? a.Name, b)); Children = new Drawable[] { text = new SpriteText { Alpha = 0 }, diff --git a/osu.Game/Overlays/Options/General/UpdateOptions.cs b/osu.Game/Overlays/Options/General/UpdateOptions.cs index e00790765c..77cfd11273 100644 --- a/osu.Game/Overlays/Options/General/UpdateOptions.cs +++ b/osu.Game/Overlays/Options/General/UpdateOptions.cs @@ -22,7 +22,7 @@ namespace osu.Game.Overlays.Options.General { new DropdownOption { - Label = "Release stream", + LabelText = "Release stream", Bindable = config.GetBindable(OsuConfig.ReleaseStream), }, new SpriteText { Text = "Your osu! is up to date" }, // TODO: map this to reality diff --git a/osu.Game/osu.Game.csproj b/osu.Game/osu.Game.csproj index affbbad2fe..a15cd5db7d 100644 --- a/osu.Game/osu.Game.csproj +++ b/osu.Game/osu.Game.csproj @@ -225,7 +225,6 @@ - From 0e07ce26bccf37ef866d8d11ce3097c248928d65 Mon Sep 17 00:00:00 2001 From: Drew DeVault Date: Fri, 2 Dec 2016 06:35:55 -0500 Subject: [PATCH 11/15] Remove Height from dropdown --- osu.Game/Overlays/Options/DropdownOption.cs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/osu.Game/Overlays/Options/DropdownOption.cs b/osu.Game/Overlays/Options/DropdownOption.cs index a75824ddd5..567e2821ab 100644 --- a/osu.Game/Overlays/Options/DropdownOption.cs +++ b/osu.Game/Overlays/Options/DropdownOption.cs @@ -64,11 +64,10 @@ namespace osu.Game.Overlays.Options dropdown = new DropDownMenu { Margin = new MarginPadding { Top = 5 }, - Height = 10, RelativeSizeAxes = Axes.X, Items = items.Select(item => new DropDownMenuItem(item.Item1, item.Item2)) } }; } } -} \ No newline at end of file +} From b06f412ffb117b32a006497348315e5e9e36de29 Mon Sep 17 00:00:00 2001 From: Drew DeVault Date: Fri, 2 Dec 2016 07:24:48 -0500 Subject: [PATCH 12/15] Use styled dropdown --- osu.Game/Overlays/Options/DropdownOption.cs | 84 ++++++++++++++++++++- 1 file changed, 82 insertions(+), 2 deletions(-) diff --git a/osu.Game/Overlays/Options/DropdownOption.cs b/osu.Game/Overlays/Options/DropdownOption.cs index 567e2821ab..0ba9811d35 100644 --- a/osu.Game/Overlays/Options/DropdownOption.cs +++ b/osu.Game/Overlays/Options/DropdownOption.cs @@ -2,6 +2,7 @@ using System.ComponentModel; using System.Linq; using System.Reflection; +using OpenTK; using OpenTK.Graphics; using osu.Framework.Configuration; using osu.Framework.Graphics; @@ -61,13 +62,92 @@ namespace osu.Game.Overlays.Options Children = new Drawable[] { text = new SpriteText { Alpha = 0 }, - dropdown = new DropDownMenu + dropdown = new StyledDropDownMenu { Margin = new MarginPadding { Top = 5 }, RelativeSizeAxes = Axes.X, - Items = items.Select(item => new DropDownMenuItem(item.Item1, item.Item2)) + Items = items.Select(item => new StyledDropDownMenuItem(item.Item1, item.Item2)) } }; } + + private class StyledDropDownMenu : DropDownMenu + { + protected override float DropDownListSpacing => 4; + + protected override DropDownComboBox CreateComboBox() + { + return new StyledDropDownComboBox(); + } + + public StyledDropDownMenu() + { + ComboBox.CornerRadius = 4; + DropDown.CornerRadius = 4; + } + + protected override void AnimateOpen() + { + foreach (StyledDropDownMenuItem child in DropDownList.Children) + { + child.FadeIn(200); + child.ResizeTo(new Vector2(1, 24), 200); + } + DropDown.Show(); + } + + protected override void AnimateClose() + { + foreach (StyledDropDownMenuItem child in DropDownList.Children) + { + child.ResizeTo(new Vector2(1, 0), 200); + child.FadeOut(200); + } + } + } + + private class StyledDropDownComboBox : DropDownComboBox + { + protected override Color4 BackgroundColour => new Color4(255, 255, 255, 100); + protected override Color4 BackgroundColourHover => Color4.HotPink; + + public StyledDropDownComboBox() + { + Foreground.Padding = new MarginPadding(4); + } + } + + private class StyledDropDownMenuItem : DropDownMenuItem + { + public StyledDropDownMenuItem(string text, U value) : base(text, value) + { + AutoSizeAxes = Axes.None; + Height = 0; + Foreground.Padding = new MarginPadding(2); + } + + protected override void OnSelectChange() + { + if (!IsLoaded) + return; + + FormatBackground(); + FormatCaret(); + FormatLabel(); + } + + protected override void FormatCaret() + { + (Caret as SpriteText).Text = IsSelected ? @"+" : @"-"; + } + + protected override void FormatLabel() + { + if (IsSelected) + (Label as SpriteText).Text = @"*" + Value + @"*"; + else + (Label as SpriteText).Text = Value.ToString(); + } + } } } From 9db8e63f830a103e034dbf786ac436bb6f66dc68 Mon Sep 17 00:00:00 2001 From: Drew DeVault Date: Mon, 5 Dec 2016 09:17:30 -0500 Subject: [PATCH 13/15] Make star display min/max a double --- osu.Game/Configuration/OsuConfigManager.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/osu.Game/Configuration/OsuConfigManager.cs b/osu.Game/Configuration/OsuConfigManager.cs index ccfa323a8a..2c5c53cc3f 100644 --- a/osu.Game/Configuration/OsuConfigManager.cs +++ b/osu.Game/Configuration/OsuConfigManager.cs @@ -154,8 +154,8 @@ namespace osu.Game.Configuration Set(OsuConfig.AlternativeChatFont, false); Set(OsuConfig.Password, string.Empty); Set(OsuConfig.Username, string.Empty); - Set(OsuConfig.DisplayStarsMaximum, 10, 0, 10); - Set(OsuConfig.DisplayStarsMinimum, 0, 0, 10); + Set(OsuConfig.DisplayStarsMaximum, 10.0, 0.0, 10.0); + Set(OsuConfig.DisplayStarsMinimum, 0.0, 0.0, 10.0); Set(OsuConfig.AudioDevice, string.Empty); Set(OsuConfig.ReleaseStream, ReleaseStream.Lazer); Set(OsuConfig.UpdateFailCount, 0); From bf33bded242116abb2f5d97d1796d65cecd52937 Mon Sep 17 00:00:00 2001 From: Drew DeVault Date: Mon, 5 Dec 2016 09:17:46 -0500 Subject: [PATCH 14/15] Update star min/max type, just use sliders for now --- .../Gameplay/SongSelectGameplayOptions.cs | 36 ++++++------------- 1 file changed, 11 insertions(+), 25 deletions(-) diff --git a/osu.Game/Overlays/Options/Gameplay/SongSelectGameplayOptions.cs b/osu.Game/Overlays/Options/Gameplay/SongSelectGameplayOptions.cs index 63453f336d..e0f25cfea7 100644 --- a/osu.Game/Overlays/Options/Gameplay/SongSelectGameplayOptions.cs +++ b/osu.Game/Overlays/Options/Gameplay/SongSelectGameplayOptions.cs @@ -13,38 +13,24 @@ namespace osu.Game.Overlays.Options.Gameplay { public class SongSelectGameplayOptions : OptionsSubsection { - protected override string Header => "Song Select"; - - private BindableInt starMinimum, starMaximum; - private StarCounter counterMin, counterMax; + protected override string Header => "Song Select"; [BackgroundDependencyLoader] private void load(OsuConfigManager config) { - starMinimum = (BindableInt)config.GetBindable(OsuConfig.DisplayStarsMinimum); - starMaximum = (BindableInt)config.GetBindable(OsuConfig.DisplayStarsMaximum); Children = new Drawable[] { - new SliderOption { LabelText = "Display beatmaps from", Bindable = starMinimum }, - counterMin = new StarCounter { Count = starMinimum.Value }, - new SliderOption { LabelText = "up to", Bindable = starMaximum }, - counterMax = new StarCounter { Count = starMaximum.Value }, + new SliderOption + { + LabelText = "Display beatmaps from", + Bindable = (BindableDouble)config.GetBindable(OsuConfig.DisplayStarsMinimum) + }, + new SliderOption + { + LabelText = "up to", + Bindable = (BindableDouble)config.GetBindable(OsuConfig.DisplayStarsMaximum) + }, }; - starMinimum.ValueChanged += starValueChanged; - starMaximum.ValueChanged += starValueChanged; - } - - private void starValueChanged(object sender, EventArgs e) - { - counterMin.Count = starMinimum.Value; - counterMax.Count = starMaximum.Value; - } - - protected override void Dispose(bool isDisposing) - { - starMinimum.ValueChanged -= starValueChanged; - starMaximum.ValueChanged -= starValueChanged; - base.Dispose(isDisposing); } } } From bf7ec397dd365740027a3a582a191f578f184302 Mon Sep 17 00:00:00 2001 From: Drew DeVault Date: Mon, 5 Dec 2016 09:24:54 -0500 Subject: [PATCH 15/15] Wire dropdowns back to bindables --- osu.Game/Overlays/Options/DropdownOption.cs | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/osu.Game/Overlays/Options/DropdownOption.cs b/osu.Game/Overlays/Options/DropdownOption.cs index 0ba9811d35..3cdc6da2ab 100644 --- a/osu.Game/Overlays/Options/DropdownOption.cs +++ b/osu.Game/Overlays/Options/DropdownOption.cs @@ -49,6 +49,18 @@ namespace osu.Game.Overlays.Options dropdown.SelectedValue = bindable.Value; } + void Dropdown_ValueChanged(object sender, EventArgs e) + { + bindable.Value = dropdown.SelectedValue; + } + + protected override void Dispose(bool isDisposing) + { + bindable.ValueChanged -= Bindable_ValueChanged; + dropdown.ValueChanged -= Dropdown_ValueChanged; + base.Dispose(isDisposing); + } + public DropdownOption() { if (!typeof(T).IsEnum) @@ -69,6 +81,7 @@ namespace osu.Game.Overlays.Options Items = items.Select(item => new StyledDropDownMenuItem(item.Item1, item.Item2)) } }; + dropdown.ValueChanged += Dropdown_ValueChanged; } private class StyledDropDownMenu : DropDownMenu