public void Reset() { FinishActionList.Clear(); CRC = 0; Path = string.Empty; IsSprite = false; Priority = ResPriority.Low; }
public void AsyncLoadAsset(string path, Action <string, Object, object> finishAction, ResPriority priority, bool isSprite = false, object param = null) { if (string.IsNullOrEmpty(path)) { return; } if (finishAction == null) { Debug.LogWarningFormat("load {0} finishAction is null", path); return; } var crc = CRC32.GetCRC32(path); var cacheItem = GetCacheResItem(crc); if (cacheItem != null) { finishAction(path, cacheItem.obj, param); return; } AsyncLoadResTask task = null; if (!loadingAssetTaskDic.TryGetValue(crc, out task)) { task = asyncLoadTaskPool.Spawn(true); task.CRC = crc; task.Path = path; task.IsSprite = isSprite; task.Priority = priority; loadingAssetTaskDic.Add(crc, task); loadingAssetTaskList[(int)priority].Add(task); } var aFinishAction = asyncFinishActionPool.Spawn(true); aFinishAction.FinishAction = finishAction; aFinishAction.Param = param; task.FinishActionList.Add(aFinishAction); }
public long AsyncInsObj(string path, Action <string, Object, object> finishAction, ResPriority priority, bool isSceneRoot, bool isSceneClear = true, object param = null) { var crc = CRC32.GetCRC32(path); var resObj = GetCacheResObj(crc); if (resObj != null) { if (isSceneRoot) { resObj.CloneObj.transform.SetParent(sceneRoot, false); } if (finishAction != null) { finishAction(path, resObj.CloneObj, param); } return(resObj.Guid); } var guid = CreateGuid(); resObj = resObjPool.Spawn(true); resObj.Guid = guid; resObj.CRC = crc; resObj.IsSceneRoot = isSceneRoot; resObj.IsSceneClear = isSceneClear; resObj.FinishAction = finishAction; resObj.param = param; createingResObjs.Add(guid, resObj); ResSvc.Ins.AsyncLoadAsset(path, OnLoadAssetFinish, priority, false, resObj); return(guid); }