Merge remote-tracking branch 'refs/remotes/ppy/master' into beatmap-mod-selector

This commit is contained in:
Andrei Zavatski
2019-09-19 17:03:00 +03:00
8 changed files with 116 additions and 33 deletions

View File

@ -13,7 +13,8 @@ namespace osu.Game.Overlays
public class DialogOverlay : OsuFocusedOverlayContainer
{
private readonly Container dialogContainer;
private PopupDialog currentDialog;
public PopupDialog CurrentDialog { get; private set; }
public DialogOverlay()
{
@ -31,15 +32,15 @@ namespace osu.Game.Overlays
public void Push(PopupDialog dialog)
{
if (dialog == currentDialog) return;
if (dialog == CurrentDialog) return;
currentDialog?.Hide();
currentDialog = dialog;
CurrentDialog?.Hide();
CurrentDialog = dialog;
dialogContainer.Add(currentDialog);
dialogContainer.Add(CurrentDialog);
currentDialog.Show();
currentDialog.State.ValueChanged += state => onDialogOnStateChanged(dialog, state.NewValue);
CurrentDialog.Show();
CurrentDialog.State.ValueChanged += state => onDialogOnStateChanged(dialog, state.NewValue);
Show();
}
@ -52,8 +53,11 @@ namespace osu.Game.Overlays
//handle the dialog being dismissed.
dialog.Delay(PopupDialog.EXIT_DURATION).Expire();
if (dialog == currentDialog)
if (dialog == CurrentDialog)
{
Hide();
CurrentDialog = null;
}
}
protected override void PopIn()
@ -66,9 +70,9 @@ namespace osu.Game.Overlays
{
base.PopOut();
if (currentDialog?.State.Value == Visibility.Visible)
if (CurrentDialog?.State.Value == Visibility.Visible)
{
currentDialog.Hide();
CurrentDialog.Hide();
return;
}
@ -80,7 +84,7 @@ namespace osu.Game.Overlays
switch (action)
{
case GlobalAction.Select:
currentDialog?.Buttons.OfType<PopupDialogOkButton>().FirstOrDefault()?.Click();
CurrentDialog?.Buttons.OfType<PopupDialogOkButton>().FirstOrDefault()?.Click();
return true;
}

View File

@ -51,7 +51,7 @@ namespace osu.Game.Overlays
protected override void Dispose(bool isDisposing)
{
audio.Tracks.RemoveAdjustment(AdjustableProperty.Volume, audioVolume);
audio?.Tracks.RemoveAdjustment(AdjustableProperty.Volume, audioVolume);
base.Dispose(isDisposing);
}
}

View File

@ -2,7 +2,9 @@
// See the LICENCE file in the repository root for full licence text.
using osu.Framework.Allocation;
using osu.Framework.Graphics;
using osu.Game.Configuration;
using osu.Game.Graphics.UserInterface;
namespace osu.Game.Overlays.Settings.Sections.Graphics
{
@ -13,7 +15,7 @@ namespace osu.Game.Overlays.Settings.Sections.Graphics
[BackgroundDependencyLoader]
private void load(OsuConfigManager config)
{
Children = new[]
Children = new Drawable[]
{
new SettingsCheckbox
{
@ -25,7 +27,18 @@ namespace osu.Game.Overlays.Settings.Sections.Graphics
LabelText = "Parallax",
Bindable = config.GetBindable<bool>(OsuSetting.MenuParallax)
},
new SettingsSlider<int, TimeSlider>
{
LabelText = "Hold-to-confirm activation time",
Bindable = config.GetBindable<int>(OsuSetting.UIHoldActivationDelay),
KeyboardStep = 50
},
};
}
private class TimeSlider : OsuSliderBar<int>
{
public override string TooltipText => Current.Value.ToString("N0") + "ms";
}
}
}