public void Init(AssetMessageMap data) { m_datas = data.Messages.Select(i => new Data(i)).ToArray(); System.Array.Sort(m_datas, (x, y) => x.assetPath.CompareTo(y.assetPath)); Repaint(); }
//------------------------------------------------------ // static function //------------------------------------------------------ public static AssetMessageList Open(AssetMessageMap data) { var win = GetWindow <AssetMessageList>(); win.Init(data); return(win); }
Dictionary <string, AssetMessageData> m_map = new Dictionary <string, AssetMessageData>(); // key:guid //------------------------------------------------------ // save/load //------------------------------------------------------ public static AssetMessageMap Load() { var data = new AssetMessageMap(); try { if (File.Exists(kFilePath)) { var savedata = JsonUtility.FromJson <SaveData>(File.ReadAllText(kFilePath)); data.m_map = savedata.messages.ToDictionary(i => i.guid, i => i); } } catch (Exception e) { Debug.LogError(e.Message); } return(data); }
static void Init() { m_icons = new Texture[Enum.GetValues(typeof(MessageType)).Length]; m_icons[(int)MessageType.None] = m_icons[(int)MessageType.Info] = EditorGUIUtility.LoadRequired("console.infoicon") as Texture; m_icons[(int)MessageType.Warning] = EditorGUIUtility.LoadRequired("console.warnicon") as Texture; m_icons[(int)MessageType.Error] = EditorGUIUtility.LoadRequired("console.erroricon") as Texture; m_editing = false; m_dataMap = AssetMessageMap.Load(); m_listWindow = Resources.FindObjectsOfTypeAll <AssetMessageList>().FirstOrDefault(); if (m_listWindow) { m_listWindow.Init(m_dataMap); } EditorApplication.projectWindowItemOnGUI += OnGUI; }