mirror of
https://github.com/ppy/osu.git
synced 2024-11-11 16:27:26 +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
|
public class OsuPlayfield : Playfield
|
||||||
{
|
{
|
||||||
|
private readonly PlayfieldBorder playfieldBorder;
|
||||||
private readonly ProxyContainer approachCircles;
|
private readonly ProxyContainer approachCircles;
|
||||||
private readonly ProxyContainer spinnerProxies;
|
private readonly ProxyContainer spinnerProxies;
|
||||||
private readonly JudgementContainer<DrawableOsuJudgement> judgementLayer;
|
private readonly JudgementContainer<DrawableOsuJudgement> judgementLayer;
|
||||||
@ -45,6 +46,11 @@ namespace osu.Game.Rulesets.Osu.UI
|
|||||||
{
|
{
|
||||||
InternalChildren = new Drawable[]
|
InternalChildren = new Drawable[]
|
||||||
{
|
{
|
||||||
|
playfieldBorder = new PlayfieldBorder
|
||||||
|
{
|
||||||
|
RelativeSizeAxes = Axes.Both,
|
||||||
|
Depth = 3
|
||||||
|
},
|
||||||
spinnerProxies = new ProxyContainer
|
spinnerProxies = new ProxyContainer
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.Both
|
RelativeSizeAxes = Axes.Both
|
||||||
@ -86,16 +92,12 @@ namespace osu.Game.Rulesets.Osu.UI
|
|||||||
private void load(OsuConfigManager config)
|
private void load(OsuConfigManager config)
|
||||||
{
|
{
|
||||||
showPlayfieldBorder = config.GetBindable<bool>(OsuSetting.ShowPlayfieldBorder);
|
showPlayfieldBorder = config.GetBindable<bool>(OsuSetting.ShowPlayfieldBorder);
|
||||||
|
showPlayfieldBorder.BindValueChanged(updateBorderVisibility, true);
|
||||||
if (showPlayfieldBorder.Value)
|
|
||||||
{
|
|
||||||
AddInternal(new PlayfieldBorder
|
|
||||||
{
|
|
||||||
RelativeSizeAxes = Axes.Both
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void updateBorderVisibility(ValueChangedEvent<bool> settingChange)
|
||||||
|
=> playfieldBorder.State.Value = settingChange.NewValue ? Visibility.Visible : Visibility.Hidden;
|
||||||
|
|
||||||
public override void Add(DrawableHitObject h)
|
public override void Add(DrawableHitObject h)
|
||||||
{
|
{
|
||||||
h.OnNewResult += onNewResult;
|
h.OnNewResult += onNewResult;
|
||||||
|
@ -11,8 +11,10 @@ namespace osu.Game.Screens
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Provides a border around the playfield.
|
/// Provides a border around the playfield.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class PlayfieldBorder : CompositeDrawable
|
public class PlayfieldBorder : VisibilityContainer
|
||||||
{
|
{
|
||||||
|
private const int fade_duration = 200;
|
||||||
|
|
||||||
public PlayfieldBorder()
|
public PlayfieldBorder()
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.Both;
|
RelativeSizeAxes = Axes.Both;
|
||||||
@ -28,5 +30,8 @@ namespace osu.Game.Screens
|
|||||||
AlwaysPresent = true
|
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