1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-13 09:23:06 +08:00

Use UIEvent level getters for modifier keys.

This commit is contained in:
ekrctb 2018-10-02 12:44:14 +09:00
parent 50091252e2
commit b7a2ad1aa5
17 changed files with 18 additions and 22 deletions

View File

@ -90,7 +90,7 @@ namespace osu.Game.Graphics.Cursor
protected override bool OnMouseUp(MouseUpEvent e)
{
if (!e.CurrentState.Mouse.HasMainButtonPressed)
if (!e.IsPressed(MouseButton.Left) && !e.IsPressed(MouseButton.Right))
{
activeCursor.AdditiveLayer.FadeOutFromOne(500, Easing.OutQuint);
activeCursor.ScaleTo(1, 500, Easing.OutElastic);

View File

@ -34,8 +34,7 @@ namespace osu.Game.Graphics.UserInterface
protected override bool OnKeyDown(KeyDownEvent e)
{
var keyboard = e.CurrentState.Keyboard;
if (!keyboard.ControlPressed && !keyboard.ShiftPressed)
if (!e.ControlPressed && !e.ShiftPressed)
{
switch (e.Key)
{
@ -57,7 +56,7 @@ namespace osu.Game.Graphics.UserInterface
}
}
if (keyboard.ShiftPressed)
if (e.ShiftPressed)
{
switch (e.Key)
{

View File

@ -3,7 +3,6 @@
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using OpenTK;
using OpenTK.Graphics;

View File

@ -10,7 +10,7 @@ using osu.Framework.Graphics.Containers;
using osu.Game.Graphics;
using osu.Game.Graphics.Sprites;
using osu.Framework.Graphics.Shapes;
using osu.Framework.Input.States;
using osu.Framework.Input.Events;
using osu.Framework.Localisation;
using osu.Game.Beatmaps;
using osu.Game.Beatmaps.Drawables;

View File

@ -171,7 +171,7 @@ namespace osu.Game.Overlays.KeyBinding
protected override bool OnMouseUp(MouseUpEvent e)
{
// don't do anything until the last button is released.
if (!HasFocus || e.CurrentState.Mouse.HasAnyButtonPressed)
if (!HasFocus || e.HasAnyButtonPressed)
return base.OnMouseUp(e);
if (bindTarget.IsHovered)
@ -205,7 +205,7 @@ namespace osu.Game.Overlays.KeyBinding
{
case Key.Delete:
{
if (e.CurrentState.Keyboard.ShiftPressed)
if (e.ShiftPressed)
{
bindTarget.UpdateKeyCombination(InputKey.None);
finalise();

View File

@ -183,7 +183,7 @@ namespace osu.Game.Overlays
protected override void OnFocusLost(FocusLostEvent e)
{
if (e.CurrentState.Keyboard.IsPressed(Key.Escape)) dismiss();
if (e.CurrentState.Keyboard.Keys.IsPressed(Key.Escape)) dismiss();
}
private const double initial_duration = 400;

View File

@ -60,7 +60,7 @@ namespace osu.Game.Overlays.Mods
{
var index = Array.IndexOf(ToggleKeys, e.Key);
if (index > -1 && index < buttons.Length)
buttons[index].SelectNext(e.CurrentState.Keyboard.ShiftPressed ? -1 : 1);
buttons[index].SelectNext(e.ShiftPressed ? -1 : 1);
}
return base.OnKeyDown(e);

View File

@ -89,7 +89,7 @@ namespace osu.Game.Overlays.Toolbar
{
base.OnKeyDown(e);
if (e.CurrentState.Keyboard.ControlPressed && !e.Repeat && e.Key >= Key.Number1 && e.Key <= Key.Number9)
if (e.ControlPressed && !e.Repeat && e.Key >= Key.Number1 && e.Key <= Key.Number9)
{
int requested = e.Key - Key.Number1;

View File

@ -8,7 +8,7 @@ using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Input;
using osu.Framework.Input.Bindings;
using osu.Framework.Input.EventArgs;
using osu.Framework.Input.Events;
using osu.Framework.Input.StateChanges.Events;
using osu.Framework.Input.States;
using osu.Framework.Timing;

View File

@ -205,8 +205,7 @@ namespace osu.Game.Screens.Menu
protected override bool OnKeyDown(KeyDownEvent e)
{
var keyboard = e.CurrentState.Keyboard;
if (e.Repeat || keyboard.ControlPressed || keyboard.ShiftPressed || keyboard.AltPressed)
if (e.Repeat || e.ControlPressed || e.ShiftPressed || e.AltPressed)
return false;
if (triggerKey == e.Key && triggerKey != Key.Unknown)

View File

@ -201,8 +201,7 @@ namespace osu.Game.Screens.Menu
protected override bool OnKeyDown(KeyDownEvent e)
{
var keyboard = e.CurrentState.Keyboard;
if (!e.Repeat && keyboard.ControlPressed && keyboard.ShiftPressed && e.Key == Key.D)
if (!e.Repeat && e.ControlPressed && e.ShiftPressed && e.Key == Key.D)
{
Push(new Drawings());
return true;

View File

@ -56,7 +56,7 @@ namespace osu.Game.Screens.Play.HUD
{
if (e.Repeat) return false;
if (e.CurrentState.Keyboard.ControlPressed)
if (e.ControlPressed)
{
if (e.Key == Key.H && ReplayLoaded)
{

View File

@ -190,7 +190,7 @@ namespace osu.Game.Screens.Play.HUD
protected override bool OnMouseUp(MouseUpEvent e)
{
if (!e.CurrentState.Mouse.Buttons.Any())
if (!e.HasAnyButtonPressed)
AbortConfirm();
return true;
}

View File

@ -155,7 +155,7 @@ namespace osu.Game.Screens.Play
{
if (e.Repeat) return false;
if (e.CurrentState.Keyboard.ShiftPressed)
if (e.ShiftPressed)
{
switch (e.Key)
{

View File

@ -130,7 +130,7 @@ namespace osu.Game.Screens.Play
protected override bool OnMouseMove(MouseMoveEvent e)
{
if (!e.CurrentState.Mouse.HasAnyButtonPressed)
if (!e.HasAnyButtonPressed)
fadeContainer.State = Visibility.Visible;
return base.OnMouseMove(e);
}

View File

@ -560,7 +560,7 @@ namespace osu.Game.Screens.Select
switch (e.Key)
{
case Key.Delete:
if (e.CurrentState.Keyboard.ShiftPressed)
if (e.ShiftPressed)
{
if (!Beatmap.IsDefault)
delete(Beatmap.Value.BeatmapSetInfo);

View File

@ -18,7 +18,7 @@
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="2.1.2" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite.Core" Version="2.1.3" />
<PackageReference Include="Newtonsoft.Json" Version="11.0.2" />
<PackageReference Include="ppy.osu.Framework" Version="0.0.7360" />
<PackageReference Include="ppy.osu.Framework" Version="0.0.7368" />
<PackageReference Include="SharpCompress" Version="0.22.0" />
<PackageReference Include="NUnit" Version="3.10.1" />
<PackageReference Include="SharpRaven" Version="2.4.0" />