1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-16 11:03:21 +08:00

Merge pull request #472 from peppy/general-fixes

Update framework.
This commit is contained in:
Dean Herbert 2017-03-14 12:12:02 +09:00 committed by GitHub
commit 98f13be7ca
4 changed files with 16 additions and 22 deletions

@ -1 +1 @@
Subproject commit a50dd75b114da963c75e6a5314099d99140035b8
Subproject commit e52af1e5ada07468512e19c86b6dcd5a23fe3707

@ -1 +1 @@
Subproject commit 39657fc6066ea3a141ac71cabf67ec9ebf24975c
Subproject commit 4f9ed4e703777ede98737c7e2af31efa4694c395

View File

@ -4,6 +4,7 @@
using System;
using System.Collections.Generic;
using System.IO;
using osu.Framework.Extensions.IEnumerableExtensions;
using osu.Framework.Input;
using osu.Framework.MathUtils;
using osu.Game.Input.Handlers;
@ -95,24 +96,17 @@ namespace osu.Game.Modes
public override List<InputState> GetPendingStates()
{
var buttons = new HashSet<MouseButton>();
if (CurrentFrame?.MouseLeft ?? false)
buttons.Add(MouseButton.Left);
if (CurrentFrame?.MouseRight ?? false)
buttons.Add(MouseButton.Right);
return new List<InputState>
{
new InputState
{
Mouse = new ReplayMouseState(
ToScreenSpace(position ?? Vector2.Zero),
new List<MouseState.ButtonState>
{
new MouseState.ButtonState(MouseButton.Left)
{
State = CurrentFrame?.MouseLeft ?? false
},
new MouseState.ButtonState(MouseButton.Right)
{
State = CurrentFrame?.MouseRight ?? false
},
}
),
Mouse = new ReplayMouseState(ToScreenSpace(position ?? Vector2.Zero), buttons),
Keyboard = new ReplayKeyboardState(new List<Key>())
}
};
@ -171,10 +165,10 @@ namespace osu.Game.Modes
private class ReplayMouseState : MouseState
{
public ReplayMouseState(Vector2 position, List<ButtonState> list)
public ReplayMouseState(Vector2 position, IEnumerable<MouseButton> list)
{
Position = position;
ButtonStates = list;
list.ForEach(b => PressedButtons.Add(b));
}
}

View File

@ -70,14 +70,14 @@ namespace osu.Game.Screens.Play
{
if (mouseDisabled.Value)
{
mouse.ButtonStates.Find(s => s.Button == MouseButton.Left).State = false;
mouse.ButtonStates.Find(s => s.Button == MouseButton.Right).State = false;
mouse.PressedButtons.Remove(MouseButton.Left);
mouse.PressedButtons.Remove(MouseButton.Right);
}
if (leftViaKeyboard)
mouse.ButtonStates.Find(s => s.Button == MouseButton.Left).State = true;
mouse.PressedButtons.Add(MouseButton.Left);
if (rightViaKeyboard)
mouse.ButtonStates.Find(s => s.Button == MouseButton.Right).State = true;
mouse.PressedButtons.Add(MouseButton.Right);
}
}