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

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;

View File

@ -11,8 +11,10 @@ namespace osu.Game.Screens
/// <summary>
/// Provides a border around the playfield.
/// </summary>
public class PlayfieldBorder : CompositeDrawable
public class PlayfieldBorder : VisibilityContainer
{
private const int fade_duration = 200;
public PlayfieldBorder()
{
RelativeSizeAxes = Axes.Both;
@ -28,5 +30,8 @@ namespace osu.Game.Screens
AlwaysPresent = true
};
}
protected override void PopIn() => this.FadeIn(fade_duration, Easing.OutQuint);
protected override void PopOut() => this.FadeOut(fade_duration, Easing.OutQuint);
}
}