ProcessorView.cs 702 B

1234567891011121314151617181920212223242526272829303132333435
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. using UnityEditor.Experimental.GraphView;
  5. using UnityEditor.UIElements;
  6. using UnityEngine.UIElements;
  7. namespace GraphProcessor
  8. {
  9. public class ProcessorView : PinnedElementView
  10. {
  11. BaseGraphProcessor processor;
  12. public ProcessorView()
  13. {
  14. title = "Process panel";
  15. }
  16. protected override void Initialize(BaseGraphView graphView)
  17. {
  18. processor = new ProcessGraphProcessor(graphView.graph);
  19. graphView.computeOrderUpdated += processor.UpdateComputeOrder;
  20. Button b = new Button(OnPlay) { name = "ActionButton", text = "Play !" };
  21. content.Add(b);
  22. }
  23. void OnPlay()
  24. {
  25. processor.Run();
  26. }
  27. }
  28. }