using System; using UnityEngine; namespace OCES { public class AssetBundleAssetProvider : IAssetProvider { readonly AssetBundle m_assetBundle; public AssetBundleAssetProvider(string bundleFilePath) { this.m_assetBundle = AssetBundle.LoadFromFile(bundleFilePath); if (this.m_assetBundle is null) { Debug.LogError($"[OCES] 无法加载: {bundleFilePath}"); } } public T Load(string path) where T : UnityEngine.Object { return this.m_assetBundle.LoadAsset(path); } public ResourceRequest LoadAsync(string path) where T : UnityEngine.Object { return this.m_assetBundle.LoadAssetAsync(path); } } }