コード例 #1
0
        public AssetBundleRes(string assetName)
        {
            mPath = ResKitUtil.FullPathForAssetBundle(assetName);

            Name = assetName;

            State = ResState.Waiting;
        }
コード例 #2
0
        private void Load()
        {
            if (ResMgr.IsSimulationModeLogic)
            {
#if UNITY_EDITOR
                var assetBundleNames = UnityEditor.AssetDatabase.GetAllAssetBundleNames();

                foreach (var assetBundleName in assetBundleNames)
                {
                    var assetPaths = UnityEditor.AssetDatabase.GetAssetPathsFromAssetBundle(assetBundleName);

                    var assetBundleData = new AssetBundleData()
                    {
                        Name = assetBundleName,
                        DenpendnecyBundleNames = UnityEditor.AssetDatabase.GetAssetBundleDependencies(assetBundleName, false)
                    };

                    foreach (var assetPath in assetPaths)
                    {
                        var assetData = new AssetData()
                        {
                            Name = assetPath.Split('/')
                                   .Last()
                                   .Split('.')
                                   .First(),
                            OwnerBundleName = assetBundleName
                        };

                        assetBundleData.AssetDataList.Add(assetData);
                    }

                    AssetBundleDatas.Add(assetBundleData);
                }

                AssetBundleDatas.ForEach(abData =>
                {
                    Debug.LogFormat("----{0}----", abData.Name);
                    abData.AssetDataList.ForEach(assetData =>
                    {
                        Debug.LogFormat("AB:{0} AssetData:{1}", abData.Name, assetData.Name);
                    });

                    foreach (var dependencyBundleName in abData.DenpendnecyBundleNames)
                    {
                        Debug.LogFormat("AB:{0} Depend:{1}", abData.Name, dependencyBundleName);
                    }
                });
#endif
            }
            else
            {
                var mainBundlePath = ResKitUtil.FullPathForAssetBundle(ResKitUtil.GetPlatformName());

                AssetBundle mainBundle = AssetBundle.LoadFromFile(mainBundlePath);

                mManifest = mainBundle.LoadAsset <AssetBundleManifest>("AssetBundleManifest");
            }
        }