mirror of
https://github.com/ppy/osu.git
synced 2024-11-07 22:27:25 +08:00
Merge pull request #9593 from peppy/editor-show-selected-count
Show count of selected objects in selection box
This commit is contained in:
commit
fb5a54d242
@ -64,6 +64,7 @@ namespace osu.Game.Screens.Edit.Compose.Components
|
|||||||
DragBox = CreateDragBox(select),
|
DragBox = CreateDragBox(select),
|
||||||
selectionHandler,
|
selectionHandler,
|
||||||
SelectionBlueprints = CreateSelectionBlueprintContainer(),
|
SelectionBlueprints = CreateSelectionBlueprintContainer(),
|
||||||
|
selectionHandler.CreateProxy(),
|
||||||
DragBox.CreateProxy().With(p => p.Depth = float.MinValue)
|
DragBox.CreateProxy().With(p => p.Depth = float.MinValue)
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -15,6 +15,7 @@ using osu.Framework.Input.Bindings;
|
|||||||
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;
|
||||||
|
using osu.Game.Graphics.Sprites;
|
||||||
using osu.Game.Graphics.UserInterface;
|
using osu.Game.Graphics.UserInterface;
|
||||||
using osu.Game.Rulesets.Edit;
|
using osu.Game.Rulesets.Edit;
|
||||||
using osu.Game.Rulesets.Objects;
|
using osu.Game.Rulesets.Objects;
|
||||||
@ -35,7 +36,9 @@ namespace osu.Game.Screens.Edit.Compose.Components
|
|||||||
|
|
||||||
public IEnumerable<HitObject> SelectedHitObjects => selectedBlueprints.Select(b => b.HitObject);
|
public IEnumerable<HitObject> SelectedHitObjects => selectedBlueprints.Select(b => b.HitObject);
|
||||||
|
|
||||||
private Drawable outline;
|
private Drawable content;
|
||||||
|
|
||||||
|
private OsuSpriteText selectionDetailsText;
|
||||||
|
|
||||||
[Resolved(CanBeNull = true)]
|
[Resolved(CanBeNull = true)]
|
||||||
protected EditorBeatmap EditorBeatmap { get; private set; }
|
protected EditorBeatmap EditorBeatmap { get; private set; }
|
||||||
@ -55,16 +58,42 @@ namespace osu.Game.Screens.Edit.Compose.Components
|
|||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
private void load(OsuColour colours)
|
private void load(OsuColour colours)
|
||||||
{
|
{
|
||||||
InternalChild = outline = new Container
|
InternalChild = content = new Container
|
||||||
{
|
{
|
||||||
Masking = true,
|
Children = new Drawable[]
|
||||||
BorderThickness = BORDER_RADIUS,
|
|
||||||
BorderColour = colours.Yellow,
|
|
||||||
Child = new Box
|
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.Both,
|
new Container
|
||||||
AlwaysPresent = true,
|
{
|
||||||
Alpha = 0
|
RelativeSizeAxes = Axes.Both,
|
||||||
|
Masking = true,
|
||||||
|
BorderThickness = BORDER_RADIUS,
|
||||||
|
BorderColour = colours.YellowDark,
|
||||||
|
Child = new Box
|
||||||
|
{
|
||||||
|
RelativeSizeAxes = Axes.Both,
|
||||||
|
AlwaysPresent = true,
|
||||||
|
Alpha = 0
|
||||||
|
}
|
||||||
|
},
|
||||||
|
new Container
|
||||||
|
{
|
||||||
|
Name = "info text",
|
||||||
|
AutoSizeAxes = Axes.Both,
|
||||||
|
Children = new Drawable[]
|
||||||
|
{
|
||||||
|
new Box
|
||||||
|
{
|
||||||
|
Colour = colours.YellowDark,
|
||||||
|
RelativeSizeAxes = Axes.Both,
|
||||||
|
},
|
||||||
|
selectionDetailsText = new OsuSpriteText
|
||||||
|
{
|
||||||
|
Padding = new MarginPadding(2),
|
||||||
|
Colour = colours.Gray0,
|
||||||
|
Font = OsuFont.Default.With(size: 11)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
@ -131,9 +160,7 @@ namespace osu.Game.Screens.Edit.Compose.Components
|
|||||||
selectedBlueprints.Remove(blueprint);
|
selectedBlueprints.Remove(blueprint);
|
||||||
EditorBeatmap.SelectedHitObjects.Remove(blueprint.HitObject);
|
EditorBeatmap.SelectedHitObjects.Remove(blueprint.HitObject);
|
||||||
|
|
||||||
// We don't want to update visibility if > 0, since we may be deselecting blueprints during drag-selection
|
UpdateVisibility();
|
||||||
if (selectedBlueprints.Count == 0)
|
|
||||||
UpdateVisibility();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -179,7 +206,11 @@ namespace osu.Game.Screens.Edit.Compose.Components
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
internal void UpdateVisibility()
|
internal void UpdateVisibility()
|
||||||
{
|
{
|
||||||
if (selectedBlueprints.Count > 0)
|
int count = selectedBlueprints.Count;
|
||||||
|
|
||||||
|
selectionDetailsText.Text = count > 0 ? count.ToString() : string.Empty;
|
||||||
|
|
||||||
|
if (count > 0)
|
||||||
Show();
|
Show();
|
||||||
else
|
else
|
||||||
Hide();
|
Hide();
|
||||||
@ -205,8 +236,8 @@ namespace osu.Game.Screens.Edit.Compose.Components
|
|||||||
topLeft -= new Vector2(5);
|
topLeft -= new Vector2(5);
|
||||||
bottomRight += new Vector2(5);
|
bottomRight += new Vector2(5);
|
||||||
|
|
||||||
outline.Size = bottomRight - topLeft;
|
content.Size = bottomRight - topLeft;
|
||||||
outline.Position = topLeft;
|
content.Position = topLeft;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
Loading…
Reference in New Issue
Block a user