1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-15 08:22:56 +08:00

Merge branch 'master' into fix-mod-panel-click-area

This commit is contained in:
Bartłomiej Dach 2022-05-24 21:52:37 +02:00 committed by GitHub
commit 2dd0b3f8d9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
11 changed files with 98 additions and 11 deletions

View File

@ -898,5 +898,24 @@ namespace osu.Game.Tests.Beatmaps.Formats
Assert.That(controlPoints[3].Type, Is.Null);
}
}
[Test]
public void TestLegacyDuplicateInitialCatmullPointIsMerged()
{
var decoder = new LegacyBeatmapDecoder { ApplyOffsets = false };
using (var resStream = TestResources.OpenResource("catmull-duplicate-initial-controlpoint.osu"))
using (var stream = new LineBufferedReader(resStream))
{
var decoded = decoder.Decode(stream);
var controlPoints = ((IHasPath)decoded.HitObjects[0]).Path.ControlPoints;
Assert.That(controlPoints.Count, Is.EqualTo(4));
Assert.That(controlPoints[0].Type, Is.EqualTo(PathType.Catmull));
Assert.That(controlPoints[0].Position, Is.EqualTo(Vector2.Zero));
Assert.That(controlPoints[1].Type, Is.Null);
Assert.That(controlPoints[1].Position, Is.Not.EqualTo(Vector2.Zero));
}
}
}
}

View File

@ -0,0 +1,2 @@
[HitObjects]
200,304,23875,6,0,C|200:304|288:304|288:208|352:208,1,260,8|0

View File

@ -8,9 +8,11 @@ using osu.Framework.Allocation;
using osu.Framework.Extensions;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.UserInterface;
using osu.Framework.Screens;
using osu.Framework.Testing;
using osu.Game.Beatmaps;
using osu.Game.Collections;
using osu.Game.Configuration;
using osu.Game.Graphics.UserInterface;
using osu.Game.Online.Leaderboards;
@ -54,6 +56,39 @@ namespace osu.Game.Tests.Visual.Navigation
exitViaEscapeAndConfirm();
}
[Test]
public void TestSongSelectBackActionHandling()
{
TestPlaySongSelect songSelect = null;
PushAndConfirm(() => songSelect = new TestPlaySongSelect());
AddStep("set filter", () => songSelect.ChildrenOfType<SearchTextBox>().Single().Current.Value = "test");
AddStep("press back", () => InputManager.Click(MouseButton.Button1));
AddAssert("still at song select", () => Game.ScreenStack.CurrentScreen == songSelect);
AddAssert("filter cleared", () => string.IsNullOrEmpty(songSelect.ChildrenOfType<SearchTextBox>().Single().Current.Value));
AddStep("set filter again", () => songSelect.ChildrenOfType<SearchTextBox>().Single().Current.Value = "test");
AddStep("open collections dropdown", () =>
{
InputManager.MoveMouseTo(songSelect.ChildrenOfType<CollectionFilterDropdown>().Single());
InputManager.Click(MouseButton.Left);
});
AddStep("press back once", () => InputManager.Click(MouseButton.Button1));
AddAssert("still at song select", () => Game.ScreenStack.CurrentScreen == songSelect);
AddAssert("collections dropdown closed", () => songSelect
.ChildrenOfType<CollectionFilterDropdown>().Single()
.ChildrenOfType<Dropdown<CollectionFilterMenuItem>.DropdownMenu>().Single().State == MenuState.Closed);
AddStep("press back a second time", () => InputManager.Click(MouseButton.Button1));
AddAssert("filter cleared", () => string.IsNullOrEmpty(songSelect.ChildrenOfType<SearchTextBox>().Single().Current.Value));
AddStep("press back a third time", () => InputManager.Click(MouseButton.Button1));
ConfirmAtMainMenu();
}
/// <summary>
/// This tests that the F1 key will open the mod select overlay, and not be handled / blocked by the music controller (which has the same default binding
/// but should be handled *after* song select).
@ -487,6 +522,9 @@ namespace osu.Game.Tests.Visual.Navigation
AddStep("move cursor to background", () => InputManager.MoveMouseTo(Game.ScreenSpaceDrawQuad.BottomRight));
AddStep("click left mouse button", () => InputManager.Click(MouseButton.Left));
AddAssert("now playing is hidden", () => nowPlayingOverlay.State.Value == Visibility.Hidden);
// move the mouse firmly inside game bounds to avoid interfering with other tests.
AddStep("center cursor", () => InputManager.MoveMouseTo(Game.ScreenSpaceDrawQuad.Centre));
}
[Test]

View File

