Esempio n. 1
0
        private void LoaderCallback(LoaderResponse response)
        {
            ItemOfQueue item = (ItemOfQueue)response.extraData;

            if (item.callback != null)
            {
                response.extraData = item.extraData;
                item.callback(response);
            }

            working = false;
            requestList.RemoveFirst();
            LoadDo();
        }
Esempio n. 2
0
        private void LoadDo()
        {
            if (working || requestList.Count == 0)
            {
                return;
            }

            working = true;
            ItemOfQueue item = requestList.First.Value;

            if (!loader.Load(item.request, LoaderCallback, item))
            {
                working = false;
                requestList.RemoveFirst();
                LoadDo();
            }
        }
Esempio n. 3
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);
        }