Beispiel #1
0
        private static string GetSearchPath(string path, out string assetBundleName)
        {
            if (AssetToBundles.TryGetValue(path, out assetBundleName))
            {
                return(path);
            }

            if (searchPaths != null)
            {
                foreach (var item in searchPaths)
                {
                    var existPath = string.Format("{0}/{1}", item, path);
                    if (development && File.Exists(existPath))
                    {
                        return(existPath);
                    }

                    if (AssetToBundles.TryGetValue(existPath, out assetBundleName))
                    {
                        return(existPath);
                    }
                }
            }

            return(path);
        }
Beispiel #2
0
        private static void ReloadVersions(Versions versions)
        {
            ActiveVariants.Clear();
            AssetToBundles.Clear();
            BundleToChildren.Clear();
            var assets         = versions.assets;
            var dirs           = versions.dirs;
            var bundles        = versions.bundles;
            var activeVariants = versions.activeVariants;

            foreach (var item in bundles)
            {
                BundleToChildren[item.name] = Array.ConvertAll(item.children, id => bundles[id].name);
            }
            foreach (var item in assets)
            {
                var path = string.Format("{0}/{1}", dirs[item.dir], item.name);
                if (item.bundle >= 0 && item.bundle < bundles.Count)
                {
                    AssetToBundles[path] = bundles[item.bundle].name;
                }
                else
                {
                    AssetToBundles[path] = string.Empty;
                }
            }

            ActiveVariants.AddRange(activeVariants);
        }