Пример #1
0
 public override TObject Provide <TObject>(IResourceLocation location)
 {
     if (location.HasDependencies)
     {
         IResourceLocation bundleLocation = location.Dependencies[0];
         AssetBundle       bundle         = CResources.Load <AssetBundle>(bundleLocation);
         LogUtility.Log("Load asset from bundle " + location.InternalId);
         return(bundle.LoadAsset(Path.GetFileName(location.InternalId), typeof(TObject)) as TObject);
     }
     else
     {
         throw new CResourcesException(" Can not find bundle Location " + location.InternalId);
     }
 }
Пример #2
0
        public override TObject Provide <TObject>(IResourceLocation location)
        {
            if (location.HasDependencies)
            {
                for (int i = 0; i < location.Dependencies.Count; i++)
                {
                    CResources.Load <AssetBundle>(location.Dependencies[i]);
                }
            }
            LogUtility.Log("[Load bundle] " + location.InternalId);
            AssetBundle bundle = AssetBundle.LoadFromFile(Path.Combine(Path.GetDirectoryName(Application.dataPath), "assetbundles/cresources/" + location.InternalId));

            return(bundle as TObject);
        }