1
0
mirror of https://github.com/ppy/osu.git synced 2024-09-22 09:27:34 +08:00

Update framework.

This commit is contained in:
Dean Herbert 2017-03-13 19:11:57 +09:00
parent c76a495d3d
commit 4fa037c0b2
No known key found for this signature in database
GPG Key ID: 46D71BF4958ABB49
3 changed files with 15 additions and 21 deletions

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

View File

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

View File

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