mirror of
https://github.com/osukey/osukey.git
synced 2025-08-04 23:24:04 +09:00
Merge branch 'master' into cinema-mod
This commit is contained in:
@ -188,26 +188,22 @@ namespace osu.Game.Screens.Play
|
||||
InternalButtons.Add(button);
|
||||
}
|
||||
|
||||
private int _selectionIndex = -1;
|
||||
private int selectionIndex = -1;
|
||||
|
||||
private int selectionIndex
|
||||
private void setSelected(int value)
|
||||
{
|
||||
get => _selectionIndex;
|
||||
set
|
||||
{
|
||||
if (_selectionIndex == value)
|
||||
return;
|
||||
if (selectionIndex == value)
|
||||
return;
|
||||
|
||||
// Deselect the previously-selected button
|
||||
if (_selectionIndex != -1)
|
||||
InternalButtons[_selectionIndex].Selected.Value = false;
|
||||
// Deselect the previously-selected button
|
||||
if (selectionIndex != -1)
|
||||
InternalButtons[selectionIndex].Selected.Value = false;
|
||||
|
||||
_selectionIndex = value;
|
||||
selectionIndex = value;
|
||||
|
||||
// Select the newly-selected button
|
||||
if (_selectionIndex != -1)
|
||||
InternalButtons[_selectionIndex].Selected.Value = true;
|
||||
}
|
||||
// Select the newly-selected button
|
||||
if (selectionIndex != -1)
|
||||
InternalButtons[selectionIndex].Selected.Value = true;
|
||||
}
|
||||
|
||||
protected override bool OnKeyDown(KeyDownEvent e)
|
||||
@ -218,16 +214,16 @@ namespace osu.Game.Screens.Play
|
||||
{
|
||||
case Key.Up:
|
||||
if (selectionIndex == -1 || selectionIndex == 0)
|
||||
selectionIndex = InternalButtons.Count - 1;
|
||||
setSelected(InternalButtons.Count - 1);
|
||||
else
|
||||
selectionIndex--;
|
||||
setSelected(selectionIndex - 1);
|
||||
return true;
|
||||
|
||||
case Key.Down:
|
||||
if (selectionIndex == -1 || selectionIndex == InternalButtons.Count - 1)
|
||||
selectionIndex = 0;
|
||||
setSelected(0);
|
||||
else
|
||||
selectionIndex++;
|
||||
setSelected(selectionIndex + 1);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@ -266,9 +262,9 @@ namespace osu.Game.Screens.Play
|
||||
private void buttonSelectionChanged(DialogButton button, bool isSelected)
|
||||
{
|
||||
if (!isSelected)
|
||||
selectionIndex = -1;
|
||||
setSelected(-1);
|
||||
else
|
||||
selectionIndex = InternalButtons.IndexOf(button);
|
||||
setSelected(InternalButtons.IndexOf(button));
|
||||
}
|
||||
|
||||
private void updateRetryCount()
|
||||
|
@ -135,7 +135,7 @@ namespace osu.Game.Screens.Play
|
||||
addGameplayComponents(GameplayClockContainer, working);
|
||||
addOverlayComponents(GameplayClockContainer, working);
|
||||
|
||||
DrawableRuleset.HasReplayLoaded.BindValueChanged(e => HUDOverlay.HoldToQuit.PauseOnFocusLost = !e.NewValue && PauseOnFocusLost, true);
|
||||
DrawableRuleset.HasReplayLoaded.BindValueChanged(_ => updatePauseOnFocusLostState(), true);
|
||||
|
||||
// bind clock into components that require it
|
||||
DrawableRuleset.IsPaused.BindTo(GameplayClockContainer.IsPaused);
|
||||
@ -146,6 +146,7 @@ namespace osu.Game.Screens.Play
|
||||
|
||||
foreach (var mod in Mods.Value.OfType<IApplicableToScoreProcessor>())
|
||||
mod.ApplyToScoreProcessor(ScoreProcessor);
|
||||
breakOverlay.IsBreakTime.ValueChanged += _ => updatePauseOnFocusLostState();
|
||||
}
|
||||
|
||||
private void addUnderlayComponents(Container target)
|
||||
@ -241,6 +242,11 @@ namespace osu.Game.Screens.Play
|
||||
});
|
||||
}
|
||||
|
||||
private void updatePauseOnFocusLostState() =>
|
||||
HUDOverlay.HoldToQuit.PauseOnFocusLost = PauseOnFocusLost
|
||||
&& !DrawableRuleset.HasReplayLoaded.Value
|
||||
&& !breakOverlay.IsBreakTime.Value;
|
||||
|
||||
private WorkingBeatmap loadBeatmap()
|
||||
{
|
||||
WorkingBeatmap working = Beatmap.Value;
|
||||
|
Reference in New Issue
Block a user