Exemplo n.º 1
0
        /// <summary>
        /// 设置资源的标签和变种
        /// </summary>
        private void SetAssetBundleLabelAndVariant(AssetInfo assetInfo)
        {
            string label   = CollectionSettingData.GetAssetBundleLabel(assetInfo.AssetPath);
            string variant = PatchDefine.AssetBundleDefaultVariant;

            // 如果是变体资源
            // 注意:仅支持文件夹级别
            if (Path.HasExtension(label) && AssetDatabase.IsValidFolder(label))
            {
                variant = Path.GetExtension(label).Substring(1);
                label   = label.Remove(label.LastIndexOf("."));
            }

            assetInfo.AssetBundleLabel   = label;
            assetInfo.AssetBundleVariant = variant;
        }
        /// <summary>
        /// 设置资源的标签和变种
        /// </summary>
        private void SetAssetBundleLabelAndVariant(AssetInfo assetInfo)
        {
            // 如果资源所在文件夹的名称包含后缀符号,则为变体资源
            string folderName = Path.GetDirectoryName(assetInfo.AssetPath);             // "Assets/Texture.HD/background.jpg" --> "Assets/Texture.HD"

            if (Path.HasExtension(folderName))
            {
                string extension = Path.GetExtension(folderName);
                string label     = CollectionSettingData.GetAssetBundleLabel(assetInfo.AssetPath);
                assetInfo.AssetBundleLabel   = label.Replace(extension, string.Empty);
                assetInfo.AssetBundleVariant = extension.Substring(1);
            }
            else
            {
                assetInfo.AssetBundleLabel   = CollectionSettingData.GetAssetBundleLabel(assetInfo.AssetPath);
                assetInfo.AssetBundleVariant = PatchDefine.AssetBundleDefaultVariant;
            }
        }