//从回收站中移除,并获取 private RecycleBinItem GetFromRecycleBin(string bundleName) { for (int i = 0; i < recycleBin.Count; ++i) { if (string.Compare(recycleBin[i].assetBundleInfoNode.bundleName, bundleName, true) == 0) { RecycleBinItem item = recycleBin[i]; recycleBin.RemoveAt(i); return(item); } } return(null); }
//加入回收站,等待回收 public void PushToRecycleBin(AssetBundleInfoNode assetBundleInfoNode) { if (assetBundleInfoNode == null) { return; } if (CheckIsInAsyncList(assetBundleInfoNode)) { Debug.LogWarning(string.Format("Push to recycle bin failed.In async list ===> {0}", assetBundleInfoNode.bundleName)); return; } RecycleBinItem recycleBinItem = RecycleBinItem.Get(); recycleBinItem.assetBundleInfoNode = assetBundleInfoNode; recycleBinItem.timeStamp = Time.unscaledTime; //记录时间,用于排序 recycleBin.Add(recycleBinItem); }