1
0
mirror of https://github.com/ppy/osu.git synced 2025-03-05 15:03:16 +08:00

Merge branch 'master' into skin-editor-borrowed-dependencies

This commit is contained in:
Dean Herbert 2022-03-17 15:09:04 +09:00
commit 1d83b36cfc
4 changed files with 22 additions and 28 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,8 +49,8 @@ namespace osu.Game.Skinning.Editor
private Container content;
private EditorSidebarSection settingsToolbox;
private EditorSidebar componentsSidebar;
private EditorSidebar settingsSidebar;
public SkinEditor()
{
@ -153,17 +152,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(),
}
}
}
@ -261,14 +250,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

@ -199,6 +199,12 @@ namespace osu.Game.Skinning.Editor
Items = createAnchorItems((d, o) => ((Drawable)d).Origin == o, applyOrigins).ToArray()
};
yield return new OsuMenuItem("Reset position", MenuItemType.Standard, () =>
{
foreach (var blueprint in SelectedBlueprints)
((Drawable)blueprint.Item).Position = Vector2.Zero;
});
foreach (var item in base.GetContextMenuItemsForSelection(selection))
yield return item;

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()
});
}
}

View File

@ -166,15 +166,15 @@ namespace osu.Game.Utils
foreach (var apiMod in proposedMods)
{
try
{
// will throw if invalid
valid.Add(apiMod.ToMod(ruleset));
}
catch
var mod = apiMod.ToMod(ruleset);
if (mod is UnknownMod)
{
proposedWereValid = false;
continue;
}
valid.Add(mod);
}
return proposedWereValid;