/// <summary> /// 删除所有请求信息 /// </summary> /// <param name="requestId"></param> public void RemoveAllBundleRequest() { for (int i = 0; i < loadBundleRequestInfoList.Count; i++) { LoadBundleRequestInfo loadBundleRequestInfo = loadBundleRequestInfoList[i]; loadBundleRequestInfo.Clear(); _freeLoadBundleRequestInfoList.Add(loadBundleRequestInfo); } loadBundleRequestInfoList.Clear(); }
/// <summary> /// 删除一个请求信息 /// </summary> public bool RemoveBundleRequest(int requestId) { for (int i = 0; i < loadBundleRequestInfoList.Count; i++) { LoadBundleRequestInfo loadBundleRequestInfo = loadBundleRequestInfoList[i]; if (loadBundleRequestInfo.requestId == requestId) { loadBundleRequestInfoList.RemoveAt(i); loadBundleRequestInfo.Clear(); _freeLoadBundleRequestInfoList.Add(loadBundleRequestInfo); return(true); } } return(false); }
/// <summary> /// 创建请求信息 /// </summary> /// <param name="onCreateAssetBundle">请求回调 多次请求对应多个回调</param> /// <returns></returns> public int CreateBundleRequest(int requestId, OnCreateAssetBundle onCreateAssetBundle) { if (requestId == 0) { requestId = ResourceUtils.GetRequestId(); } LoadBundleRequestInfo loadBundleRequestInfo = GetTempLoadBundleRequestInfo(); loadBundleRequestInfo.requestId = requestId; loadBundleRequestInfo.onCreateAssetBundle = onCreateAssetBundle; loadBundleRequestInfoList.Add(loadBundleRequestInfo); return(requestId); }
public LoadBundleRequestInfo GetTempLoadBundleRequestInfo() { LoadBundleRequestInfo loadBundleRequestInfo = null; if (_freeLoadBundleRequestInfoList.Count > 0) { loadBundleRequestInfo = _freeLoadBundleRequestInfoList[0]; _freeLoadBundleRequestInfoList.RemoveAt(0); } else { loadBundleRequestInfo = new LoadBundleRequestInfo(); } return(loadBundleRequestInfo); }