From 4757a1c4338cb2ba67a9e552c733f8db4623326c Mon Sep 17 00:00:00 2001 From: Drew DeVault Date: Thu, 1 Dec 2016 17:28:20 -0500 Subject: [PATCH] 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 @@ + + + + + +