/// <summary> /// 加载原始资源通用接口 /// </summary> /// <param name="assetName"></param> /// <param name="?"></param> private static void LoadOriginalAsset(string assetName, UseOriginalAssetDelegate onComplete) { if (!instance.data.assetBundlePath.ContainsKey(assetName)) { Debug.LogWarning("--Toto-- AssetBundleLoadManager->LoadOriginalAsset: '" + assetName + "' asset does not exist."); return; } if (!instance.mOriginalAssetCounter.ContainsKey(assetName)) // 使用计数 { instance.mOriginalAssetCounter[assetName] = 0; } ++instance.mOriginalAssetCounter[assetName]; if (instance.mAssetCached.ContainsKey(assetName)) { Object t = (Object)instance.mAssetCached[assetName]; if (t != null && onComplete != null) { onComplete(assetName, t); } return; } OriginalAssetLoadRequest loadRequest = (OriginalAssetLoadRequest)FindLoadRequestByName(assetName); if (loadRequest != null) { loadRequest.onComplete += onComplete; return; } string abPath = instance.data.assetBundlePath[assetName]; OriginalAssetLoadRequest abLoadRequest = new OriginalAssetLoadRequest(); abLoadRequest.assetName = assetName; abLoadRequest.onComplete = onComplete; instance.mAssetLoadRequestList.Add(abLoadRequest); // 添加至资源请求list instance.StartCoroutine(instance.LoadAssetBundle(abPath, abLoadRequest)); }
/// <summary> /// 加载原始资源通用接口 /// </summary> /// <param name="assetName"></param> /// <param name="?"></param> private static void LoadOriginalAsset(string assetName, UseOriginalAssetDelegate onComplete) { if (!instance.data.assetBundlePath.ContainsKey(assetName)) { Debug.LogWarning("--Toto-- AssetBundleLoadManager->LoadOriginalAsset: '" + assetName + "' asset does not exist."); return; } if (!instance.mOriginalAssetCounter.ContainsKey(assetName)) // 使用计数 instance.mOriginalAssetCounter[assetName] = 0; ++instance.mOriginalAssetCounter[assetName]; if (instance.mAssetCached.ContainsKey(assetName)) { Object t = (Object)instance.mAssetCached[assetName]; if (t != null && onComplete != null) { onComplete(assetName, t); } return; } OriginalAssetLoadRequest loadRequest = (OriginalAssetLoadRequest)FindLoadRequestByName(assetName); if (loadRequest != null) { loadRequest.onComplete += onComplete; return; } string abPath = instance.data.assetBundlePath[assetName]; OriginalAssetLoadRequest abLoadRequest = new OriginalAssetLoadRequest(); abLoadRequest.assetName = assetName; abLoadRequest.onComplete = onComplete; instance.mAssetLoadRequestList.Add(abLoadRequest); // 添加至资源请求list instance.StartCoroutine(instance.LoadAssetBundle(abPath, abLoadRequest)); }
/// <summary> /// 使用纹理资源 /// </summary> /// <param name="assetName"></param> /// <param name="onComplete"></param> public static void UseTextureAsset(string assetName, UseOriginalAssetDelegate onComplete) { LoadOriginalAsset(assetName, onComplete); }