Ejemplo n.º 1
0
 public static void RefreshData()
 {
     m_dataControl.RefreshBaseData();
     m_bundleDict.Clear();
     m_specialCache.Clear();
     AssetSize.Clear();
     AssetDepot.Clear();
 }
Ejemplo n.º 2
0
        private static void _AddPathToBundleByImportData(BundleImportData data, string path)
        {
            if (data == null || string.IsNullOrEmpty(path) || BundleDataManager.CheckPathInBundle(path))
            {
                return;
            }

            string parentName = BundleDataManager.GetIndexBundleName(data.Index);
            string bundleName = BundleDataManager.GetPathBundleName(path);

            if (!string.IsNullOrEmpty(bundleName))
            {
                BundleData bundleData = BundleDataManager.GetBundleData(bundleName);
                if (bundleData.parent == parentName)
                {
                    return;
                }
                else
                {
                    BundleDataManager.RemovePathFromBundle(path, bundleName);
                }
            }

            _AddToDict(bundleName, m_bundleDict);

            BundleData parent = BundleDataManager.GetBundleData(parentName);

            if (parent == null)
            {
                BundleDataManager.CreateNewBundle(parentName, "", BundleType.None, BundleLoadState.UnloadOnUnloadAsset);
                parent = BundleDataManager.GetBundleData(parentName);
            }

            string name = "";

            for (int i = 0; i < parent.children.Count; ++i)
            {
                int        index = parent.children.Count - i - 1;
                BundleData child = BundleDataManager.GetBundleData(parent.children[index]);

                if (BundleDataManager.IsBundleFull(child, data.LimitCount, data.LimitKBSize * 1024))
                {
                    continue;
                }

                if (data.Publish && BundleDataManager.IsNameDuplicatedAsset(child, path))
                {
                    continue;
                }

                name = child.name;
                break;
            }

            if (string.IsNullOrEmpty(name))
            {
                name = BundleDataManager.GenBundleNameByType(data.Type);
                BundleDataManager.CreateNewBundle(name, parent.name, data.Type, data.LoadState);
            }

            int size = (int)AssetSize.CalcAssetSize(path, data.Type);

            BundleDataManager.AddPathToBundle(path, name, size);
            _AddToDict(name, m_bundleDict);
        }