mirror of
https://github.com/ppy/osu.git
synced 2025-01-28 06:42:54 +08:00
Pass input state in OnSelected.
This commit is contained in:
parent
df3f75b842
commit
44fd0eb78b
@ -1,12 +1,14 @@
|
||||
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
|
||||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||
|
||||
using osu.Framework.Input;
|
||||
|
||||
namespace osu.Game.Screens.Select
|
||||
{
|
||||
public class EditSongSelect : SongSelect
|
||||
{
|
||||
protected override bool ShowFooter => false;
|
||||
|
||||
protected override void OnSelected() => Exit();
|
||||
protected override void OnSelected(InputState state) => Exit();
|
||||
}
|
||||
}
|
||||
|
@ -1,10 +1,12 @@
|
||||
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
|
||||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||
|
||||
using osu.Framework.Input;
|
||||
|
||||
namespace osu.Game.Screens.Select
|
||||
{
|
||||
public class MatchSongSelect : SongSelect
|
||||
{
|
||||
protected override void OnSelected() => Exit();
|
||||
protected override void OnSelected(InputState state) => Exit();
|
||||
}
|
||||
}
|
||||
|
@ -25,7 +25,6 @@ namespace osu.Game.Screens.Select
|
||||
private readonly ModSelectOverlay modSelect;
|
||||
private readonly BeatmapDetailArea beatmapDetails;
|
||||
private IEnumerable<Mod> originalMods;
|
||||
private bool controlPressed;
|
||||
|
||||
public PlaySongSelect()
|
||||
{
|
||||
@ -109,24 +108,12 @@ namespace osu.Game.Screens.Select
|
||||
return false;
|
||||
}
|
||||
|
||||
protected override bool OnKeyDown(InputState state, KeyDownEventArgs args)
|
||||
{
|
||||
controlPressed = state.Keyboard.ControlPressed;
|
||||
return base.OnKeyDown(state, args);
|
||||
}
|
||||
|
||||
protected override bool OnKeyUp(InputState state, KeyUpEventArgs args)
|
||||
{
|
||||
controlPressed = state.Keyboard.ControlPressed;
|
||||
return base.OnKeyUp(state, args);
|
||||
}
|
||||
|
||||
protected override void OnSelected()
|
||||
protected override void OnSelected(InputState state)
|
||||
{
|
||||
if (player != null) return;
|
||||
|
||||
originalMods = modSelect.SelectedMods.Value;
|
||||
if (controlPressed)
|
||||
if (state?.Keyboard.ControlPressed == true)
|
||||
if (findAutoMod(originalMods) == null)
|
||||
{
|
||||
var auto = findAutoMod(Ruleset.Value.CreateInstance().GetModsFor(ModType.Special));
|
||||
|
@ -106,7 +106,7 @@ namespace osu.Game.Screens.Select
|
||||
Origin = Anchor.CentreRight,
|
||||
SelectionChanged = carouselSelectionChanged,
|
||||
BeatmapsChanged = carouselBeatmapsLoaded,
|
||||
StartRequested = carouselRaisedStart,
|
||||
StartRequested = () => carouselRaisedStart(),
|
||||
});
|
||||
Add(FilterControl = new FilterControl
|
||||
{
|
||||
@ -143,7 +143,7 @@ namespace osu.Game.Screens.Select
|
||||
Add(Footer = new Footer
|
||||
{
|
||||
OnBack = Exit,
|
||||
OnStart = carouselRaisedStart,
|
||||
OnStart = () => carouselRaisedStart(),
|
||||
});
|
||||
|
||||
FooterPanels.Add(BeatmapOptions = new BeatmapOptionsOverlay());
|
||||
@ -193,7 +193,7 @@ namespace osu.Game.Screens.Select
|
||||
carousel.SelectNext();
|
||||
}
|
||||
|
||||
private void carouselRaisedStart()
|
||||
private void carouselRaisedStart(InputState state = null)
|
||||
{
|
||||
// if we have a pending filter operation, we want to run it now.
|
||||
// it could change selection (ie. if the ruleset has been changed).
|
||||
@ -206,7 +206,7 @@ namespace osu.Game.Screens.Select
|
||||
selectionChangedDebounce = null;
|
||||
}
|
||||
|
||||
OnSelected();
|
||||
OnSelected(state);
|
||||
}
|
||||
|
||||
private ScheduledDelegate selectionChangedDebounce;
|
||||
@ -270,7 +270,7 @@ namespace osu.Game.Screens.Select
|
||||
carousel.SelectNextRandom();
|
||||
}
|
||||
|
||||
protected abstract void OnSelected();
|
||||
protected abstract void OnSelected(InputState state);
|
||||
|
||||
private void filterChanged(FilterCriteria criteria, bool debounce = true)
|
||||
{
|
||||
@ -393,7 +393,7 @@ namespace osu.Game.Screens.Select
|
||||
{
|
||||
case Key.KeypadEnter:
|
||||
case Key.Enter:
|
||||
carouselRaisedStart();
|
||||
carouselRaisedStart(state);
|
||||
return true;
|
||||
case Key.Delete:
|
||||
if (state.Keyboard.ShiftPressed)
|
||||
|
Loading…
Reference in New Issue
Block a user