Ejemplo n.º 1
0
 public void Update()
 {
     if (m_current_loading != null || m_pending_asset.Count == 0)
     {
         return;
     }
     m_current_loading = m_pending_asset.Dequeue();
     StartCoroutine(_loadFileBinaryFile(m_current_loading));
 }
Ejemplo n.º 2
0
 public void LoadBinaryFile(Resource_GrtPackage _assetbundle)
 {
     // 等待中或者正在加载的被跳过
     if (m_pending_asset.Contains(_assetbundle) || m_current_loading == _assetbundle)
     {
         return;
     }
     m_pending_asset.Enqueue(_assetbundle);
 }
Ejemplo n.º 3
0
 public GrtPackageLoadTask(Resource_GrtPackage _asset_data, Predicate <Boolean, Resource_Base> _callback)
 {
     m_resource = _asset_data;
     m_callback = _callback;
     if (_asset_data.State == ResourceState.Error)
     {
         throw new Utility.ExceptionEx("");
     }
     m_resource.Retain();
 }
Ejemplo n.º 4
0
        public void LoadGrtPackageAsync(String _name, Predicate <Boolean, Resource_Base> _callback)
        {
            Resource_GrtPackage res = GetResource(_name) as Resource_GrtPackage;

            if (res == null)
            {
                _callback(false, null);
                Log.Error("[ResouceManager.LoadGrtPackageAsync]: res [{0}] 不存在或类型不为GrtPackage!", _name);
                return;
            }
            var task = new GrtPackageLoadTask(res, _callback);

            m_running_task.AddLast(task);
        }
Ejemplo n.º 5
0
        private IEnumerator _loadFileBinaryFile(Resource_GrtPackage _assetbundle_data)
        {
            using (WWW www = new WWW(_assetbundle_data.ResouceInfo.UnityApiLoadingPath))
            {
                yield return(www);

                if (www.error != null)
                {
                    Utility.Log.Error(Utility.eLogType.Resources, "Binary file  [{0}] load fail:! Msg: {1}", _assetbundle_data.ResouceInfo.UnityApiLoadingPath, www.error);
                }
                _assetbundle_data.OnLoadFinish(www.error != null ? null : GrtPackge.CreateFromeMemory(www.bytes));
            }
            m_current_loading = null;
        }