1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-12 18:23:04 +08:00

Merge branch 'master' into brace-escaping-in-links

This commit is contained in:
Dan Balasescu 2019-09-04 13:57:39 +09:00 committed by GitHub
commit 1aead3cda8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
11 changed files with 145 additions and 143 deletions

View File

@ -60,7 +60,7 @@
<Reference Include="Java.Interop" /> <Reference Include="Java.Interop" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="ppy.osu.Game.Resources" Version="2019.903.1" /> <PackageReference Include="ppy.osu.Game.Resources" Version="2019.904.0" />
<PackageReference Include="ppy.osu.Framework.Android" Version="2019.830.1" /> <PackageReference Include="ppy.osu.Framework.Android" Version="2019.830.1" />
</ItemGroup> </ItemGroup>
</Project> </Project>

View File

@ -86,7 +86,7 @@ namespace osu.Game.Rulesets.Catch.Tests
{ {
switch (component.LookupName) switch (component.LookupName)
{ {
case "Gameplay/Catch/fruit-catcher-idle": case "Gameplay/catch/fruit-catcher-idle":
return new CatcherCustomSkin(); return new CatcherCustomSkin();
} }

View File

@ -5,6 +5,7 @@ using System;
using osu.Game.Beatmaps; using osu.Game.Beatmaps;
using osu.Game.Beatmaps.ControlPoints; using osu.Game.Beatmaps.ControlPoints;
using osu.Game.Rulesets.Judgements; using osu.Game.Rulesets.Judgements;
using osu.Game.Rulesets.Objects;
using osu.Game.Rulesets.Osu.Judgements; using osu.Game.Rulesets.Osu.Judgements;
namespace osu.Game.Rulesets.Osu.Objects namespace osu.Game.Rulesets.Osu.Objects
@ -28,5 +29,7 @@ namespace osu.Game.Rulesets.Osu.Objects
} }
public override Judgement CreateJudgement() => new OsuJudgement(); public override Judgement CreateJudgement() => new OsuJudgement();
protected override HitWindows CreateHitWindows() => null;
} }
} }

View File

@ -23,5 +23,7 @@ namespace osu.Game.Rulesets.Osu.Objects
} }
public override Judgement CreateJudgement() => new OsuSliderTailJudgement(); public override Judgement CreateJudgement() => new OsuSliderTailJudgement();
protected override HitWindows CreateHitWindows() => null;
} }
} }

View File

@ -143,7 +143,7 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables
// Normal and clap samples are handled by the drum // Normal and clap samples are handled by the drum
protected override IEnumerable<HitSampleInfo> GetSamples() => HitObject.Samples.Where(s => s.Name != HitSampleInfo.HIT_NORMAL && s.Name != HitSampleInfo.HIT_CLAP); protected override IEnumerable<HitSampleInfo> GetSamples() => HitObject.Samples.Where(s => s.Name != HitSampleInfo.HIT_NORMAL && s.Name != HitSampleInfo.HIT_CLAP);
protected override string SampleNamespace => "Taiko"; protected override string SampleNamespace => "taiko";
protected virtual TaikoPiece CreateMainPiece() => new CirclePiece(); protected virtual TaikoPiece CreateMainPiece() => new CirclePiece();

View File

