GroupByGORenderer.cs 782 B

123456789101112131415161718192021222324252627282930313233
  1. using System.Collections.Generic;
  2. using System.Linq;
  3. using UnityEditor;
  4. using UnityEngine;
  5. namespace UnityTest
  6. {
  7. public class GroupByGORenderer : AssertionListRenderer<GameObject>
  8. {
  9. protected override IEnumerable<IGrouping<GameObject, AssertionComponent>> GroupResult (IEnumerable<AssertionComponent> assertionComponents)
  10. {
  11. return assertionComponents.GroupBy (c => c.gameObject);
  12. }
  13. protected override bool PrintFoldout (bool isFolded, GameObject key)
  14. {
  15. isFolded = base.PrintFoldout (isFolded,
  16. key);
  17. EditorGUILayout.ObjectField (key,
  18. typeof (GameObject),
  19. true,
  20. GUILayout.ExpandWidth (false));
  21. return isFolded;
  22. }
  23. protected override string GetFoldoutDisplayName (GameObject key)
  24. {
  25. return key.name;
  26. }
  27. }
  28. }