Пример #1
0
        private void doBundleSaveOne(string bundleName, int type)
        {
            ResourceSaveExData data = _newVersion.getBundleEx(bundleName);

            if (data != null)
            {
                if (ShineToolSetting.bundlePackNeedPutDependAlsoIntoStreamingAssets && type == ResourceSaveType.InStreamingAsset && data.saveType != type)
                {
                    data.saveType = type;
                }
            }
            else
            {
                data = doFileSaveData(getTargetSourcePath(), bundleName, type);

                if (ShineToolSetting.bundlePackNeedPutDependAlsoIntoStreamingAssets)
                {
                    int resourceID = LoadControl.getResourceIDByName(data.name);

                    BundleInfoData bundleInfoData = LoadControl.getBundleInfo(resourceID);

                    foreach (int d in bundleInfoData.depends)
                    {
                        string pName = LoadControl.getResourceNameByID(d);

                        //父类型
                        doBundleSaveOne(pName, type);
                    }
                }
            }
        }
Пример #2
0
        private ResourceSaveExData doFileSaveData(string front, string fileName, int type)
        {
            //本地强制进包
            if (!_isReleasePack)
            {
                type = ResourceSaveType.InStreamingAsset;
            }

            string path = front + "/" + fileName;

            string md5 = FileUtils.getFileMD5(path);
//			string md5=_manifest.GetAssetBundleHash(FileUtils.getFileName(fileName)).ToString();

            FileInfo fileInfo = new FileInfo(path);

            ResourceSaveExData lastData = _lastTargetVersion.getBundleEx(fileName);

            ResourceSaveExData data = new ResourceSaveExData();

            data.name     = fileName;
            data.size     = fileInfo.Exists ? (int)fileInfo.Length : 0;       //强转int,最大支持2G文件
            data.saveType = type;
            data.md5      = md5;

            if (lastData != null)
            {
                if (lastData.md5.Equals(md5))
                {
                    data.version = lastData.version;
                }
                else
                {
                    data.version = _newVersion.resourceVersion;
                }

                //进包变成不进包
                if (ResourceSaveType.isStreamingAsset(lastData.saveType) && !ResourceSaveType.isStreamingAsset(data.saveType))
                {
                    //更新资源版本
                    data.version = _newVersion.resourceVersion;
                }
            }
            else
            {
                data.version = _newVersion.resourceVersion;
            }

            _newVersion.resourceDic.put(data.name, data);

            return(data);
        }