mirror of
https://github.com/osukey/osukey.git
synced 2025-07-02 08:49:59 +09:00
Moved key press select mods to ModSection
This commit is contained in:
@ -1,14 +1,16 @@
|
|||||||
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
|
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
|
||||||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||||
|
|
||||||
|
using OpenTK.Input;
|
||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
using osu.Game.Graphics;
|
using osu.Game.Graphics;
|
||||||
using osu.Game.Modes;
|
|
||||||
|
|
||||||
namespace osu.Game.Overlays.Mods
|
namespace osu.Game.Overlays.Mods
|
||||||
{
|
{
|
||||||
public class AssistedSection : ModSection
|
public class AssistedSection : ModSection
|
||||||
{
|
{
|
||||||
|
protected override Key[] ToggleKeys => new Key[] { Key.Z, Key.X, Key.C, Key.V, Key.B, Key.N, Key.M };
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
private void load(OsuColour colours)
|
private void load(OsuColour colours)
|
||||||
{
|
{
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
|
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
|
||||||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||||
|
|
||||||
|
using OpenTK.Input;
|
||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
using osu.Game.Graphics;
|
using osu.Game.Graphics;
|
||||||
|
|
||||||
@ -8,6 +9,8 @@ namespace osu.Game.Overlays.Mods
|
|||||||
{
|
{
|
||||||
public class DifficultyIncreaseSection : ModSection
|
public class DifficultyIncreaseSection : ModSection
|
||||||
{
|
{
|
||||||
|
protected override Key[] ToggleKeys => new Key[] { Key.A, Key.S, Key.D, Key.F, Key.G, Key.H, Key.J, Key.K, Key.L };
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
private void load(OsuColour colours)
|
private void load(OsuColour colours)
|
||||||
{
|
{
|
||||||
|
@ -4,13 +4,13 @@
|
|||||||
using OpenTK.Input;
|
using OpenTK.Input;
|
||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
using osu.Game.Graphics;
|
using osu.Game.Graphics;
|
||||||
using osu.Game.Modes;
|
|
||||||
using osu.Game.Overlays.Mods;
|
|
||||||
|
|
||||||
namespace osu.Game
|
namespace osu.Game.Overlays.Mods
|
||||||
{
|
{
|
||||||
public class DifficultyReductionSection : ModSection
|
public class DifficultyReductionSection : ModSection
|
||||||
{
|
{
|
||||||
|
protected override Key[] ToggleKeys => new Key[] { Key.Q, Key.W, Key.E, Key.R, Key.T, Key.Y, Key.U, Key.I, Key.O, Key.P };
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
private void load(OsuColour colours)
|
private void load(OsuColour colours)
|
||||||
{
|
{
|
||||||
|
@ -30,7 +30,6 @@ namespace osu.Game.Overlays.Mods
|
|||||||
private SampleChannel sampleOn, sampleOff;
|
private SampleChannel sampleOn, sampleOff;
|
||||||
|
|
||||||
public Action<Mod> Action; // Passed the selected mod or null if none
|
public Action<Mod> Action; // Passed the selected mod or null if none
|
||||||
public Key ToggleKey;
|
|
||||||
|
|
||||||
private int _selectedMod = -1;
|
private int _selectedMod = -1;
|
||||||
private int selectedMod
|
private int selectedMod
|
||||||
@ -235,17 +234,6 @@ namespace osu.Game.Overlays.Mods
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override bool OnKeyDown(Framework.Input.InputState state, KeyDownEventArgs args)
|
|
||||||
{
|
|
||||||
if (args.Key == ToggleKey)
|
|
||||||
{
|
|
||||||
SelectNext();
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
return base.OnKeyDown(state, args);
|
|
||||||
}
|
|
||||||
|
|
||||||
public ModButton(Mod m)
|
public ModButton(Mod m)
|
||||||
{
|
{
|
||||||
Direction = FlowDirections.Vertical;
|
Direction = FlowDirections.Vertical;
|
||||||
|
@ -2,12 +2,15 @@
|
|||||||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
|
using System.Linq;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using OpenTK;
|
using OpenTK;
|
||||||
using OpenTK.Graphics;
|
using OpenTK.Graphics;
|
||||||
|
using OpenTK.Input;
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Graphics.Containers;
|
using osu.Framework.Graphics.Containers;
|
||||||
using osu.Framework.Graphics.Primitives;
|
using osu.Framework.Graphics.Primitives;
|
||||||
|
using osu.Framework.Input;
|
||||||
using osu.Game.Graphics.Sprites;
|
using osu.Game.Graphics.Sprites;
|
||||||
using osu.Game.Modes;
|
using osu.Game.Modes;
|
||||||
|
|
||||||
@ -26,6 +29,7 @@ namespace osu.Game.Overlays.Mods
|
|||||||
public FlowContainer ButtonsContainer => buttonsContainer;
|
public FlowContainer ButtonsContainer => buttonsContainer;
|
||||||
|
|
||||||
public Action<Mod> Action;
|
public Action<Mod> Action;
|
||||||
|
protected virtual Key[] ToggleKeys => new Key[] { };
|
||||||
|
|
||||||
public Mod[] SelectedMods
|
public Mod[] SelectedMods
|
||||||
{
|
{
|
||||||
@ -119,6 +123,15 @@ namespace osu.Game.Overlays.Mods
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected override bool OnKeyDown(InputState state, KeyDownEventArgs args)
|
||||||
|
{
|
||||||
|
var index = Array.IndexOf(ToggleKeys, args.Key);
|
||||||
|
if (index > -1 && index < Buttons.Length)
|
||||||
|
Buttons[index].SelectNext();
|
||||||
|
|
||||||
|
return base.OnKeyDown(state, args);
|
||||||
|
}
|
||||||
|
|
||||||
public void DeselectAll()
|
public void DeselectAll()
|
||||||
{
|
{
|
||||||
foreach (ModButton button in buttons)
|
foreach (ModButton button in buttons)
|
||||||
|
Reference in New Issue
Block a user