@ -132,10 +132,10 @@ namespace osu.Game.Rulesets.Taiko.UI
[BackgroundDependencyLoader] [BackgroundDependencyLoader]
private void load(TextureStore textures, OsuColour colours) private void load(TextureStore textures, OsuColour colours)
{ {
rim.Texture = textures.Get(@"Gameplay/Taiko/taiko-drum-outer"); rim.Texture = textures.Get(@"Gameplay/taiko/taiko-drum-outer");
rimHit.Texture = textures.Get(@"Gameplay/Taiko/taiko-drum-outer-hit"); rimHit.Texture = textures.Get(@"Gameplay/taiko/taiko-drum-outer-hit");
centre.Texture = textures.Get(@"Gameplay/Taiko/taiko-drum-inner"); centre.Texture = textures.Get(@"Gameplay/taiko/taiko-drum-inner");
centreHit.Texture = textures.Get(@"Gameplay/Taiko/taiko-drum-inner-hit"); centreHit.Texture = textures.Get(@"Gameplay/taiko/taiko-drum-inner-hit");
rimHit.Colour = colours.Blue; rimHit.Colour = colours.Blue;
centreHit.Colour = colours.Pink; centreHit.Colour = colours.Pink;

View File

@ -3,12 +3,13 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.ComponentModel;
using System.Linq; using System.Linq;
using NUnit.Framework;
using osu.Framework.Allocation; using osu.Framework.Allocation;
using osu.Framework.Graphics; using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Containers;
using osu.Framework.Logging; using osu.Framework.Logging;
using osu.Game.Graphics.UserInterface;
using osu.Game.Input.Bindings; using osu.Game.Input.Bindings;
using osu.Game.Screens.Play; using osu.Game.Screens.Play;
using osuTK; using osuTK;
@ -16,7 +17,7 @@ using osuTK.Input;
namespace osu.Game.Tests.Visual.Gameplay namespace osu.Game.Tests.Visual.Gameplay
{ {
[Description("player pause/fail screens")] [System.ComponentModel.Description("player pause/fail screens")]
public class TestSceneGameplayMenuOverlay : ManualInputManagerTestScene public class TestSceneGameplayMenuOverlay : ManualInputManagerTestScene
{ {
public override IReadOnlyList<Type> RequiredTypes => new[] { typeof(FailOverlay), typeof(PauseOverlay) }; public override IReadOnlyList<Type> RequiredTypes => new[] { typeof(FailOverlay), typeof(PauseOverlay) };
@ -29,9 +30,13 @@ namespace osu.Game.Tests.Visual.Gameplay
[BackgroundDependencyLoader] [BackgroundDependencyLoader]
private void load(OsuGameBase game) private void load(OsuGameBase game)
{ {
Child = globalActionContainer = new GlobalActionContainer(game) Child = globalActionContainer = new GlobalActionContainer(game);
}
[SetUp]
public void SetUp() => Schedule(() =>
{ {
Children = new Drawable[] globalActionContainer.Children = new Drawable[]
{ {
pauseOverlay = new PauseOverlay pauseOverlay = new PauseOverlay
{ {
@ -45,41 +50,98 @@ namespace osu.Game.Tests.Visual.Gameplay
OnRetry = () => Logger.Log(@"Retry"), OnRetry = () => Logger.Log(@"Retry"),
OnQuit = () => Logger.Log(@"Quit"), OnQuit = () => Logger.Log(@"Quit"),
} }
}
}; };
InputManager.MoveMouseTo(Vector2.Zero);
});
[Test]
public void TestAdjustRetryCount()
{
showOverlay();
var retryCount = 0; var retryCount = 0;
AddStep("Add retry", () => AddRepeatStep("Add retry", () =>
{ {
retryCount++; retryCount++;
pauseOverlay.Retries = failOverlay.Retries = retryCount; pauseOverlay.Retries = failOverlay.Retries = retryCount;
}); }, 10);
}
AddToggleStep("Toggle pause overlay", t => pauseOverlay.ToggleVisibility()); /// <summary>
AddToggleStep("Toggle fail overlay", t => failOverlay.ToggleVisibility()); /// Tests that pressing enter after an overlay shows doesn't trigger an event because a selection hasn't occurred.
/// </summary>
[Test]
public void TestEnterWithoutSelection()
{
showOverlay();
testHideResets(); AddStep("Press select", () => press(GlobalAction.Select));
AddAssert("Overlay still open", () => pauseOverlay.State.Value == Visibility.Visible);
}
testEnterWithoutSelection(); /// <summary>
testKeyUpFromInitial(); /// Tests that pressing the up arrow from the initial state selects the last button.
testKeyDownFromInitial(); /// </summary>
testKeyUpWrapping(); [Test]
testKeyDownWrapping(); public void TestKeyUpFromInitial()
{
showOverlay();
testMouseSelectionAfterKeySelection(); AddStep("Up arrow", () => press(Key.Up));
testKeySelectionAfterMouseSelection(); AddAssert("Last button selected", () => pauseOverlay.Buttons.Last().Selected.Value);
}
testMouseDeselectionResets(); /// <summary>
/// Tests that pressing the down arrow from the initial state selects the first button.
/// </summary>
[Test]
public void TestKeyDownFromInitial()
{
showOverlay();
testClickSelection(); AddStep("Down arrow", () => press(Key.Down));
testEnterKeySelection(); AddAssert("First button selected", () => getButton(0).Selected.Value);
}
/// <summary>
/// Tests that pressing the up arrow repeatedly causes the selected button to wrap correctly.
/// </summary>
[Test]
public void TestKeyUpWrapping()
{
AddStep("Show overlay", () => failOverlay.Show());
AddStep("Up arrow", () => press(Key.Up));
AddAssert("Last button selected", () => failOverlay.Buttons.Last().Selected.Value);
AddStep("Up arrow", () => press(Key.Up));
AddAssert("First button selected", () => failOverlay.Buttons.First().Selected.Value);
AddStep("Up arrow", () => press(Key.Up));
AddAssert("Last button selected", () => failOverlay.Buttons.Last().Selected.Value);
}
/// <summary>
/// Tests that pressing the down arrow repeatedly causes the selected button to wrap correctly.
/// </summary>
[Test]
public void TestKeyDownWrapping()
{
AddStep("Show overlay", () => failOverlay.Show());
AddStep("Down arrow", () => press(Key.Down));
AddAssert("First button selected", () => failOverlay.Buttons.First().Selected.Value);
AddStep("Down arrow", () => press(Key.Down));
AddAssert("Last button selected", () => failOverlay.Buttons.Last().Selected.Value);
AddStep("Down arrow", () => press(Key.Down));
AddAssert("First button selected", () => failOverlay.Buttons.First().Selected.Value);
} }
/// <summary> /// <summary>
/// Test that hiding the overlay after hovering a button will reset the overlay to the initial state with no buttons selected. /// Test that hiding the overlay after hovering a button will reset the overlay to the initial state with no buttons selected.
/// </summary> /// </summary>
private void testHideResets() [Test]
public void TestHideResets()
{ {
AddStep("Show overlay", () => failOverlay.Show()); AddStep("Show overlay", () => failOverlay.Show());
@ -90,141 +152,73 @@ namespace osu.Game.Tests.Visual.Gameplay
} }
/// <summary> /// <summary>
/// Tests that pressing enter after an overlay shows doesn't trigger an event because a selection hasn't occurred. /// Tests that entering menu with cursor initially on button selects it.
/// </summary> /// </summary>
private void testEnterWithoutSelection() [Test]
public void TestInitialButtonHover()
{ {
AddStep("Show overlay", () => pauseOverlay.Show()); showOverlay();
AddStep("Press select", () => press(GlobalAction.Select)); AddStep("Hover first button", () => InputManager.MoveMouseTo(getButton(0)));
AddAssert("Overlay still open", () => pauseOverlay.State.Value == Visibility.Visible);
AddStep("Hide overlay", () => pauseOverlay.Hide()); AddStep("Hide overlay", () => pauseOverlay.Hide());
} showOverlay();
/// <summary> AddAssert("First button selected", () => getButton(0).Selected.Value);
/// Tests that pressing the up arrow from the initial state selects the last button.
/// </summary>
private void testKeyUpFromInitial()
{
AddStep("Show overlay", () => pauseOverlay.Show());
AddStep("Up arrow", () => press(Key.Up));
AddAssert("Last button selected", () => pauseOverlay.Buttons.Last().Selected.Value);
AddStep("Hide overlay", () => pauseOverlay.Hide());
}
/// <summary>
/// Tests that pressing the down arrow from the initial state selects the first button.
/// </summary>
private void testKeyDownFromInitial()
{
AddStep("Show overlay", () => pauseOverlay.Show());
AddStep("Down arrow", () => press(Key.Down));
AddAssert("First button selected", () => pauseOverlay.Buttons.First().Selected.Value);
AddStep("Hide overlay", () => pauseOverlay.Hide());
}
/// <summary>
/// Tests that pressing the up arrow repeatedly causes the selected button to wrap correctly.
/// </summary>
private void testKeyUpWrapping()
{
AddStep("Show overlay", () => failOverlay.Show());
AddStep("Up arrow", () => press(Key.Up));
AddAssert("Last button selected", () => failOverlay.Buttons.Last().Selected.Value);
AddStep("Up arrow", () => press(Key.Up));
AddAssert("First button selected", () => failOverlay.Buttons.First().Selected.Value);
AddStep("Up arrow", () => press(Key.Up));
AddAssert("Last button selected", () => failOverlay.Buttons.Last().Selected.Value);
AddStep("Hide overlay", () => failOverlay.Hide());
}
/// <summary>
/// Tests that pressing the down arrow repeatedly causes the selected button to wrap correctly.
/// </summary>
private void testKeyDownWrapping()
{
AddStep("Show overlay", () => failOverlay.Show());
AddStep("Down arrow", () => press(Key.Down));
AddAssert("First button selected", () => failOverlay.Buttons.First().Selected.Value);
AddStep("Down arrow", () => press(Key.Down));
AddAssert("Last button selected", () => failOverlay.Buttons.Last().Selected.Value);
AddStep("Down arrow", () => press(Key.Down));
AddAssert("First button selected", () => failOverlay.Buttons.First().Selected.Value);
AddStep("Hide overlay", () => failOverlay.Hide());
} }
/// <summary> /// <summary>
/// Tests that hovering a button that was previously selected with the keyboard correctly selects the new button and deselects the previous button. /// Tests that hovering a button that was previously selected with the keyboard correctly selects the new button and deselects the previous button.
/// </summary> /// </summary>
private void testMouseSelectionAfterKeySelection() [Test]
public void TestMouseSelectionAfterKeySelection()
{ {
AddStep("Show overlay", () => pauseOverlay.Show()); showOverlay();
var secondButton = pauseOverlay.Buttons.Skip(1).First();
AddStep("Down arrow", () => press(Key.Down)); AddStep("Down arrow", () => press(Key.Down));
AddStep("Hover second button", () => InputManager.MoveMouseTo(secondButton)); AddStep("Hover second button", () => InputManager.MoveMouseTo(getButton(1)));
AddAssert("First button not selected", () => !pauseOverlay.Buttons.First().Selected.Value); AddAssert("First button not selected", () => !getButton(0).Selected.Value);
AddAssert("Second button selected", () => secondButton.Selected.Value); AddAssert("Second button selected", () => getButton(1).Selected.Value);
AddStep("Hide overlay", () => pauseOverlay.Hide());
} }
/// <summary> /// <summary>
/// Tests that pressing a key after selecting a button with a hover event correctly selects a new button and deselects the previous button. /// Tests that pressing a key after selecting a button with a hover event correctly selects a new button and deselects the previous button.
/// </summary> /// </summary>
private void testKeySelectionAfterMouseSelection() [Test]
public void TestKeySelectionAfterMouseSelection()
{ {
AddStep("Show overlay", () => AddStep("Show overlay", () =>
{ {
pauseOverlay.Show(); pauseOverlay.Show();
InputManager.MoveMouseTo(Vector2.Zero);
}); });
var secondButton = pauseOverlay.Buttons.Skip(1).First(); AddStep("Hover second button", () => InputManager.MoveMouseTo(getButton(1)));
AddStep("Hover second button", () => InputManager.MoveMouseTo(secondButton));
AddStep("Up arrow", () => press(Key.Up)); AddStep("Up arrow", () => press(Key.Up));
AddAssert("Second button not selected", () => !secondButton.Selected.Value); AddAssert("Second button not selected", () => !getButton(1).Selected.Value);
AddAssert("First button selected", () => pauseOverlay.Buttons.First().Selected.Value); AddAssert("First button selected", () => getButton(0).Selected.Value);
AddStep("Hide overlay", () => pauseOverlay.Hide());
} }
/// <summary> /// <summary>
/// Tests that deselecting with the mouse by losing hover will reset the overlay to the initial state. /// Tests that deselecting with the mouse by losing hover will reset the overlay to the initial state.
/// </summary> /// </summary>
private void testMouseDeselectionResets() [Test]
public void TestMouseDeselectionResets()
{ {
AddStep("Show overlay", () => pauseOverlay.Show()); showOverlay();
var secondButton = pauseOverlay.Buttons.Skip(1).First(); AddStep("Hover second button", () => InputManager.MoveMouseTo(getButton(1)));
AddStep("Hover second button", () => InputManager.MoveMouseTo(secondButton));
AddStep("Unhover second button", () => InputManager.MoveMouseTo(Vector2.Zero)); AddStep("Unhover second button", () => InputManager.MoveMouseTo(Vector2.Zero));
AddStep("Down arrow", () => press(Key.Down)); AddStep("Down arrow", () => press(Key.Down));
AddAssert("First button selected", () => pauseOverlay.Buttons.First().Selected.Value); // Initial state condition AddAssert("First button selected", () => getButton(0).Selected.Value); // Initial state condition
AddStep("Hide overlay", () => pauseOverlay.Hide());
} }
/// <summary> /// <summary>
/// Tests that clicking on a button correctly causes a click event for that button. /// Tests that clicking on a button correctly causes a click event for that button.
/// </summary> /// </summary>
private void testClickSelection() [Test]
public void TestClickSelection()
{ {
AddStep("Show overlay", () => pauseOverlay.Show()); showOverlay();
var retryButton = pauseOverlay.Buttons.Skip(1).First();
bool triggered = false; bool triggered = false;
AddStep("Click retry button", () => AddStep("Click retry button", () =>
@ -232,7 +226,7 @@ namespace osu.Game.Tests.Visual.Gameplay
var lastAction = pauseOverlay.OnRetry; var lastAction = pauseOverlay.OnRetry;
pauseOverlay.OnRetry = () => triggered = true; pauseOverlay.OnRetry = () => triggered = true;
retryButton.Click(); getButton(1).Click();
pauseOverlay.OnRetry = lastAction; pauseOverlay.OnRetry = lastAction;
}); });
@ -243,9 +237,10 @@ namespace osu.Game.Tests.Visual.Gameplay
/// <summary> /// <summary>
/// Tests that pressing the enter key with a button selected correctly causes a click event for that button. /// Tests that pressing the enter key with a button selected correctly causes a click event for that button.
/// </summary> /// </summary>
private void testEnterKeySelection() [Test]
public void TestEnterKeySelection()
{ {
AddStep("Show overlay", () => pauseOverlay.Show()); showOverlay();
AddStep("Select second button", () => AddStep("Select second button", () =>
{ {
@ -275,6 +270,10 @@ namespace osu.Game.Tests.Visual.Gameplay
AddAssert("Overlay is closed", () => pauseOverlay.State.Value == Visibility.Hidden); AddAssert("Overlay is closed", () => pauseOverlay.State.Value == Visibility.Hidden);
} }
private void showOverlay() => AddStep("Show overlay", () => pauseOverlay.Show());
private DialogButton getButton(int index) => pauseOverlay.Buttons.Skip(index).First();
private void press(Key key) private void press(Key key)
{ {
InputManager.PressKey(key); InputManager.PressKey(key);

View File

@ -34,12 +34,12 @@ namespace osu.Game.Graphics.UserInterface
this.buttons = buttons ?? new[] { MouseButton.Left }; this.buttons = buttons ?? new[] { MouseButton.Left };
} }
protected override bool OnMouseUp(MouseUpEvent e) protected override bool OnClick(ClickEvent e)
{ {
if (buttons.Contains(e.Button) && Contains(e.ScreenSpaceMousePosition)) if (buttons.Contains(e.Button) && Contains(e.ScreenSpaceMousePosition))
sampleClick?.Play(); sampleClick?.Play();
return base.OnMouseUp(e); return base.OnClick(e);
} }
[BackgroundDependencyLoader] [BackgroundDependencyLoader]

View File

@ -304,8 +304,6 @@ namespace osu.Game.Screens.Play
private class Button : DialogButton private class Button : DialogButton
{ {
protected override bool OnHover(HoverEvent e) => true;
protected override bool OnMouseMove(MouseMoveEvent e) protected override bool OnMouseMove(MouseMoveEvent e)
{ {
Selected.Value = true; Selected.Value = true;

View File

@ -14,7 +14,7 @@
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="2.2.6" /> <PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="2.2.6" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite.Core" Version="2.2.6" /> <PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite.Core" Version="2.2.6" />
<PackageReference Include="Newtonsoft.Json" Version="12.0.2" /> <PackageReference Include="Newtonsoft.Json" Version="12.0.2" />
<PackageReference Include="ppy.osu.Game.Resources" Version="2019.903.1" /> <PackageReference Include="ppy.osu.Game.Resources" Version="2019.904.0" />
<PackageReference Include="ppy.osu.Framework" Version="2019.830.1" /> <PackageReference Include="ppy.osu.Framework" Version="2019.830.1" />
<PackageReference Include="SharpCompress" Version="0.24.0" /> <PackageReference Include="SharpCompress" Version="0.24.0" />
<PackageReference Include="NUnit" Version="3.12.0" /> <PackageReference Include="NUnit" Version="3.12.0" />

View File

@ -117,7 +117,7 @@
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="2.2.1" /> <PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="2.2.1" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite.Core" Version="2.2.1" /> <PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite.Core" Version="2.2.1" />
<PackageReference Include="Newtonsoft.Json" Version="12.0.1" /> <PackageReference Include="Newtonsoft.Json" Version="12.0.1" />
<PackageReference Include="ppy.osu.Game.Resources" Version="2019.903.1" /> <PackageReference Include="ppy.osu.Game.Resources" Version="2019.904.0" />
<PackageReference Include="ppy.osu.Framework" Version="2019.830.1" /> <PackageReference Include="ppy.osu.Framework" Version="2019.830.1" />
<PackageReference Include="ppy.osu.Framework.iOS" Version="2019.830.1" /> <PackageReference Include="ppy.osu.Framework.iOS" Version="2019.830.1" />
<PackageReference Include="SharpCompress" Version="0.24.0" /> <PackageReference Include="SharpCompress" Version="0.24.0" />