mirror of
https://github.com/ppy/osu.git
synced 2024-11-11 09:27:29 +08:00
Merge pull request #26937 from frenzibyte/fix-osu-logo-blocking-load
Stop blocking player load when hovering over osu! logo
This commit is contained in:
commit
970e45ff24
@ -25,9 +25,11 @@ using osu.Game.Rulesets.Osu;
|
||||
using osu.Game.Rulesets.Osu.Mods;
|
||||
using osu.Game.Rulesets.Scoring;
|
||||
using osu.Game.Scoring;
|
||||
using osu.Game.Screens.Menu;
|
||||
using osu.Game.Screens.Play;
|
||||
using osu.Game.Screens.Play.PlayerSettings;
|
||||
using osu.Game.Utils;
|
||||
using osuTK;
|
||||
using osuTK.Input;
|
||||
|
||||
namespace osu.Game.Tests.Visual.Gameplay
|
||||
@ -55,6 +57,9 @@ namespace osu.Game.Tests.Visual.Gameplay
|
||||
[Cached]
|
||||
private readonly VolumeOverlay volumeOverlay;
|
||||
|
||||
[Cached]
|
||||
private readonly OsuLogo logo;
|
||||
|
||||
[Cached(typeof(BatteryInfo))]
|
||||
private readonly LocalBatteryInfo batteryInfo = new LocalBatteryInfo();
|
||||
|
||||
@ -78,7 +83,14 @@ namespace osu.Game.Tests.Visual.Gameplay
|
||||
Anchor = Anchor.TopLeft,
|
||||
Origin = Anchor.TopLeft,
|
||||
},
|
||||
changelogOverlay = new ChangelogOverlay()
|
||||
changelogOverlay = new ChangelogOverlay(),
|
||||
logo = new OsuLogo
|
||||
{
|
||||
Anchor = Anchor.BottomRight,
|
||||
Origin = Anchor.BottomRight,
|
||||
Scale = new Vector2(0.5f),
|
||||
Position = new Vector2(128f),
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
@ -212,6 +224,36 @@ namespace osu.Game.Tests.Visual.Gameplay
|
||||
AddUntilStep("loads after idle", () => !loader.IsCurrentScreen());
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestLoadNotBlockedOnOsuLogo()
|
||||
{
|
||||
AddStep("load dummy beatmap", () => resetPlayer(false));
|
||||
AddUntilStep("wait for current", () => loader.IsCurrentScreen());
|
||||
|
||||
AddUntilStep("wait for load ready", () =>
|
||||
{
|
||||
moveMouse();
|
||||
return player?.LoadState == LoadState.Ready;
|
||||
});
|
||||
|
||||
// move mouse in logo while waiting for load to still proceed (it shouldn't be blocked when hovering logo).
|
||||
AddUntilStep("move mouse in logo", () =>
|
||||
{
|
||||
moveMouse();
|
||||
return !loader.IsCurrentScreen();
|
||||
});
|
||||
|
||||
void moveMouse()
|
||||
{
|
||||
notificationOverlay.State.Value = Visibility.Hidden;
|
||||
|
||||
InputManager.MoveMouseTo(
|
||||
logo.ScreenSpaceDrawQuad.TopLeft
|
||||
+ (logo.ScreenSpaceDrawQuad.BottomRight - logo.ScreenSpaceDrawQuad.TopLeft)
|
||||
* RNG.NextSingle(0.3f, 0.7f));
|
||||
}
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestLoadContinuation()
|
||||
{
|
||||
|
@ -110,8 +110,8 @@ namespace osu.Game.Screens.Play
|
||||
&& ReadyForGameplay;
|
||||
|
||||
protected virtual bool ReadyForGameplay =>
|
||||
// not ready if the user is hovering one of the panes, unless they are idle.
|
||||
(IsHovered || idleTracker.IsIdle.Value)
|
||||
// not ready if the user is hovering one of the panes (logo is excluded), unless they are idle.
|
||||
(IsHovered || osuLogo?.IsHovered == true || idleTracker.IsIdle.Value)
|
||||
// not ready if the user is dragging a slider or otherwise.
|
||||
&& inputManager.DraggedDrawable == null
|
||||
// not ready if a focused overlay is visible, like settings.
|
||||
@ -335,10 +335,14 @@ namespace osu.Game.Screens.Play
|
||||
return base.OnExiting(e);
|
||||
}
|
||||
|
||||
private OsuLogo? osuLogo;
|
||||
|
||||
protected override void LogoArriving(OsuLogo logo, bool resuming)
|
||||
{
|
||||
base.LogoArriving(logo, resuming);
|
||||
|
||||
osuLogo = logo;
|
||||
|
||||
const double duration = 300;
|
||||
|
||||
if (!resuming) logo.MoveTo(new Vector2(0.5f), duration, Easing.OutQuint);
|
||||
@ -357,6 +361,7 @@ namespace osu.Game.Screens.Play
|
||||
{
|
||||
base.LogoExiting(logo);
|
||||
content.StopTracking();
|
||||
osuLogo = null;
|
||||
}
|
||||
|
||||
protected override void LogoSuspending(OsuLogo logo)
|
||||
@ -367,6 +372,8 @@ namespace osu.Game.Screens.Play
|
||||
logo
|
||||
.FadeOut(CONTENT_OUT_DURATION / 2, Easing.OutQuint)
|
||||
.ScaleTo(logo.Scale * 0.8f, CONTENT_OUT_DURATION * 2, Easing.OutQuint);
|
||||
|
||||
osuLogo = null;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
Loading…
Reference in New Issue
Block a user