public void OnDataSelected(object selected, int col) { TextureOverviewData overViewData = selected as TextureOverviewData; if (overViewData == null) { return; } if (m_showTable != null) { m_showTable.RefreshData(overViewData.GetObjects()); } }
public static TextureOverviewData CreateNew(TextureOverviewMode mode, TextureInfo texInfo) { TextureOverviewData retData = new TextureOverviewData(); retData.Mode = mode; retData.ReadWriteEnable = texInfo.ReadWriteEnable; retData.MipmapEnable = texInfo.MipmapEnable; retData.ImportType = texInfo.ImportType; retData.AndroidFormat = texInfo.AndroidFormat; retData.IosFormat = texInfo.IosFormat; retData.WidthAndHeight = texInfo.Width == texInfo.Height; retData.SizeIndex = OverviewTableConst.GetTextureSizeIndex(texInfo.Width, texInfo.Height); retData.SizeStr = OverviewTableConst.TextureSizeStr[retData.SizeIndex]; return(retData); }
public void SwitchMode(int mode) { m_mode = (TextureOverviewMode)mode; if (!m_flag[mode] && m_texInfoList != null) { m_flag[mode] = true; List <object> data = m_data[mode]; for (int i = 0; i < m_texInfoList.Count; ++i) { TextureInfo texInfo = m_texInfoList[i]; EditorUtility.DisplayProgressBar("刷新数据", System.IO.Path.GetFileName(texInfo.Path), (i * 1.0f) / m_texInfoList.Count); bool find = false; for (int j = 0; j < data.Count; ++j) { TextureOverviewData overViewData = data[j] as TextureOverviewData; if (overViewData.IsMatch(texInfo)) { find = true; overViewData.AddObject(texInfo); break; } } if (!find) { TextureOverviewData overViewData = TextureOverviewData.CreateNew(m_mode, texInfo); overViewData.AddObject(texInfo); data.Add(overViewData); } } EditorUtility.ClearProgressBar(); } if (m_dataTable != null) { TextureOverviewData.SwitchDataTableMode(m_mode, m_dataTable); m_dataTable.RefreshData(m_data[mode]); } }
public TextureOverviewViewer(EditorWindow hostWindow) { m_data = new List <object> [(int)TextureOverviewMode.Count]; m_flag = new bool[(int)TextureOverviewMode.Count]; for (int i = 0; i < (int)TextureOverviewMode.Count; ++i) { m_flag[i] = false; m_data[i] = new List <object>(); } m_dataTable = new TableView(hostWindow, typeof(TextureOverviewData)); TextureOverviewData.SwitchDataTableMode(m_mode, m_dataTable); m_showTable = new TableView(hostWindow, typeof(TextureInfo)); m_showTable.AddColumn("Path", "Path", 0.8f, TextAnchor.MiddleLeft); m_showTable.AddColumn("MemSize", "Memory", 0.2f, TextAnchor.MiddleCenter, "<fmt_bytes>"); m_dataTable.OnSelected += OnDataSelected; m_showTable.OnSelected += OnInfoSelected; }