Exemplo n.º 1
0
        private void ParseResData(ABDataList dataList)
        {
            mABDict    = new Dictionary <string, ResName>();
            mAssetDict = new Dictionary <string, List <ResName> >();

            foreach (ABData abInfo in dataList.abInfos)
            {
                ResName abName = new ResName(GroupName, abInfo.name, null, null);
                mABDict.Add(abName.ABName, abName);

                foreach (string asset in abInfo.assets)
                {
                    ResName        assetName = new ResName(GroupName, abInfo.name, Path.GetFileNameWithoutExtension(asset), Path.GetExtension(asset));
                    List <ResName> resList;
                    if (!mAssetDict.TryGetValue(assetName.AssetName, out resList))
                    {
                        resList = new List <ResName>();
                        mAssetDict.Add(assetName.AssetName, resList);
                    }
                    else if (resList.Exists(r => r.Equals(assetName)))
                    {
                        throw new Exception(string.Format(">>>[ResKit]: assetbundle \"{0}\" 中存在同名且同后缀文件: {1}", assetName.ABName,
                                                          assetName.AssetNameWithExtension));
                    }
                    resList.Add(assetName);
                }
            }
        }
Exemplo n.º 2
0
        public void SimulateLoad()
        {
#if UNITY_EDITOR
            ABDataList dataList = new ABDataList();
            dataList.abInfos = new List <ABData>();

            string[] abs = UnityEditor.AssetDatabase.GetAllAssetBundleNames();
            for (int i = 0; i < abs.Length; i++)
            {
                string[] assets = UnityEditor.AssetDatabase.GetAssetPathsFromAssetBundle(abs[i]);
                if (assets.Length == 0)
                {
                    continue;
                }
                ABData abData = new ABData
                {
                    name   = abs[i],
                    assets = assets
                };
                dataList.abInfos.Add(abData);
            }
            ParseResData(dataList);
#endif
        }