Beispiel #1
0
        void DownLoadResource(string name, string path, _DelegateGameObj onLoadOk, EResourceType type)
        {
            string[] deps = _manifest != null?_manifest.GetAllDependencies(path) : new string[0];

            Queue <string> queue = new Queue <string>(deps.Length);

            for (int i = 0, imax = deps.Length; i < imax; ++i)
            {
                queue.Enqueue(deps[i]);
            }

            DownLoadResInfo info = new DownLoadResInfo();

            info.Assets = new AssetsResource();
            info.Assets.SetNameAndPath(name, path, type);
            info.MainAbPath       = path;
            info.DependenceAbPath = queue;
            AddAssetsResource(info.Assets);
            info.onLoadComplete = delegate(AssetsResource ar)
            {
                if (ar != null)
                {
                    ar.LoadObject();
                    onLoadOk(PoolMgr.Instance.GetGameObj(ar));
                }
                else
                {
                    onLoadOk(null);
                }
            };

            DownLoadMgr.Instance.AddToDownLoadQueue(info);
        }
        public void AddToWaitList(_DelegateGameObj onloadok)
        {
            if (_getObjList == null)
            {
                _getObjList = new List <_DelegateGameObj>();
            }

            _getObjList.Add(onloadok);
        }
Beispiel #3
0
        public void GetGameObjAsync(string name, string path, EResourceType type, _DelegateGameObj onLoadOk)
        {
            //string path = ResourcePath.GetPath (type) + name + _bundleEx;

            AssetsResource ar;

            if (_originObjDic.TryGetValue(path, out ar))
            {
                if (!ar.LoadOk)
                {
                    ar.AddToWaitList(onLoadOk);
                    return;
                }
                onLoadOk(PoolMgr.Instance.GetGameObj(ar));
            }
            else
            {
                DownLoadResource(name, path, onLoadOk, type);
            }
        }