mirror of
https://github.com/ppy/osu.git
synced 2024-11-11 09:27:29 +08:00
Merge branch 'master' into fix-taiko-whistle
This commit is contained in:
commit
dabf782a23
@ -2,9 +2,9 @@
|
||||
// See the LICENCE file in the repository root for full licence text.
|
||||
|
||||
using System;
|
||||
using System.Linq;
|
||||
using NUnit.Framework;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Game.Rulesets.Mods;
|
||||
using osu.Game.Rulesets.Osu;
|
||||
using osu.Game.Screens.Play;
|
||||
@ -16,7 +16,7 @@ namespace osu.Game.Tests.Visual.Gameplay
|
||||
[TestFixture]
|
||||
public class TestSceneSkipOverlay : OsuManualInputManagerTestScene
|
||||
{
|
||||
private SkipOverlay skip;
|
||||
private TestSkipOverlay skip;
|
||||
private int requestCount;
|
||||
|
||||
private double increment;
|
||||
@ -37,7 +37,7 @@ namespace osu.Game.Tests.Visual.Gameplay
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Children = new Drawable[]
|
||||
{
|
||||
skip = new SkipOverlay(skip_time)
|
||||
skip = new TestSkipOverlay(skip_time)
|
||||
{
|
||||
RequestSkip = () =>
|
||||
{
|
||||
@ -56,19 +56,19 @@ namespace osu.Game.Tests.Visual.Gameplay
|
||||
public void TestFadeOnIdle()
|
||||
{
|
||||
AddStep("move mouse", () => InputManager.MoveMouseTo(Vector2.Zero));
|
||||
AddUntilStep("fully visible", () => skip.Children.First().Alpha == 1);
|
||||
AddUntilStep("wait for fade", () => skip.Children.First().Alpha < 1);
|
||||
AddUntilStep("fully visible", () => skip.FadingContent.Alpha == 1);
|
||||
AddUntilStep("wait for fade", () => skip.FadingContent.Alpha < 1);
|
||||
|
||||
AddStep("move mouse", () => InputManager.MoveMouseTo(skip.ScreenSpaceDrawQuad.Centre));
|
||||
AddUntilStep("fully visible", () => skip.Children.First().Alpha == 1);
|
||||
AddUntilStep("wait for fade", () => skip.Children.First().Alpha < 1);
|
||||
AddUntilStep("fully visible", () => skip.FadingContent.Alpha == 1);
|
||||
AddUntilStep("wait for fade", () => skip.FadingContent.Alpha < 1);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestClickableAfterFade()
|
||||
{
|
||||
AddStep("move mouse", () => InputManager.MoveMouseTo(skip.ScreenSpaceDrawQuad.Centre));
|
||||
AddUntilStep("wait for fade", () => skip.Children.First().Alpha == 0);
|
||||
AddUntilStep("wait for fade", () => skip.FadingContent.Alpha == 0);
|
||||
AddStep("click", () => InputManager.Click(MouseButton.Left));
|
||||
checkRequestCount(1);
|
||||
}
|
||||
@ -105,13 +105,25 @@ namespace osu.Game.Tests.Visual.Gameplay
|
||||
{
|
||||
AddStep("move mouse", () => InputManager.MoveMouseTo(skip.ScreenSpaceDrawQuad.Centre));
|
||||
AddStep("button down", () => InputManager.PressButton(MouseButton.Left));
|
||||
AddUntilStep("wait for overlay disappear", () => !skip.IsPresent);
|
||||
AddAssert("ensure button didn't disappear", () => skip.Children.First().Alpha > 0);
|
||||
AddUntilStep("wait for overlay disappear", () => !skip.OverlayContent.IsPresent);
|
||||
AddAssert("ensure button didn't disappear", () => skip.FadingContent.Alpha > 0);
|
||||
AddStep("button up", () => InputManager.ReleaseButton(MouseButton.Left));
|
||||
checkRequestCount(0);
|
||||
}
|
||||
|
||||
private void checkRequestCount(int expected) =>
|
||||
AddAssert($"request count is {expected}", () => requestCount == expected);
|
||||
|
||||
private class TestSkipOverlay : SkipOverlay
|
||||
{
|
||||
public TestSkipOverlay(double startTime)
|
||||
: base(startTime)
|
||||
{
|
||||
}
|
||||
|
||||
public Drawable OverlayContent => InternalChild;
|
||||
|
||||
public Drawable FadingContent => (OverlayContent as Container)?.Child;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -69,6 +69,7 @@ namespace osu.Game.Tests.Visual.Multiplayer
|
||||
{
|
||||
settings.NameField.Current.Value = expected_name;
|
||||
settings.DurationField.Current.Value = expectedDuration;
|
||||
Room.Playlist.Add(new PlaylistItem { Beatmap = { Value = CreateBeatmap(Ruleset.Value).BeatmapInfo } });
|
||||
|
||||
roomManager.CreateRequested = r =>
|
||||
{
|
||||
@ -89,6 +90,9 @@ namespace osu.Game.Tests.Visual.Multiplayer
|
||||
|
||||
AddStep("setup", () =>
|
||||
{
|
||||
Room.Name.Value = "Test Room";
|
||||
Room.Playlist.Add(new PlaylistItem { Beatmap = { Value = CreateBeatmap(Ruleset.Value).BeatmapInfo } });
|
||||
|
||||
fail = true;
|
||||
roomManager.CreateRequested = _ => !fail;
|
||||
});
|
||||
|
@ -133,7 +133,6 @@ namespace osu.Game.Screens.Multi.Match.Components
|
||||
{
|
||||
RelativeSizeAxes = Axes.X,
|
||||
TabbableContentContainer = this,
|
||||
OnCommit = (sender, text) => apply(),
|
||||
},
|
||||
},
|
||||
new Section("Duration")
|
||||
@ -196,7 +195,6 @@ namespace osu.Game.Screens.Multi.Match.Components
|
||||
RelativeSizeAxes = Axes.X,
|
||||
TabbableContentContainer = this,
|
||||
ReadOnly = true,
|
||||
OnCommit = (sender, text) => apply()
|
||||
},
|
||||
},
|
||||
new Section("Password (optional)")
|
||||
@ -207,7 +205,6 @@ namespace osu.Game.Screens.Multi.Match.Components
|
||||
RelativeSizeAxes = Axes.X,
|
||||
TabbableContentContainer = this,
|
||||
ReadOnly = true,
|
||||
OnCommit = (sender, text) => apply()
|
||||
},
|
||||
},
|
||||
},
|
||||
@ -331,6 +328,9 @@ namespace osu.Game.Screens.Multi.Match.Components
|
||||
|
||||
private void apply()
|
||||
{
|
||||
if (!ApplyButton.Enabled.Value)
|
||||
return;
|
||||
|
||||
hideError();
|
||||
|
||||
RoomName.Value = NameField.Text;
|
||||
|
@ -83,6 +83,8 @@ namespace osu.Game.Screens.Play
|
||||
|
||||
private BreakTracker breakTracker;
|
||||
|
||||
private SkipOverlay skipOverlay;
|
||||
|
||||
protected ScoreProcessor ScoreProcessor { get; private set; }
|
||||
|
||||
protected HealthProcessor HealthProcessor { get; private set; }
|
||||
@ -189,6 +191,7 @@ namespace osu.Game.Screens.Play
|
||||
HUDOverlay.ShowHud.Value = false;
|
||||
HUDOverlay.ShowHud.Disabled = true;
|
||||
BreakOverlay.Hide();
|
||||
skipOverlay.Hide();
|
||||
}
|
||||
|
||||
DrawableRuleset.HasReplayLoaded.BindValueChanged(_ => updatePauseOnFocusLostState(), true);
|
||||
@ -290,7 +293,7 @@ namespace osu.Game.Screens.Play
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.Centre
|
||||
},
|
||||
new SkipOverlay(DrawableRuleset.GameplayStartTime)
|
||||
skipOverlay = new SkipOverlay(DrawableRuleset.GameplayStartTime)
|
||||
{
|
||||
RequestSkip = GameplayClockContainer.Skip
|
||||
},
|
||||
|
@ -24,13 +24,14 @@ using osu.Game.Input.Bindings;
|
||||
|
||||
namespace osu.Game.Screens.Play
|
||||
{
|
||||
public class SkipOverlay : VisibilityContainer, IKeyBindingHandler<GlobalAction>
|
||||
public class SkipOverlay : CompositeDrawable, IKeyBindingHandler<GlobalAction>
|
||||
{
|
||||
private readonly double startTime;
|
||||
|
||||
public Action RequestSkip;
|
||||
|
||||
private Button button;
|
||||
private ButtonContainer buttonContainer;
|
||||
private Box remainingTimeBox;
|
||||
|
||||
private FadeContainer fadeContainer;
|
||||
@ -61,9 +62,10 @@ namespace osu.Game.Screens.Play
|
||||
[BackgroundDependencyLoader(true)]
|
||||
private void load(OsuColour colours)
|
||||
{
|
||||
Children = new Drawable[]
|
||||
InternalChild = buttonContainer = new ButtonContainer
|
||||
{
|
||||
fadeContainer = new FadeContainer
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Child = fadeContainer = new FadeContainer
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Children = new Drawable[]
|
||||
@ -104,14 +106,8 @@ namespace osu.Game.Screens.Play
|
||||
|
||||
button.Action = () => RequestSkip?.Invoke();
|
||||
displayTime = gameplayClock.CurrentTime;
|
||||
|
||||
Show();
|
||||
}
|
||||
|
||||
protected override void PopIn() => this.FadeIn(fade_time);
|
||||
|
||||
protected override void PopOut() => this.FadeOut(fade_time);
|
||||
|
||||
protected override void Update()
|
||||
{
|
||||
base.Update();
|
||||
@ -121,13 +117,14 @@ namespace osu.Game.Screens.Play
|
||||
remainingTimeBox.Width = (float)Interpolation.Lerp(remainingTimeBox.Width, progress, Math.Clamp(Time.Elapsed / 40, 0, 1));
|
||||
|
||||
button.Enabled.Value = progress > 0;
|
||||
State.Value = progress > 0 ? Visibility.Visible : Visibility.Hidden;
|
||||
buttonContainer.State.Value = progress > 0 ? Visibility.Visible : Visibility.Hidden;
|
||||
}
|
||||
|
||||
protected override bool OnMouseMove(MouseMoveEvent e)
|
||||
{
|
||||
if (!e.HasAnyButtonPressed)
|
||||
fadeContainer.Show();
|
||||
|
||||
return base.OnMouseMove(e);
|
||||
}
|
||||
|
||||
@ -214,6 +211,13 @@ namespace osu.Game.Screens.Play
|
||||
public override void Show() => State = Visibility.Visible;
|
||||
}
|
||||
|
||||
private class ButtonContainer : VisibilityContainer
|
||||
{
|
||||
protected override void PopIn() => this.FadeIn(fade_time);
|
||||
|
||||
protected override void PopOut() => this.FadeOut(fade_time);
|
||||
}
|
||||
|
||||
private class Button : OsuClickableContainer
|
||||
{
|
||||
private Color4 colourNormal;
|
||||
|
Loading…
Reference in New Issue
Block a user