1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-15 14:02:55 +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.Graphics.UserInterface;
using osu.Framework.Input.Events; using osu.Framework.Input.Events;
using osu.Framework.Testing; using osu.Framework.Testing;
using osu.Game.Configuration;
using osu.Game.Graphics; using osu.Game.Graphics;
using osu.Game.Graphics.Containers; using osu.Game.Graphics.Containers;
using osu.Game.Graphics.Cursor; using osu.Game.Graphics.Cursor;
@ -50,7 +49,7 @@ namespace osu.Game.Skinning.Editor
private Container content; private Container content;
private EditorSidebarSection settingsToolbox; private EditorSidebar settingsSidebar;
public SkinEditor() public SkinEditor()
{ {
@ -161,17 +160,7 @@ namespace osu.Game.Skinning.Editor
Depth = float.MaxValue, Depth = float.MaxValue,
RelativeSizeAxes = Axes.Both, RelativeSizeAxes = Axes.Both,
}, },
new EditorSidebar settingsSidebar = new EditorSidebar(),
{
Children = new[]
{
settingsToolbox = new SkinSettingsToolbox
{
Anchor = Anchor.CentreRight,
Origin = Anchor.CentreRight,
}
}
},
} }
} }
} }
@ -266,14 +255,10 @@ namespace osu.Game.Skinning.Editor
private void populateSettings() private void populateSettings()
{ {
settingsToolbox.Clear(); settingsSidebar.Clear();
var first = SelectedComponents.OfType<Drawable>().FirstOrDefault(); foreach (var component in SelectedComponents.OfType<Drawable>())
settingsSidebar.Add(new SkinSettingsToolbox(component));
if (first != null)
{
settingsToolbox.Children = first.CreateSettingsControls().ToArray();
}
} }
private IEnumerable<ISkinnableTarget> availableTargets => targetScreen.ChildrenOfType<ISkinnableTarget>(); 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. // 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. // See the LICENCE file in the repository root for full licence text.
using System.Linq;
using osu.Framework.Graphics; using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Containers;
using osu.Game.Configuration;
using osu.Game.Screens.Edit.Components; using osu.Game.Screens.Edit.Components;
using osuTK; using osuTK;
@ -12,8 +14,8 @@ namespace osu.Game.Skinning.Editor
{ {
protected override Container<Drawable> Content { get; } protected override Container<Drawable> Content { get; }
public SkinSettingsToolbox() public SkinSettingsToolbox(Drawable component)
: base("Settings") : base($"Settings ({component.GetType().Name})")
{ {
base.Content.Add(Content = new FillFlowContainer base.Content.Add(Content = new FillFlowContainer
{ {
@ -21,6 +23,7 @@ namespace osu.Game.Skinning.Editor
AutoSizeAxes = Axes.Y, AutoSizeAxes = Axes.Y,
Direction = FillDirection.Vertical, Direction = FillDirection.Vertical,
Spacing = new Vector2(10), Spacing = new Vector2(10),
Children = component.CreateSettingsControls().ToArray()
}); });
} }
} }