Beispiel #1
0
 /// <summary>
 /// 释放一个资源obj
 /// </summary>
 /// <param name="bundleNmae"></param>
 /// <param name="resName"></param>
 public void DisposeResObj(string bundleNmae, string resName)
 {
     if (loadObj.ContainsKey(bundleNmae))
     {
         AssetResObj tmp = loadObj[bundleNmae];
         tmp.ReleaseResObj(resName);
     }
     else
     {
         Debug.Log("bundle is not exist ==" + bundleNmae);
     }
 }
Beispiel #2
0
        /// <summary>
        /// 释放一个bundle包里所有资源obj
        /// </summary>
        /// <param name="bundleNmae"></param>
        /// <param name="resName"></param>
        public void DisposeResObj(string bundleNmae)
        {
            if (loadObj.ContainsKey(bundleNmae))
            {
                AssetResObj tmp = loadObj[bundleNmae];
                tmp.ReleaseAllResObj();
                //
                loadObj.Remove(bundleNmae);
            }
            else
            {
                Debug.Log("bundle is not exist ==" + bundleNmae);
            }

            Resources.UnloadUnusedAssets();
        }
Beispiel #3
0
        public UnityEngine.Object GetSingleResourcess(string bundleName, string resName)
        {
            if (loadObj.ContainsKey(bundleName))
            {
                List <UnityEngine.Object> listObj = loadObj[bundleName].GetResObj(resName);
                if (listObj != null)
                {
                    return(listObj[0]);
                }
            }

            if (loadHelper.ContainsKey(bundleName))//表示已经加载过bundle
            {
                IABRelationManager loader = loadHelper[bundleName];

                // lhy change bundleName --> resName
                UnityEngine.Object tmpObj = loader.GetSingleResources(resName);

                AssetObj tmpAssetObj = new AssetObj(tmpObj);

                //缓存里面是否有这个bundle包
                if (loadObj.ContainsKey(bundleName))
                {
                    AssetResObj tmpAssetResObj = loadObj[bundleName];
                    tmpAssetResObj.AddResObj(resName, tmpAssetObj);
                }
                else
                {
                    AssetResObj tmpRes = new AssetResObj(resName, tmpAssetObj);
                    loadObj.Add(bundleName, tmpRes);
                }

                return(tmpObj);
            }
            else
            {//没有加载过
                return(null);
            }
        }