Ejemplo n.º 1
0
 public bool RemoveAssetBundle(IgnoreCaseString key)
 {
     if (_assetbundleDictionary != null)
     {
         return(_assetbundleDictionary.Remove(key));
     }
     return(false);
 }
Ejemplo n.º 2
0
 public bool IsExceptionRes(IgnoreCaseString key)
 {
     if (!string.IsNullOrEmpty(key.Info) && _exceptionHashSet != null)
     {
         return(_exceptionHashSet.Contains(key));
     }
     return(false);
 }
 public bool TryGetRemoteUrl(IgnoreCaseString key, out string result)
 {
     if (_dict != null && _dict.TryGetValue(key, out result))
     {
         return(true);
     }
     result = null;
     return(false);
 }
        public bool Contains(IgnoreCaseString key)
        {
            if (_dict == null)
            {
                return(false);
            }

            return(_dict.ContainsKey(key));
        }
Ejemplo n.º 5
0
 public bool CanLoad(IgnoreCaseString key, out AssetBundleInfo info)
 {
     if (!string.IsNullOrEmpty(key.Info) && !IsExceptionRes(key) && TryGetInfo(key, out info))
     {
         return(true);
     }
     info = default(AssetBundleInfo);
     return(false);
 }
Ejemplo n.º 6
0
 public bool GetAssetBundle(IgnoreCaseString key, out GameAssetBundle ab)
 {
     if (_assetbundleDictionary != null && _assetbundleDictionary.TryGetValue(key, out ab))
     {
         return(true);
     }
     ab = default(GameAssetBundle);
     return(false);
 }
Ejemplo n.º 7
0
 public bool UpdateAssetBundle(IgnoreCaseString assetbundlename, ref GameAssetBundle ab)
 {
     if (_assetbundleDictionary != null)
     {
         _assetbundleDictionary[assetbundlename] = ab;
         return(true);
     }
     return(false);
 }
Ejemplo n.º 8
0
 public bool TryGetInfo(IgnoreCaseString key, out AssetBundleInfo info)
 {
     if (_assetBundleInfoDict != null && _assetBundleInfoDict.TryGetValue(key, out info))
     {
         return(true);
     }
     info = default(AssetBundleInfo);
     return(false);
 }
Ejemplo n.º 9
0
 public bool TryGetDownloadUrl(IgnoreCaseString key, out string result)
 {
     if (_remoteinfo != null)
     {
         return(_remoteinfo.TryGetRemoteUrl(key, out result));
     }
     result = null;
     return(false);
 }
Ejemplo n.º 10
0
        public AssetBundleStatus GetAssetBundleStatus(IgnoreCaseString key)
        {
            GameAssetBundle ab;

            if (GetAssetBundle(key, out ab))
            {
                return(ab.AssetStatus);
            }
            return(AssetBundleStatus.None);
        }
        public IEnumerator Init(string url)
        {
            using (var request = UnityWebRequest.Get(url + "/" + AssetBundleConfig.DepFileName))
            {
                yield return(request.Send());

                if (request.responseCode != 200)
                {
                    Debug.LogErrorFormat("Http Error :{0} Info: {1}", request.url, request.downloadHandler.text);
                }
                else if (!string.IsNullOrEmpty(request.error))
                {
                    Debug.LogErrorFormat("Error :{0} Info: {1}", request.error, request.downloadHandler.text);
                }
                else
                {
                    string perpath = AssetBundleHelper.GetBundlePersistentPath(AssetBundleConfig.DepFileName);
                    string dirname = Path.GetDirectoryName(perpath);
                    if (!Directory.Exists(dirname))
                    {
                        Directory.CreateDirectory(dirname);
                    }

                    File.WriteAllBytes(perpath, request.downloadHandler.data);

                    var getter = AssetBundleTypeGetter.GetDepReader();

                    List <AssetBundleInfo> list = new List <AssetBundleInfo>();
                    getter.ReadBytes(list, request.downloadHandler.data);

                    if (_dict == null)
                    {
                        _dict = new Dictionary <IgnoreCaseString, string>();
                    }

                    foreach (var element in list)
                    {
                        IgnoreCaseString key = new IgnoreCaseString(element.AssetBundleName);
                        _dict[key] = url + "/" + element.AssetBundleName;
                    }
                }

                IsDone = true;
            }
        }
Ejemplo n.º 12
0
        public void UpdateAssetBundleStatus(IgnoreCaseString key, AssetBundleStatus status, bool and = false)
        {
            GameAssetBundle ab;

            if (GetAssetBundle(key, out ab))
            {
                if (and)
                {
                    ab.AssetStatus |= status;
                }
                else
                {
                    ab.AssetStatus = status;
                }

                UpdateAssetBundle(key, ref ab);
            }
        }
Ejemplo n.º 13
0
        public void Load(List <AssetBundleInfo> assetbundlelist)
        {
            _assetbundleDictionary = InitCollection(_assetbundleDictionary);
            _exceptionHashSet      = InitCollection(_exceptionHashSet);
            _assetBundleInfoDict   = InitCollection(_assetBundleInfoDict);
            _assetbundleincludes   = InitCollection(_assetbundleincludes);

            if (assetbundlelist != null)
            {
                foreach (var assetbundleinfo in assetbundlelist)
                {
                    AssetBundleInfo  info;
                    IgnoreCaseString key = new IgnoreCaseString(assetbundleinfo.UnityPath);

                    if (_assetBundleInfoDict.TryGetValue(key, out info))
                    {
                        Debug.LogErrorFormat("duplicate assetbundle info : {0}", assetbundleinfo);
                    }
                    else
                    {
                        _assetBundleInfoDict.Add(key, assetbundleinfo);

                        List <string> list;
                        if (_assetbundleincludes.TryGetValue(assetbundleinfo.AssetBundleName, out list))
                        {
                            list.Add(assetbundleinfo.UnityPath);
                        }
                        else
                        {
                            list = ListPool <string> .Get();

                            list.Add(assetbundleinfo.UnityPath);
                            _assetbundleincludes.Add(assetbundleinfo.AssetBundleName, list);
                        }
                    }
                }
            }
        }
Ejemplo n.º 14
0
Archivo: CSEX.cs Proyecto: knat/SData
 internal static ExpressionSyntax Literal(IgnoreCaseString value)
 {
     return CS.NewObjExpr(IgnoreCaseStringName, CS.Literal(value.Value), CS.Literal(value.IsReadOnly));
 }
Ejemplo n.º 15
0
 public bool AddExceptionRes(IgnoreCaseString key)
 {
     return(_exceptionHashSet.Add(key));
 }