public AssetTreeView(TreeViewState state, MultiColumnHeader header, AssetWindow.WindowMode md) : base(state, header)
 {
     header.sortingChanged += OnSortingChanged;
     _viewMode              = md;
     _model = AssetTreeManager.mIns.GetModel <T>();
     //Reload();
 }
        public List <IAssetGuiInterface> GetGuiRender(AssetWindow.WindowMode md)
        {
            List <IAssetGuiInterface> data;

            if (_guidictionary.TryGetValue((int)md, out data))
            {
                return(data);
            }
            return(null);
        }
        public List <ILogicInterface> Get(AssetWindow.WindowMode md)
        {
            List <ILogicInterface> data;

            if (_dictionary.TryGetValue((int)md, out data))
            {
                return(data);
            }
            return(null);
        }
Beispiel #4
0
        public static AssetWindow.WindowMode GetMainMode(AssetWindow.WindowMode md)
        {
            if (md == AssetWindow.WindowMode.End)
            {
                return(AssetWindow.WindowMode.Asset);
            }

            var mdidx = (int)md / 8;

            return((AssetWindow.WindowMode)(mdidx * 8));
        }
        IEnumerator DoForceModeChange(AssetWindow.WindowMode md)
        {
            GuiContext.IsLoading = true;
            var logic = AssetTreeManager.mIns.Get(md);

            if (logic != null)
            {
                foreach (var sublogic in logic)
                {
                    if (sublogic.TypeMode == md)
                    {
                        sublogic.Clear();
                        yield return(sublogic.ReLoad());
                    }
                }
            }

            var render = AssetTreeManager.mIns.GetGuiRender(md);

            if (render != null)
            {
                foreach (var subrender in render)
                {
                    if (subrender.TypeMode == md)
                    {
                        IGuiTree treeRender = subrender as IGuiTree;
                        if (treeRender != null)
                        {
                            treeRender.Refresh();
                        }
                    }
                }
            }

            EditorUtility.ClearProgressBar();
            GuiContext.IsLoading = false;
        }
        IEnumerator DoModeChange(AssetWindow.WindowMode old, AssetWindow.WindowMode newmd)
        {
            GuiContext.IsLoading = true;
            bool needupdate = false;
            int  oldval     = (int)old;
            int  newval     = (int)newmd;
            int  oldmain    = oldval / 8;
            int  newmain    = newval / 8;

            if (oldmain != newmain)
            {
                var oldrender = AssetTreeManager.mIns.GetGuiRender(old);
                if (oldrender != null)
                {
                    foreach (var subrender in oldrender)
                    {
                        subrender.Destory();
                    }
                }

                needupdate = true;
            }
            else
            {
                if (newmain != newval)
                {
                    needupdate = true;
                }
            }

            if (needupdate)
            {
                //logic
                var logic = AssetTreeManager.mIns.Get(newmd);
                if (logic != null)
                {
                    foreach (var sublogic in logic)
                    {
                        if (sublogic.TypeMode == newmd)
                        {
                            sublogic.Clear();
                            yield return(sublogic.ReLoad());
                        }
                    }
                }

                var render = AssetTreeManager.mIns.GetGuiRender(newmd);
                if (render != null)
                {
                    foreach (var subrender in render)
                    {
                        if (subrender.TypeMode == newmd)
                        {
                            subrender.Init();
                            IGuiTree treeRender = subrender as IGuiTree;
                            if (treeRender != null)
                            {
                                treeRender.Refresh();
                            }
                        }
                    }
                }
            }

            EditorUtility.ClearProgressBar();
            GuiContext.IsLoading = false;
        }
 void ModeChange(AssetWindow.WindowMode old, AssetWindow.WindowMode newmd)
 {
     EditorCoroutineGroup.StartCoroutine(DoModeChange(old, newmd), GuiWindow);
 }
 public void ForceModeChange(AssetWindow.WindowMode md)
 {
     EditorCoroutineGroup.StartCoroutine(DoForceModeChange(md), GuiWindow);
 }