2021-04-28 06:14:48 +00:00
|
|
|
// 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.Testing;
|
|
|
|
using osu.Game.Rulesets.Edit;
|
|
|
|
using osu.Game.Screens.Edit.Compose.Components;
|
|
|
|
using osu.Game.Screens.Play.HUD;
|
|
|
|
|
|
|
|
namespace osu.Game.Skinning.Editor
|
|
|
|
{
|
2021-04-28 09:34:34 +00:00
|
|
|
public class SkinBlueprintContainer : BlueprintContainer<ISkinnableComponent>
|
2021-04-28 06:14:48 +00:00
|
|
|
{
|
|
|
|
private readonly Drawable target;
|
|
|
|
|
|
|
|
public SkinBlueprintContainer(Drawable target)
|
|
|
|
{
|
|
|
|
this.target = target;
|
|
|
|
}
|
|
|
|
|
|
|
|
protected override void LoadComplete()
|
|
|
|
{
|
|
|
|
base.LoadComplete();
|
|
|
|
|
2021-04-28 09:59:55 +00:00
|
|
|
checkForComponents();
|
|
|
|
}
|
|
|
|
|
|
|
|
private void checkForComponents()
|
|
|
|
{
|
|
|
|
foreach (var c in target.ChildrenOfType<ISkinnableComponent>().ToArray()) AddBlueprintFor(c);
|
2021-04-28 06:14:48 +00:00
|
|
|
|
2021-04-28 09:59:55 +00:00
|
|
|
Scheduler.AddDelayed(checkForComponents, 1000);
|
2021-04-28 06:14:48 +00:00
|
|
|
}
|
|
|
|
|
2021-04-28 09:34:34 +00:00
|
|
|
protected override SelectionHandler<ISkinnableComponent> CreateSelectionHandler() => new SkinSelectionHandler();
|
2021-04-28 06:14:48 +00:00
|
|
|
|
2021-04-28 09:34:34 +00:00
|
|
|
protected override SelectionBlueprint<ISkinnableComponent> CreateBlueprintFor(ISkinnableComponent component)
|
2021-04-28 06:14:48 +00:00
|
|
|
=> new SkinBlueprint(component);
|
|
|
|
}
|
|
|
|
}
|