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.

FieldCollection.cs 1.2KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. namespace UnityEditor.ShaderGraph
  4. {
  5. [GenerationAPI]
  6. internal class FieldCollection : IEnumerable<FieldCollection.Item>
  7. {
  8. public class Item
  9. {
  10. public FieldDescriptor field { get; }
  11. public Item(FieldDescriptor field)
  12. {
  13. this.field = field;
  14. }
  15. }
  16. readonly List<FieldCollection.Item> m_Items;
  17. public FieldCollection()
  18. {
  19. m_Items = new List<FieldCollection.Item>();
  20. }
  21. public FieldCollection Add(FieldCollection fields)
  22. {
  23. foreach (FieldCollection.Item item in fields)
  24. {
  25. m_Items.Add(item);
  26. }
  27. return this;
  28. }
  29. public FieldCollection Add(FieldDescriptor field)
  30. {
  31. m_Items.Add(new Item(field));
  32. return this;
  33. }
  34. public IEnumerator<FieldCollection.Item> GetEnumerator()
  35. {
  36. return m_Items.GetEnumerator();
  37. }
  38. IEnumerator IEnumerable.GetEnumerator()
  39. {
  40. return GetEnumerator();
  41. }
  42. }
  43. }