static IEnumerable <AssetEntryRecordCandidate> EnumerateAssetEntryRecords(string rootDirPath, string assetBundleName)
        {
            string path = $"{rootDirPath}{assetBundleName}";

            AssetBundle assetBundle = AssetBundle.LoadFromFile(path);

            try
            {
                foreach (var assetPath in assetBundle.GetAllAssetNames())
                {
                    AssetEntryRecordCandidate record = AssetEntryRecordCandidate.Create(assetPath, assetBundleName);
                    if (record != null)
                    {
                        yield return(record);
                    }
                }

                foreach (var assetPath in assetBundle.GetAllScenePaths())
                {
                    AssetEntryRecordCandidate record = AssetEntryRecordCandidate.Create(assetPath, assetBundleName);
                    if (record != null)
                    {
                        yield return(record);
                    }
                }
            }
            finally
            {
                assetBundle.Unload(true);
            }
        }
        bool HasAnyTags(AssetEntryRecordCandidate candidate)
        {
            FixedHashSet <string> candidateTags = candidate.TagsDictionary.GetValue(this.Id);

            if (candidateTags.IsNull)
            {
                return(false);
            }

            return(candidateTags.Count > 0);
        }
        bool HasTag(AssetEntryRecordCandidate candidate, BranchTagCondition condition)
        {
            FixedHashSet <string> candidateTags = candidate.TagsDictionary.GetValue(this.Id);

            if (candidateTags.IsNull)
            {
                return(false);
            }

            if (condition.Tag.IsNullOrEmpty())
            {
                return(candidateTags.Count <= 0);
            }

            return(candidateTags.Contains(condition.Tag));
        }
Пример #4
0
        int GetStep(AssetEntryRecordCandidate candidate)
        {
            int step = int.MaxValue / 2;

            FixedHashSet <string> candidateTags = candidate.TagsDictionary.GetValue(this.Id);

            if (candidateTags.IsNull)
            {
                return(step);
            }

            foreach (var tag in candidateTags)
            {
                StepTagCondition condition = conditionDictionary.GetValue(tag);
                if (condition != null)
                {
                    step = Mathf.Min(step, condition.Step);
                }
            }

            return(step);
        }