1
0
mirror of https://github.com/ppy/osu.git synced 2025-02-13 15:43:21 +08:00

Block player enter when a drag initiates from an overlaying container

This commit is contained in:
Dean Herbert 2018-03-08 18:16:23 +09:00
parent 80bd2a95f6
commit d3e91024a7
2 changed files with 20 additions and 3 deletions

View File

@ -5,6 +5,7 @@ using osu.Framework.Allocation;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Sprites;
using osu.Framework.Input;
using osu.Framework.Screens;
using osu.Game.Beatmaps;
using osu.Game.Graphics;
@ -22,7 +23,6 @@ namespace osu.Game.Screens.Play
private Player player;
private BeatmapMetadataDisplay info;
private VisualSettings visualSettings;
private bool showOverlays = true;
public override bool ShowOverlaysOnEnter => showOverlays;
@ -51,7 +51,7 @@ namespace osu.Game.Screens.Play
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
});
Add(visualSettings = new VisualSettings
Add(new VisualSettings
{
Anchor = Anchor.TopRight,
Origin = Anchor.TopRight,
@ -116,9 +116,22 @@ namespace osu.Game.Screens.Play
logo.Delay(resuming ? 0 : 500).MoveToOffset(new Vector2(0, -0.24f), 500, Easing.InOutExpo);
}
private bool weHandledMouseDown;
protected override bool OnMouseDown(InputState state, MouseDownEventArgs args)
{
weHandledMouseDown = true;
return base.OnMouseDown(state, args);
}
protected override bool OnMouseUp(InputState state, MouseUpEventArgs args)
{
weHandledMouseDown = false;
return base.OnMouseUp(state, args);
}
private void pushWhenLoaded()
{
if (player.LoadState != LoadState.Ready || visualSettings.IsHovered)
if (player.LoadState != LoadState.Ready || !IsHovered || GetContainingInputManager().CurrentState.Mouse.HasAnyButtonPressed && !weHandledMouseDown)
{
Schedule(pushWhenLoaded);
return;

View File

@ -5,6 +5,7 @@ using osu.Framework.Allocation;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Shapes;
using osu.Framework.Input;
using osu.Game.Graphics;
using osu.Game.Graphics.Sprites;
using osu.Game.Graphics.UserInterface;
@ -133,5 +134,8 @@ namespace osu.Game.Screens.Play.PlayerSettings
}
protected override Container<Drawable> Content => content;
protected override bool OnHover(InputState state) => true;
protected override bool OnMouseDown(InputState state, MouseDownEventArgs args) => true;
}
}