mirror of
https://github.com/ppy/osu.git
synced 2024-12-14 10:12:54 +08:00
Allow toggling border on & off during gameplay
This commit is contained in:
parent
053c7a69a6
commit
4af3fd1ed6
@ -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;
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user