Esempio n. 1
0
        internal void AddWWW(string name)
        {
            foreach (string res in mListRes)
            {
                if (res == name)
                {
                    return;
                }
            }

            if (name.Length == 0)
            {
                Logger.GetFile(LogFile.Res).LogError(" ResList:AddBundle name can't empty");
                return;
            }

            mListRes.Add(name);
            GOEBundleMapItem bundle = ResourceLoader.GetFinalBundle(name);

            if (bundle == null)
            {
                UnityEngine.Debug.LogError("Cannot find bundle " + name);
            }
            mListAsset.Add(bundle.FinalName);
        }
Esempio n. 2
0
        public override string ToString()
        {
            StringWriter sw = new StringWriter();

            foreach (KeyValuePair <string, GOEBundleMapItem> kvp in _bundleMap)
            {
                GOEBundleMapItem bmi = kvp.Value;
                sw.WriteLine(bmi.ToString());
            }
            return(sw.ToString());
        }
Esempio n. 3
0
        public bool AppendRead(string stream)
        {
            StringReader sr   = new StringReader(stream);
            string       line = sr.ReadLine();

            while (null != line)
            {
                if (line.StartsWith(BUNDLE_INFO_PREFIX))
                {
                    byte[]       buf = Convert.FromBase64String(line.Substring(BUNDLE_INFO_PREFIX.Length + 1));
                    MemoryStream ms  = new MemoryStream(buf);
                    BinaryReader br  = new BinaryReader(ms);

                    int bundleCnt = br.ReadInt32();
                    for (int i = 0; i < bundleCnt; i++)
                    {
                        string           name       = br.ReadString();
                        int              size       = br.ReadInt32();
                        int              assetCnt   = br.ReadInt32();
                        HashSet <string> assets     = new HashSet <string>();
                        string           firstAsset = null;
                        for (int j = 0; j < assetCnt; j++)
                        {
                            string assetName = br.ReadString();

                            if (firstAsset == null)
                            {
                                firstAsset = assetName;
                            }
                            ResourceMgr.Instance().RegisterBundleIdx(assetName, name, size);
                        }
                        GOEBundle bundle = ResourceMgr.Instance().GetBundle(name);
                        bundle.FirstAsset = firstAsset;
                        int dependCnt = br.ReadInt32();
                        for (int j = 0; j < dependCnt; j++)
                        {
                            string depName = br.ReadString();
                            bundle.DependsOn.Add(depName);
                        }
                    }
                }
                else
                {
                    GOEBundleMapItem bmi = new GOEBundleMapItem();
                    bmi.FromString(line);
                    if (!_bundleMap.ContainsKey(bmi.Name))
                    {
                        _bundleMap.Add(bmi.Name, bmi);
                    }
                }
                line = sr.ReadLine();
            }
            return(true);
        }
Esempio n. 4
0
 private void checkCampareEnd()
 {
     if (loadNum <= 0)
     {
         foreach (string name in upatingRes)
         {
             GOEBundleMapItem bundle = ResourceLoader.GetFinalBundle(name);
             //RemoveAsset(bundle.finalname);
         }
         upatingRes.Clear();
     }
 }
Esempio n. 5
0
        internal string GetBundleNameFromOriginalName(string originalName)
        {
            GOEBundleMapItem bmi = GetBundleItemFromOriginalName(originalName);

            if (null == bmi)
            {
                return(null);
            }
            else
            {
                return(bmi.FinalName);
            }
        }
Esempio n. 6
0
        internal GOEBundleMapItem GetBundleItemFromOriginalName(string originalName)
        {
            GOEBundleMapItem bmi = null;

            if (bundlemap.BundleMap.TryGetValue(originalName, out bmi))
            {
                return(bmi);
            }
            else
            {
                Logger.GetFile(LogFile.Res).LogError(originalName + " not found in BundleMap");
                return(null);
            }
        }
        public static GOEBundleMapItem GetFinalBundle(string name, bool fromWeb = false)
        {
            GOEBundleMapItem item = null;

            if (!fromWeb)
            {
                item = ResourceMgr.Instance().BundleRename.GetBundleItemFromOriginalName(name);
            }
            if (null == item)
            {
                item           = new GOEBundleMapItem();
                item.FinalName = name;
            }

            return(item);
        }
        public void BeginLoad()
        {
            if (mWWWType == GOEngine.WWWType.AssetBundle)
            {
                loadScale = 0.9f;
            }

            mRealName = mName;
#if DEBUG_BUNDLE_CACHE
            ResourceMgr.Instance().SampleLoadEvent(mName, 2);
#endif
            GOEBundleMapItem item = GetFinalBundle(mName, IsFromWeb);
            mRealName = item.FinalName;
            string name = mRealName;

            loadWWW        = WWWUtil.CreateWWW(name, IsRawResource, IsFromStream, IsFromWeb);
            mBeginLoadTime = 0;
        }