Exemplo n.º 1
0
    private static void SetGroupsSetting(AddressableAssetGroup group,
                                         bool UseAssetBundleCache,
                                         bool UseAssetBundleCrc,
                                         BundledAssetGroupSchema.BundleNamingStyle BundleNaming,
                                         string BuildPath,
                                         string LoadPath,
                                         bool StaticContent)
    {
        BundledAssetGroupSchema bundledAssetGroupSchema = group.GetSchema <BundledAssetGroupSchema>();

        if (bundledAssetGroupSchema == null)
        {
            bundledAssetGroupSchema = group.AddSchema <BundledAssetGroupSchema>();
        }
        //bundledAssetGroupSchema.IncludeInBuild = true;
        bundledAssetGroupSchema.UseAssetBundleCache = UseAssetBundleCache;
        bundledAssetGroupSchema.UseAssetBundleCrc   = UseAssetBundleCrc;
        bundledAssetGroupSchema.BundleNaming        = BundleNaming;
        bundledAssetGroupSchema.BuildPath.SetVariableByName(group.Settings, BuildPath);
        bundledAssetGroupSchema.LoadPath.SetVariableByName(group.Settings, LoadPath);
        bundledAssetGroupSchema.SetAssetBundleProviderType(typeof(AssetBundleEncryptProvider));
        EditorUtility.SetDirty(bundledAssetGroupSchema);


        ContentUpdateGroupSchema contentUpdateGroupSchema = group.GetSchema <ContentUpdateGroupSchema>();

        if (contentUpdateGroupSchema == null)
        {
            contentUpdateGroupSchema = group.AddSchema <ContentUpdateGroupSchema>();
        }
        contentUpdateGroupSchema.StaticContent = StaticContent;
        EditorUtility.SetDirty(contentUpdateGroupSchema);
    }
        public static string GetNameWithHashNaming(BundledAssetGroupSchema.BundleNamingStyle schemaBundleNaming, string hash, string sourceBundleName)
        {
            string result = sourceBundleName;

            switch (schemaBundleNaming)
            {
            case BundledAssetGroupSchema.BundleNamingStyle.AppendHash:
                result = sourceBundleName.Replace(".bundle", "_" + hash + ".bundle");
                break;

            case BundledAssetGroupSchema.BundleNamingStyle.NoHash:
                break;

            case BundledAssetGroupSchema.BundleNamingStyle.OnlyHash:
                result = hash + ".bundle";
                break;
            }

            return(result);
        }
Exemplo n.º 3
0
        public static string GetNameWithHashNaming(BundledAssetGroupSchema.BundleNamingStyle schemaBundleNaming, string hash, string sourceBundleName)
        {
            string result = sourceBundleName;

            switch (schemaBundleNaming)
            {
            case BundledAssetGroupSchema.BundleNamingStyle.AppendHash:
                result = sourceBundleName.Replace(".bundle", "_" + hash + ".bundle");
                break;

            case BundledAssetGroupSchema.BundleNamingStyle.NoHash:
                break;

            case BundledAssetGroupSchema.BundleNamingStyle.OnlyHash:
                string fileName = Path.GetFileNameWithoutExtension(sourceBundleName);
                if (!string.IsNullOrEmpty(fileName))
                {
                    result = sourceBundleName.Replace(fileName, hash);
                }
                break;
            }

            return(result);
        }