diff --git a/osu.Game.Tests/Visual/TestCaseReplaySettingsOverlay.cs b/osu.Game.Tests/Visual/TestCaseReplaySettingsOverlay.cs index a5d8019bc1..595a93b194 100644 --- a/osu.Game.Tests/Visual/TestCaseReplaySettingsOverlay.cs +++ b/osu.Game.Tests/Visual/TestCaseReplaySettingsOverlay.cs @@ -4,7 +4,7 @@ using osu.Framework.Graphics; using osu.Game.Graphics.UserInterface; using osu.Game.Screens.Play.HUD; -using osu.Game.Screens.Play.ReplaySettings; +using osu.Game.Screens.Play.PlayerSettings; namespace osu.Game.Tests.Visual { @@ -14,7 +14,7 @@ namespace osu.Game.Tests.Visual { ExampleContainer container; - Add(new ReplaySettingsOverlay + Add(new PlayerSettingsOverlay { Anchor = Anchor.TopRight, Origin = Anchor.TopRight, @@ -28,7 +28,7 @@ namespace osu.Game.Tests.Visual Text = @"Button", })); - AddStep(@"Add checkbox", () => container.Add(new ReplayCheckbox + AddStep(@"Add checkbox", () => container.Add(new PlayerCheckbox { LabelText = "Checkbox", })); @@ -42,7 +42,7 @@ namespace osu.Game.Tests.Visual })); } - private class ExampleContainer : ReplayGroup + private class ExampleContainer : PlayerSettingsGroup { protected override string Title => @"example"; } diff --git a/osu.Game/Rulesets/Edit/ToolboxGroup.cs b/osu.Game/Rulesets/Edit/ToolboxGroup.cs index 3b13cc38ab..e153607f47 100644 --- a/osu.Game/Rulesets/Edit/ToolboxGroup.cs +++ b/osu.Game/Rulesets/Edit/ToolboxGroup.cs @@ -2,11 +2,11 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using osu.Framework.Graphics; -using osu.Game.Screens.Play.ReplaySettings; +using osu.Game.Screens.Play.PlayerSettings; namespace osu.Game.Rulesets.Edit { - public class ToolboxGroup : ReplayGroup + public class ToolboxGroup : PlayerSettingsGroup { protected override string Title => "toolbox"; diff --git a/osu.Game/Screens/Play/HUD/ReplaySettingsOverlay.cs b/osu.Game/Screens/Play/HUD/PlayerSettingsOverlay.cs similarity index 81% rename from osu.Game/Screens/Play/HUD/ReplaySettingsOverlay.cs rename to osu.Game/Screens/Play/HUD/PlayerSettingsOverlay.cs index cb30222831..0f10721425 100644 --- a/osu.Game/Screens/Play/HUD/ReplaySettingsOverlay.cs +++ b/osu.Game/Screens/Play/HUD/PlayerSettingsOverlay.cs @@ -3,29 +3,30 @@ using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; -using osu.Game.Screens.Play.ReplaySettings; using OpenTK; using osu.Framework.Input; +using osu.Game.Screens.Play.PlayerSettings; using OpenTK.Input; namespace osu.Game.Screens.Play.HUD { - public class ReplaySettingsOverlay : VisibilityContainer + public class PlayerSettingsOverlay : VisibilityContainer { private const int fade_duration = 200; public bool ReplayLoaded; public readonly PlaybackSettings PlaybackSettings; + public readonly VisualSettings VisualSettings; //public readonly CollectionSettings CollectionSettings; //public readonly DiscussionSettings DiscussionSettings; - public ReplaySettingsOverlay() + public PlayerSettingsOverlay() { AlwaysPresent = true; RelativeSizeAxes = Axes.Both; - Child = new FillFlowContainer + Child = new FillFlowContainer { Anchor = Anchor.TopRight, Origin = Anchor.TopRight, @@ -33,11 +34,12 @@ namespace osu.Game.Screens.Play.HUD Direction = FillDirection.Vertical, Spacing = new Vector2(0, 20), Margin = new MarginPadding { Top = 100, Right = 10 }, - Children = new[] + Children = new PlayerSettingsGroup[] { //CollectionSettings = new CollectionSettings(), //DiscussionSettings = new DiscussionSettings(), PlaybackSettings = new PlaybackSettings(), + VisualSettings = new VisualSettings() } }; diff --git a/osu.Game/Screens/Play/HUDOverlay.cs b/osu.Game/Screens/Play/HUDOverlay.cs index 5fb867e151..e68a17f014 100644 --- a/osu.Game/Screens/Play/HUDOverlay.cs +++ b/osu.Game/Screens/Play/HUDOverlay.cs @@ -34,7 +34,7 @@ namespace osu.Game.Screens.Play public readonly HealthDisplay HealthDisplay; public readonly SongProgress Progress; public readonly ModDisplay ModDisplay; - public readonly ReplaySettingsOverlay ReplaySettingsOverlay; + public readonly PlayerSettingsOverlay PlayerSettingsOverlay; private Bindable showHud; private readonly BindableBool replayLoaded = new BindableBool(); @@ -58,7 +58,7 @@ namespace osu.Game.Screens.Play HealthDisplay = CreateHealthDisplay(), Progress = CreateProgress(), ModDisplay = CreateModsContainer(), - ReplaySettingsOverlay = CreateReplaySettingsOverlay(), + PlayerSettingsOverlay = CreatePlayerSettingsOverlay() } }); @@ -72,7 +72,7 @@ namespace osu.Game.Screens.Play ModDisplay.Current.BindTo(working.Mods); - ReplaySettingsOverlay.PlaybackSettings.AdjustableClock = adjustableSourceClock; + PlayerSettingsOverlay.PlaybackSettings.AdjustableClock = adjustableSourceClock; } [BackgroundDependencyLoader(true)] @@ -115,16 +115,16 @@ namespace osu.Game.Screens.Play private void replayLoadedValueChanged(bool loaded) { - ReplaySettingsOverlay.ReplayLoaded = loaded; + PlayerSettingsOverlay.ReplayLoaded = loaded; if (loaded) { - ReplaySettingsOverlay.Show(); + PlayerSettingsOverlay.Show(); ModDisplay.FadeIn(200); } else { - ReplaySettingsOverlay.Hide(); + PlayerSettingsOverlay.Hide(); ModDisplay.Delay(2000).FadeOut(200); } } @@ -213,7 +213,7 @@ namespace osu.Game.Screens.Play Margin = new MarginPadding { Top = 20, Right = 10 }, }; - protected virtual ReplaySettingsOverlay CreateReplaySettingsOverlay() => new ReplaySettingsOverlay(); + protected virtual PlayerSettingsOverlay CreatePlayerSettingsOverlay() => new PlayerSettingsOverlay(); protected virtual void BindProcessor(ScoreProcessor processor) { diff --git a/osu.Game/Screens/Play/PlayerLoader.cs b/osu.Game/Screens/Play/PlayerLoader.cs index cf6c252bec..2950990779 100644 --- a/osu.Game/Screens/Play/PlayerLoader.cs +++ b/osu.Game/Screens/Play/PlayerLoader.cs @@ -13,6 +13,7 @@ using osu.Game.Screens.Backgrounds; using OpenTK; using osu.Framework.Localisation; using osu.Game.Screens.Menu; +using osu.Game.Screens.Play.PlayerSettings; namespace osu.Game.Screens.Play { @@ -21,6 +22,7 @@ namespace osu.Game.Screens.Play private Player player; private BeatmapMetadataDisplay info; + private VisualSettings visualSettings; private bool showOverlays = true; public override bool ShowOverlaysOnEnter => showOverlays; @@ -49,6 +51,12 @@ namespace osu.Game.Screens.Play Anchor = Anchor.Centre, Origin = Anchor.Centre, }); + Add(visualSettings = new VisualSettings + { + Anchor = Anchor.TopRight, + Origin = Anchor.TopRight, + Margin = new MarginPadding(25) + }); LoadComponentAsync(player); } @@ -110,7 +118,7 @@ namespace osu.Game.Screens.Play private void pushWhenLoaded() { - if (player.LoadState != LoadState.Ready) + if (player.LoadState != LoadState.Ready || visualSettings.IsHovered) { Schedule(pushWhenLoaded); return; diff --git a/osu.Game/Screens/Play/ReplaySettings/CollectionSettings.cs b/osu.Game/Screens/Play/PlayerSettings/CollectionSettings.cs similarity index 87% rename from osu.Game/Screens/Play/ReplaySettings/CollectionSettings.cs rename to osu.Game/Screens/Play/PlayerSettings/CollectionSettings.cs index 9f29e085d1..f18b0876a2 100644 --- a/osu.Game/Screens/Play/ReplaySettings/CollectionSettings.cs +++ b/osu.Game/Screens/Play/PlayerSettings/CollectionSettings.cs @@ -1,15 +1,15 @@ // Copyright (c) 2007-2018 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE +using System.Collections.Generic; using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Game.Graphics.Sprites; using osu.Game.Overlays.Music; -using System.Collections.Generic; -namespace osu.Game.Screens.Play.ReplaySettings +namespace osu.Game.Screens.Play.PlayerSettings { - public class CollectionSettings : ReplayGroup + public class CollectionSettings : PlayerSettingsGroup { protected override string Title => @"collections"; diff --git a/osu.Game/Screens/Play/ReplaySettings/DiscussionSettings.cs b/osu.Game/Screens/Play/PlayerSettings/DiscussionSettings.cs similarity index 84% rename from osu.Game/Screens/Play/ReplaySettings/DiscussionSettings.cs rename to osu.Game/Screens/Play/PlayerSettings/DiscussionSettings.cs index cc7ccac7f5..e6d4fe3e09 100644 --- a/osu.Game/Screens/Play/ReplaySettings/DiscussionSettings.cs +++ b/osu.Game/Screens/Play/PlayerSettings/DiscussionSettings.cs @@ -6,9 +6,9 @@ using osu.Framework.Graphics; using osu.Game.Configuration; using osu.Game.Graphics.UserInterface; -namespace osu.Game.Screens.Play.ReplaySettings +namespace osu.Game.Screens.Play.PlayerSettings { - public class DiscussionSettings : ReplayGroup + public class DiscussionSettings : PlayerSettingsGroup { protected override string Title => @"discussions"; @@ -17,7 +17,7 @@ namespace osu.Game.Screens.Play.ReplaySettings { Children = new Drawable[] { - new ReplayCheckbox + new PlayerCheckbox { LabelText = "Show floating comments", Bindable = config.GetBindable(OsuSetting.FloatingComments) diff --git a/osu.Game/Screens/Play/ReplaySettings/PlaybackSettings.cs b/osu.Game/Screens/Play/PlayerSettings/PlaybackSettings.cs similarity index 88% rename from osu.Game/Screens/Play/ReplaySettings/PlaybackSettings.cs rename to osu.Game/Screens/Play/PlayerSettings/PlaybackSettings.cs index f8ac653f69..15d8e73a76 100644 --- a/osu.Game/Screens/Play/ReplaySettings/PlaybackSettings.cs +++ b/osu.Game/Screens/Play/PlayerSettings/PlaybackSettings.cs @@ -1,15 +1,15 @@ // Copyright (c) 2007-2018 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE -using osu.Framework.Timing; using osu.Framework.Configuration; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; +using osu.Framework.Timing; using osu.Game.Graphics.Sprites; -namespace osu.Game.Screens.Play.ReplaySettings +namespace osu.Game.Screens.Play.PlayerSettings { - public class PlaybackSettings : ReplayGroup + public class PlaybackSettings : PlayerSettingsGroup { private const int padding = 10; @@ -17,7 +17,7 @@ namespace osu.Game.Screens.Play.ReplaySettings public IAdjustableClock AdjustableClock { set; get; } - private readonly ReplaySliderBar sliderbar; + private readonly PlayerSliderBar sliderbar; public PlaybackSettings() { @@ -47,7 +47,7 @@ namespace osu.Game.Screens.Play.ReplaySettings } }, }, - sliderbar = new ReplaySliderBar + sliderbar = new PlayerSliderBar { Bindable = new BindableDouble(1) { diff --git a/osu.Game/Screens/Play/ReplaySettings/ReplayCheckbox.cs b/osu.Game/Screens/Play/PlayerSettings/PlayerCheckbox.cs similarity index 82% rename from osu.Game/Screens/Play/ReplaySettings/ReplayCheckbox.cs rename to osu.Game/Screens/Play/PlayerSettings/PlayerCheckbox.cs index f0b9ff623a..89fbbb8bf2 100644 --- a/osu.Game/Screens/Play/ReplaySettings/ReplayCheckbox.cs +++ b/osu.Game/Screens/Play/PlayerSettings/PlayerCheckbox.cs @@ -5,9 +5,9 @@ using osu.Framework.Allocation; using osu.Game.Graphics; using osu.Game.Graphics.UserInterface; -namespace osu.Game.Screens.Play.ReplaySettings +namespace osu.Game.Screens.Play.PlayerSettings { - public class ReplayCheckbox : OsuCheckbox + public class PlayerCheckbox : OsuCheckbox { [BackgroundDependencyLoader] private void load(OsuColour colours) diff --git a/osu.Game/Screens/Play/ReplaySettings/ReplayGroup.cs b/osu.Game/Screens/Play/PlayerSettings/PlayerSettingsGroup.cs similarity index 94% rename from osu.Game/Screens/Play/ReplaySettings/ReplayGroup.cs rename to osu.Game/Screens/Play/PlayerSettings/PlayerSettingsGroup.cs index bf22250e12..e8a4bc6b27 100644 --- a/osu.Game/Screens/Play/ReplaySettings/ReplayGroup.cs +++ b/osu.Game/Screens/Play/PlayerSettings/PlayerSettingsGroup.cs @@ -1,8 +1,6 @@ // Copyright (c) 2007-2018 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE -using OpenTK; -using OpenTK.Graphics; using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; @@ -10,10 +8,12 @@ using osu.Framework.Graphics.Shapes; using osu.Game.Graphics; using osu.Game.Graphics.Sprites; using osu.Game.Graphics.UserInterface; +using OpenTK; +using OpenTK.Graphics; -namespace osu.Game.Screens.Play.ReplaySettings +namespace osu.Game.Screens.Play.PlayerSettings { - public abstract class ReplayGroup : Container + public abstract class PlayerSettingsGroup : Container { /// /// The title to be displayed in the header of this group. @@ -33,7 +33,7 @@ namespace osu.Game.Screens.Play.ReplaySettings private Color4 buttonActiveColour; - protected ReplayGroup() + protected PlayerSettingsGroup() { AutoSizeAxes = Axes.Y; Width = container_width; diff --git a/osu.Game/Screens/Play/ReplaySettings/ReplaySliderBar.cs b/osu.Game/Screens/Play/PlayerSettings/PlayerSliderBar.cs similarity index 88% rename from osu.Game/Screens/Play/ReplaySettings/ReplaySliderBar.cs rename to osu.Game/Screens/Play/PlayerSettings/PlayerSliderBar.cs index e755e6bfd9..946669e3dd 100644 --- a/osu.Game/Screens/Play/ReplaySettings/ReplaySliderBar.cs +++ b/osu.Game/Screens/Play/PlayerSettings/PlayerSliderBar.cs @@ -1,16 +1,16 @@ // Copyright (c) 2007-2018 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE -using osu.Framework.Allocation; -using osu.Game.Graphics.UserInterface; using System; -using osu.Game.Graphics; +using osu.Framework.Allocation; using osu.Framework.Graphics; +using osu.Game.Graphics; +using osu.Game.Graphics.UserInterface; using osu.Game.Overlays.Settings; -namespace osu.Game.Screens.Play.ReplaySettings +namespace osu.Game.Screens.Play.PlayerSettings { - public class ReplaySliderBar : SettingsSlider + public class PlayerSliderBar : SettingsSlider where T : struct, IEquatable, IComparable, IConvertible { protected override Drawable CreateControl() => new Sliderbar diff --git a/osu.Game/Screens/Play/PlayerSettings/VisualSettings.cs b/osu.Game/Screens/Play/PlayerSettings/VisualSettings.cs new file mode 100644 index 0000000000..1a7b80ec9a --- /dev/null +++ b/osu.Game/Screens/Play/PlayerSettings/VisualSettings.cs @@ -0,0 +1,52 @@ +// Copyright (c) 2007-2018 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using osu.Framework.Allocation; +using osu.Framework.Graphics; +using osu.Game.Configuration; +using osu.Game.Graphics.Sprites; + +namespace osu.Game.Screens.Play.PlayerSettings +{ + public class VisualSettings : PlayerSettingsGroup + { + protected override string Title => "Visual settings"; + + private readonly PlayerSliderBar dimSliderBar; + private readonly PlayerSliderBar blurSliderBar; + private readonly PlayerCheckbox showStoryboardToggle; + private readonly PlayerCheckbox mouseWheelDisabledToggle; + + public VisualSettings() + { + Children = new Drawable[] + { + new OsuSpriteText + { + Text = "Background dim:" + }, + dimSliderBar = new PlayerSliderBar(), + new OsuSpriteText + { + Text = "Background blur:" + }, + blurSliderBar = new PlayerSliderBar(), + new OsuSpriteText + { + Text = "Toggles:" + }, + showStoryboardToggle = new PlayerCheckbox { LabelText = "Storyboards" }, + mouseWheelDisabledToggle = new PlayerCheckbox { LabelText = "Disable mouse wheel" } + }; + } + + [BackgroundDependencyLoader] + private void load(OsuConfigManager config) + { + dimSliderBar.Bindable = config.GetBindable(OsuSetting.DimLevel); + blurSliderBar.Bindable = config.GetBindable(OsuSetting.BlurLevel); + showStoryboardToggle.Bindable = config.GetBindable(OsuSetting.ShowStoryboard); + mouseWheelDisabledToggle.Bindable = config.GetBindable(OsuSetting.MouseDisableWheel); + } + } +} diff --git a/osu.Game/osu.Game.csproj b/osu.Game/osu.Game.csproj index f937497fa0..12e2f45d76 100644 --- a/osu.Game/osu.Game.csproj +++ b/osu.Game/osu.Game.csproj @@ -339,6 +339,7 @@ + @@ -769,13 +770,13 @@ - - - - - - - + + + + + + +