Beispiel #1
0
        private void ProcessOneSpriteAtlas(ResInfo resInfo)
        {
            List <OneInfo> deps = resInfo.depends;

            foreach (var dep in deps)
            {
                if (dep.Type != InfoType.RES)
                {
                    continue;
                }
                ResInfo oneRes = dep as ResInfo;
                if (oneRes.IsTexture())
                {
                    oneRes.bundleExclude = true;
                    List <string> refBy = oneRes.refBy;
                    if (null != refBy)
                    {
                        foreach (var oneRefStr in refBy)
                        {
                            if (totals.ContainsKey(oneRefStr))
                            {
                                OneInfo refInfo = totals[oneRefStr];
                                if (refInfo.Type == InfoType.RES && ((ResInfo)refInfo).IsTexture())
                                {
                                    continue;
                                }
                                refInfo.RemoveDepend(oneRes);
                                refInfo.AddDepend(resInfo);//依赖于spriteAtlas
                                resInfo.RefBy(refInfo.res);
                            }
                        }
                    }
                }
            }
        }
Beispiel #2
0
 private void ProcessOneExclude(OneInfo info)
 {
     if (null == info || info.bundleExclude)
     {
         return;
     }
     Debug.Log("exclude " + info.res);
     info.bundleExclude = true;
     if (null != info.refBy)
     {
         foreach (var refResPath in info.refBy)
         {
             if (totals.ContainsKey(refResPath))
             {
                 OneInfo refRes = totals[refResPath];
                 if (!refRes.bundleExclude && refRes.Type == InfoType.RES)//对于依赖它的值只处理基础资源
                 {
                     ResInfo aRes = refRes as ResInfo;
                     if (aRes.IsShaderVariants())
                     {
                         continue;
                     }
                     ProcessOneExclude(aRes);
                 }
             }
         }
     }
 }
Beispiel #3
0
        private void GetResFromDir(ResDir dir)
        {
            if (dir.ignore)
            {
                return;
            }
            List <string> files = FileUtils.GetFiles(dir.path, dir.filePattern);
            string        shaderBundleSingleName = null;

            foreach (var file in files)
            {
                if (resList.ContainsKey(file))
                {
                    continue;
                }
                ResInfo resInfo = new ResInfo()
                {
                    res      = file,
                    dir      = dir,
                    refBy    = null,
                    refCount = 0,
                    depends  = null,
                };
                resList.Add(file, resInfo);
            }
        }
Beispiel #4
0
        private void CheckResDepend()
        {
            string _progressTitle = "检测基础资源依赖数据";

            EditorUtility.DisplayProgressBar(_progressTitle, "", 0);
            int index = 0;
            int count = resList.Count;

            foreach (var kvp in resList)
            {
                ResInfo resInfo = kvp.Value;
                ProcessOneInfo(resInfo, ignorePatterns);
                index++;
                EditorUtility.DisplayProgressBar(_progressTitle, resInfo.res, (float)(index) / count);
            }
            EditorUtility.ClearProgressBar();
        }
Beispiel #5
0
        private void ProcessAllSpriteAtlas()
        {
            string _progressTitle = "处理SpriteAtlas";

            EditorUtility.DisplayProgressBar(_progressTitle, "", 0);
            foreach (var kvp in totals)
            {
                OneInfo info = kvp.Value;
                if (info.Type != InfoType.RES || info.bundleExclude)
                {
                    continue;
                }
                ResInfo resInfo = info as ResInfo;
                if (resInfo.IsSpriteAtlas())
                {
                    ProcessOneSpriteAtlas(resInfo);
                }
            }
            EditorUtility.ClearProgressBar();
        }
Beispiel #6
0
        private void GetResFromDir(ResDir dir)
        {
            if (dir.ignore)
            {
                return;
            }
            List <string> files = FileUtils.GetFiles(dir.path, dir.filePattern);
            string        shaderBundleSingleName = null;

            foreach (var file in files)
            {
                if (resList.ContainsKey(file))
                {
                    continue;
                }
                ResInfo resInfo = new ResInfo()
                {
                    res      = file,
                    dir      = dir,
                    refBy    = null,
                    refCount = 0,
                    depends  = null,
                };
                if (dir.bundleType == BundleType.Single)
                {
                    if (resInfo.IsShaderAsset())
                    {
                        string bundleBasicName = resInfo.GetShaderBundleBasicName();
                        if (null != bundleBasicName)
                        {
                            if (null == shaderBundleSingleName)
                            {
                                shaderBundleSingleName = dir.path.Replace('/', '_');
                            }
                            ResDataHelp.shadersAsSingleNames[bundleBasicName] = shaderBundleSingleName;
                        }
                    }
                }
                resList.Add(file, resInfo);
            }
        }