public static AssetMoveResult OnWillMoveAsset(string oldPath, string newPath)
        {
            AssetMoveResult result = AssetMoveResult.DidNotMove;

            if (!oldPath.Contains("/Resources/") && !oldPath.Contains(ResConfig.ExternalResDir))
            {
                result = AssetMoveResult.DidNotMove;
                return(result);
            }

            AssetMode.Rebuild();
            var isSaveRes = CheckIsResPath(oldPath);
            var isFolder  = Directory.Exists(oldPath);

            if (isSaveRes)
            {
                if (!newPath.Contains("/Resources/") && !newPath.Contains(ResConfig.ExternalResDir))
                {
                    result = AssetMoveResult.FailedMove;
                }

                if (!isFolder && newPath.Contains(ResConfig.ExternalResDir) &&
                    Path.GetDirectoryName(newPath).Replace("\\", "/") == ResConfig.ExternalResDir)
                {
                    result = AssetMoveResult.FailedMove;
                }

                if (result == AssetMoveResult.FailedMove)
                {
                    UnityEditor.EditorUtility.DisplayDialog("tips", "移动路径不符合规范", "确定");
                }
                else
                {
                    if (UnityEditor.EditorUtility.DisplayDialog("tips", "此资源已经被添加至了资源编辑器,改变后会自动修改\n 确定要修改吗?", "确定"))
                    {
                        if (isFolder)
                        {
                            MoveFolder(oldPath, newPath);
                        }
                        else
                        {
                            ChangeAssetInfo(oldPath, newPath);
                        }
                    }
                    else
                    {
                        result = AssetMoveResult.FailedMove;
                    }
                }
            }
            else
            {
                result = AssetMoveResult.DidNotMove;
            }

            return(result);
        }
Esempio n. 2
0
        public ResGroupTreeEditor(TreeViewState state, AssetGroupMgr ctrl, MultiColumnHeaderState mchs) : base(state,
                                                                                                               new MultiColumnHeader(mchs))
        {
            showBorder = true;

            showAlternatingRowBackgrounds = false;
            //DefaultStyles.label.richText = true;
            AssetMode.Rebuild();
            mController = ctrl;
            Refresh();
            Reload();
        }
Esempio n. 3
0
        public void OnEnable(Rect pos, EditorWindow parent)
        {
            m_Parent   = parent;
            m_Position = pos;
            m_HorizontalSplitterRect = new Rect(
                (int)(m_Position.x + m_Position.width * m_HorizontalSplitterPercent),
                m_Position.y,
                k_SplitterWidth,
                m_Position.height);

            m_VerticalSplitterRect = new Rect(
                m_HorizontalSplitterRect.x,
                (int)(m_Position.y + m_HorizontalSplitterRect.height * m_VerticalSplitterPercent),
                (m_Position.width - m_HorizontalSplitterRect.width) - k_SplitterWidth,
                k_SplitterWidth);
            if (mAssetsBundleAssetsTree == null)
            {
                m_AssetListState = new TreeViewState();
                var assetHeaderState = AssetsBundleAssetsTree.CreateDefaultMultiColumnHeaderState();
                if (MultiColumnHeaderState.CanOverwriteSerializedFields(m_AssetListMCHState, assetHeaderState))
                {
                    MultiColumnHeaderState.OverwriteSerializedFields(m_AssetListMCHState, assetHeaderState);
                }

                m_AssetListMCHState     = assetHeaderState;
                mAssetsBundleAssetsTree = new AssetsBundleAssetsTree(m_AssetListState, m_AssetListMCHState);
            }
            if (mAssetBundleNameTree == null)
            {
                m_GroupTreeState = new TreeViewState();

                var headerState = AssetBundleNameTree.CreateDefaultMultiColumnHeaderState(); //
                if (MultiColumnHeaderState.CanOverwriteSerializedFields(m_GroupTreeMCHState, headerState))
                {
                    MultiColumnHeaderState.OverwriteSerializedFields(m_GroupTreeMCHState, headerState);
                }
                m_GroupTreeMCHState  = headerState;
                mAssetBundleNameTree = new AssetBundleNameTree(mAssetsBundleAssetsTree, m_GroupTreeState, m_GroupTreeMCHState);
            }



            if (mAssetBuildView == null)
            {
                mAssetBuildView = new AssetBuildView();
            }
            AssetMode.Rebuild();
            mAssetBuildView.Reload();
            mAssetBundleNameTree.Reload();
            mAssetsBundleAssetsTree.Reload();
        }
Esempio n. 4
0
        public static void BuildAll(string ver, string outPath, BuildTarget target, BuildAssetBundleOptions options)
        {
            AssetMode.Rebuild();
            var    buils       = BuildSelect(outPath, AssetMode.GetAllBundleNames(), target, options);
            string newFileName = outPath + "/" + Path.GetFileName(ResConfig.ResJsonCfgFilePath);

            if (File.Exists(newFileName))
            {
                File.Delete(newFileName);
            }
            File.Copy(ResConfig.ResJsonCfgFilePath, newFileName, true);
            BuildABVersionInfo(outPath, ver, buils);
            GC.Collect();
            Resources.UnloadUnusedAssets();
            AssetDatabase.Refresh();
        }
        private static AssetDeleteResult OnWillDeleteAsset(string assetPath, RemoveAssetOptions options)
        {
            AssetMode.Rebuild();
            AssetDeleteResult r = AssetDeleteResult.DidNotDelete;
            var isFolder        = Directory.Exists(assetPath);
            var isres           = CheckIsResPath(assetPath);

            if (isres)
            {
                if (UnityEditor.EditorUtility.DisplayDialog("tips", "此资源已经被添加至了资源编辑器,删除后将会从管理器中移除\n 确定要删除吗?", "确定"))
                {
                    DelAssset(assetPath);
                }
                else
                {
                    r = AssetDeleteResult.FailedDelete;
                }
            }

            return(r);
        }
Esempio n. 6
0
        public void OnEnable(Rect pos, EditorWindow parent)
        {
            m_Parent   = parent;
            m_Position = pos;
            m_HorizontalSplitterRect = new Rect(
                (int)(m_Position.x + m_Position.width * m_HorizontalSplitterPercent),
                m_Position.y,
                k_SplitterWidth,
                m_Position.height);

            m_VerticalSplitterRect = new Rect(
                m_HorizontalSplitterRect.x,
                (int)(m_Position.y + m_HorizontalSplitterRect.height * m_VerticalSplitterPercent),
                (m_Position.width - m_HorizontalSplitterRect.width) - k_SplitterWidth,
                k_SplitterWidth);
            if (m_ResGroupTree != null)
            {
                m_ResGroupTree.Reload();
            }

            if (m_ResGroupTree != null)
            {
                m_ResGroupTree.Reload();
            }

            if (mAssetInfoEditor != null)
            {
                mAssetInfoEditor.Reload();
            }

            if (m_Parent != null)
            {
                m_Parent.Repaint();
            }
            AssetMode.Rebuild();
        }