mirror of
https://github.com/osukey/osukey.git
synced 2025-05-28 08:57:25 +09:00
Add commit status to EndPlacement; call BeginPlacement on initial movement
This commit is contained in:
parent
66f5ad4adb
commit
e31d69c749
@ -56,7 +56,7 @@ namespace osu.Game.Rulesets.Mania.Edit.Blueprints
|
||||
|
||||
protected override void OnMouseUp(MouseUpEvent e)
|
||||
{
|
||||
EndPlacement();
|
||||
EndPlacement(true);
|
||||
base.OnMouseUp(e);
|
||||
}
|
||||
|
||||
|
@ -30,12 +30,13 @@ namespace osu.Game.Rulesets.Osu.Edit.Blueprints.HitCircles
|
||||
|
||||
protected override bool OnClick(ClickEvent e)
|
||||
{
|
||||
EndPlacement();
|
||||
EndPlacement(true);
|
||||
return true;
|
||||
}
|
||||
|
||||
public override void UpdatePosition(Vector2 screenSpacePosition)
|
||||
{
|
||||
BeginPlacement();
|
||||
HitObject.Position = ToLocalSpace(screenSpacePosition);
|
||||
}
|
||||
}
|
||||
|
@ -68,6 +68,7 @@ namespace osu.Game.Rulesets.Osu.Edit.Blueprints.Sliders
|
||||
switch (state)
|
||||
{
|
||||
case PlacementState.Initial:
|
||||
BeginPlacement();
|
||||
HitObject.Position = ToLocalSpace(screenSpacePosition);
|
||||
break;
|
||||
|
||||
@ -132,7 +133,7 @@ namespace osu.Game.Rulesets.Osu.Edit.Blueprints.Sliders
|
||||
private void endCurve()
|
||||
{
|
||||
updateSlider();
|
||||
EndPlacement();
|
||||
EndPlacement(true);
|
||||
}
|
||||
|
||||
protected override void Update()
|
||||
|
@ -37,7 +37,7 @@ namespace osu.Game.Rulesets.Osu.Edit.Blueprints.Spinners
|
||||
if (isPlacingEnd)
|
||||
{
|
||||
HitObject.EndTime = EditorClock.CurrentTime;
|
||||
EndPlacement();
|
||||
EndPlacement(true);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -254,11 +254,14 @@ namespace osu.Game.Rulesets.Edit
|
||||
hitObject.StartTime = GetSnappedPosition(distanceSnapGrid.ToLocalSpace(inputManager.CurrentState.Mouse.Position), hitObject.StartTime).time;
|
||||
}
|
||||
|
||||
public void EndPlacement(HitObject hitObject)
|
||||
public void EndPlacement(HitObject hitObject, bool commit)
|
||||
{
|
||||
EditorBeatmap.Add(hitObject);
|
||||
if (commit)
|
||||
{
|
||||
EditorBeatmap.Add(hitObject);
|
||||
|
||||
adjustableClock.Seek(hitObject.StartTime);
|
||||
adjustableClock.Seek(hitObject.StartTime);
|
||||
}
|
||||
|
||||
showGridFor(Enumerable.Empty<HitObject>());
|
||||
}
|
||||
|
@ -103,11 +103,12 @@ namespace osu.Game.Rulesets.Edit
|
||||
/// Signals that the placement of <see cref="HitObject"/> has finished.
|
||||
/// This will destroy this <see cref="PlacementBlueprint"/>, and add the <see cref="HitObject"/> to the <see cref="Beatmap"/>.
|
||||
/// </summary>
|
||||
protected void EndPlacement()
|
||||
/// <param name="commit">Whether the object should be committed.</param>
|
||||
public void EndPlacement(bool commit)
|
||||
{
|
||||
if (!PlacementBegun)
|
||||
BeginPlacement();
|
||||
placementHandler.EndPlacement(HitObject);
|
||||
placementHandler.EndPlacement(HitObject, commit);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -63,6 +63,8 @@ namespace osu.Game.Screens.Edit.Compose.Components
|
||||
private void refreshTool()
|
||||
{
|
||||
placementBlueprintContainer.Clear();
|
||||
|
||||
currentPlacement?.EndPlacement(false);
|
||||
currentPlacement = null;
|
||||
|
||||
var blueprint = CurrentTool?.CreatePlacementBlueprint();
|
||||
|
@ -17,7 +17,8 @@ namespace osu.Game.Screens.Edit.Compose
|
||||
/// Notifies that a placement has finished.
|
||||
/// </summary>
|
||||
/// <param name="hitObject">The <see cref="HitObject"/> that has been placed.</param>
|
||||
void EndPlacement(HitObject hitObject);
|
||||
/// <param name="commit">Whether the object should be committed.</param>
|
||||
void EndPlacement(HitObject hitObject, bool commit);
|
||||
|
||||
/// <summary>
|
||||
/// Deletes a <see cref="HitObject"/>.
|
||||
|
@ -53,9 +53,10 @@ namespace osu.Game.Tests.Visual
|
||||
{
|
||||
}
|
||||
|
||||
public void EndPlacement(HitObject hitObject)
|
||||
public void EndPlacement(HitObject hitObject, bool commit)
|
||||
{
|
||||
AddHitObject(CreateHitObject(hitObject));
|
||||
if (commit)
|
||||
AddHitObject(CreateHitObject(hitObject));
|
||||
|
||||
Remove(currentBlueprint);
|
||||
Add(currentBlueprint = CreateBlueprint());
|
||||
|
Loading…
x
Reference in New Issue
Block a user