Firstborn/Library/PackageCache/com.unity.visualscripting@1.../Editor/VisualScripting.State/Flow/FlowGraphContextStateExtens...
Schaken-Mods b486678290 Library -Artifacts
Library -Artifacts
2023-03-28 12:24:16 -05:00

26 lines
939 B
C#

namespace Unity.VisualScripting
{
[GraphContextExtension(typeof(FlowGraphContext))]
public sealed class FlowGraphContextStateExtension : GraphContextExtension<FlowGraphContext>
{
public FlowGraphContextStateExtension(FlowGraphContext context) : base(context) { }
public override bool AcceptsDragAndDrop()
{
return DragAndDropUtility.Is<StateGraphAsset>();
}
public override void PerformDragAndDrop()
{
var statemacro = DragAndDropUtility.Get<StateGraphAsset>();
var stateUnit = new StateUnit(statemacro);
context.canvas.AddUnit(stateUnit, DragAndDropUtility.position);
}
public override void DrawDragAndDropPreview()
{
GraphGUI.DrawDragAndDropPreviewLabel(DragAndDropUtility.offsetedPosition, DragAndDropUtility.Get<StateGraphAsset>().name, typeof(StateGraphAsset).Icon());
}
}
}