mirror of
https://github.com/ppy/osu.git
synced 2025-03-28 01:37:46 +08:00
Add basic target layer selection in skin editor
This commit is contained in:
parent
c03b6cec23
commit
ba5a87ca04
@ -24,6 +24,7 @@ using osu.Game.Graphics.Cursor;
|
|||||||
using osu.Game.Graphics.UserInterface;
|
using osu.Game.Graphics.UserInterface;
|
||||||
using osu.Game.Localisation;
|
using osu.Game.Localisation;
|
||||||
using osu.Game.Overlays.OSD;
|
using osu.Game.Overlays.OSD;
|
||||||
|
using osu.Game.Overlays.Settings;
|
||||||
using osu.Game.Screens.Edit;
|
using osu.Game.Screens.Edit;
|
||||||
using osu.Game.Screens.Edit.Components;
|
using osu.Game.Screens.Edit.Components;
|
||||||
using osu.Game.Screens.Edit.Components.Menus;
|
using osu.Game.Screens.Edit.Components.Menus;
|
||||||
@ -66,6 +67,8 @@ namespace osu.Game.Overlays.SkinEditor
|
|||||||
[Cached]
|
[Cached]
|
||||||
private readonly OverlayColourProvider colourProvider = new OverlayColourProvider(OverlayColourScheme.Blue);
|
private readonly OverlayColourProvider colourProvider = new OverlayColourProvider(OverlayColourScheme.Blue);
|
||||||
|
|
||||||
|
private readonly Bindable<SkinComponentsContainerLookup?> selectedTarget = new Bindable<SkinComponentsContainerLookup?>();
|
||||||
|
|
||||||
private bool hasBegunMutating;
|
private bool hasBegunMutating;
|
||||||
|
|
||||||
private Container? content;
|
private Container? content;
|
||||||
@ -271,9 +274,27 @@ namespace osu.Game.Overlays.SkinEditor
|
|||||||
|
|
||||||
content.Child = new SkinBlueprintContainer(targetScreen);
|
content.Child = new SkinBlueprintContainer(targetScreen);
|
||||||
|
|
||||||
componentsSidebar.Child = new SkinComponentToolbox(getFirstTarget() as CompositeDrawable)
|
selectedTarget.Default = getFirstTarget()?.Lookup;
|
||||||
|
if (!availableTargets.Any(t => t.Lookup.Equals(selectedTarget.Value)))
|
||||||
|
selectedTarget.Value = getFirstTarget()?.Lookup;
|
||||||
|
|
||||||
|
componentsSidebar.Children = new[]
|
||||||
{
|
{
|
||||||
RequestPlacement = placeComponent
|
new EditorSidebarSection("Current working layer")
|
||||||
|
{
|
||||||
|
Children = new Drawable[]
|
||||||
|
{
|
||||||
|
new SettingsDropdown<SkinComponentsContainerLookup?>
|
||||||
|
{
|
||||||
|
Items = availableTargets.Select(t => t.Lookup),
|
||||||
|
Current = selectedTarget,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
new SkinComponentToolbox(getFirstTarget())
|
||||||
|
{
|
||||||
|
RequestPlacement = placeComponent
|
||||||
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -341,9 +362,9 @@ namespace osu.Game.Overlays.SkinEditor
|
|||||||
|
|
||||||
private IEnumerable<SkinComponentsContainer> availableTargets => targetScreen.ChildrenOfType<SkinComponentsContainer>();
|
private IEnumerable<SkinComponentsContainer> availableTargets => targetScreen.ChildrenOfType<SkinComponentsContainer>();
|
||||||
|
|
||||||
private ISerialisableDrawableContainer? getFirstTarget() => availableTargets.FirstOrDefault();
|
private SkinComponentsContainer? getFirstTarget() => availableTargets.FirstOrDefault();
|
||||||
|
|
||||||
private ISerialisableDrawableContainer? getTarget(SkinComponentsContainerLookup.TargetArea target)
|
private SkinComponentsContainer? getTarget(SkinComponentsContainerLookup.TargetArea target)
|
||||||
{
|
{
|
||||||
return availableTargets.FirstOrDefault(c => c.Lookup.Target == target);
|
return availableTargets.FirstOrDefault(c => c.Lookup.Target == target);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user