2020-01-02 10:46:18 +08:00
|
|
|
// 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.
|
|
|
|
|
2022-06-17 15:37:17 +08:00
|
|
|
#nullable disable
|
|
|
|
|
2020-01-15 18:09:49 +08:00
|
|
|
using System.Collections.Generic;
|
|
|
|
using System.Linq;
|
2020-09-25 16:53:41 +08:00
|
|
|
using Humanizer;
|
2021-06-23 08:40:07 +08:00
|
|
|
using JetBrains.Annotations;
|
2020-01-15 18:09:49 +08:00
|
|
|
using osu.Framework.Allocation;
|
2020-09-25 13:10:30 +08:00
|
|
|
using osu.Framework.Bindables;
|
2020-01-15 18:09:49 +08:00
|
|
|
using osu.Framework.Graphics;
|
|
|
|
using osu.Framework.Graphics.Containers;
|
2020-09-25 15:33:22 +08:00
|
|
|
using osu.Framework.Graphics.Sprites;
|
2021-03-25 18:56:26 +08:00
|
|
|
using osu.Framework.Input.Events;
|
2020-09-25 16:53:41 +08:00
|
|
|
using osu.Game.Audio;
|
2022-10-19 20:35:08 +08:00
|
|
|
using osu.Game.Graphics;
|
|
|
|
using osu.Game.Graphics.Sprites;
|
2020-09-25 15:33:22 +08:00
|
|
|
using osu.Game.Graphics.UserInterface;
|
2020-01-15 18:09:49 +08:00
|
|
|
using osu.Game.Rulesets.Edit;
|
|
|
|
using osu.Game.Rulesets.Edit.Tools;
|
|
|
|
using osu.Game.Rulesets.Objects;
|
2021-05-13 20:16:19 +08:00
|
|
|
using osu.Game.Rulesets.Objects.Drawables;
|
2020-09-25 13:10:30 +08:00
|
|
|
using osu.Game.Rulesets.Objects.Types;
|
2022-11-28 04:43:33 +08:00
|
|
|
using osu.Game.Rulesets.UI;
|
2020-09-25 15:33:22 +08:00
|
|
|
using osu.Game.Screens.Edit.Components.TernaryButtons;
|
2020-06-14 12:20:58 +08:00
|
|
|
using osuTK;
|
2021-03-25 18:56:26 +08:00
|
|
|
using osuTK.Input;
|
2020-01-15 18:09:49 +08:00
|
|
|
|
2020-01-02 10:46:18 +08:00
|
|
|
namespace osu.Game.Screens.Edit.Compose.Components
|
|
|
|
{
|
|
|
|
/// <summary>
|
|
|
|
/// A blueprint container generally displayed as an overlay to a ruleset's playfield.
|
|
|
|
/// </summary>
|
2022-11-24 13:32:20 +08:00
|
|
|
public partial class ComposeBlueprintContainer : EditorBlueprintContainer
|
2020-01-02 10:46:18 +08:00
|
|
|
{
|
2020-01-15 18:09:49 +08:00
|
|
|
private readonly Container<PlacementBlueprint> placementBlueprintContainer;
|
|
|
|
|
2021-04-27 14:40:35 +08:00
|
|
|
protected new EditorSelectionHandler SelectionHandler => (EditorSelectionHandler)base.SelectionHandler;
|
|
|
|
|
2023-01-13 23:16:52 +08:00
|
|
|
public PlacementBlueprint CurrentPlacement { get; private set; }
|
2022-10-11 13:11:45 +08:00
|
|
|
|
2022-06-18 23:28:36 +08:00
|
|
|
/// <remarks>
|
|
|
|
/// Positional input must be received outside the container's bounds,
|
|
|
|
/// in order to handle composer blueprints which are partially offscreen.
|
|
|
|
/// </remarks>
|
|
|
|
public override bool ReceivePositionalInputAt(Vector2 screenSpacePos) => true;
|
|
|
|
|
2020-11-12 18:52:02 +08:00
|
|
|
public ComposeBlueprintContainer(HitObjectComposer composer)
|
|
|
|
: base(composer)
|
2020-01-15 18:09:49 +08:00
|
|
|
{
|
|
|
|
placementBlueprintContainer = new Container<PlacementBlueprint>
|
|
|
|
{
|
|
|
|
RelativeSizeAxes = Axes.Both
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
[BackgroundDependencyLoader]
|
|
|
|
private void load()
|
|
|
|
{
|
2022-10-19 20:35:08 +08:00
|
|
|
MainTernaryStates = CreateTernaryButtons().ToArray();
|
|
|
|
SampleBankTernaryStates = createSampleBankTernaryButtons().ToArray();
|
2020-09-25 16:40:43 +08:00
|
|
|
|
2022-11-30 19:17:58 +08:00
|
|
|
AddInternal(new DrawableRulesetDependenciesProvidingContainer(Composer.Ruleset)
|
2022-11-28 04:43:33 +08:00
|
|
|
{
|
|
|
|
Child = placementBlueprintContainer
|
|
|
|
});
|
2020-01-15 18:09:49 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
protected override void LoadComplete()
|
|
|
|
{
|
|
|
|
base.LoadComplete();
|
|
|
|
|
2021-05-24 16:03:54 +08:00
|
|
|
Beatmap.HitObjectAdded += hitObjectAdded;
|
|
|
|
|
2020-09-25 15:33:22 +08:00
|
|
|
// updates to selected are handled for us by SelectionHandler.
|
|
|
|
NewCombo.BindTo(SelectionHandler.SelectionNewComboState);
|
2020-09-25 13:10:30 +08:00
|
|
|
|
2020-09-25 15:33:22 +08:00
|
|
|
// we are responsible for current placement blueprint updated based on state changes.
|
2020-09-25 17:00:17 +08:00
|
|
|
NewCombo.ValueChanged += _ => updatePlacementNewCombo();
|
2020-09-25 16:53:41 +08:00
|
|
|
|
|
|
|
// we own SelectionHandler so don't need to worry about making bindable copies (for simplicity)
|
|
|
|
foreach (var kvp in SelectionHandler.SelectionSampleStates)
|
2020-09-25 17:00:17 +08:00
|
|
|
kvp.Value.BindValueChanged(_ => updatePlacementSamples());
|
2022-10-19 20:39:51 +08:00
|
|
|
|
|
|
|
foreach (var kvp in SelectionHandler.SelectionBankStates)
|
|
|
|
kvp.Value.BindValueChanged(_ => updatePlacementSamples());
|
2020-09-25 16:53:41 +08:00
|
|
|
}
|
|
|
|
|
2021-05-13 20:16:19 +08:00
|
|
|
protected override void TransferBlueprintFor(HitObject hitObject, DrawableHitObject drawableObject)
|
|
|
|
{
|
|
|
|
base.TransferBlueprintFor(hitObject, drawableObject);
|
|
|
|
|
|
|
|
var blueprint = (HitObjectSelectionBlueprint)GetBlueprintFor(hitObject);
|
|
|
|
blueprint.DrawableObject = drawableObject;
|
|
|
|
}
|
|
|
|
|
2023-02-03 16:28:55 +08:00
|
|
|
private bool nudgeMovementActive;
|
|
|
|
|
2021-03-25 18:56:26 +08:00
|
|
|
protected override bool OnKeyDown(KeyDownEvent e)
|
|
|
|
{
|
|
|
|
if (e.ControlPressed)
|
|
|
|
{
|
|
|
|
switch (e.Key)
|
|
|
|
{
|
|
|
|
case Key.Left:
|
2023-02-03 16:28:55 +08:00
|
|
|
nudgeSelection(new Vector2(-1, 0));
|
2021-03-25 18:56:26 +08:00
|
|
|
return true;
|
|
|
|
|
|
|
|
case Key.Right:
|
2023-02-03 16:28:55 +08:00
|
|
|
nudgeSelection(new Vector2(1, 0));
|
2021-03-25 18:56:26 +08:00
|
|
|
return true;
|
|
|
|
|
|
|
|
case Key.Up:
|
2023-02-03 16:28:55 +08:00
|
|
|
nudgeSelection(new Vector2(0, -1));
|
2021-03-25 18:56:26 +08:00
|
|
|
return true;
|
|
|
|
|
|
|
|
case Key.Down:
|
2023-02-03 16:28:55 +08:00
|
|
|
nudgeSelection(new Vector2(0, 1));
|
2021-03-25 18:56:26 +08:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2023-02-03 16:28:55 +08:00
|
|
|
protected override void OnKeyUp(KeyUpEvent e)
|
|
|
|
{
|
|
|
|
base.OnKeyUp(e);
|
|
|
|
|
|
|
|
if (nudgeMovementActive && !e.ControlPressed)
|
|
|
|
{
|
|
|
|
Beatmap.EndChange();
|
|
|
|
nudgeMovementActive = false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-03-25 18:56:26 +08:00
|
|
|
/// <summary>
|
|
|
|
/// Move the current selection spatially by the specified delta, in gamefield coordinates (ie. the same coordinates as the blueprints).
|
|
|
|
/// </summary>
|
|
|
|
/// <param name="delta"></param>
|
2023-02-03 16:28:55 +08:00
|
|
|
private void nudgeSelection(Vector2 delta)
|
2021-03-25 18:56:26 +08:00
|
|
|
{
|
2023-02-03 16:28:55 +08:00
|
|
|
if (!nudgeMovementActive)
|
|
|
|
{
|
|
|
|
nudgeMovementActive = true;
|
|
|
|
Beatmap.BeginChange();
|
|
|
|
}
|
|
|
|
|
2021-03-25 18:56:26 +08:00
|
|
|
var firstBlueprint = SelectionHandler.SelectedBlueprints.FirstOrDefault();
|
|
|
|
|
|
|
|
if (firstBlueprint == null)
|
|
|
|
return;
|
|
|
|
|
|
|
|
// convert to game space coordinates
|
|
|
|
delta = firstBlueprint.ToScreenSpace(delta) - firstBlueprint.ToScreenSpace(Vector2.Zero);
|
|
|
|
|
2021-04-29 14:29:25 +08:00
|
|
|
SelectionHandler.HandleMovement(new MoveSelectionEvent<HitObject>(firstBlueprint, delta));
|
2021-03-25 18:56:26 +08:00
|
|
|
}
|
|
|
|
|
2020-09-25 17:00:17 +08:00
|
|
|
private void updatePlacementNewCombo()
|
|
|
|
{
|
2023-01-13 23:16:52 +08:00
|
|
|
if (CurrentPlacement?.HitObject is IHasComboInformation c)
|
2020-09-25 17:00:17 +08:00
|
|
|
c.NewCombo = NewCombo.Value == TernaryState.True;
|
|
|
|
}
|
|
|
|
|
|
|
|
private void updatePlacementSamples()
|
|
|
|
{
|
2023-01-13 23:16:52 +08:00
|
|
|
if (CurrentPlacement == null) return;
|
2020-09-25 17:00:17 +08:00
|
|
|
|
|
|
|
foreach (var kvp in SelectionHandler.SelectionSampleStates)
|
|
|
|
sampleChanged(kvp.Key, kvp.Value.Value);
|
2022-10-19 20:39:51 +08:00
|
|
|
|
|
|
|
foreach (var kvp in SelectionHandler.SelectionBankStates)
|
|
|
|
bankChanged(kvp.Key, kvp.Value.Value);
|
2020-09-25 17:00:17 +08:00
|
|
|
}
|
|
|
|
|
2020-09-25 16:53:41 +08:00
|
|
|
private void sampleChanged(string sampleName, TernaryState state)
|
|
|
|
{
|
2023-01-13 23:16:52 +08:00
|
|
|
if (CurrentPlacement == null) return;
|
2020-09-25 16:53:41 +08:00
|
|
|
|
2023-01-13 23:16:52 +08:00
|
|
|
var samples = CurrentPlacement.HitObject.Samples;
|
2020-09-25 16:53:41 +08:00
|
|
|
|
|
|
|
var existingSample = samples.FirstOrDefault(s => s.Name == sampleName);
|
|
|
|
|
|
|
|
switch (state)
|
|
|
|
{
|
|
|
|
case TernaryState.False:
|
|
|
|
if (existingSample != null)
|
|
|
|
samples.Remove(existingSample);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case TernaryState.True:
|
|
|
|
if (existingSample == null)
|
2023-05-17 13:07:48 +08:00
|
|
|
samples.Add(CurrentPlacement.HitObject.CreateHitSampleInfo(sampleName));
|
2020-09-25 16:53:41 +08:00
|
|
|
break;
|
|
|
|
}
|
2020-01-15 18:09:49 +08:00
|
|
|
}
|
|
|
|
|
2022-10-19 20:39:51 +08:00
|
|
|
private void bankChanged(string bankName, TernaryState state)
|
|
|
|
{
|
2023-05-24 13:20:38 +08:00
|
|
|
if (CurrentPlacement == null) return;
|
2022-10-19 20:39:51 +08:00
|
|
|
|
2023-05-24 16:11:12 +08:00
|
|
|
if (bankName == EditorSelectionHandler.HIT_BANK_AUTO)
|
|
|
|
CurrentPlacement.AutomaticBankAssignment = state == TernaryState.True;
|
2023-05-24 15:14:05 +08:00
|
|
|
if (state == TernaryState.True)
|
|
|
|
CurrentPlacement.HitObject.Samples = CurrentPlacement.HitObject.Samples.Select(s => s.With(newBank: bankName)).ToList();
|
2022-10-19 20:39:51 +08:00
|
|
|
}
|
|
|
|
|
2020-09-25 15:33:22 +08:00
|
|
|
public readonly Bindable<TernaryState> NewCombo = new Bindable<TernaryState> { Description = "New Combo" };
|
2020-09-25 13:10:30 +08:00
|
|
|
|
2020-09-25 16:45:19 +08:00
|
|
|
/// <summary>
|
|
|
|
/// A collection of states which will be displayed to the user in the toolbox.
|
|
|
|
/// </summary>
|
2022-10-19 20:35:08 +08:00
|
|
|
public TernaryButton[] MainTernaryStates { get; private set; }
|
|
|
|
|
|
|
|
public TernaryButton[] SampleBankTernaryStates { get; private set; }
|
2020-09-25 16:40:43 +08:00
|
|
|
|
2020-09-25 16:45:19 +08:00
|
|
|
/// <summary>
|
|
|
|
/// Create all ternary states required to be displayed to the user.
|
|
|
|
/// </summary>
|
|
|
|
protected virtual IEnumerable<TernaryButton> CreateTernaryButtons()
|
2020-09-25 13:10:30 +08:00
|
|
|
{
|
|
|
|
//TODO: this should only be enabled (visible?) for rulesets that provide combo-supporting HitObjects.
|
2020-09-25 16:40:43 +08:00
|
|
|
yield return new TernaryButton(NewCombo, "New combo", () => new SpriteIcon { Icon = FontAwesome.Regular.DotCircle });
|
2020-09-25 16:53:41 +08:00
|
|
|
|
|
|
|
foreach (var kvp in SelectionHandler.SelectionSampleStates)
|
|
|
|
yield return new TernaryButton(kvp.Value, kvp.Key.Replace("hit", string.Empty).Titleize(), () => getIconForSample(kvp.Key));
|
|
|
|
}
|
|
|
|
|
2022-10-19 20:35:08 +08:00
|
|
|
private IEnumerable<TernaryButton> createSampleBankTernaryButtons()
|
|
|
|
{
|
|
|
|
foreach (var kvp in SelectionHandler.SelectionBankStates)
|
|
|
|
yield return new TernaryButton(kvp.Value, kvp.Key.Titleize(), () => getIconForBank(kvp.Key));
|
|
|
|
}
|
|
|
|
|
|
|
|
private Drawable getIconForBank(string sampleName)
|
|
|
|
{
|
|
|
|
return new Container
|
|
|
|
{
|
|
|
|
Size = new Vector2(30, 20),
|
|
|
|
Children = new Drawable[]
|
|
|
|
{
|
|
|
|
new SpriteIcon
|
|
|
|
{
|
|
|
|
Size = new Vector2(8),
|
|
|
|
Anchor = Anchor.CentreLeft,
|
|
|
|
Origin = Anchor.CentreLeft,
|
|
|
|
Icon = FontAwesome.Solid.VolumeOff
|
|
|
|
},
|
|
|
|
new OsuSpriteText
|
|
|
|
{
|
|
|
|
Anchor = Anchor.CentreLeft,
|
|
|
|
Origin = Anchor.CentreLeft,
|
|
|
|
X = 10,
|
|
|
|
Y = -1,
|
|
|
|
Font = OsuFont.Default.With(weight: FontWeight.Bold, size: 20),
|
2022-10-20 23:16:33 +08:00
|
|
|
Text = $"{char.ToUpperInvariant(sampleName.First())}"
|
2022-10-19 20:35:08 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
2020-09-25 16:53:41 +08:00
|
|
|
private Drawable getIconForSample(string sampleName)
|
|
|
|
{
|
|
|
|
switch (sampleName)
|
|
|
|
{
|
|
|
|
case HitSampleInfo.HIT_CLAP:
|
|
|
|
return new SpriteIcon { Icon = FontAwesome.Solid.Hands };
|
|
|
|
|
|
|
|
case HitSampleInfo.HIT_WHISTLE:
|
|
|
|
return new SpriteIcon { Icon = FontAwesome.Solid.Bullhorn };
|
|
|
|
|
|
|
|
case HitSampleInfo.HIT_FINISH:
|
|
|
|
return new SpriteIcon { Icon = FontAwesome.Solid.DrumSteelpan };
|
|
|
|
}
|
|
|
|
|
|
|
|
return null;
|
2020-09-25 16:40:43 +08:00
|
|
|
}
|
2020-09-25 13:10:30 +08:00
|
|
|
|
2020-01-15 18:09:49 +08:00
|
|
|
#region Placement
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Refreshes the current placement tool.
|
|
|
|
/// </summary>
|
|
|
|
private void refreshTool()
|
|
|
|
{
|
2020-02-13 09:00:09 +08:00
|
|
|
removePlacement();
|
2021-04-16 13:10:21 +08:00
|
|
|
ensurePlacementCreated();
|
2020-01-15 18:09:49 +08:00
|
|
|
}
|
|
|
|
|
2020-05-20 17:40:55 +08:00
|
|
|
private void updatePlacementPosition()
|
2020-01-15 18:09:49 +08:00
|
|
|
{
|
2022-10-11 21:39:53 +08:00
|
|
|
var snapResult = Composer.FindSnappedPositionAndTime(InputManager.CurrentState.Mouse.Position);
|
2020-01-15 18:09:49 +08:00
|
|
|
|
2020-11-26 18:20:51 +08:00
|
|
|
// if no time was found from positional snapping, we should still quantize to the beat.
|
|
|
|
snapResult.Time ??= Beatmap.SnapTime(EditorClock.CurrentTime, null);
|
|
|
|
|
2023-01-13 23:16:52 +08:00
|
|
|
CurrentPlacement.UpdateTimeAndPosition(snapResult);
|
2020-01-15 18:09:49 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
protected override void Update()
|
|
|
|
{
|
|
|
|
base.Update();
|
|
|
|
|
2023-01-13 23:16:52 +08:00
|
|
|
if (CurrentPlacement != null)
|
2021-04-16 13:10:21 +08:00
|
|
|
{
|
2023-01-13 23:16:52 +08:00
|
|
|
switch (CurrentPlacement.PlacementActive)
|
2021-04-16 13:10:21 +08:00
|
|
|
{
|
|
|
|
case PlacementBlueprint.PlacementState.Waiting:
|
|
|
|
if (!Composer.CursorInPlacementArea)
|
|
|
|
removePlacement();
|
|
|
|
break;
|
|
|
|
|
|
|
|
case PlacementBlueprint.PlacementState.Finished:
|
|
|
|
removePlacement();
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-11-13 16:10:29 +08:00
|
|
|
if (Composer.CursorInPlacementArea)
|
2021-04-16 13:10:21 +08:00
|
|
|
ensurePlacementCreated();
|
2020-02-13 09:45:16 +08:00
|
|
|
|
2023-01-13 23:16:52 +08:00
|
|
|
if (CurrentPlacement != null)
|
2020-05-20 17:40:55 +08:00
|
|
|
updatePlacementPosition();
|
2020-01-15 18:09:49 +08:00
|
|
|
}
|
|
|
|
|
2021-04-27 17:33:47 +08:00
|
|
|
protected sealed override SelectionBlueprint<HitObject> CreateBlueprintFor(HitObject item)
|
2020-01-15 18:09:49 +08:00
|
|
|
{
|
2021-04-27 17:33:47 +08:00
|
|
|
var drawable = Composer.HitObjects.FirstOrDefault(d => d.HitObject == item);
|
2020-02-13 09:00:09 +08:00
|
|
|
|
2020-01-15 18:09:49 +08:00
|
|
|
if (drawable == null)
|
|
|
|
return null;
|
|
|
|
|
2021-06-22 09:05:03 +08:00
|
|
|
return CreateHitObjectBlueprintFor(item)?.With(b => b.DrawableObject = drawable);
|
2020-01-15 18:09:49 +08:00
|
|
|
}
|
|
|
|
|
2021-06-23 08:40:07 +08:00
|
|
|
[CanBeNull]
|
2021-05-13 18:53:32 +08:00
|
|
|
public virtual HitObjectSelectionBlueprint CreateHitObjectBlueprintFor(HitObject hitObject) => null;
|
2020-01-15 18:09:49 +08:00
|
|
|
|
2021-05-24 16:03:54 +08:00
|
|
|
private void hitObjectAdded(HitObject obj)
|
2020-01-15 18:09:49 +08:00
|
|
|
{
|
2021-05-24 16:03:54 +08:00
|
|
|
// refresh the tool to handle the case of placement completing.
|
2020-11-12 18:52:02 +08:00
|
|
|
refreshTool();
|
2020-10-09 02:31:01 +08:00
|
|
|
|
|
|
|
// on successful placement, the new combo button should be reset as this is the most common user interaction.
|
|
|
|
if (Beatmap.SelectedHitObjects.Count == 0)
|
|
|
|
NewCombo.Value = TernaryState.False;
|
2020-01-15 18:09:49 +08:00
|
|
|
}
|
|
|
|
|
2021-04-16 13:10:21 +08:00
|
|
|
private void ensurePlacementCreated()
|
2020-02-13 09:05:50 +08:00
|
|
|
{
|
2023-01-13 23:16:52 +08:00
|
|
|
if (CurrentPlacement != null) return;
|
2020-02-13 09:05:50 +08:00
|
|
|
|
|
|
|
var blueprint = CurrentTool?.CreatePlacementBlueprint();
|
|
|
|
|
|
|
|
if (blueprint != null)
|
|
|
|
{
|
2023-01-13 23:16:52 +08:00
|
|
|
placementBlueprintContainer.Child = CurrentPlacement = blueprint;
|
2020-02-13 09:05:50 +08:00
|
|
|
|
|
|
|
// Fixes a 1-frame position discrepancy due to the first mouse move event happening in the next frame
|
2020-05-20 17:40:55 +08:00
|
|
|
updatePlacementPosition();
|
2020-09-25 17:00:17 +08:00
|
|
|
|
|
|
|
updatePlacementSamples();
|
|
|
|
|
|
|
|
updatePlacementNewCombo();
|
2020-02-13 09:05:50 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-05-12 14:48:53 +08:00
|
|
|
private void commitIfPlacementActive()
|
2020-02-13 09:00:09 +08:00
|
|
|
{
|
2023-05-12 14:48:53 +08:00
|
|
|
CurrentPlacement?.EndPlacement(CurrentPlacement.PlacementActive == PlacementBlueprint.PlacementState.Active);
|
|
|
|
removePlacement();
|
|
|
|
}
|
2020-02-13 09:00:09 +08:00
|
|
|
|
2023-05-12 14:48:53 +08:00
|
|
|
private void removePlacement()
|
|
|
|
{
|
|
|
|
CurrentPlacement?.EndPlacement(false);
|
|
|
|
CurrentPlacement?.Expire();
|
2023-01-13 23:16:52 +08:00
|
|
|
CurrentPlacement = null;
|
2020-02-13 09:00:09 +08:00
|
|
|
}
|
|
|
|
|
2020-01-15 18:09:49 +08:00
|
|
|
private HitObjectCompositionTool currentTool;
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// The current placement tool.
|
|
|
|
/// </summary>
|
|
|
|
public HitObjectCompositionTool CurrentTool
|
|
|
|
{
|
|
|
|
get => currentTool;
|
2020-02-13 09:00:09 +08:00
|
|
|
|
2020-01-15 18:09:49 +08:00
|
|
|
set
|
|
|
|
{
|
|
|
|
if (currentTool == value)
|
|
|
|
return;
|
|
|
|
|
|
|
|
currentTool = value;
|
|
|
|
|
2023-05-12 14:48:53 +08:00
|
|
|
// As per stable editor, when changing tools, we should forcefully commit any pending placement.
|
|
|
|
commitIfPlacementActive();
|
2020-01-15 18:09:49 +08:00
|
|
|
}
|
|
|
|
}
|
2020-01-02 10:46:18 +08:00
|
|
|
}
|
|
|
|
}
|