IEnumerator InitForWindow()
        {
            EditorContexts.mIns.GuiContext.IsLoading = true;
            if (!Inited)
            {
                var logic = AssetTreeManager.mIns.Get(EditorContexts.mIns.Mode);
                if (logic != null)
                {
                    for (int i = 0; i < logic.Count; i++)
                    {
                        logic[i].Clear();
                        yield return(logic[i].ReLoad());
                    }
                }

                EditorContexts.mIns.RefreshGuiInfo(this);

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

                Inited = true;
                EditorUtility.ClearProgressBar();

                Repaint();
            }
            EditorContexts.mIns.GuiContext.IsLoading = false;
        }
        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;
        }