Show settings for multiple components in a selection

This commit is contained in:
Dean Herbert 2022-03-15 17:41:20 +09:00
parent 54e351efe9
commit 27122c17c9
2 changed files with 10 additions and 22 deletions

View File

@ -11,7 +11,6 @@
using osu.Framework.Graphics.UserInterface;
using osu.Framework.Input.Events;
using osu.Framework.Testing;
using osu.Game.Configuration;
using osu.Game.Graphics;
using osu.Game.Graphics.Containers;
using osu.Game.Graphics.Cursor;
@ -50,7 +49,7 @@ public class SkinEditor : VisibilityContainer
private Container content;
private EditorSidebarSection settingsToolbox;
private EditorSidebar settingsSidebar;
public SkinEditor()
{
@ -161,17 +160,7 @@ private void load()
Depth = float.MaxValue,
RelativeSizeAxes = Axes.Both,
},
new EditorSidebar
{
Children = new[]
{
settingsToolbox = new SkinSettingsToolbox
{
Anchor = Anchor.CentreRight,
Origin = Anchor.CentreRight,
}
}
},
settingsSidebar = new EditorSidebar(),
}
}
}
@ -266,14 +255,10 @@ private void placeComponent(Type type)
private void populateSettings()
{
settingsToolbox.Clear();
settingsSidebar.Clear();
var first = SelectedComponents.OfType<Drawable>().FirstOrDefault();
if (first != null)
{
settingsToolbox.Children = first.CreateSettingsControls().ToArray();
}
foreach (var component in SelectedComponents.OfType<Drawable>())
settingsSidebar.Add(new SkinSettingsToolbox(component));
}
private IEnumerable<ISkinnableTarget> availableTargets => targetScreen.ChildrenOfType<ISkinnableTarget>();

View File

@ -1,8 +1,10 @@
// 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.
using System.Linq;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Game.Configuration;
using osu.Game.Screens.Edit.Components;
using osuTK;
@ -12,8 +14,8 @@ internal class SkinSettingsToolbox : EditorSidebarSection
{
protected override Container<Drawable> Content { get; }
public SkinSettingsToolbox()
: base("Settings")
public SkinSettingsToolbox(Drawable component)
: base($"Settings ({component.GetType().Name})")
{
base.Content.Add(Content = new FillFlowContainer
{
@ -21,6 +23,7 @@ public SkinSettingsToolbox()
AutoSizeAxes = Axes.Y,
Direction = FillDirection.Vertical,
Spacing = new Vector2(10),
Children = component.CreateSettingsControls().ToArray()
});
}
}