示例#1
0
        private void OnLoadBundleMap(string name, string data)
        {
            if (data == null)
            {
                //Logger.GetFile(LogFile.Res).LogError("load bundlemap failed");
                return;
            }
            brn.Read(data);
            RemoveAsset(name);
            if (onBundleMapEnd != null)
            {
                onBundleMapEnd();
                onBundleMapEnd = null;
            }

            HasInitialized = true;

            //EngineDelegateCore.OnShowUpdateAlert.Invoke();
        }
示例#2
0
        private void beginCampare()
        {
            if (_localMapText == null || _serverMapText == null)
            {
                return;
            }
            sbr = brn;
            sbr.Read(_serverMapText);
            BundleRename lbr = new BundleRename();

            lbr.Read(_localMapText, false);
            upatingRes       = new List <string>();
            upatingMap       = new Dictionary <string, string>();
            BundleNameToFile = new Dictionary <string, string>();
            int totalSize = 0;

            foreach (BundleInfoMapItem item in sbr.bundlemap.BundleMap.Values)
            {
                if (lbr.GetBundleNameFromOriginalName(item.Name) == item.FinalName)
                {
                    continue;
                }
                string path = Application.persistentDataPath + "/" + item.FinalName;
                if (File.Exists(path))
                {
                    FileInfo   fileInfo = new FileInfo(path);
                    BundleInfo bundle   = resourceMgr.GetBundle(item.Name);
                    if (bundle != null)
                    {
                        int _size = bundle.Size;
                        if (_size == fileInfo.Length)
                        {
                            continue;
                        }
                    }
                    else
                    {
                        if (item.Size == fileInfo.Length)
                        {
                            continue;
                        }
                    }

                    File.Delete(path);
                }
                loadNum++;
                totalSize += item.Size;
                upatingRes.Add(item.Name);
                upatingMap.Add(item.FinalName, item.Name);
                BundleNameToFile.Add(item.Name, item.FinalName);
                //ResourceModule.Instance.getWWWFromServer(item.FinalName, onGotWWW);ResourceModule.Instance.getWWWFromServer(item.FinalName, onGotWWW);
            }
            if (totalSize > 0)
            {
                EngineDelegateCore.OnShowUpdateAlert.Invoke(totalSize);
            }
            else
            {
                GogetWWWFromServer();
            }
            //if (upatingRes.Count > 0 && EngineDelegateCore.OnUpdateResource != null)
            //    EngineDelegateCore.OnUpdateResource.Invoke(upatingRes.ToArray());
            //sbr.AppendRead(_localMapText);
            //_localMapText = null;
            //_serverMapText = null;
            //checkCampareEnd();
        }