Exemplo n.º 1
0
 public bool isDataProcess(GAbstractData data)
 {
     if (data.URL == _item.URL)
     {
         return(true);
     }
     return(false);
 }
Exemplo n.º 2
0
        private bool AlreadyDownloaded()
        {
            bool dataExist = GameResourceLoadManager.GetInstance().DataExist(_resName);

            if (dataExist)
            {
                GAbstractData preDownloadData = GameResourceLoadManager.GetInstance().GetGameData(_resName);
                _data = preDownloadData._data;
                return(true);
            }

            return(false);
        }
        public void AddUnloadData(GAbstractData data)
        {
            GAbstractData resData = _unloadDataList.Find(
                delegate(GAbstractData tmpData)
            {
                return(tmpData.ResName == data.ResName);
            }
                );

            if (resData == null)
            {
                _unloadDataList.Add(data);
            }
        }
Exemplo n.º 4
0
        public bool isInProcesser(GAbstractData data)
        {
            GGameDataLoaderProcesser processer;

            for (int i = 0; i < _runningList.Count; ++i)
            {
                processer = _runningList[i];

                if (processer.isDataProcess(data))
                {
                    return(true);
                }
            }

            return(false);
        }
        public void ReleaseGameData(string name)
        {
            if (!_dataMap.ContainsKey(name))
            {
                return;
            }

            GAbstractData tempData = _dataMap[name];

            if (tempData != null)
            {
                tempData.RemoveRef();
                if (tempData.GetRefCount() <= 0)
                {
                    tempData.Unload();
                }
            }
        }
 public void DataCompletedHandler(GAbstractData gameData)
 {
     if (gameData != null)
     {
         if (gameData.error)
         {
             foreach (IGDataListener listener in _listnerQueue)
             {
                 listener.dataError(gameData.ResName);
             }
         }
         else
         {
             foreach (IGDataListener listener in _listnerQueue)
             {
                 listener.dataLoaded(gameData.ResName);
             }
         }
     }
 }
        public void FrameUpdate(float deltaTime)
        {
            for (int i = 0; i < _loadingResList.Count;)
            {
                GAbstractData tempData = _loadingResList[i];

                if (tempData.Update(deltaTime))
                {
                    _loadingResList.RemoveAt(i);
                    DataCompletedHandler(tempData);
                }
                else
                {
                    ++i;
                }

                // don't need progress for now
                //dataProgressHandler( tempData );
            }

            GGameDataLoader.GetInstance().FrameUpdate(deltaTime);
        }
        /// <summary>
        /// Load raw resource by path
        /// </summary>
        /// <param name="path"> resource path </param>
        /// <param name="onComplete"> callback function when resource loaded </param>
        /// <param name="useLocal"> true: use file from Resource folder, false: use assetBundle </param>
        /// <param name="param"></param>
        private void LoadResourceByPath(string path, OnLoadedComplete onComplete, bool useLocal, System.Object param = null)
        {
            if (!string.IsNullOrEmpty(path))
            {
                GAbstractData waitLoadResource = null;

                if (_dataMap.ContainsKey(path))
                {
                    waitLoadResource = _dataMap[path];
                    waitLoadResource.AddRef();
                    waitLoadResource.AddDataHandler(onComplete);
                }
                else
                {
                    if (useLocal)
                    {
                        waitLoadResource = new GGameLocalData();
                    }
                    else
                    {
                        waitLoadResource = new GAssetBundleData();
                    }

                    _dataMap.Add(path, waitLoadResource);
                    _loadingResList.Add(waitLoadResource);

                    waitLoadResource.AddRef();
                    waitLoadResource.AddDataHandler(onComplete);
                    waitLoadResource.Init(path, useLocal, param);
                }
            }
            else
            {
                DebugUtils.LogError(DebugUtils.Type.Resource, "GetGameData Can't input the null path!");
            }
        }
 public void RemoveUnloadData(GAbstractData data)
 {
     _unloadDataList.Remove(data);
 }