示例#1
0
        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();
        }
示例#2
0
        //------------------------------------------------------
        // static function
        //------------------------------------------------------

        public static AssetMessageList Open(AssetMessageMap data)
        {
            var win = GetWindow <AssetMessageList>();

            win.Init(data);
            return(win);
        }
示例#3
0
        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);
        }
示例#4
0
        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;
        }