1
0
mirror of https://github.com/ppy/osu.git synced 2025-02-16 01:42:54 +08:00

Allow fullscreen overlays to surface on subsequent show requests (#4989)

Allow fullscreen overlays to surface on subsequent show requests
This commit is contained in:
Dean Herbert 2019-06-12 00:21:37 +09:00 committed by GitHub
commit 15f1ee4b67
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 31 additions and 1 deletions

View File

@ -18,8 +18,24 @@ namespace osu.Game.Tests.Visual.Online
{ {
base.LoadComplete(); base.LoadComplete();
int fireCount = 0;
Add(overlay = new TestFullscreenOverlay()); Add(overlay = new TestFullscreenOverlay());
AddStep(@"toggle", overlay.ToggleVisibility);
overlay.State.ValueChanged += _ => fireCount++;
AddStep(@"show", overlay.Show);
AddAssert("fire count 1", () => fireCount == 1);
AddStep(@"show again", overlay.Show);
// this logic is specific to FullscreenOverlay
AddAssert("fire count 2", () => fireCount == 2);
AddStep(@"hide", overlay.Hide);
AddAssert("fire count 3", () => fireCount == 3);
} }
private class TestFullscreenOverlay : FullscreenOverlay private class TestFullscreenOverlay : FullscreenOverlay

View File

@ -4,6 +4,7 @@
using osu.Framework.Allocation; using osu.Framework.Allocation;
using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Extensions.Color4Extensions;
using osu.Framework.Graphics; using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Effects; using osu.Framework.Graphics.Effects;
using osu.Game.Graphics; using osu.Game.Graphics;
using osu.Game.Graphics.Containers; using osu.Game.Graphics.Containers;
@ -40,6 +41,19 @@ namespace osu.Game.Overlays
}; };
} }
public override void Show()
{
if (State.Value == Visibility.Visible)
{
// re-trigger the state changed so we can potentially surface to front
State.TriggerChange();
}
else
{
base.Show();
}
}
protected override void PopIn() protected override void PopIn()
{ {
base.PopIn(); base.PopIn();