public static EditorAssetLoad Take(string assetBundleName) { EditorAssetLoad editorAssetLoad; if (allEditorAssetLoad.TryGetValue(assetBundleName, out editorAssetLoad) == false) { //todo 验证是ab包名正确性 editorAssetLoad = new EditorAssetLoad(); allEditorAssetLoad.Add(assetBundleName, editorAssetLoad); editorAssetLoad.referenceCount = 0; editorAssetLoad.assetBundleName = assetBundleName; editorAssetLoad.assetRootPath = new string[] { assetBundleName.Replace('_', '/') }; editorAssetLoad.allAsset = new Dictionary <string, Object>(); editorAssetLoad.referenceCount++; return(editorAssetLoad); } else { editorAssetLoad.referenceCount++; return(editorAssetLoad); } }
public AssetsLoad(string assetBundleName) { if (EditorAssetLoad.LocalLoadModel) { editorAssetLoad = EditorAssetLoad.Take(assetBundleName); } else { assetBundleLoad = AssetBundleLoad.Take(assetBundleName); } }
public static void Put(EditorAssetLoad editorAssetLoad) { if (editorAssetLoad.referenceCount == 1) { editorAssetLoad.referenceCount = 0; editorAssetLoad.allAsset.Clear(); } else { editorAssetLoad.referenceCount--; } }
public void UnLoad() { if (EditorAssetLoad.LocalLoadModel) { EditorAssetLoad.Put(editorAssetLoad); editorAssetLoad = null; } else { AssetBundleLoad.Put(assetBundleLoad); assetBundleLoad = null; } }