mirror of
https://github.com/osukey/osukey.git
synced 2025-08-08 00:53:56 +09:00
Merge pull request #7755 from peppy/fix-spinner-placement
Fix spinner placement blueprint in multiple ways
This commit is contained in:
@ -1,6 +1,7 @@
|
|||||||
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
// 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.
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
|
using System;
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Input.Events;
|
using osu.Framework.Input.Events;
|
||||||
using osu.Game.Rulesets.Edit;
|
using osu.Game.Rulesets.Edit;
|
||||||
@ -8,6 +9,7 @@ using osu.Game.Rulesets.Osu.Edit.Blueprints.Spinners.Components;
|
|||||||
using osu.Game.Rulesets.Osu.Objects;
|
using osu.Game.Rulesets.Osu.Objects;
|
||||||
using osu.Game.Rulesets.Osu.UI;
|
using osu.Game.Rulesets.Osu.UI;
|
||||||
using osuTK;
|
using osuTK;
|
||||||
|
using osuTK.Input;
|
||||||
|
|
||||||
namespace osu.Game.Rulesets.Osu.Edit.Blueprints.Spinners
|
namespace osu.Game.Rulesets.Osu.Edit.Blueprints.Spinners
|
||||||
{
|
{
|
||||||
@ -29,22 +31,31 @@ namespace osu.Game.Rulesets.Osu.Edit.Blueprints.Spinners
|
|||||||
{
|
{
|
||||||
base.Update();
|
base.Update();
|
||||||
|
|
||||||
|
if (isPlacingEnd)
|
||||||
|
HitObject.EndTime = Math.Max(HitObject.StartTime, EditorClock.CurrentTime);
|
||||||
|
|
||||||
piece.UpdateFrom(HitObject);
|
piece.UpdateFrom(HitObject);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override bool OnClick(ClickEvent e)
|
protected override bool OnMouseDown(MouseDownEvent e)
|
||||||
{
|
{
|
||||||
if (isPlacingEnd)
|
if (isPlacingEnd)
|
||||||
{
|
{
|
||||||
|
if (e.Button != MouseButton.Right)
|
||||||
|
return false;
|
||||||
|
|
||||||
HitObject.EndTime = EditorClock.CurrentTime;
|
HitObject.EndTime = EditorClock.CurrentTime;
|
||||||
EndPlacement();
|
EndPlacement();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
isPlacingEnd = true;
|
if (e.Button != MouseButton.Left)
|
||||||
piece.FadeTo(1f, 150, Easing.OutQuint);
|
return false;
|
||||||
|
|
||||||
BeginPlacement();
|
BeginPlacement();
|
||||||
|
piece.FadeTo(1f, 150, Easing.OutQuint);
|
||||||
|
|
||||||
|
isPlacingEnd = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
@ -36,6 +36,9 @@ namespace osu.Game.Rulesets.Osu.Edit
|
|||||||
|
|
||||||
protected override DistanceSnapGrid CreateDistanceSnapGrid(IEnumerable<HitObject> selectedHitObjects)
|
protected override DistanceSnapGrid CreateDistanceSnapGrid(IEnumerable<HitObject> selectedHitObjects)
|
||||||
{
|
{
|
||||||
|
if (BlueprintContainer.CurrentTool is SpinnerCompositionTool)
|
||||||
|
return null;
|
||||||
|
|
||||||
var objects = selectedHitObjects.ToList();
|
var objects = selectedHitObjects.ToList();
|
||||||
|
|
||||||
if (objects.Count == 0)
|
if (objects.Count == 0)
|
||||||
@ -89,6 +92,9 @@ namespace osu.Game.Rulesets.Osu.Edit
|
|||||||
targetIndex++;
|
targetIndex++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (sourceObject is Spinner)
|
||||||
|
return null;
|
||||||
|
|
||||||
return new OsuDistanceSnapGrid((OsuHitObject)sourceObject, (OsuHitObject)targetObject);
|
return new OsuDistanceSnapGrid((OsuHitObject)sourceObject, (OsuHitObject)targetObject);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -13,8 +13,13 @@ namespace osu.Game.Rulesets.Osu.Objects
|
|||||||
{
|
{
|
||||||
public class Spinner : OsuHitObject, IHasEndTime
|
public class Spinner : OsuHitObject, IHasEndTime
|
||||||
{
|
{
|
||||||
public double EndTime { get; set; }
|
public double EndTime
|
||||||
public double Duration => EndTime - StartTime;
|
{
|
||||||
|
get => StartTime + Duration;
|
||||||
|
set => Duration = value - StartTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
public double Duration { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Number of spins required to finish the spinner without miss.
|
/// Number of spins required to finish the spinner without miss.
|
||||||
|
@ -49,8 +49,9 @@ namespace osu.Game.Rulesets.Edit
|
|||||||
[Resolved]
|
[Resolved]
|
||||||
private IBeatSnapProvider beatSnapProvider { get; set; }
|
private IBeatSnapProvider beatSnapProvider { get; set; }
|
||||||
|
|
||||||
|
protected ComposeBlueprintContainer BlueprintContainer { get; private set; }
|
||||||
|
|
||||||
private DrawableEditRulesetWrapper<TObject> drawableRulesetWrapper;
|
private DrawableEditRulesetWrapper<TObject> drawableRulesetWrapper;
|
||||||
private ComposeBlueprintContainer blueprintContainer;
|
|
||||||
private Container distanceSnapGridContainer;
|
private Container distanceSnapGridContainer;
|
||||||
private DistanceSnapGrid distanceSnapGrid;
|
private DistanceSnapGrid distanceSnapGrid;
|
||||||
private readonly List<Container> layerContainers = new List<Container>();
|
private readonly List<Container> layerContainers = new List<Container>();
|
||||||
@ -94,7 +95,7 @@ namespace osu.Game.Rulesets.Edit
|
|||||||
new EditorPlayfieldBorder { RelativeSizeAxes = Axes.Both }
|
new EditorPlayfieldBorder { RelativeSizeAxes = Axes.Both }
|
||||||
});
|
});
|
||||||
|
|
||||||
var layerAboveRuleset = drawableRulesetWrapper.CreatePlayfieldAdjustmentContainer().WithChild(blueprintContainer = CreateBlueprintContainer());
|
var layerAboveRuleset = drawableRulesetWrapper.CreatePlayfieldAdjustmentContainer().WithChild(BlueprintContainer = CreateBlueprintContainer());
|
||||||
|
|
||||||
layerContainers.Add(layerBelowRuleset);
|
layerContainers.Add(layerBelowRuleset);
|
||||||
layerContainers.Add(layerAboveRuleset);
|
layerContainers.Add(layerAboveRuleset);
|
||||||
@ -142,7 +143,7 @@ namespace osu.Game.Rulesets.Edit
|
|||||||
|
|
||||||
setSelectTool();
|
setSelectTool();
|
||||||
|
|
||||||
blueprintContainer.SelectionChanged += selectionChanged;
|
BlueprintContainer.SelectionChanged += selectionChanged;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override bool OnKeyDown(KeyDownEvent e)
|
protected override bool OnKeyDown(KeyDownEvent e)
|
||||||
@ -174,7 +175,7 @@ namespace osu.Game.Rulesets.Edit
|
|||||||
{
|
{
|
||||||
base.Update();
|
base.Update();
|
||||||
|
|
||||||
if (EditorClock.CurrentTime != lastGridUpdateTime && !(blueprintContainer.CurrentTool is SelectTool))
|
if (EditorClock.CurrentTime != lastGridUpdateTime && !(BlueprintContainer.CurrentTool is SelectTool))
|
||||||
showGridFor(Enumerable.Empty<HitObject>());
|
showGridFor(Enumerable.Empty<HitObject>());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -210,7 +211,7 @@ namespace osu.Game.Rulesets.Edit
|
|||||||
|
|
||||||
private void toolSelected(HitObjectCompositionTool tool)
|
private void toolSelected(HitObjectCompositionTool tool)
|
||||||
{
|
{
|
||||||
blueprintContainer.CurrentTool = tool;
|
BlueprintContainer.CurrentTool = tool;
|
||||||
|
|
||||||
if (tool is SelectTool)
|
if (tool is SelectTool)
|
||||||
distanceSnapGridContainer.Hide();
|
distanceSnapGridContainer.Hide();
|
||||||
|
Reference in New Issue
Block a user