mirror of
https://github.com/ppy/osu.git
synced 2024-11-15 21:17:25 +08:00
allow hotkeys in sample point piece
This commit is contained in:
parent
952540024e
commit
5e86a01e5e
@ -373,6 +373,8 @@ namespace osu.Game.Rulesets.Edit
|
||||
if (e.ControlPressed || e.SuperPressed)
|
||||
return false;
|
||||
|
||||
bool handled = false;
|
||||
|
||||
if (checkLeftToggleFromKey(e.Key, out int leftIndex))
|
||||
{
|
||||
var item = toolboxCollection.Items.ElementAtOrDefault(leftIndex);
|
||||
@ -387,20 +389,30 @@ namespace osu.Game.Rulesets.Edit
|
||||
|
||||
if (checkRightToggleFromKey(e.Key, out int rightIndex))
|
||||
{
|
||||
var item = e.AltPressed
|
||||
? sampleAdditionBankTogglesCollection.ElementAtOrDefault(rightIndex)
|
||||
: e.ShiftPressed
|
||||
? sampleBankTogglesCollection.ElementAtOrDefault(rightIndex)
|
||||
: togglesCollection.ElementAtOrDefault(rightIndex);
|
||||
if (e.ShiftPressed || e.AltPressed)
|
||||
{
|
||||
if (e.ShiftPressed)
|
||||
attemptToggle(rightIndex, sampleBankTogglesCollection);
|
||||
|
||||
if (e.AltPressed)
|
||||
attemptToggle(rightIndex, sampleAdditionBankTogglesCollection);
|
||||
}
|
||||
else
|
||||
attemptToggle(rightIndex, togglesCollection);
|
||||
}
|
||||
|
||||
return handled || base.OnKeyDown(e);
|
||||
|
||||
void attemptToggle(int index, FillFlowContainer collection)
|
||||
{
|
||||
var item = collection.ElementAtOrDefault(index);
|
||||
|
||||
if (item is DrawableTernaryButton button)
|
||||
{
|
||||
button.Button.Toggle();
|
||||
return true;
|
||||
handled = true;
|
||||
}
|
||||
}
|
||||
|
||||
return base.OnKeyDown(e);
|
||||
}
|
||||
|
||||
private bool checkLeftToggleFromKey(Key key, out int index)
|
||||
|
@ -381,21 +381,28 @@ namespace osu.Game.Screens.Edit.Compose.Components.Timeline
|
||||
|
||||
protected override bool OnKeyDown(KeyDownEvent e)
|
||||
{
|
||||
if (e.ControlPressed || e.AltPressed || e.SuperPressed || !checkRightToggleFromKey(e.Key, out int rightIndex))
|
||||
if (e.ControlPressed || e.SuperPressed || !checkRightToggleFromKey(e.Key, out int rightIndex))
|
||||
return base.OnKeyDown(e);
|
||||
|
||||
if (e.ShiftPressed)
|
||||
if (e.ShiftPressed || e.AltPressed)
|
||||
{
|
||||
string? newBank = banks.ElementAtOrDefault(rightIndex);
|
||||
|
||||
if (string.IsNullOrEmpty(newBank))
|
||||
return true;
|
||||
|
||||
if (e.ShiftPressed)
|
||||
{
|
||||
setBank(newBank);
|
||||
updatePrimaryBankState();
|
||||
}
|
||||
|
||||
if (e.AltPressed)
|
||||
{
|
||||
setAdditionBank(newBank);
|
||||
updateAdditionBankState();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
var item = togglesCollection.ElementAtOrDefault(rightIndex);
|
||||
|
Loading…
Reference in New Issue
Block a user