//取消获取,reserve标识对于取消加载的对象是缓存到自己的缓冲池 //还是完全取消对象的加载 public void CancelUngotGameObj(ulong cbIdx, bool reserve) { GoCallback gcb = GoCallback.Get(cbIdx); if (null == gcb) { return; } if (goTasks.ContainsKey(gcb.Id)) { if (reserve)//需要缓存的情况 { gcb.Cb = (go, cbId) => { UnuseGameObj(gcb.Path, go); }; } else { goTasks.Remove(gcb.Id); GoCallback.Remove(gcb.Id); gcb.Cancel(); if (instanters.ContainsKey(gcb.Id)) { IEnumerator instanter = instanters[gcb.Id]; StopCoroutine(instanter); instanters.Remove(gcb.Id); } } } }
private void FinishInstant(ulong gcbId, GameObject go) { if (goTasks.ContainsKey(gcbId)) { GoCallback task = goTasks[gcbId]; task.Do(go); GoCallback.Remove(gcbId); goTasks.Remove(gcbId); } if (instanters.ContainsKey(gcbId)) { instanters.Remove(gcbId); } }