public ResourceLoadHandle LoadAsync(ulong pathHash, System.Type type, int priority) { ResourceLoadHandle loadHandle = new ResourceLoadHandle(); ResourceData resourceData = _GetResourceData(pathHash); if (resourceData == null) { ResourceLoadRequest request = m_loader.TryGetRequest(pathHash); if (request == null) { request = new ResourceLoadRequest(pathHash, type, priority); request.OnLoadDone += _OnRequestDone; m_loader.PushRequst(request); } else { Log.Assert(request.type == type); } request.AddLoadHandle(loadHandle); } else { Log.Assert(resourceData.type == type); resourceData.AddRef(); loadHandle.isDone = true; loadHandle.asset = resourceData.asset; } return(loadHandle); }
public void AddLoadHandle(ResourceLoadHandle loadHandle) { if (loadHandle != null) { m_loadList.AddLast(loadHandle); } }
public override bool TryLoad() { m_resourceLoadHandle = ResourceDataManager.Instance.LoadAsync(Id, typeof(GameObject), m_priority); if (m_resourceLoadHandle == null) { return(false); } return(base.TryLoad()); }
public static ResourceLoadHandle LoadAsync <T>(ulong pathHash, LoadingPriority priority = LoadingPriority.Normal) where T : Object { ResourceLoadHandle result = null; if (!Application.isPlaying) { string path = HashToPath(pathHash); result = LoadAsync <T>(path, priority); } else { result = ResourceDataManager.Instance.LoadAsync(pathHash, typeof(T), (int)priority); } return(result); }
public static ResourceLoadHandle LoadAsync <T>(string path, LoadingPriority priority = LoadingPriority.Normal) where T : Object { ResourceLoadHandle result = null; if (!Application.isPlaying) { result = new ResourceLoadHandle(); result.progress = 1.0f; result.isDone = true; result.asset = Resources.Load(path, typeof(T)); } else { ulong pathHash = PathToHash(path); result = LoadAsync <T>(pathHash, priority); } return(result); }
public override bool IsDone() { if (m_resourceLoadHandle != null) { if (m_resourceLoadHandle.isDone) { Object asset = m_resourceLoadHandle.asset; if (asset != null) { m_data = new ResourcePool(Id, asset); } m_resourceLoadHandle = null; return(true); } return(m_resourceLoadHandle.isDone); } return(base.IsDone()); }