Пример #1
0
        //取消获取,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);
                    }
                }
            }
        }
Пример #2
0
 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);
     }
 }