1
0
mirror of https://github.com/ppy/osu.git synced 2025-03-23 08:27:23 +08:00

Merge branch 'master' into show-in-windows-association-menus

This commit is contained in:
Dean Herbert 2025-01-09 12:41:50 +09:00 committed by GitHub
commit 025f3dbd9f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 47 additions and 11 deletions

View File

@ -1,8 +1,6 @@
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
#nullable disable
using System.Collections.Generic;
using System.Linq;
using NUnit.Framework;
@ -21,7 +19,7 @@ namespace osu.Game.Rulesets.Catch.Tests.Editor
{
public partial class TestSceneJuiceStreamSelectionBlueprint : CatchSelectionBlueprintTestScene
{
private JuiceStream hitObject;
private JuiceStream hitObject = null!;
private readonly ManualClock manualClock = new ManualClock();
@ -193,6 +191,17 @@ namespace osu.Game.Rulesets.Catch.Tests.Editor
addVertexCheckStep(1, 0, times[0], positions[0]);
}
[Test]
public void TestDeletingSecondVertexDeletesEntireJuiceStream()
{
double[] times = { 100, 400 };
float[] positions = { 100, 150 };
addBlueprintStep(times, positions);
addDeleteVertexSteps(times[1], positions[1]);
AddAssert("juice stream deleted", () => EditorBeatmap.HitObjects, () => Is.Empty);
}
[Test]
public void TestVertexResampling()
{

View File

@ -92,7 +92,7 @@ namespace osu.Game.Rulesets.Catch.Edit.Blueprints.Components
}));
}
public void UpdateHitObjectFromPath(JuiceStream hitObject)
public virtual void UpdateHitObjectFromPath(JuiceStream hitObject)
{
// The SV setting may need to be changed for the current path.
var svBindable = hitObject.SliderVelocityMultiplierBindable;

View File

@ -138,5 +138,13 @@ namespace osu.Game.Rulesets.Catch.Edit.Blueprints.Components
EditorBeatmap?.EndChange();
}
public override void UpdateHitObjectFromPath(JuiceStream hitObject)
{
base.UpdateHitObjectFromPath(hitObject);
if (hitObject.Path.ControlPoints.Count <= 1 || !hitObject.Path.HasValidLength)
EditorBeatmap?.Remove(hitObject);
}
}
}

View File

@ -15,6 +15,8 @@ namespace osu.Game.Screens.Edit.Timing
[Cached]
public readonly Bindable<ControlPointGroup> SelectedGroup = new Bindable<ControlPointGroup>();
private readonly Bindable<EditorScreenMode> currentEditorMode = new Bindable<EditorScreenMode>();
[Resolved]
private EditorClock? editorClock { get; set; }
@ -41,18 +43,35 @@ namespace osu.Game.Screens.Edit.Timing
}
};
[BackgroundDependencyLoader]
private void load(Editor? editor)
{
if (editor != null)
currentEditorMode.BindTo(editor.Mode);
}
protected override void LoadComplete()
{
base.LoadComplete();
if (editorClock != null)
// When entering the timing screen, let's choose the closest valid timing point.
// This will emulate the osu-stable behaviour where a metronome and timing information
// are presented on entering the screen.
currentEditorMode.BindValueChanged(mode =>
{
// When entering the timing screen, let's choose the closest valid timing point.
// This will emulate the osu-stable behaviour where a metronome and timing information
// are presented on entering the screen.
var nearestTimingPoint = EditorBeatmap.ControlPointInfo.TimingPointAt(editorClock.CurrentTime);
SelectedGroup.Value = EditorBeatmap.ControlPointInfo.GroupAt(nearestTimingPoint.Time);
}
if (mode.NewValue == EditorScreenMode.Timing)
selectClosestTimingPoint();
});
selectClosestTimingPoint();
}
private void selectClosestTimingPoint()
{
if (editorClock == null)
return;
var nearestTimingPoint = EditorBeatmap.ControlPointInfo.TimingPointAt(editorClock.CurrentTime);
SelectedGroup.Value = EditorBeatmap.ControlPointInfo.GroupAt(nearestTimingPoint.Time);
}
protected override void ConfigureTimeline(TimelineArea timelineArea)