Esempio n. 1
0
        public IAssetAsynRequest LoadAsyn()
        {
            if (!CheckLoadStatus())
            {
                return(null);
            }
            IAssetAsynRequest asynRequest = new AssetAsynRequest();

            if (asset)
            {
                asynRequest.SetAsset(asset);
            }
            else
            {
                if (bundleLoader == null)
                {
                    string bundleName = ResourceSetting.GetBundleName(resID);
                    bundleLoader = resourceModule.GetBundleLoader(bundleName);
                }
                bundleLoader.LoadAsyn((bundle) =>
                {
                    StartCoroutine(LoadAsset((asset) =>
                    {
                        asynRequest.SetAsset(asset);
                    }));
                    // AppendCoroutine(LoadAsset(assetName,bundle,(asset)=>
                    // {
                    //  asynRequest.SetAsset(asset);
                    // }));
                });
            }
            return(asynRequest);
        }
Esempio n. 2
0
 public AssetBundleLoader(string bundleName)
 {
     status          = eLoadStatus.idle;
     this.bundleName = bundleName;
     path            = ResourceSetting.GetBundlePathByBundleName(bundleName);
     resourceModule  = Mango.GetModule <ResourceModule>();
     taskModule      = Mango.GetModule <TaskModule>();
 }
Esempio n. 3
0
        public UnityEngine.Object Load()
        {
            if (!CheckLoadStatus())
            {
                return(null);
            }
            if (asset)
            {
                return(asset);
            }
            if (bundleLoader == null)
            {
                string bundleName = ResourceSetting.GetBundleName(resID);
                bundleLoader = resourceModule.GetBundleLoader(bundleName);
            }
            AssetBundle bundle = bundleLoader.Load();

            asset  = bundle.LoadAsset(resID.assetName);
            status = eLoadStatus.Loaded;
            return(asset);
        }