源战役客户端
Não pode escolher mais do que 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.

53 linhas
1.3 KiB

  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using MemoryProfilerWindow;
  6. using Treemap;
  7. using UnityEditor;
  8. using UnityEditor.Graphs;
  9. using UnityEngine;
  10. namespace Assets.Editor.Treemap
  11. {
  12. public class Item : IComparable<Item>, ITreemapRenderable
  13. {
  14. public Group _group;
  15. public Rect _position;
  16. public int _index;
  17. public ThingInMemory _thingInMemory;
  18. public int memorySize { get { return _thingInMemory.size; } }
  19. public string name { get { return _thingInMemory.caption; } }
  20. public Color color { get { return _group.color; } }
  21. public Item(ThingInMemory thingInMemory, Group group)
  22. {
  23. _thingInMemory = thingInMemory;
  24. _group = group;
  25. }
  26. public int CompareTo(Item other)
  27. {
  28. return (int)(_group != other._group ? other._group.totalMemorySize - _group.totalMemorySize : other.memorySize - memorySize);
  29. }
  30. public Color GetColor()
  31. {
  32. return _group.color;
  33. }
  34. public Rect GetPosition()
  35. {
  36. return _position;
  37. }
  38. public string GetLabel()
  39. {
  40. string row1 = _group._name;
  41. string row2 = EditorUtility.FormatBytes(memorySize);
  42. return row1 + "\n" + row2;
  43. }
  44. }
  45. }