You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
26 lines
939 B
C#
26 lines
939 B
C#
1 year ago
|
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());
|
||
|
}
|
||
|
}
|
||
|
}
|