源战役客户端
25개 이상의 토픽을 선택하실 수 없습니다. Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

53 lines
1.3 KiB

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using MemoryProfilerWindow;
using Treemap;
using UnityEditor;
using UnityEditor.Graphs;
using UnityEngine;
namespace Assets.Editor.Treemap
{
public class Item : IComparable<Item>, ITreemapRenderable
{
public Group _group;
public Rect _position;
public int _index;
public ThingInMemory _thingInMemory;
public int memorySize { get { return _thingInMemory.size; } }
public string name { get { return _thingInMemory.caption; } }
public Color color { get { return _group.color; } }
public Item(ThingInMemory thingInMemory, Group group)
{
_thingInMemory = thingInMemory;
_group = group;
}
public int CompareTo(Item other)
{
return (int)(_group != other._group ? other._group.totalMemorySize - _group.totalMemorySize : other.memorySize - memorySize);
}
public Color GetColor()
{
return _group.color;
}
public Rect GetPosition()
{
return _position;
}
public string GetLabel()
{
string row1 = _group._name;
string row2 = EditorUtility.FormatBytes(memorySize);
return row1 + "\n" + row2;
}
}
}