mirror of
https://github.com/ppy/osu.git
synced 2025-02-12 02:02:55 +08:00
Merge branch 'master' into fix-combo-handling
This commit is contained in:
commit
686afa9697
@ -159,9 +159,9 @@ namespace osu.Game.Rulesets.Osu.Edit.Blueprints.Sliders.Components
|
||||
if (allowSelection)
|
||||
d.RequestSelection = selectionRequested;
|
||||
|
||||
d.DragStarted = dragStarted;
|
||||
d.DragInProgress = dragInProgress;
|
||||
d.DragEnded = dragEnded;
|
||||
d.DragStarted = DragStarted;
|
||||
d.DragInProgress = DragInProgress;
|
||||
d.DragEnded = DragEnded;
|
||||
}));
|
||||
|
||||
Connections.Add(new PathControlPointConnectionPiece<T>(hitObject, e.NewStartingIndex + i));
|
||||
@ -267,7 +267,7 @@ namespace osu.Game.Rulesets.Osu.Edit.Blueprints.Sliders.Components
|
||||
private int draggedControlPointIndex;
|
||||
private HashSet<PathControlPoint> selectedControlPoints;
|
||||
|
||||
private void dragStarted(PathControlPoint controlPoint)
|
||||
public void DragStarted(PathControlPoint controlPoint)
|
||||
{
|
||||
dragStartPositions = hitObject.Path.ControlPoints.Select(point => point.Position).ToArray();
|
||||
dragPathTypes = hitObject.Path.ControlPoints.Select(point => point.Type).ToArray();
|
||||
@ -279,7 +279,7 @@ namespace osu.Game.Rulesets.Osu.Edit.Blueprints.Sliders.Components
|
||||
changeHandler?.BeginChange();
|
||||
}
|
||||
|
||||
private void dragInProgress(DragEvent e)
|
||||
public void DragInProgress(DragEvent e)
|
||||
{
|
||||
Vector2[] oldControlPoints = hitObject.Path.ControlPoints.Select(cp => cp.Position).ToArray();
|
||||
var oldPosition = hitObject.Position;
|
||||
@ -341,7 +341,7 @@ namespace osu.Game.Rulesets.Osu.Edit.Blueprints.Sliders.Components
|
||||
hitObject.Path.ControlPoints[i].Type = dragPathTypes[i];
|
||||
}
|
||||
|
||||
private void dragEnded() => changeHandler?.EndChange();
|
||||
public void DragEnded() => changeHandler?.EndChange();
|
||||
|
||||
#endregion
|
||||
|
||||
|
@ -39,9 +39,6 @@ namespace osu.Game.Rulesets.Osu.Edit.Blueprints.Sliders
|
||||
[CanBeNull]
|
||||
protected PathControlPointVisualiser<Slider> ControlPointVisualiser { get; private set; }
|
||||
|
||||
[Resolved(CanBeNull = true)]
|
||||
private IPositionSnapProvider positionSnapProvider { get; set; }
|
||||
|
||||
[Resolved(CanBeNull = true)]
|
||||
private IDistanceSnapProvider distanceSnapProvider { get; set; }
|
||||
|
||||
@ -191,21 +188,30 @@ namespace osu.Game.Rulesets.Osu.Edit.Blueprints.Sliders
|
||||
[CanBeNull]
|
||||
private PathControlPoint placementControlPoint;
|
||||
|
||||
protected override bool OnDragStart(DragStartEvent e) => placementControlPoint != null;
|
||||
protected override bool OnDragStart(DragStartEvent e)
|
||||
{
|
||||
if (placementControlPoint == null)
|
||||
return base.OnDragStart(e);
|
||||
|
||||
ControlPointVisualiser?.DragStarted(placementControlPoint);
|
||||
return true;
|
||||
}
|
||||
|
||||
protected override void OnDrag(DragEvent e)
|
||||
{
|
||||
base.OnDrag(e);
|
||||
|
||||
if (placementControlPoint != null)
|
||||
{
|
||||
var result = positionSnapProvider?.FindSnappedPositionAndTime(ToScreenSpace(e.MousePosition));
|
||||
placementControlPoint.Position = ToLocalSpace(result?.ScreenSpacePosition ?? ToScreenSpace(e.MousePosition)) - HitObject.Position;
|
||||
}
|
||||
ControlPointVisualiser?.DragInProgress(e);
|
||||
}
|
||||
|
||||
protected override void OnMouseUp(MouseUpEvent e)
|
||||
{
|
||||
if (placementControlPoint != null)
|
||||
{
|
||||
if (IsDragged)
|
||||
ControlPointVisualiser?.DragEnded();
|
||||
|
||||
placementControlPoint = null;
|
||||
changeHandler?.EndChange();
|
||||
}
|
||||
|
@ -335,6 +335,40 @@ namespace osu.Game.Tests.Visual.Gameplay
|
||||
AddAssert("value is less than default", () => hitErrorMeter.JudgementLineThickness.Value < hitErrorMeter.JudgementLineThickness.Default);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestCopyPaste()
|
||||
{
|
||||
AddStep("paste", () =>
|
||||
{
|
||||
InputManager.PressKey(Key.LControl);
|
||||
InputManager.Key(Key.V);
|
||||
InputManager.ReleaseKey(Key.LControl);
|
||||
});
|
||||
// no assertions. just make sure nothing crashes.
|
||||
|
||||
AddStep("select bar hit error blueprint", () =>
|
||||
{
|
||||
var blueprint = skinEditor.ChildrenOfType<SkinBlueprint>().First(b => b.Item is BarHitErrorMeter);
|
||||
skinEditor.SelectedComponents.Clear();
|
||||
skinEditor.SelectedComponents.Add(blueprint.Item);
|
||||
});
|
||||
AddStep("copy", () =>
|
||||
{
|
||||
InputManager.PressKey(Key.LControl);
|
||||
InputManager.Key(Key.C);
|
||||
InputManager.ReleaseKey(Key.LControl);
|
||||
});
|
||||
AddStep("paste", () =>
|
||||
{
|
||||
InputManager.PressKey(Key.LControl);
|
||||
InputManager.Key(Key.V);
|
||||
InputManager.ReleaseKey(Key.LControl);
|
||||
});
|
||||
AddAssert("three hit error meters present",
|
||||
() => skinEditor.ChildrenOfType<SkinBlueprint>().Count(b => b.Item is BarHitErrorMeter),
|
||||
() => Is.EqualTo(3));
|
||||
}
|
||||
|
||||
protected override Ruleset CreatePlayerRuleset() => new OsuRuleset();
|
||||
|
||||
private partial class TestSkinEditorChangeHandler : SkinEditorChangeHandler
|
||||
|
@ -510,6 +510,9 @@ namespace osu.Game.Overlays.SkinEditor
|
||||
|
||||
protected void Paste()
|
||||
{
|
||||
if (!canPaste.Value)
|
||||
return;
|
||||
|
||||
changeHandler?.BeginChange();
|
||||
|
||||
var drawableInfo = JsonConvert.DeserializeObject<SerialisedDrawableInfo[]>(clipboard.Content.Value);
|
||||
|
@ -210,6 +210,9 @@ namespace osu.Game.Overlays.SkinEditor
|
||||
|
||||
// The skin editor doesn't work well if beatmap skins are being applied to the player screen.
|
||||
// To keep things simple, disable the setting game-wide while using the skin editor.
|
||||
//
|
||||
// This causes a full reload of the skin, which is pretty ugly.
|
||||
// TODO: Investigate if we can avoid this when a beatmap skin is not being applied by the current beatmap.
|
||||
leasedBeatmapSkins = beatmapSkins.BeginLease(true);
|
||||
leasedBeatmapSkins.Value = false;
|
||||
}
|
||||
|
@ -12,6 +12,8 @@ namespace osu.Game.Screens.Play.HUD
|
||||
{
|
||||
public partial class PlayerFlag : CompositeDrawable, ISerialisableDrawable
|
||||
{
|
||||
protected override bool ReceivePositionalInputAtSubTree(Vector2 screenSpacePos) => false;
|
||||
|
||||
private readonly UpdateableFlag flag;
|
||||
|
||||
private const float default_size = 40f;
|
||||
|
Loading…
Reference in New Issue
Block a user