mirror of
https://github.com/ppy/osu.git
synced 2025-02-21 20:12:57 +08:00
Fix code style issues & restructure
This commit is contained in:
parent
255bb9d100
commit
3f8c4c57d0
@ -120,6 +120,11 @@ namespace osu.Game.Rulesets.Edit
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public void Deselect() => State = SelectionState.NotSelected;
|
public void Deselect() => State = SelectionState.NotSelected;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Toggles the selection state of this <see cref="OverlaySelectionBlueprint"/>.
|
||||||
|
/// </summary>
|
||||||
|
public void ToggleSelection() => State = IsSelected ? SelectionState.NotSelected : SelectionState.Selected;
|
||||||
|
|
||||||
public bool IsSelected => State == SelectionState.Selected;
|
public bool IsSelected => State == SelectionState.Selected;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -14,7 +14,6 @@ using osu.Framework.Graphics.Shapes;
|
|||||||
using osu.Framework.Graphics.UserInterface;
|
using osu.Framework.Graphics.UserInterface;
|
||||||
using osu.Framework.Input;
|
using osu.Framework.Input;
|
||||||
using osu.Framework.Input.Bindings;
|
using osu.Framework.Input.Bindings;
|
||||||
using osu.Framework.Input.Events;
|
|
||||||
using osu.Framework.Input.States;
|
using osu.Framework.Input.States;
|
||||||
using osu.Game.Audio;
|
using osu.Game.Audio;
|
||||||
using osu.Game.Graphics;
|
using osu.Game.Graphics;
|
||||||
@ -225,38 +224,22 @@ namespace osu.Game.Screens.Edit.Compose.Components
|
|||||||
/// <param name="blueprint">The blueprint.</param>
|
/// <param name="blueprint">The blueprint.</param>
|
||||||
/// <param name="state">The input state at the point of selection.</param>
|
/// <param name="state">The input state at the point of selection.</param>
|
||||||
internal void HandleSelectionRequested(SelectionBlueprint blueprint, InputState state)
|
internal void HandleSelectionRequested(SelectionBlueprint blueprint, InputState state)
|
||||||
{
|
|
||||||
if (!shiftClickDeleteCheck(blueprint, state))
|
|
||||||
handleMultiSelection(blueprint, state);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void handleMultiSelection(SelectionBlueprint blueprint, InputState state)
|
|
||||||
{
|
|
||||||
if (state.Keyboard.ControlPressed)
|
|
||||||
{
|
|
||||||
if (blueprint.IsSelected)
|
|
||||||
blueprint.Deselect();
|
|
||||||
else
|
|
||||||
blueprint.Select();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (blueprint.IsSelected)
|
|
||||||
return;
|
|
||||||
|
|
||||||
DeselectAll?.Invoke();
|
|
||||||
blueprint.Select();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private bool shiftClickDeleteCheck(SelectionBlueprint blueprint, InputState state)
|
|
||||||
{
|
{
|
||||||
if (state.Keyboard.ShiftPressed && state.Mouse.IsPressed(MouseButton.Right))
|
if (state.Keyboard.ShiftPressed && state.Mouse.IsPressed(MouseButton.Right))
|
||||||
{
|
|
||||||
EditorBeatmap.Remove(blueprint.HitObject);
|
EditorBeatmap.Remove(blueprint.HitObject);
|
||||||
return true;
|
else if (state.Keyboard.ControlPressed)
|
||||||
}
|
blueprint.ToggleSelection();
|
||||||
return false;
|
else
|
||||||
|
ensureSelected(blueprint);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void ensureSelected(SelectionBlueprint blueprint)
|
||||||
|
{
|
||||||
|
if (blueprint.IsSelected)
|
||||||
|
return;
|
||||||
|
|
||||||
|
DeselectAll?.Invoke();
|
||||||
|
blueprint.Select();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void deleteSelected()
|
private void deleteSelected()
|
||||||
|
Loading…
Reference in New Issue
Block a user