Add component list to main editor interface and enable basic placement

This commit is contained in:
Dean Herbert
2021-04-30 12:35:58 +09:00
parent 6442fb819f
commit ae9d1dc40b
4 changed files with 76 additions and 21 deletions

View File

@ -1,13 +1,17 @@
// 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;
using System.Linq;
using osu.Framework.Allocation;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Input.Events;
using osu.Framework.Testing;
using osu.Game.Graphics;
using osu.Game.Graphics.Containers;
using osu.Game.Graphics.Cursor;
using osu.Game.Screens.Play;
namespace osu.Game.Skinning.Editor
{
@ -45,6 +49,12 @@ namespace osu.Game.Skinning.Editor
RelativeSizeAxes = Axes.X
},
new SkinBlueprintContainer(target),
new SkinComponentToolbox
{
Anchor = Anchor.CentreLeft,
Origin = Anchor.CentreLeft,
RequestPlacement = placeComponent
}
}
};
@ -56,6 +66,15 @@ namespace osu.Game.Skinning.Editor
});
}
private void placeComponent(Type type)
{
var instance = (Drawable)Activator.CreateInstance(type);
var targetContainer = target.ChildrenOfType<HUDOverlay>().FirstOrDefault();
targetContainer?.Add(instance);
}
protected override void LoadComplete()
{
base.LoadComplete();