protected void SetSerizlizeData(SerializeData data)
        {
            if (data == null || data.AssetDataGroup == null)
            {
                return;
            }

            for (int i = data.AssetDataGroup.Length - 1; i >= 0; --i)
            {
                mAllAssetDataGroup.Add(BuildAssetDataGroup(data.AssetDataGroup[i]));
            }

            if (mAssetDataTable == null)
            {
                mAssetDataTable = new AssetDataTable();

                foreach (var serializeData in data.AssetDataGroup)
                {
                    foreach (var assetData in serializeData.assetDataArray)
                    {
                        mAssetDataTable.Add(assetData);
                    }
                }
            }
        }
Exemple #2
0
        private static void ProcessAssetBundleRes(AssetDataTable table)
        {
            AssetDataGroup group = null;

            AssetDatabase.RemoveUnusedAssetBundleNames();

            string[] abNames = AssetDatabase.GetAllAssetBundleNames();
            if (abNames != null && abNames.Length > 0)
            {
                for (int i = 0; i < abNames.Length; ++i)
                {
                    string[] depends = AssetDatabase.GetAssetBundleDependencies(abNames[i], false);
                    var      abIndex = table.AddAssetBundleName(abNames[i], depends, out group);
                    if (abIndex < 0)
                    {
                        continue;
                    }

                    string[] assets = AssetDatabase.GetAssetPathsFromAssetBundle(abNames[i]);
                    foreach (var cell in assets)
                    {
                        if (cell.EndsWith(".unity"))
                        {
                            group.AddAssetData(new AssetData(AssetPath2Name(cell), ResType.ABScene, abIndex, abNames[i]));
                        }
                        else
                        {
                            group.AddAssetData(new AssetData(AssetPath2Name(cell), ResType.ABAsset, abIndex, abNames[i]));
                        }
                    }
                }
            }

            table.Dump();
        }
        private static void ProcessAssetBundleRes(AssetDataTable table)
        {
            int abIndex = table.AddAssetBundleName(ProjectPathConfigTemp.ABMANIFEST_AB_NAME);

            table.AddAssetData(new AssetData(ProjectPathConfigTemp.ABMANIFEST_ASSET_NAME, eResType.kABAsset, abIndex));

            AssetDatabase.RemoveUnusedAssetBundleNames();

            string[] abNames = AssetDatabase.GetAllAssetBundleNames();
            if (abNames != null && abNames.Length > 0)
            {
                for (int i = 0; i < abNames.Length; ++i)
                {
                    Log.i("AB Name:" + abNames[i]);
                    abIndex = table.AddAssetBundleName(abNames[i]);
                    string[] assets = AssetDatabase.GetAssetPathsFromAssetBundle(abNames[i]);
                    foreach (var cell in assets)
                    {
                        if (cell.EndsWith(".unity"))
                        {
                            table.AddAssetData(new AssetData(AssetPath2Name(cell), eResType.kABScene, abIndex));
                        }
                        else
                        {
                            table.AddAssetData(new AssetData(AssetPath2Name(cell), eResType.kABAsset, abIndex));
                        }
                    }
                }
            }

            table.Dump();
        }
        public static void BuildDataTable()
        {
            Log.i("Start BuildAssetDataTable!");
            AssetDataTable table = new AssetDataTable();

            ProcessAssetBundleRes(table);

            string filePath = FilePath.streamingAssetsPath + ProjectPathConfigTemp.EXPORT_ASSETBUNDLE_CONFIG_PATH;

            table.Save(filePath);
            AssetDatabase.Refresh();
        }
        public static void BuildDataTable()
        {
            Log.i("Start BuildAssetDataTable!");
            AssetDataTable table = SingletonObjectPool <AssetDataTable> .Instance.Allocate();

            ProcessAssetBundleRes(table);

            string filePath = FilePath.streamingAssetsPath + QFrameworkConfigData.EXPORT_ASSETBUNDLE_CONFIG_PATH;

            table.Save(filePath);
            AssetDatabase.Refresh();
        }
        public static void BuildDataTable()
        {
            Log.I("Start BuildAssetDataTable!");
            AssetDataTable table = AssetDataTable.Create();

            ProcessAssetBundleRes(table);

            string filePath =
                IOExtension.CreateDirIfNotExists(FilePath.StreamingAssetsPath + QFrameworkConfigData.RELATIVE_AB_ROOT_FOLDER) +
                QFrameworkConfigData.EXPORT_ASSETBUNDLE_CONFIG_FILENAME;

            table.Save(filePath);
            AssetDatabase.Refresh();
        }
        public void Reset()
        {
            for (int i = mAllAssetDataGroup.Count - 1; i >= 0; --i)
            {
                mAllAssetDataGroup[i].Reset();
            }

            mAllAssetDataGroup.Clear();

            if (mAssetDataTable != null)
            {
                mAssetDataTable.Dispose();
            }

            mAssetDataTable = null;
        }
        public AssetData  GetAssetData(ResSearchKeys resSearchKeys)
        {
            if (mAssetDataTable == null)
            {
                mAssetDataTable = new AssetDataTable();

                for (var i = mAllAssetDataGroup.Count - 1; i >= 0; --i)
                {
                    foreach (var assetData in mAllAssetDataGroup[i].AssetDatas)
                    {
                        mAssetDataTable.Add(assetData);
                    }
                }
            }

            return(mAssetDataTable.GetAssetDataByResSearchKeys(resSearchKeys));
        }
        private static void ProcessAssetBundleRes(AssetDataTable table)
        {
            AssetDataPackage group = null;

            int abIndex = table.AddAssetBundleName(ProjectPathConfigTemp.ABMANIFEST_AB_NAME, null, out group);

            if (abIndex > 0)
            {
                group.AddAssetData(new AssetData(ProjectPathConfigTemp.ABMANIFEST_ASSET_NAME, eResType.kABAsset, abIndex));
            }

            AssetDatabase.RemoveUnusedAssetBundleNames();

            string[] abNames = AssetDatabase.GetAllAssetBundleNames();
            if (abNames != null && abNames.Length > 0)
            {
                for (int i = 0; i < abNames.Length; ++i)
                {
                    string[] depends = AssetDatabase.GetAssetBundleDependencies(abNames[i], false);
                    abIndex = table.AddAssetBundleName(abNames[i], depends, out group);
                    if (abIndex < 0)
                    {
                        continue;
                    }

                    string[] assets = AssetDatabase.GetAssetPathsFromAssetBundle(abNames[i]);
                    foreach (var cell in assets)
                    {
                        if (cell.EndsWith(".unity"))
                        {
                            group.AddAssetData(new AssetData(AssetPath2Name(cell), eResType.kABScene, abIndex));
                        }
                        else
                        {
                            group.AddAssetData(new AssetData(AssetPath2Name(cell), eResType.kABAsset, abIndex));
                        }
                    }
                }
            }

            table.Dump();
        }
 private static void ProcessResourcesRes(AssetDataTable table)
 {
 }