1
0
mirror of https://github.com/ppy/osu.git synced 2024-09-22 09:27:34 +08:00

Add playfield bounds box with toggle and dim slider

This commit is contained in:
Yao Chung Hu 2020-07-09 14:01:28 -05:00
parent 0f91e41764
commit 321815f535
4 changed files with 73 additions and 4 deletions

View File

@ -99,6 +99,9 @@ namespace osu.Game.Configuration
Set(OsuSetting.IncreaseFirstObjectVisibility, true);
Set(OsuSetting.ShowPlayfieldArea, false);
Set(OsuSetting.PlayfieldAreaDimLevel, 0.1, 0, 1, 0.01);
// Update
Set(OsuSetting.ReleaseStream, ReleaseStream.Lazer);
@ -227,6 +230,8 @@ namespace osu.Game.Configuration
IntroSequence,
UIHoldActivationDelay,
HitLighting,
MenuBackgroundSource
MenuBackgroundSource,
ShowPlayfieldArea,
PlayfieldAreaDimLevel
}
}

View File

@ -76,7 +76,19 @@ namespace osu.Game.Overlays.Settings.Sections.Gameplay
{
LabelText = "Score display mode",
Bindable = config.GetBindable<ScoringMode>(OsuSetting.ScoreDisplayMode)
}
},
new SettingsCheckbox
{
LabelText = "Show playfield area",
Bindable = config.GetBindable<bool>(OsuSetting.ShowPlayfieldArea)
},
new SettingsSlider<double>
{
LabelText = "Playfield area dim",
Bindable = config.GetBindable<double>(OsuSetting.PlayfieldAreaDimLevel),
KeyboardStep = 0.01f,
DisplayAsPercentage = true
},
};
}
}

View File

@ -12,6 +12,9 @@ using osu.Framework.Extensions.IEnumerableExtensions;
using osu.Framework.Graphics.Containers;
using osu.Game.Rulesets.Mods;
using osuTK;
using osu.Framework.Graphics.Shapes;
using osuTK.Graphics;
using osu.Game.Configuration;
namespace osu.Game.Rulesets.UI
{
@ -51,6 +54,10 @@ namespace osu.Game.Rulesets.UI
/// </summary>
public readonly BindableBool DisplayJudgements = new BindableBool(true);
private Bindable<bool> showPlayfieldArea;
private Bindable<double> playfieldAreaDimLevel;
private Box playfieldArea;
/// <summary>
/// Creates a new <see cref="Playfield"/>.
/// </summary>
@ -65,7 +72,7 @@ namespace osu.Game.Rulesets.UI
private IReadOnlyList<Mod> mods { get; set; }
[BackgroundDependencyLoader]
private void load()
private void load(OsuConfigManager config)
{
Cursor = CreateCursor();
@ -76,6 +83,38 @@ namespace osu.Game.Rulesets.UI
AddInternal(Cursor);
}
showPlayfieldArea = config.GetBindable<bool>(OsuSetting.ShowPlayfieldArea);
playfieldAreaDimLevel = config.GetBindable<double>(OsuSetting.PlayfieldAreaDimLevel);
showPlayfieldArea.ValueChanged += _ => UpdateVisuals();
playfieldAreaDimLevel.ValueChanged += _ => UpdateVisuals();
UpdateVisuals();
}
protected virtual void UpdateVisuals()
{
if(playfieldArea == null)
{
if (showPlayfieldArea.Value)
{
AddInternal(playfieldArea = new Box
{
RelativeSizeAxes = Axes.Both,
Colour = Color4.White,
Alpha = (float)playfieldAreaDimLevel.Value,
});
}
}
else
{
if (showPlayfieldArea.Value)
{
playfieldArea.Alpha = (float)playfieldAreaDimLevel.Value;
}
else
{
playfieldArea.Alpha = 0;
}
}
}
/// <summary>

View File

@ -14,9 +14,11 @@ namespace osu.Game.Screens.Play.PlayerSettings
private readonly PlayerSliderBar<double> dimSliderBar;
private readonly PlayerSliderBar<double> blurSliderBar;
private readonly PlayerSliderBar<double> playfieldAreaDimSliderBar;
private readonly PlayerCheckbox showStoryboardToggle;
private readonly PlayerCheckbox beatmapSkinsToggle;
private readonly PlayerCheckbox beatmapHitsoundsToggle;
private readonly PlayerCheckbox showPlayfieldAreaToggle;
public VisualSettings()
{
@ -39,12 +41,21 @@ namespace osu.Game.Screens.Play.PlayerSettings
DisplayAsPercentage = true
},
new OsuSpriteText
{
Text = "Playfieldd area dim:"
},
playfieldAreaDimSliderBar = new PlayerSliderBar<double>
{
DisplayAsPercentage = true
},
new OsuSpriteText
{
Text = "Toggles:"
},
showStoryboardToggle = new PlayerCheckbox { LabelText = "Storyboard / Video" },
beatmapSkinsToggle = new PlayerCheckbox { LabelText = "Beatmap skins" },
beatmapHitsoundsToggle = new PlayerCheckbox { LabelText = "Beatmap hitsounds" }
beatmapHitsoundsToggle = new PlayerCheckbox { LabelText = "Beatmap hitsounds" },
showPlayfieldAreaToggle = new PlayerCheckbox { LabelText = "Show playfield area" }
};
}
@ -53,9 +64,11 @@ namespace osu.Game.Screens.Play.PlayerSettings
{
dimSliderBar.Bindable = config.GetBindable<double>(OsuSetting.DimLevel);
blurSliderBar.Bindable = config.GetBindable<double>(OsuSetting.BlurLevel);
playfieldAreaDimSliderBar.Bindable = config.GetBindable<double>(OsuSetting.PlayfieldAreaDimLevel);
showStoryboardToggle.Current = config.GetBindable<bool>(OsuSetting.ShowStoryboard);
beatmapSkinsToggle.Current = config.GetBindable<bool>(OsuSetting.BeatmapSkins);
beatmapHitsoundsToggle.Current = config.GetBindable<bool>(OsuSetting.BeatmapHitsounds);
showPlayfieldAreaToggle.Current = config.GetBindable<bool>(OsuSetting.ShowPlayfieldArea);
}
}
}