示例#1
0
        private bool ABState2Msg(ABState state, out string msg)
        {
            msg = "";
            bool result = true;

            if (state.isMixedFlag || state.hasMixed)
            {
                msg   += "-混合模式";
                result = false;
            }
            else if (state.isFileFlag)
            {
                msg += "-文件模式";
            }
            else if (state.isFolderFlag)
            {
                msg += "-文件夹模式";
            }

            if (state.isLost)
            {
                msg   += "-丢失";
                result = false;
            }

            if (string.IsNullOrEmpty(msg))
            {
                msg += "-正常";
            }

            return(result);
        }
示例#2
0
 public void OnFolderVisitorResult(string folderFullPath, ABState state)
 {
     m_Handler.AddConfig(folderFullPath, state);
     if (((state.flag ^ ABStateDefine.MIXED) & ABStateDefine.MIXED) == 0)
     {
         //Log.w("Folder Has Mixed Flag:" + folderFullPath);
     }
 }
示例#3
0
        public void AddConfig(string folderFullPath, ABState state)
        {
            ABStateUnit unit = null;

            if (!m_StateMap.TryGetValue(folderFullPath, out unit))
            {
                unit = new ABStateUnit();
                AddConfigUnit(folderFullPath, unit);
            }

            unit.folderAssetPath = EditorUtils.ABSPath2AssetsPath(folderFullPath);
            unit.state           = state;
        }
示例#4
0
        public void BuildAsFileSystem(string folderPath)
        {
            m_FolderAssetsPath = folderPath;

            if (m_StateMap == null)
            {
                m_StateMap = new Dictionary <string, ABStateUnit>();
            }
            else
            {
                m_StateMap.Clear();
            }

            var gen = new GenerateConfigVisitor(this);

            string  fullPath = EditorUtils.AssetsPath2ABSPath(folderPath);
            ABState subState = VisitorFolder(fullPath, gen);

            gen.OnFolderVisitorResult(fullPath, subState);
        }
示例#5
0
        private ABState VisitorFolder(string absPath, IFolderVisitor visitor)
        {
            if (visitor == null)
            {
                return(ABState.NONE);
            }

            ABState state = new ABState();

            var dirs = Directory.GetDirectories(absPath);

            if (dirs.Length > 0)
            {
                for (int i = 0; i < dirs.Length; ++i)
                {
                    ABState subState = VisitorFolder(dirs[i], visitor);

                    if (subState.hasMixed)
                    {
                        state.hasMixed = true;
                    }

                    if (subState.isLost)
                    {
                        state.isLost = true;
                    }
                }
            }

            var files = Directory.GetFiles(absPath);

            if (files.Length > 0)
            {
                for (int i = 0; i < files.Length; ++i)
                {
                    if (!AssetFileFilter.IsAsset(files[i]))
                    {
                        continue;
                    }

                    AssetImporter ai = AssetImporter.GetAtPath(EditorUtils.ABSPath2AssetsPath(files[i]));
                    if (ai != null)
                    {
                        if (!string.IsNullOrEmpty(ai.assetBundleName))
                        {
                            //Log.i("Files:" + files[i] + " ---> " + ai.assetBundleName);
                            string assetPath  = EditorFileUtils.RemoveFileExtend(ai.assetPath).ToLower();
                            string bundleName = EditorFileUtils.RemoveFileExtend(ai.assetBundleName);
                            if (assetPath.EndsWith(bundleName))
                            {
                                //Log.i("File Flag:" + assetPath);
                                state.flag |= ABStateDefine.FILE;
                                visitor.OnAssetVisitorResult(ai, ABStateDefine.FILE);
                            }
                            else
                            {
                                //Log.i("##Folder Flag:" + assetPath);
                                state.flag |= ABStateDefine.FOLDER;
                                visitor.OnAssetVisitorResult(ai, ABStateDefine.FOLDER);
                            }
                        }
                        else
                        {
                            state.isLost = true;
                            visitor.OnAssetVisitorResult(ai, ABStateDefine.LOST);
                        }
                    }
                }
            }

            if (state.isMixedFlag)
            {
                state.hasMixed = true;
            }
            visitor.OnFolderVisitorResult(absPath, state);
            return(state);
        }