/// <summary> /// Method for generating asset model list based on string lists /// </summary> /// <param name="user"> /// User of asset model loaders /// </param> /// <param name="ids"> /// list of ids of all asset model loaders /// </param> /// <param name="names"> /// list of names of all asset model loaders /// </param> /// <returns> /// Collection of generated AssetModelLoaders /// </returns> public static List <AssetModelLoader> GenerateAssetModelLoaders(User user, List <string> ids, List <string> names, List <bool> filesExist, List <bool> iosFilesExist) { //Checking length of both - ids and names if (ids.Count != names.Count) { throw new InvalidOperationException(String.Format("length of id and name collection of models has to be the same! id length: {0} name length: {1}", ids.Count, names.Count)); } //Checking length of both - ids and filesExist if (ids.Count != filesExist.Count) { throw new InvalidOperationException(String.Format("length of id and filesExist collection of models has to be the same! id length: {0} filesExist length: {1}", ids.Count, filesExist.Count)); } //Creating and fetching list to return List <AssetModelLoader> listToReturn = new List <AssetModelLoader>(); for (var i = 0; i < ids.Count; i++) { var id = ids[i]; var name = names[i]; var fileExist = filesExist[i]; var iosFileExist = iosFilesExist[i]; var assetModelLoader = new AssetModelLoader(id, name, fileExist, user, iosFileExist); listToReturn.Add(assetModelLoader); } return(listToReturn); }
/// <summary> /// Method for creating and additing new model item to Instantiated model /// </summary> /// <param name="model"></param> private void _createAndAddModelItem(AssetModelLoader model) { var newModelItemGO = GameObject.Instantiate(ModelItemPrefab, _itemContainerGO.transform); //Creating and assigning model to new model item var newModelItem = newModelItemGO.GetComponent <ModelItem>(); newModelItem.AssignModel(model); this.InstantiatedModels.Add(newModelItem); }
/// <summary> /// Method called to assing model to model item /// </summary> /// <param name="model"></param> public void AssignModel(AssetModelLoader model) { this._model = model; this._model.OnDownloadCanceled = HandleDownloadCanceled; this._model.OnDownloadCompleted = HandleDownloadCompleted; this._model.OnDownloadFailure = HandleDownloadFailure; this._model.OnProgressChanged = HandleDownloadProgressChanged; this._model.OnDownloadStarted = HandleDownloadStart; this._model.AssignFileDownloader(this._fileDownloader); }