Ei kuvausta
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.

AdditionalCommandCollection.cs 1.3KB

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