From d40f209f4bbb15406b5512ad77585311ead25af4 Mon Sep 17 00:00:00 2001 From: Yao Chung Hu <30311066+FlashyReese@users.noreply.github.com> Date: Fri, 10 Jul 2020 07:36:21 -0500 Subject: [PATCH] Move Playfield Border to OsuPlayfield Ruleset --- osu.Game.Rulesets.Osu/UI/OsuPlayfield.cs | 19 +++++++++++++++++++ osu.Game/Configuration/OsuConfigManager.cs | 6 ++---- .../Sections/Gameplay/GeneralSettings.cs | 13 +++---------- .../Play/PlayerSettings/VisualSettings.cs | 15 +-------------- 4 files changed, 25 insertions(+), 28 deletions(-) diff --git a/osu.Game.Rulesets.Osu/UI/OsuPlayfield.cs b/osu.Game.Rulesets.Osu/UI/OsuPlayfield.cs index 4b1a2ce43c..3189db69a5 100644 --- a/osu.Game.Rulesets.Osu/UI/OsuPlayfield.cs +++ b/osu.Game.Rulesets.Osu/UI/OsuPlayfield.cs @@ -12,6 +12,10 @@ using osu.Game.Rulesets.UI; using osu.Game.Rulesets.Judgements; using osu.Game.Rulesets.Osu.UI.Cursor; using osu.Game.Skinning; +using osu.Framework.Allocation; +using osu.Game.Configuration; +using osu.Framework.Bindables; +using osu.Game.Screens; namespace osu.Game.Rulesets.Osu.UI { @@ -26,6 +30,8 @@ namespace osu.Game.Rulesets.Osu.UI protected override GameplayCursorContainer CreateCursor() => new OsuCursorContainer(); + private Bindable showPlayfieldBorder; + public OsuPlayfield() { InternalChildren = new Drawable[] @@ -56,6 +62,19 @@ namespace osu.Game.Rulesets.Osu.UI hitPolicy = new OrderedHitPolicy(HitObjectContainer); } + [BackgroundDependencyLoader] + private void load(OsuConfigManager config) + { + showPlayfieldBorder = config.GetBindable(OsuSetting.ShowPlayfieldBorder); + if (showPlayfieldBorder.Value) + { + AddInternal(new PlayfieldBorder + { + RelativeSizeAxes = Axes.Both + }); + } + } + public override void Add(DrawableHitObject h) { h.OnNewResult += onNewResult; diff --git a/osu.Game/Configuration/OsuConfigManager.cs b/osu.Game/Configuration/OsuConfigManager.cs index 40a132a8e8..9ed73b7bd6 100644 --- a/osu.Game/Configuration/OsuConfigManager.cs +++ b/osu.Game/Configuration/OsuConfigManager.cs @@ -99,8 +99,7 @@ namespace osu.Game.Configuration Set(OsuSetting.IncreaseFirstObjectVisibility, true); - Set(OsuSetting.ShowPlayfieldArea, false); - Set(OsuSetting.PlayfieldAreaDimLevel, 0.1, 0, 1, 0.01); + Set(OsuSetting.ShowPlayfieldBorder, false); // Update Set(OsuSetting.ReleaseStream, ReleaseStream.Lazer); @@ -231,7 +230,6 @@ namespace osu.Game.Configuration UIHoldActivationDelay, HitLighting, MenuBackgroundSource, - ShowPlayfieldArea, - PlayfieldAreaDimLevel + ShowPlayfieldBorder } } diff --git a/osu.Game/Overlays/Settings/Sections/Gameplay/GeneralSettings.cs b/osu.Game/Overlays/Settings/Sections/Gameplay/GeneralSettings.cs index ad02b54dd8..85eb61edff 100644 --- a/osu.Game/Overlays/Settings/Sections/Gameplay/GeneralSettings.cs +++ b/osu.Game/Overlays/Settings/Sections/Gameplay/GeneralSettings.cs @@ -79,16 +79,9 @@ namespace osu.Game.Overlays.Settings.Sections.Gameplay }, new SettingsCheckbox { - LabelText = "Show playfield area", - Bindable = config.GetBindable(OsuSetting.ShowPlayfieldArea) - }, - new SettingsSlider - { - LabelText = "Playfield area dim", - Bindable = config.GetBindable(OsuSetting.PlayfieldAreaDimLevel), - KeyboardStep = 0.01f, - DisplayAsPercentage = true - }, + LabelText = "Show playfield border", + Bindable = config.GetBindable(OsuSetting.ShowPlayfieldBorder) + } }; } } diff --git a/osu.Game/Screens/Play/PlayerSettings/VisualSettings.cs b/osu.Game/Screens/Play/PlayerSettings/VisualSettings.cs index 36e7c53132..d6c66d0751 100644 --- a/osu.Game/Screens/Play/PlayerSettings/VisualSettings.cs +++ b/osu.Game/Screens/Play/PlayerSettings/VisualSettings.cs @@ -14,11 +14,9 @@ namespace osu.Game.Screens.Play.PlayerSettings private readonly PlayerSliderBar dimSliderBar; private readonly PlayerSliderBar blurSliderBar; - private readonly PlayerSliderBar playfieldAreaDimSliderBar; private readonly PlayerCheckbox showStoryboardToggle; private readonly PlayerCheckbox beatmapSkinsToggle; private readonly PlayerCheckbox beatmapHitsoundsToggle; - private readonly PlayerCheckbox showPlayfieldAreaToggle; public VisualSettings() { @@ -41,21 +39,12 @@ namespace osu.Game.Screens.Play.PlayerSettings DisplayAsPercentage = true }, new OsuSpriteText - { - Text = "Playfieldd area dim:" - }, - playfieldAreaDimSliderBar = new PlayerSliderBar - { - DisplayAsPercentage = true - }, - new OsuSpriteText { Text = "Toggles:" }, showStoryboardToggle = new PlayerCheckbox { LabelText = "Storyboard / Video" }, beatmapSkinsToggle = new PlayerCheckbox { LabelText = "Beatmap skins" }, - beatmapHitsoundsToggle = new PlayerCheckbox { LabelText = "Beatmap hitsounds" }, - showPlayfieldAreaToggle = new PlayerCheckbox { LabelText = "Show playfield area" } + beatmapHitsoundsToggle = new PlayerCheckbox { LabelText = "Beatmap hitsounds" } }; } @@ -64,11 +53,9 @@ namespace osu.Game.Screens.Play.PlayerSettings { dimSliderBar.Bindable = config.GetBindable(OsuSetting.DimLevel); blurSliderBar.Bindable = config.GetBindable(OsuSetting.BlurLevel); - playfieldAreaDimSliderBar.Bindable = config.GetBindable(OsuSetting.PlayfieldAreaDimLevel); showStoryboardToggle.Current = config.GetBindable(OsuSetting.ShowStoryboard); beatmapSkinsToggle.Current = config.GetBindable(OsuSetting.BeatmapSkins); beatmapHitsoundsToggle.Current = config.GetBindable(OsuSetting.BeatmapHitsounds); - showPlayfieldAreaToggle.Current = config.GetBindable(OsuSetting.ShowPlayfieldArea); } } }