Exemplo n.º 1
0
        public bool Load(LoaderRequest request, System.Action <LoaderResponse> callback = null, object extraData = null)
        {
            if (request == null || string.IsNullOrEmpty(request.url))
            {
                return(false);
            }
            else
            {
                LoaderResponse response = null;
                if (cacheMap.TryGetValue(request.url, out response))
                {
                    Debug.Log("CacheLoader complete:" + request.url);

                    if (callback != null)
                    {
                        response.extraData = extraData;
                        callback(response);
                    }
                    return(true);
                }
                else
                {
                    if (loader.Load(request, LoaderCallback, extraData))
                    {
                        this.callback = callback;
                        return(true);
                    }
                    else
                    {
                        return(false);
                    }
                }
            }
        }
Exemplo n.º 2
0
        public bool Load(LoaderRequest request, System.Action<LoaderResponse> callback = null, object extraData = null)
        {
            if (request == null || string.IsNullOrEmpty(request.url))
            {
                return false;
            }
            else
            {
                LoaderResponse response = null;
                if (cacheMap.TryGetValue(request.url, out response))
                {
                    Debug.Log("CacheLoader complete:" + request.url);

                    if (callback != null)
                    {
                        response.extraData = extraData;
                        callback(response);
                    }
                    return true;
                }
                else
                {
                    if (loader.Load(request, LoaderCallback, extraData))
                    {
                        this.callback = callback;
                        return true;
                    }
                    else
                    {
                        return false;
                    }
                }
            }
        }
Exemplo n.º 3
0
        public bool Load(LoaderRequest request, System.Action <LoaderResponse> callback = null, object extraData = null)
        {
            if (request == null || request.urlList == null || request.urlList.Length == 0)
            {
                return(false);
            }

            Stop();

            response              = new LoaderResponse();
            responseIndex         = 0;
            response.responseList = new LoaderResponse[request.urlList.Length];

            int requestCount = request.urlList.Length;

            for (int i = 0; i < requestCount; ++i)
            {
                ExtraData data = new ExtraData();
                data.callback  = callback;
                data.extraData = extraData;
                loader.Load(new LoaderRequest(request.urlList[i], request.typeList[i]), CompleteCallback, data);
            }

            return(true);
        }
Exemplo n.º 4
0
        public bool Load(LoaderRequest request, System.Action <LoaderResponse> callback = null, object extraData = null)
        {
            if (request == null)
            {
                return(false);
            }

            ItemOfQueue item = new ItemOfQueue();

            item.request   = request;
            item.callback  = callback;
            item.extraData = extraData;
            requestList.AddLast(item);

            LoadDo();

            return(true);
        }
Exemplo n.º 5
0
        public bool Load(LoaderRequest request, System.Action <LoaderResponse> callback = null, object extraData = null)
        {
            if (request == null || string.IsNullOrEmpty(request.url))
            {
                return(false);
            }

            Stop();

            this.request   = request;
            this.callback  = callback;
            this.extraData = extraData;
            loaderList.Add(this);

            www = new WWW(request.url);

            if (!coroutineWorking)
            {
                coroutineWorking = true;
                GlobalCoroutine.Start(LoaderGlobalCoroutine());
            }

            return(true);
        }
Exemplo n.º 6
0
        public bool Load(LoaderRequest request, System.Action<LoaderResponse> callback = null, object extraData = null)
        {
            if (request == null || string.IsNullOrEmpty(request.url))
            {
                return false;
            }

            Stop();

            this.request = request;
            this.callback = callback;
            this.extraData = extraData;
            loaderList.Add(this);

            www = new WWW(request.url);

            if (!coroutineWorking)
            {
                coroutineWorking = true;
                GlobalCoroutine.Start(LoaderGlobalCoroutine());
            }

            return true;
        }
Exemplo n.º 7
0
        public static bool LoadSQ(LoaderRequest request, System.Action <LoaderResponse> callback = null, object extraData = null)
        {
            Loader loader = new Loader();

            return(loader.Load(request, callback, extraData));
        }
Exemplo n.º 8
0
 public static bool LoadSQ(LoaderRequest request, System.Action<LoaderResponse> callback = null, object extraData = null)
 {
     Loader loader = new Loader();
     return loader.Load(request, callback, extraData);
 }