Exemplo n.º 1
0
        public Object[] LoadAssetWithSubAssets(string bundleName, string assetName)
        {
            if (mNameChacheDict.ContainsKey(bundleName))
            {
                Object[] assets = mNameChacheDict[bundleName].GetAsset(assetName);
                if (assets != null)
                {
                    return(assets);
                }
            }

            if (!mNameBundleDict.ContainsKey(bundleName))
            {
                Debug.LogError("当前" + bundleName + "为空,无法获取:" + assetName);
                return(null);
            }

            Object[]   asset      = mNameBundleDict[bundleName].LoadAssetWithSubAssets(assetName);
            TempObject tempObject = new TempObject(asset);

            if (mNameChacheDict.ContainsKey(bundleName))
            {
                mNameChacheDict[bundleName].AddAsset(assetName, tempObject);
            }
            else
            {
                AssetCaching assetCaching = new AssetCaching();
                assetCaching.AddAsset(assetName, tempObject);
                mNameChacheDict.Add(bundleName, assetCaching);
            }

            return(asset);
        }
Exemplo n.º 2
0
 public void AddAsset(string assetName, TempObject asset)
 {
     if (!mNameAssetDict.ContainsKey(assetName))
     {
         mNameAssetDict.Add(assetName, asset);
     }
     else
     {
         Debug.LogError("已经加载过了:" + assetName);
     }
 }