Exemplo n.º 1
0
        //----------------------------------------------------------------------------
        public bool IsPreLoadView()
        {
            ResourceListData data = FileSystem.Instance().GetResData();

            if (data == null)
            {
                return(false);
            }
            sAssetInfo info = sAssetInfo.zero;

            data.GetAssetBundleInfo(strAssetID, ref info);
            return(info.bPreLoad);
        }
Exemplo n.º 2
0
        //----------------------------------------------------------------------------
        private void AddUseAtlas()
        {
            m_bHasAddAtlas = true;
            ResourceListData data = FileSystem.Instance().GetResData();
            sAssetInfo       info = sAssetInfo.zero;

            data.GetAssetBundleInfo(strAssetID, ref info);
            if (info.childListAssetID != null && info.childListAssetID.Count > 0)
            {
                int nTotalCount = info.childListAssetID.Count;
                for (int i = 0; i < nTotalCount; i++)
                {
                    m_uiSystem.AddUseAtlas(info.childListAssetID[i]);
                }
            }
        }
Exemplo n.º 3
0
        //----------------------------------------------------------------------------
        public virtual void StageLoadViewer()
        {
            m_uiSystem.AddPreLoadAsset(strAssetID);
            ResourceListData data = FileSystem.Instance().GetResData();
            sAssetInfo       info = sAssetInfo.zero;

            data.GetAssetBundleInfo(strAssetID, ref info);
            if (info.childListAssetID != null && info.childListAssetID.Count > 0)
            {
                int nTotalCount = info.childListAssetID.Count;
                for (int i = 0; i < nTotalCount; i++)
                {
                    m_uiSystem.AddPreLoadAsset(info.childListAssetID[i]);
                    m_uiSystem.AddUseAtlas(info.childListAssetID[i]);
                }
            }
            m_bHasAddAtlas = true;
        }
Exemplo n.º 4
0
 //----------------------------------------------------------------------------
 public void GetAssetInfo(string strID, ref sAssetInfo info)
 {
     m_data.GetAssetBundleInfo(strID, ref info);
 }
Exemplo n.º 5
0
        //----------------------------------------------------------------------------
        private void StartLoad(sNeedLoadData needLoad)
        {
            string strAssetID = needLoad.strAssetID;

            UnityEngine.Object obj = assetsManager.GetAssetObjByID(strAssetID);
            if (obj != null)
            {
                Callback <string, UnityEngine.Object> callback = needLoad.callback as Callback <string, UnityEngine.Object>;
                callback(strAssetID, obj);
                return;
            }

            sAssetInfo info = sAssetInfo.zero;

            m_ResourceList.GetAssetBundleInfo(strAssetID, ref info);
            string strBaseDir = GetResDirByPath(info.strFile);
            string path       = info.strFile;

            if (m_bundleDependenciseDict.ContainsKey(path))
            {
                List <string> strDependecise = m_bundleDependenciseDict[path];
                for (int i = 0; i < strDependecise.Count; i++)
                {
                    if (!m_assetBundleDict.ContainsKey(strDependecise[i]))
                    {
                        AssetBundle tempBundle = AssetBundle.LoadFromFile(GetResPathByName(strDependecise[i]));
                        if (tempBundle != null)
                        {
                            m_assetBundleDict.Add(strDependecise[i], tempBundle);
                        }
                        else
                        {
                            Debug.LogErrorFormat("资源加载失败:{0}", strDependecise[i]);
                        }
                    }
                }
                path = strBaseDir + path;
                AssetBundle bundle = null;
                if (!m_assetBundleDict.ContainsKey(info.strFile))
                {
                    bundle = AssetBundle.LoadFromFile(path);
                    if (bundle != null)
                    {
                        m_assetBundleDict.Add(info.strFile, bundle);
                    }
                    else
                    {
                        Debug.LogErrorFormat("资源加载失败:{0}", path);
                    }
                }
                else
                {
                    bundle = m_assetBundleDict[info.strFile];
                }
                string loadAssetName             = string.IsNullOrEmpty(info.assetName) ? info.strName : info.assetName;
                UnityEngine.Object[] tempObjList = bundle.LoadAllAssets();
                var count = tempObjList.Length;
                for (int i = 0; i < tempObjList.Length; i++)
                {
                    ProcessAsset(strAssetID, tempObjList[i], needLoad.callback, info.eAssetType, count, i);
                    ProcessStreamedAsset(info, tempObjList[i], bundle);
                }
                return;
            }

            needLoad.callback?.Invoke(strAssetID, null);
            Debug.LogError("配置了不存在的资源:" + path);
            return;
        }