private void Update()
 {
     if ((this.dbLoader != null) && this.dbLoader.IsDone)
     {
         Engine engine = EngineService.Engine;
         base.enabled = false;
         if (!string.IsNullOrEmpty(this.dbLoader.Error))
         {
             string message = $"AssetBundleDatabase loading was failed. URL: {this.dbLoader.URL}, Error: {this.dbLoader.Error}";
             LoggerProvider.GetLogger(this).Error(message);
             this.dbLoader.Dispose();
             this.dbLoader = null;
             engine.ScheduleEvent <InvalidGameDataErrorEvent>(engine.CreateEntity("RemoteConfigLoading"));
         }
         else
         {
             this.dbLoader.Dispose();
             this.dbLoader = null;
             AssetBundleDatabaseComponent component = new AssetBundleDatabaseComponent {
                 AssetBundleDatabase = this.DeserializeDatabase(this.dbLoader.Bytes)
             };
             this.dbEntity.AddComponent(component);
             base.Complete();
         }
     }
 }
Exemple #2
0
        private static AsyncLoadAssetFromBundleRequest CreateLoadAssetRequest(AssetReference assetReference, AssetBundleDatabaseComponent db, AssetBundlesLoadDataComponent assetBundlesLoadData)
        {
            AsyncLoadAssetFromBundleRequest request;
            AssetInfo assetInfo = db.AssetBundleDatabase.GetAssetInfo(assetReference.AssetGuid);

            try
            {
                request = new AsyncLoadAssetFromBundleRequest(assetBundlesLoadData.LoadedBundles[assetInfo.AssetBundleInfo], assetInfo.ObjectName, assetInfo.AssetType);
            }
            catch (KeyNotFoundException exception)
            {
                throw new Exception("Bundle not found in LoadedBundles: " + assetInfo.AssetBundleInfo.BundleName + ", ref=" + assetReference.AssetGuid, exception);
            }
            return(request);
        }