Allow toggling border on & off during gameplay

This commit is contained in:
Bartłomiej Dach
2020-10-19 20:41:45 +02:00
parent 053c7a69a6
commit 4af3fd1ed6
2 changed files with 16 additions and 9 deletions

View File

@ -27,6 +27,7 @@ namespace osu.Game.Rulesets.Osu.UI
{
public class OsuPlayfield : Playfield
{
private readonly PlayfieldBorder playfieldBorder;
private readonly ProxyContainer approachCircles;
private readonly ProxyContainer spinnerProxies;
private readonly JudgementContainer<DrawableOsuJudgement> judgementLayer;
@ -45,6 +46,11 @@ namespace osu.Game.Rulesets.Osu.UI
{
InternalChildren = new Drawable[]
{
playfieldBorder = new PlayfieldBorder
{
RelativeSizeAxes = Axes.Both,
Depth = 3
},
spinnerProxies = new ProxyContainer
{
RelativeSizeAxes = Axes.Both
@ -86,16 +92,12 @@ namespace osu.Game.Rulesets.Osu.UI
private void load(OsuConfigManager config)
{
showPlayfieldBorder = config.GetBindable<bool>(OsuSetting.ShowPlayfieldBorder);
if (showPlayfieldBorder.Value)
{
AddInternal(new PlayfieldBorder
{
RelativeSizeAxes = Axes.Both
});
}
showPlayfieldBorder.BindValueChanged(updateBorderVisibility, true);
}
private void updateBorderVisibility(ValueChangedEvent<bool> settingChange)
=> playfieldBorder.State.Value = settingChange.NewValue ? Visibility.Visible : Visibility.Hidden;
public override void Add(DrawableHitObject h)
{
h.OnNewResult += onNewResult;