예제 #1
0
        protected virtual Resource CreateResource(string name, LoadPriority priority)
        {
            Resource res = new Resource();

            res.Name            = name;
            res.Loader.Priority = priority;
            mDownResource.Add(res);

            BundleInfo bundle = ResourceMgr.GetBundle(name);

            if (bundle != null)
            {
                res.Size = bundle.Size;
            }

            res.AddGotWWWCallback(this.OnLoadWWW);

            return(res);
        }
예제 #2
0
        internal void EnsureDependencies(string name)
        {
            string bundleName = ResourceMgr.GetBundleName(name);

            if (!string.IsNullOrEmpty(bundleName))
            {
                BundleInfo bundle = ResourceMgr.GetBundle(bundleName);
                if (bundle != null)
                {
                    foreach (var dep in bundle.DependsOn)
                    {
                        BundleInfo depBundle = ResourceMgr.GetBundle(dep);
                        if (depBundle == null)
                        {
                            continue;
                        }
                        if (!HasLoaded(depBundle.FirstAsset))
                        {
                            ResourceModule.Instance.PreloadBundle(dep, null);
                        }
                    }
                }
            }
        }
예제 #3
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();
        }
예제 #4
0
        public void SetAssetBundlePersistent(string bundleName)
        {
            var bundle = resourceMgr.GetBundle(bundleName);

            bundle.BundlePersistent = true;
        }