@ -12,9 +12,12 @@ using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Sprites;
using osu.Framework.Graphics.UserInterface;
using osu.Framework.Input.Bindings;
using osu.Framework.Input.Events;
using osu.Framework.Localisation;
using osu.Game.Graphics.Containers;
using osu.Game.Graphics.Sprites;
using osu.Game.Input.Bindings;
using osu.Game.Overlays;
using osuTK;
using osuTK.Graphics;
@ -31,7 +34,7 @@ namespace osu.Game.Graphics.UserInterface
#region OsuDropdownMenu
protected class OsuDropdownMenu : DropdownMenu
protected class OsuDropdownMenu : DropdownMenu, IKeyBindingHandler<GlobalAction>
{
public override bool HandleNonPositionalInput => State == MenuState.Open;
@ -275,6 +278,23 @@ namespace osu.Game.Graphics.UserInterface
}
#endregion
public bool OnPressed(KeyBindingPressEvent<GlobalAction> e)
{
if (e.Repeat) return false;
if (e.Action == GlobalAction.Back)
{
State = MenuState.Closed;
return true;
}
return false;
}
public void OnReleased(KeyBindingReleaseEvent<GlobalAction> e)
{
}
}
#endregion

View File

@ -21,6 +21,9 @@ namespace osu.Game.Overlays.BeatmapListing
[Description("Subscribed mappers")]
Follows,
[LocalisableDescription(typeof(BeatmapsStrings), nameof(BeatmapsStrings.GeneralSpotlights))]
Spotlights,
[LocalisableDescription(typeof(BeatmapsStrings), nameof(BeatmapsStrings.GeneralFeaturedArtists))]
[Description("Featured artists")]
FeaturedArtists

View File

@ -340,8 +340,10 @@ namespace osu.Game.Rulesets.Objects.Legacy
if (vertices[endIndex].Position != vertices[endIndex - 1].Position)
continue;
// Adjacent legacy Catmull segments should be treated as a single segment.
if (FormatVersion < LegacyBeatmapEncoder.FIRST_LAZER_VERSION && type == PathType.Catmull)
// Legacy Catmull sliders don't support multiple segments, so adjacent Catmull segments should be treated as a single one.
// Importantly, this is not applied to the first control point, which may duplicate the slider path's position
// resulting in a duplicate (0,0) control point in the resultant list.
if (type == PathType.Catmull && endIndex > 1 && FormatVersion < LegacyBeatmapEncoder.FIRST_LAZER_VERSION)
continue;
// The last control point of each segment is not allowed to start a new implicit segment.

View File

@ -453,6 +453,7 @@ namespace osu.Game.Screens.Edit.Compose.Components
protected override bool OnMouseDown(MouseDownEvent e)
{
marker.Active = true;
handleMouseInput(e.ScreenSpaceMousePosition);
return base.OnMouseDown(e);
}

View File

@ -163,10 +163,11 @@ namespace osu.Game.Screens.Edit.Compose.Components.Timeline
{
base.LoadComplete();
WaveformVisible.BindValueChanged(_ => updateWaveformOpacity());
waveformOpacity.BindValueChanged(_ => updateWaveformOpacity(), true);
WaveformVisible.ValueChanged += _ => updateWaveformOpacity();
TicksVisible.ValueChanged += visible => ticks.FadeTo(visible.NewValue ? 1 : 0, 200, Easing.OutQuint);
TicksVisible.BindValueChanged(visible => ticks.FadeTo(visible.NewValue ? 1 : 0, 200, Easing.OutQuint), true);
ControlPointsVisible.BindValueChanged(visible =>
{
if (visible.NewValue)

View File

@ -17,7 +17,7 @@ namespace osu.Game.Screens.Edit.Timing
{
private LabelledTextBox textBox;
private TriangleButton button;
private OsuButton button;
[Resolved]
protected Bindable<ControlPointGroup> SelectedGroup { get; private set; }
@ -53,7 +53,7 @@ namespace osu.Game.Screens.Edit.Timing
{
Label = "Time"
},
button = new TriangleButton
button = new RoundedButton
{
Text = "Use current time",
RelativeSizeAxes = Axes.X,

View File

@ -10,6 +10,7 @@ using osu.Framework.Graphics.Shapes;
using osu.Game.Beatmaps.ControlPoints;
using osu.Game.Graphics.Containers;
using osu.Game.Graphics.UserInterface;
using osu.Game.Graphics.UserInterfaceV2;
using osu.Game.Overlays;
using osuTK;
@ -100,7 +101,7 @@ namespace osu.Game.Screens.Edit.Timing
Spacing = new Vector2(5),
Children = new Drawable[]
{
deleteButton = new OsuButton
deleteButton = new RoundedButton
{
Text = "-",
Size = new Vector2(30, 30),
@ -108,7 +109,7 @@ namespace osu.Game.Screens.Edit.Timing
Anchor = Anchor.BottomRight,
Origin = Anchor.BottomRight,
},
new OsuButton
new RoundedButton
{
Text = "+ Add at current time",
Action = addNew,

View File

@ -10,7 +10,7 @@ using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Shapes;
using osu.Game.Beatmaps;
using osu.Game.Graphics.Containers;
using osu.Game.Graphics.UserInterface;
using osu.Game.Graphics.UserInterfaceV2;
using osu.Game.Overlays;
using osu.Game.Rulesets.Edit;
using osu.Game.Rulesets.Edit.Checks.Components;
@ -67,7 +67,7 @@ namespace osu.Game.Screens.Edit.Verify
Margin = new MarginPadding(20),
Children = new Drawable[]
{
new TriangleButton
new RoundedButton
{
Text = "Refresh",
Action = refresh,