PortConnectionTests.cs 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. using GraphProcessor;
  5. using System.Linq;
  6. [System.Serializable, NodeMenuItem("Custom/PortConnectionTests")]
  7. public class PortConnectionTests : BaseNode
  8. {
  9. [Input]
  10. public IEnumerable< object > inputs = null;
  11. [Output]
  12. public IEnumerable< object > outputs;
  13. public float padding;
  14. public override string name => "Port Tests";
  15. protected override void Process() {}
  16. [CustomPortBehavior(nameof(inputs))]
  17. IEnumerable< PortData > GetPortsForInputs(List< SerializableEdge > edges)
  18. {
  19. yield return new PortData{ displayName = "In 0", displayType = typeof(float), identifier = "0" };
  20. yield return new PortData{ displayName = "In 1", displayType = typeof(Color), identifier = "1" };
  21. yield return new PortData{ displayName = "In 2", displayType = typeof(Vector4), identifier = "2" };
  22. yield return new PortData{ displayName = "In 3", displayType = typeof(GameObject), identifier = "3" };
  23. yield return new PortData{ displayName = "In 4", displayType = typeof(float), identifier = "4" };
  24. yield return new PortData{ displayName = "In 5", displayType = typeof(Color), identifier = "5" };
  25. yield return new PortData{ displayName = "In 6", displayType = typeof(Vector4), identifier = "6" };
  26. yield return new PortData{ displayName = "In 7", displayType = typeof(GameObject), identifier = "7" };
  27. }
  28. [CustomPortBehavior(nameof(outputs))]
  29. IEnumerable< PortData > GetPortsForOutput(List< SerializableEdge > edges)
  30. {
  31. yield return new PortData{ displayName = "Out 0", displayType = typeof(float), identifier = "0" };
  32. yield return new PortData{ displayName = "Out 1", displayType = typeof(Color), identifier = "1" };
  33. yield return new PortData{ displayName = "Out 2", displayType = typeof(Vector4), identifier = "2" };
  34. yield return new PortData{ displayName = "Out 3", displayType = typeof(GameObject), identifier = "3" };
  35. yield return new PortData{ displayName = "Out 4", displayType = typeof(float), identifier = "4" };
  36. yield return new PortData{ displayName = "Out 5", displayType = typeof(Color), identifier = "5" };
  37. yield return new PortData{ displayName = "Out 6", displayType = typeof(Vector4), identifier = "6" };
  38. yield return new PortData{ displayName = "Out 7", displayType = typeof(GameObject), identifier = "7" };
  39. }
  40. }