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

Fix simultaneous slider input not allowing both keys

This commit is contained in:
smoogipoo 2021-04-26 15:20:29 +09:00
parent bda8f68da4
commit 6182181ea1

View File

@ -2,6 +2,7 @@
// See the LICENCE file in the repository root for full licence text. // See the LICENCE file in the repository root for full licence text.
using System; using System;
using System.Collections.Generic;
using System.Linq; using System.Linq;
using osu.Framework.Allocation; using osu.Framework.Allocation;
using osu.Framework.Bindables; using osu.Framework.Bindables;
@ -134,6 +135,11 @@ namespace osu.Game.Rulesets.Osu.Skinning.Default
/// </summary> /// </summary>
private double? timeToAcceptAnyKeyAfter; private double? timeToAcceptAnyKeyAfter;
/// <summary>
/// The actions that were pressed in the previous frame.
/// </summary>
private readonly List<OsuAction> lastPressedActions = new List<OsuAction>();
protected override void Update() protected override void Update()
{ {
base.Update(); base.Update();
@ -152,8 +158,8 @@ namespace osu.Game.Rulesets.Osu.Skinning.Default
{ {
var otherKey = headCircleHitAction == OsuAction.RightButton ? OsuAction.LeftButton : OsuAction.RightButton; var otherKey = headCircleHitAction == OsuAction.RightButton ? OsuAction.LeftButton : OsuAction.RightButton;
// we can return to accepting all keys if the initial head circle key is the *only* key pressed, or all keys have been released. // we can return to accepting all other keys if they were released in the previous frame.
if (actions?.Contains(otherKey) != true) if (!lastPressedActions.Contains(otherKey))
timeToAcceptAnyKeyAfter = Time.Current; timeToAcceptAnyKeyAfter = Time.Current;
} }
@ -164,6 +170,9 @@ namespace osu.Game.Rulesets.Osu.Skinning.Default
lastScreenSpaceMousePosition.HasValue && followCircle.ReceivePositionalInputAt(lastScreenSpaceMousePosition.Value) && lastScreenSpaceMousePosition.HasValue && followCircle.ReceivePositionalInputAt(lastScreenSpaceMousePosition.Value) &&
// valid action // valid action
(actions?.Any(isValidTrackingAction) ?? false); (actions?.Any(isValidTrackingAction) ?? false);
lastPressedActions.Clear();
lastPressedActions.AddRange(actions);
} }
/// <summary> /// <summary>