Exemplo n.º 1
0
        /// <summary>
        /// 根据crc查找ResItem
        /// </summary>
        /// <param name="crc"></param>
        /// <returns></returns>
        public ResItem FindResourceItme(uint crc)
        {
            ResItem item = null;

            mResConfigItem.TryGetValue(crc, out item);
            return(item);
        }
Exemplo n.º 2
0
 public virtual void Init(ResLoadInfo resLoadInfo)
 {
     mResPath        = resLoadInfo.mResPath;
     mLoadRePriority = resLoadInfo.loadResPriority;
     DestroyCache    = resLoadInfo.DestroyCache;
     isSprite        = resLoadInfo.mIsSprite;
     resItem         = new ResItem();
     resItem.mCrc    = Crc32.GetCrc32(mResPath);
     mListener       = resLoadInfo.mListener;
     mResState       = ResState.Waiting;
 }
Exemplo n.º 3
0
        /// <summary>
        /// 加载AB包
        /// </summary>
        /// <param name="crc"></param>
        /// <returns></returns>
        public ABResItem LoadAssetBundle(uint crc)
        {
            ABResItem ABResitem = new ABResItem();
            ResItem   resItem   = null;

            if (!mResConfigItem.TryGetValue(crc, out resItem) || resItem == null)
            {
                AFLogger.e(string.Format("LoadResourceAssetBundle error: can not find crc {0} in AssetBundleConfig", crc.ToString()));
                return(null);
            }
            ABResitem.assetBundle = LoadAssetBundle(resItem.ABName);
            if (resItem.DependAssetBundle != null)
            {
                for (int i = 0; i < resItem.DependAssetBundle.Count; i++)
                {
                    LoadAssetBundle(resItem.DependAssetBundle[i]);
                }
            }
            ABResitem.mResItem = resItem;
            return(ABResitem);
        }
Exemplo n.º 4
0
 public void CacheABConfig(AssetBundleConfig config)
 {
     mResConfigItem.Clear();
     for (int i = 0; i < config.ABList.Count; i++)
     {
         ABBase abBase = config.ABList[i];
         //使用中间类进行保存
         ResItem item = new ResItem();
         item.mCrc              = abBase.Crc;
         item.mResPath          = abBase.Path;
         item.ABName            = abBase.ABName;
         item.DependAssetBundle = abBase.ABDependce;
         if (mResConfigItem.ContainsKey(item.mCrc))
         {
             AFLogger.e("重复的Crc:" + item.mCrc + " ab包名:" + item.ABName);
         }
         else
         {
             mResConfigItem.Add(item.mCrc, item);
         }
     }
 }