No Description
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

FlowGraphContextStateExtension.cs 939B

12345678910111213141516171819202122232425
  1. namespace Unity.VisualScripting
  2. {
  3. [GraphContextExtension(typeof(FlowGraphContext))]
  4. public sealed class FlowGraphContextStateExtension : GraphContextExtension<FlowGraphContext>
  5. {
  6. public FlowGraphContextStateExtension(FlowGraphContext context) : base(context) { }
  7. public override bool AcceptsDragAndDrop()
  8. {
  9. return DragAndDropUtility.Is<StateGraphAsset>();
  10. }
  11. public override void PerformDragAndDrop()
  12. {
  13. var statemacro = DragAndDropUtility.Get<StateGraphAsset>();
  14. var stateUnit = new StateUnit(statemacro);
  15. context.canvas.AddUnit(stateUnit, DragAndDropUtility.position);
  16. }
  17. public override void DrawDragAndDropPreview()
  18. {
  19. GraphGUI.DrawDragAndDropPreviewLabel(DragAndDropUtility.offsetedPosition, DragAndDropUtility.Get<StateGraphAsset>().name, typeof(StateGraphAsset).Icon());
  20. }
  21. }
  22. }