1
0
mirror of https://github.com/ppy/osu.git synced 2025-02-22 02:22:57 +08:00

Rename and Move EditorPlayfieldBorder to PlayfieldBorder for general purpose

This commit is contained in:
Yao Chung Hu 2020-07-10 07:34:48 -05:00
parent 8121ccaad0
commit 0d95b768aa
3 changed files with 6 additions and 43 deletions

View File

@ -20,6 +20,7 @@ using osu.Game.Rulesets.Objects;
using osu.Game.Rulesets.Objects.Drawables; using osu.Game.Rulesets.Objects.Drawables;
using osu.Game.Rulesets.UI; using osu.Game.Rulesets.UI;
using osu.Game.Rulesets.UI.Scrolling; using osu.Game.Rulesets.UI.Scrolling;
using osu.Game.Screens;
using osu.Game.Screens.Edit; using osu.Game.Screens.Edit;
using osu.Game.Screens.Edit.Components.RadioButtons; using osu.Game.Screens.Edit.Components.RadioButtons;
using osu.Game.Screens.Edit.Compose; using osu.Game.Screens.Edit.Compose;
@ -108,7 +109,7 @@ namespace osu.Game.Rulesets.Edit
drawableRulesetWrapper.CreatePlayfieldAdjustmentContainer().WithChildren(new Drawable[] drawableRulesetWrapper.CreatePlayfieldAdjustmentContainer().WithChildren(new Drawable[]
{ {
LayerBelowRuleset, LayerBelowRuleset,
new EditorPlayfieldBorder { RelativeSizeAxes = Axes.Both } new PlayfieldBorder { RelativeSizeAxes = Axes.Both }
}), }),
drawableRulesetWrapper, drawableRulesetWrapper,
// layers above playfield // layers above playfield

View File

@ -12,8 +12,6 @@ using osu.Framework.Extensions.IEnumerableExtensions;
using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Containers;
using osu.Game.Rulesets.Mods; using osu.Game.Rulesets.Mods;
using osuTK; using osuTK;
using osu.Game.Configuration;
using osu.Game.Screens.Edit.Compose.Components;
namespace osu.Game.Rulesets.UI namespace osu.Game.Rulesets.UI
{ {
@ -53,10 +51,6 @@ namespace osu.Game.Rulesets.UI
/// </summary> /// </summary>
public readonly BindableBool DisplayJudgements = new BindableBool(true); public readonly BindableBool DisplayJudgements = new BindableBool(true);
private Bindable<bool> showPlayfieldArea;
private Bindable<double> playfieldAreaDimLevel;
private EditorPlayfieldBorder playfieldArea;
/// <summary> /// <summary>
/// Creates a new <see cref="Playfield"/>. /// Creates a new <see cref="Playfield"/>.
/// </summary> /// </summary>
@ -71,7 +65,7 @@ namespace osu.Game.Rulesets.UI
private IReadOnlyList<Mod> mods { get; set; } private IReadOnlyList<Mod> mods { get; set; }
[BackgroundDependencyLoader] [BackgroundDependencyLoader]
private void load(OsuConfigManager config) private void load()
{ {
Cursor = CreateCursor(); Cursor = CreateCursor();
@ -82,38 +76,6 @@ namespace osu.Game.Rulesets.UI
AddInternal(Cursor); 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 EditorPlayfieldBorder
{
RelativeSizeAxes = Axes.Both,
Alpha = (float)playfieldAreaDimLevel.Value,
});
}
}
else
{
if (showPlayfieldArea.Value)
{
playfieldArea.Alpha = (float)playfieldAreaDimLevel.Value;
}
else
{
playfieldArea.Alpha = 0;
}
}
} }
/// <summary> /// <summary>

View File

@ -6,14 +6,14 @@ using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Shapes; using osu.Framework.Graphics.Shapes;
using osuTK.Graphics; using osuTK.Graphics;
namespace osu.Game.Screens.Edit.Compose.Components namespace osu.Game.Screens
{ {
/// <summary> /// <summary>
/// Provides a border around the playfield. /// Provides a border around the playfield.
/// </summary> /// </summary>
public class EditorPlayfieldBorder : CompositeDrawable public class PlayfieldBorder : CompositeDrawable
{ {
public EditorPlayfieldBorder() public PlayfieldBorder()
{ {
RelativeSizeAxes = Axes.Both; RelativeSizeAxes = Axes.Both;