Пример #1
0
        public static AssetCallback Gen(OnAssetGot cb, string path)
        {
            AssetCallback acb = new AssetCallback(cb, path);

            items.Add(acb.Id, acb);
            return(acb);
        }
Пример #2
0
        public void OnLoaded()
        {
            int num = cbs.Count;

            while (num > 0)
            {
                AssetCallback acb = cbs[num - 1];
                AssetCallback.Remove(acb.Id);
                cbs.RemoveAt(num - 1);
                DoAssetCallback(acb);
                num = cbs.Count;
            }
        }
Пример #3
0
        public void CancelUngotAsset(ulong cbIdx)
        {
            AssetCallback acb = AssetCallback.Get(cbIdx);

            if (null == acb)
            {
                return;
            }
            BundleHolder holder = GetExistHolder(acb.Path);

            if (null != holder)
            {
                holder.UnRefBy(cbIdx);
            }
        }
Пример #4
0
 public ulong RefBy(OnAssetGot cb)
 {
     if (this.IsLoaded())
     {
         Ref();
         DoCallback(cb);
         return(0);
     }
     else
     {
         AssetCallback acb = AssetCallback.Gen(cb, info.path);
         cbs.Add(acb);
         Ref();
         return(acb.Id);
     }
 }
Пример #5
0
        public void UnRefBy(ulong cbId)
        {
            int ret = -1;

            for (int i = 0; i < cbs.Count; ++i)
            {
                if (cbs[i].Id == cbId)
                {
                    ret = i;
                    break;
                }
            }
            if (ret >= 0)
            {
                AssetCallback.Remove(cbs[ret].Id);
                cbs.RemoveAt(ret);
                UnRef(true);
            }
        }
Пример #6
0
 protected override void DoAssetCallback(AssetCallback acb)
 {
     acb.Do(assets);
 }
Пример #7
0
 protected virtual void DoAssetCallback(AssetCallback acb)
 {
     acb.Do(MyAsset);
 }