mirror of
https://github.com/ppy/osu.git
synced 2024-11-13 20:07:25 +08:00
Merge branch 'master' into fix-carousel-missing-import
This commit is contained in:
commit
db3e360229
@ -9,6 +9,7 @@ using osu.Framework.Allocation;
|
|||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Graphics.Containers;
|
using osu.Framework.Graphics.Containers;
|
||||||
using osu.Framework.Input;
|
using osu.Framework.Input;
|
||||||
|
using osu.Framework.Input.Events;
|
||||||
using osu.Framework.Logging;
|
using osu.Framework.Logging;
|
||||||
using osu.Framework.Threading;
|
using osu.Framework.Threading;
|
||||||
using osu.Framework.Timing;
|
using osu.Framework.Timing;
|
||||||
@ -25,6 +26,7 @@ using osu.Game.Screens.Edit.Components.RadioButtons;
|
|||||||
using osu.Game.Screens.Edit.Compose;
|
using osu.Game.Screens.Edit.Compose;
|
||||||
using osu.Game.Screens.Edit.Compose.Components;
|
using osu.Game.Screens.Edit.Compose.Components;
|
||||||
using osuTK;
|
using osuTK;
|
||||||
|
using Key = osuTK.Input.Key;
|
||||||
|
|
||||||
namespace osu.Game.Rulesets.Edit
|
namespace osu.Game.Rulesets.Edit
|
||||||
{
|
{
|
||||||
@ -58,6 +60,8 @@ namespace osu.Game.Rulesets.Edit
|
|||||||
|
|
||||||
private InputManager inputManager;
|
private InputManager inputManager;
|
||||||
|
|
||||||
|
private RadioButtonCollection toolboxCollection;
|
||||||
|
|
||||||
protected HitObjectComposer(Ruleset ruleset)
|
protected HitObjectComposer(Ruleset ruleset)
|
||||||
{
|
{
|
||||||
Ruleset = ruleset;
|
Ruleset = ruleset;
|
||||||
@ -100,7 +104,6 @@ namespace osu.Game.Rulesets.Edit
|
|||||||
layerContainers.Add(layerBelowRuleset);
|
layerContainers.Add(layerBelowRuleset);
|
||||||
layerContainers.Add(layerAboveRuleset);
|
layerContainers.Add(layerAboveRuleset);
|
||||||
|
|
||||||
RadioButtonCollection toolboxCollection;
|
|
||||||
InternalChild = new GridContainer
|
InternalChild = new GridContainer
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.Both,
|
RelativeSizeAxes = Axes.Both,
|
||||||
@ -142,11 +145,27 @@ namespace osu.Game.Rulesets.Edit
|
|||||||
.Select(t => new RadioButton(t.Name, () => toolSelected(t)))
|
.Select(t => new RadioButton(t.Name, () => toolSelected(t)))
|
||||||
.ToList();
|
.ToList();
|
||||||
|
|
||||||
toolboxCollection.Items.First().Select();
|
setSelectTool();
|
||||||
|
|
||||||
blueprintContainer.SelectionChanged += selectionChanged;
|
blueprintContainer.SelectionChanged += selectionChanged;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected override bool OnKeyDown(KeyDownEvent e)
|
||||||
|
{
|
||||||
|
if (e.Key >= Key.Number1 && e.Key <= Key.Number9)
|
||||||
|
{
|
||||||
|
var item = toolboxCollection.Items.Skip(e.Key - Key.Number1).FirstOrDefault();
|
||||||
|
|
||||||
|
if (item != null)
|
||||||
|
{
|
||||||
|
item.Select();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return base.OnKeyDown(e);
|
||||||
|
}
|
||||||
|
|
||||||
protected override void LoadComplete()
|
protected override void LoadComplete()
|
||||||
{
|
{
|
||||||
base.LoadComplete();
|
base.LoadComplete();
|
||||||
@ -181,12 +200,19 @@ namespace osu.Game.Rulesets.Edit
|
|||||||
{
|
{
|
||||||
var hitObjects = selectedHitObjects.ToArray();
|
var hitObjects = selectedHitObjects.ToArray();
|
||||||
|
|
||||||
if (!hitObjects.Any())
|
if (hitObjects.Any())
|
||||||
distanceSnapGridContainer.Hide();
|
{
|
||||||
else
|
// ensure in selection mode if a selection is made.
|
||||||
|
setSelectTool();
|
||||||
|
|
||||||
showGridFor(hitObjects);
|
showGridFor(hitObjects);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
distanceSnapGridContainer.Hide();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void setSelectTool() => toolboxCollection.Items.First().Select();
|
||||||
|
|
||||||
private void toolSelected(HitObjectCompositionTool tool)
|
private void toolSelected(HitObjectCompositionTool tool)
|
||||||
{
|
{
|
||||||
blueprintContainer.CurrentTool = tool;
|
blueprintContainer.CurrentTool = tool;
|
||||||
@ -194,7 +220,10 @@ namespace osu.Game.Rulesets.Edit
|
|||||||
if (tool is SelectTool)
|
if (tool is SelectTool)
|
||||||
distanceSnapGridContainer.Hide();
|
distanceSnapGridContainer.Hide();
|
||||||
else
|
else
|
||||||
|
{
|
||||||
|
EditorBeatmap.SelectedHitObjects.Clear();
|
||||||
showGridFor(Enumerable.Empty<HitObject>());
|
showGridFor(Enumerable.Empty<HitObject>());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void showGridFor(IEnumerable<HitObject> selectedHitObjects)
|
private void showGridFor(IEnumerable<HitObject> selectedHitObjects)
|
||||||
|
@ -74,12 +74,16 @@ namespace osu.Game.Screens.Edit.Compose.Components
|
|||||||
{
|
{
|
||||||
foreach (var o in objects)
|
foreach (var o in objects)
|
||||||
selectionBlueprints.FirstOrDefault(b => b.HitObject == o)?.Select();
|
selectionBlueprints.FirstOrDefault(b => b.HitObject == o)?.Select();
|
||||||
|
|
||||||
|
SelectionChanged?.Invoke(selectedHitObjects);
|
||||||
};
|
};
|
||||||
|
|
||||||
selectedHitObjects.ItemsRemoved += objects =>
|
selectedHitObjects.ItemsRemoved += objects =>
|
||||||
{
|
{
|
||||||
foreach (var o in objects)
|
foreach (var o in objects)
|
||||||
selectionBlueprints.FirstOrDefault(b => b.HitObject == o)?.Deselect();
|
selectionBlueprints.FirstOrDefault(b => b.HitObject == o)?.Deselect();
|
||||||
|
|
||||||
|
SelectionChanged?.Invoke(selectedHitObjects);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -332,8 +336,6 @@ namespace osu.Game.Screens.Edit.Compose.Components
|
|||||||
selectionHandler.HandleSelected(blueprint);
|
selectionHandler.HandleSelected(blueprint);
|
||||||
selectionBlueprints.ChangeChildDepth(blueprint, 1);
|
selectionBlueprints.ChangeChildDepth(blueprint, 1);
|
||||||
beatmap.SelectedHitObjects.Add(blueprint.HitObject);
|
beatmap.SelectedHitObjects.Add(blueprint.HitObject);
|
||||||
|
|
||||||
SelectionChanged?.Invoke(selectionHandler.SelectedHitObjects);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void onBlueprintDeselected(SelectionBlueprint blueprint)
|
private void onBlueprintDeselected(SelectionBlueprint blueprint)
|
||||||
@ -341,8 +343,6 @@ namespace osu.Game.Screens.Edit.Compose.Components
|
|||||||
selectionHandler.HandleDeselected(blueprint);
|
selectionHandler.HandleDeselected(blueprint);
|
||||||
selectionBlueprints.ChangeChildDepth(blueprint, 0);
|
selectionBlueprints.ChangeChildDepth(blueprint, 0);
|
||||||
beatmap.SelectedHitObjects.Remove(blueprint.HitObject);
|
beatmap.SelectedHitObjects.Remove(blueprint.HitObject);
|
||||||
|
|
||||||
SelectionChanged?.Invoke(selectionHandler.SelectedHitObjects);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
Loading…
Reference in New Issue
Block a user