1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-15 00:53:22 +08:00

Merge pull request #17278 from peppy/skin-editor-multiple-component-settings

Show settings for multiple skin components in a selection
This commit is contained in:
Dan Balasescu 2022-03-17 13:43:59 +09:00 committed by GitHub
commit 07433d0540
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 22 deletions

View File

@ -11,7 +11,6 @@ using osu.Framework.Graphics.Containers;
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 @@ namespace osu.Game.Skinning.Editor
private Container content;
private EditorSidebarSection settingsToolbox;
private EditorSidebar settingsSidebar;
public SkinEditor()
{
@ -161,17 +160,7 @@ namespace osu.Game.Skinning.Editor
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 @@ namespace osu.Game.Skinning.Editor
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 @@ namespace osu.Game.Skinning.Editor
{
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 @@ namespace osu.Game.Skinning.Editor
AutoSizeAxes = Axes.Y,
Direction = FillDirection.Vertical,
Spacing = new Vector2(10),
Children = component.CreateSettingsControls().ToArray()
});
}
}