Пример #1
0
        /// <inheritdoc/>
        public override void OnGUIMultiple(List <AddressableAssetGroupSchema> otherSchemas)
        {
            var so = new SerializedObject(this);
            SerializedProperty prop;

            List <BundledAssetGroupSchema> otherBundledSchemas = new List <BundledAssetGroupSchema>();

            foreach (var schema in otherSchemas)
            {
                otherBundledSchemas.Add(schema as BundledAssetGroupSchema);
            }

            EditorGUI.BeginChangeCheck();
            m_ShowPaths = EditorGUILayout.Foldout(m_ShowPaths, "Build and Load Paths");
            if (EditorGUI.EndChangeCheck())
            {
                foreach (var schema in otherBundledSchemas)
                {
                    schema.m_ShowPaths = m_ShowPaths;
                }
            }
            if (m_ShowPaths)
            {
                // BuildPath
                prop = so.FindProperty("m_BuildPath");
                ShowMixedValue(prop, otherSchemas, typeof(ProfileValueReference), "m_BuildPath");

                EditorGUI.BeginChangeCheck();
                EditorGUILayout.PropertyField(prop, true);
                if (EditorGUI.EndChangeCheck())
                {
                    foreach (var schema in otherBundledSchemas)
                    {
                        schema.m_BuildPath.Id = BuildPath.Id;
                    }
                }
                EditorGUI.showMixedValue = false;

                // LoadPath
                prop = so.FindProperty("m_LoadPath");
                ShowMixedValue(prop, otherSchemas, typeof(ProfileValueReference), "m_LoadPath");

                EditorGUI.BeginChangeCheck();
                EditorGUILayout.PropertyField(prop, true);
                if (EditorGUI.EndChangeCheck())
                {
                    foreach (var schema in otherBundledSchemas)
                    {
                        schema.m_LoadPath.Id = LoadPath.Id;
                    }
                }
                EditorGUI.showMixedValue = false;
            }

            EditorGUI.BeginChangeCheck();
            m_ShowAdvanced = EditorGUILayout.Foldout(m_ShowAdvanced, "Advanced Options");
            if (EditorGUI.EndChangeCheck())
            {
                foreach (var schema in otherBundledSchemas)
                {
                    schema.m_ShowAdvanced = m_ShowAdvanced;
                }
            }
            if (m_ShowAdvanced)
            {
                // Compression
                prop = so.FindProperty("m_Compression");
                ShowMixedValue(prop, otherSchemas, typeof(Enum), "m_Compression");
                EditorGUI.BeginChangeCheck();
                BundleCompressionMode newCompression = (BundleCompressionMode)EditorGUILayout.EnumPopup(prop.displayName, Compression);
                if (EditorGUI.EndChangeCheck())
                {
                    Compression = newCompression;
                    foreach (var schema in otherBundledSchemas)
                    {
                        schema.Compression = Compression;
                    }
                }
                EditorGUI.showMixedValue = false;

                // IncludeInBuild
                prop = so.FindProperty("m_IncludeInBuild");
                ShowMixedValue(prop, otherSchemas, typeof(bool), "m_IncludeInBuild");
                EditorGUI.BeginChangeCheck();
                bool newIncludeInBuild = (bool)EditorGUILayout.Toggle(prop.displayName, IncludeInBuild);
                if (EditorGUI.EndChangeCheck())
                {
                    IncludeInBuild = newIncludeInBuild;
                    foreach (var schema in otherBundledSchemas)
                    {
                        schema.IncludeInBuild = IncludeInBuild;
                    }
                }
                EditorGUI.showMixedValue = false;

                // ForceUniqueProvider
                prop = so.FindProperty("m_ForceUniqueProvider");
                ShowMixedValue(prop, otherSchemas, typeof(bool), "m_ForceUniqueProvider");
                EditorGUI.BeginChangeCheck();
                bool newForceUniqueProvider = (bool)EditorGUILayout.Toggle(prop.displayName, ForceUniqueProvider);
                if (EditorGUI.EndChangeCheck())
                {
                    ForceUniqueProvider = newForceUniqueProvider;
                    foreach (var schema in otherBundledSchemas)
                    {
                        schema.ForceUniqueProvider = ForceUniqueProvider;
                    }
                }
                EditorGUI.showMixedValue = false;

                // UseAssetBundleCache
                prop = so.FindProperty("m_UseAssetBundleCache");
                ShowMixedValue(prop, otherSchemas, typeof(bool), "m_UseAssetBundleCache");
                EditorGUI.BeginChangeCheck();
                bool newUseAssetBundleCache = (bool)EditorGUILayout.Toggle(prop.displayName, UseAssetBundleCache);
                if (EditorGUI.EndChangeCheck())
                {
                    UseAssetBundleCache = newUseAssetBundleCache;
                    foreach (var schema in otherBundledSchemas)
                    {
                        schema.UseAssetBundleCache = UseAssetBundleCache;
                    }
                }
                EditorGUI.showMixedValue = false;

                // UseAssetBundleCrc
                prop = so.FindProperty("m_UseAssetBundleCrc");
                ShowMixedValue(prop, otherSchemas, typeof(bool), "m_UseAssetBundleCrc");
                EditorGUI.BeginChangeCheck();
                bool newUseAssetBundleCrc = (bool)EditorGUILayout.Toggle(prop.displayName, UseAssetBundleCrc);
                if (EditorGUI.EndChangeCheck())
                {
                    UseAssetBundleCrc = newUseAssetBundleCrc;
                    foreach (var schema in otherBundledSchemas)
                    {
                        schema.UseAssetBundleCrc = UseAssetBundleCrc;
                    }
                }
                EditorGUI.showMixedValue = false;

                // Timeout
                prop = so.FindProperty("m_Timeout");
                ShowMixedValue(prop, otherSchemas, typeof(int), "m_Timeout");
                EditorGUI.BeginChangeCheck();
                int newTimeout = (int)EditorGUILayout.IntField(prop.displayName, Timeout);
                if (EditorGUI.EndChangeCheck())
                {
                    Timeout = newTimeout;
                    foreach (var schema in otherBundledSchemas)
                    {
                        schema.Timeout = Timeout;
                    }
                }
                EditorGUI.showMixedValue = false;

                // ChunkedTransfer
                prop = so.FindProperty("m_ChunkedTransfer");
                ShowMixedValue(prop, otherSchemas, typeof(bool), "m_ChunkedTransfer");
                EditorGUI.BeginChangeCheck();
                bool newChunkedTransfer = (bool)EditorGUILayout.Toggle(prop.displayName, ChunkedTransfer);
                if (EditorGUI.EndChangeCheck())
                {
                    ChunkedTransfer = newChunkedTransfer;
                    foreach (var schema in otherBundledSchemas)
                    {
                        schema.ChunkedTransfer = ChunkedTransfer;
                    }
                }
                EditorGUI.showMixedValue = false;

                // RedirectLimit
                prop = so.FindProperty("m_RedirectLimit");
                ShowMixedValue(prop, otherSchemas, typeof(int), "m_RedirectLimit");
                EditorGUI.BeginChangeCheck();
                int newRedirectLimit = (int)EditorGUILayout.IntField(prop.displayName, RedirectLimit);
                if (EditorGUI.EndChangeCheck())
                {
                    RedirectLimit = newRedirectLimit;
                    foreach (var schema in otherBundledSchemas)
                    {
                        schema.RedirectLimit = RedirectLimit;
                    }
                }
                EditorGUI.showMixedValue = false;

                // RetryCount
                prop = so.FindProperty("m_RetryCount");
                ShowMixedValue(prop, otherSchemas, typeof(int), "m_RetryCount");
                EditorGUI.BeginChangeCheck();
                int newRetryCount = (int)EditorGUILayout.IntField(prop.displayName, RetryCount);
                if (EditorGUI.EndChangeCheck())
                {
                    RetryCount = newRetryCount;
                    foreach (var schema in otherBundledSchemas)
                    {
                        schema.RetryCount = RetryCount;
                    }
                }
                EditorGUI.showMixedValue = false;

                // BundleMode
                prop = so.FindProperty("m_BundleMode");
                ShowMixedValue(prop, otherSchemas, typeof(Enum), "m_BundleMode");
                EditorGUI.BeginChangeCheck();
                BundlePackingMode newBundleMode = (BundlePackingMode)EditorGUILayout.EnumPopup(prop.displayName, BundleMode);
                if (EditorGUI.EndChangeCheck())
                {
                    BundleMode = newBundleMode;
                    foreach (var schema in otherBundledSchemas)
                    {
                        schema.BundleMode = BundleMode;
                    }
                }
                EditorGUI.showMixedValue = false;

                //Bundle Naming
                prop = so.FindProperty("m_BundleNaming");
                ShowMixedValue(prop, otherSchemas, typeof(Enum), "m_BundleNaming");
                EditorGUI.BeginChangeCheck();
                EditorGUILayout.PropertyField(prop, true);
                if (EditorGUI.EndChangeCheck())
                {
                    BundleNamingStyle newNamingStyle = (BundleNamingStyle)prop.enumValueIndex;
                    BundleNaming = newNamingStyle;
                    foreach (var schema in otherBundledSchemas)
                    {
                        schema.BundleNaming = BundleNaming;
                    }
                }
                EditorGUI.showMixedValue = false;

                //Bundled Asset Provider Type
                prop = so.FindProperty("m_BundledAssetProviderType");
                ShowMixedValue(prop, otherSchemas, typeof(SerializedType), "m_BundledAssetProviderType");

                EditorGUI.BeginChangeCheck();
                EditorGUILayout.PropertyField(prop, m_AssetProviderContent, true);
                if (EditorGUI.EndChangeCheck())
                {
                    foreach (var schema in otherBundledSchemas)
                    {
                        schema.m_BundledAssetProviderType = BundledAssetProviderType;
                    }
                }
                EditorGUI.showMixedValue = false;

                //Asset Bundle Provider Type
                prop = so.FindProperty("m_AssetBundleProviderType");
                ShowMixedValue(prop, otherSchemas, typeof(SerializedType), "m_AssetBundleProviderType");

                EditorGUI.BeginChangeCheck();
                EditorGUILayout.PropertyField(prop, m_BundleProviderContent, true);
                if (EditorGUI.EndChangeCheck())
                {
                    foreach (var schema in otherBundledSchemas)
                    {
                        schema.m_AssetBundleProviderType = AssetBundleProviderType;
                    }
                }

                EditorGUI.showMixedValue = false;
            }

            so.ApplyModifiedProperties();
        }
Пример #2
0
        /// <inheritdoc/>
        public override void OnGUIMultiple(List <AddressableAssetGroupSchema> otherSchemas)
        {
            m_QueuedChanges.Clear();
            var so = new SerializedObject(this);
            SerializedProperty prop;

            List <BundledAssetGroupSchema> otherBundledSchemas = new List <BundledAssetGroupSchema>();

            foreach (var schema in otherSchemas)
            {
                otherBundledSchemas.Add(schema as BundledAssetGroupSchema);
            }

            EditorGUI.BeginChangeCheck();
            m_ShowPaths = EditorGUILayout.Foldout(m_ShowPaths, "Build and Load Paths");
            if (EditorGUI.EndChangeCheck())
            {
                foreach (var schema in otherBundledSchemas)
                {
                    schema.m_ShowPaths = m_ShowPaths;
                }
            }
            if (m_ShowPaths)
            {
                // BuildPath
                prop = so.FindProperty("m_BuildPath");
                var prevBuildPath = m_BuildPath.Id;
                ShowMixedValue(prop, otherSchemas, typeof(ProfileValueReference), "m_BuildPath");

                EditorGUI.BeginChangeCheck();
                EditorGUILayout.PropertyField(prop, true);
                if (EditorGUI.EndChangeCheck())
                {
                    // Workaround to EditorGUILayout.PropertyField Undo bug
                    var newBuildPath = m_BuildPath.Id;
                    m_BuildPath.Id = prevBuildPath;
                    Undo.RecordObject(this, "BundledAssetGroupSchemaBuildPath" + name);
                    m_BuildPath.Id = newBuildPath;
                    foreach (var schema in otherBundledSchemas)
                    {
                        m_QueuedChanges.Add(() => schema.m_BuildPath.Id = BuildPath.Id);
                    }
                }
                EditorGUI.showMixedValue = false;

                // LoadPath
                prop = so.FindProperty("m_LoadPath");
                var prevLoadPath = m_LoadPath.Id;
                ShowMixedValue(prop, otherSchemas, typeof(ProfileValueReference), "m_LoadPath");

                EditorGUI.BeginChangeCheck();
                EditorGUILayout.PropertyField(prop, true);
                if (EditorGUI.EndChangeCheck())
                {
                    // Workaround to EditorGUILayout.PropertyField Undo bug
                    var newLoadPath = m_LoadPath.Id;
                    m_LoadPath.Id = prevLoadPath;
                    Undo.RecordObject(this, "BundledAssetGroupSchemaLoadPath" + name);
                    m_LoadPath.Id = newLoadPath;
                    foreach (var schema in otherBundledSchemas)
                    {
                        m_QueuedChanges.Add(() => schema.m_LoadPath.Id = LoadPath.Id);
                    }
                }
                EditorGUI.showMixedValue = false;
            }

            EditorGUI.BeginChangeCheck();
            m_ShowAdvanced = EditorGUILayout.Foldout(m_ShowAdvanced, "Advanced Options");
            if (EditorGUI.EndChangeCheck())
            {
                foreach (var schema in otherBundledSchemas)
                {
                    schema.m_ShowAdvanced = m_ShowAdvanced;
                }
            }
            if (m_ShowAdvanced)
            {
                // Compression
                prop = so.FindProperty("m_Compression");
                ShowMixedValue(prop, otherSchemas, typeof(Enum), "m_Compression");
                EditorGUI.BeginChangeCheck();
                BundleCompressionMode newCompression = (BundleCompressionMode)EditorGUILayout.EnumPopup(prop.displayName, Compression);
                if (EditorGUI.EndChangeCheck())
                {
                    Undo.RecordObject(this, "BundledAssetGroupSchemaCompression" + name);
                    Compression = newCompression;
                    foreach (var schema in otherBundledSchemas)
                    {
                        m_QueuedChanges.Add(() => schema.Compression = Compression);
                    }
                }
                EditorGUI.showMixedValue = false;

                // IncludeInBuild
                prop = so.FindProperty("m_IncludeInBuild");
                ShowMixedValue(prop, otherSchemas, typeof(bool), "m_IncludeInBuild");
                EditorGUI.BeginChangeCheck();
                bool newIncludeInBuild = (bool)EditorGUILayout.Toggle(prop.displayName, IncludeInBuild);
                if (EditorGUI.EndChangeCheck())
                {
                    Undo.RecordObject(this, "BundledAssetGroupSchemaIncludeInBuild" + name);
                    IncludeInBuild = newIncludeInBuild;
                    foreach (var schema in otherBundledSchemas)
                    {
                        m_QueuedChanges.Add(() => schema.IncludeInBuild = IncludeInBuild);
                    }
                }
                EditorGUI.showMixedValue = false;

                // ForceUniqueProvider
                prop = so.FindProperty("m_ForceUniqueProvider");
                ShowMixedValue(prop, otherSchemas, typeof(bool), "m_ForceUniqueProvider");
                EditorGUI.BeginChangeCheck();
                bool newForceUniqueProvider = (bool)EditorGUILayout.Toggle(prop.displayName, ForceUniqueProvider);
                if (EditorGUI.EndChangeCheck())
                {
                    Undo.RecordObject(this, "BundledAssetGroupSchemaForceUniqueProvider" + name);
                    ForceUniqueProvider = newForceUniqueProvider;
                    foreach (var schema in otherBundledSchemas)
                    {
                        m_QueuedChanges.Add(() => schema.ForceUniqueProvider = ForceUniqueProvider);
                    }
                }
                EditorGUI.showMixedValue = false;

                // UseAssetBundleCache
                prop = so.FindProperty("m_UseAssetBundleCache");
                ShowMixedValue(prop, otherSchemas, typeof(bool), "m_UseAssetBundleCache");
                EditorGUI.BeginChangeCheck();
                bool newUseAssetBundleCache = (bool)EditorGUILayout.Toggle(prop.displayName, UseAssetBundleCache);
                if (EditorGUI.EndChangeCheck())
                {
                    Undo.RecordObject(this, "BundledAssetGroupSchemaUseAssetBundleCache" + name);
                    UseAssetBundleCache = newUseAssetBundleCache;
                    foreach (var schema in otherBundledSchemas)
                    {
                        m_QueuedChanges.Add(() => schema.UseAssetBundleCache = UseAssetBundleCache);
                    }
                }
                EditorGUI.showMixedValue = false;

                // UseAssetBundleCrc
                prop = so.FindProperty("m_UseAssetBundleCrc");
                ShowMixedValue(prop, otherSchemas, typeof(bool), "m_UseAssetBundleCrc");
                EditorGUI.BeginChangeCheck();
                bool newUseAssetBundleCrc = (bool)EditorGUILayout.Toggle(prop.displayName, UseAssetBundleCrc);
                if (EditorGUI.EndChangeCheck())
                {
                    Undo.RecordObject(this, "BundledAssetGroupSchemaUseAssetBundleCrc" + name);
                    UseAssetBundleCrc = newUseAssetBundleCrc;
                    foreach (var schema in otherBundledSchemas)
                    {
                        m_QueuedChanges.Add(() => schema.UseAssetBundleCrc = UseAssetBundleCrc);
                    }
                }
                EditorGUI.showMixedValue = false;

                //UseAssetBundleCrcForCachedBundles
                prop = so.FindProperty("m_UseAssetBundleCrcForCachedBundles");
                ShowMixedValue(prop, otherSchemas, typeof(bool), "m_UseAssetBundleCrcForCachedBundles");
                EditorGUI.BeginChangeCheck();
                bool newUseAssetBundleCrcForCache = (bool)EditorGUILayout.Toggle(prop.displayName, UseAssetBundleCrcForCachedBundles);
                if (EditorGUI.EndChangeCheck())
                {
                    Undo.RecordObject(this, "BundledAssetGroupSchemaUseAssetBundleCrcForCachedBundles" + name);
                    UseAssetBundleCrcForCachedBundles = newUseAssetBundleCrcForCache;
                    foreach (var schema in otherBundledSchemas)
                    {
                        m_QueuedChanges.Add(() => schema.UseAssetBundleCrcForCachedBundles = UseAssetBundleCrcForCachedBundles);
                    }
                }
                EditorGUI.showMixedValue = false;

                // Timeout
                prop = so.FindProperty("m_Timeout");
                ShowMixedValue(prop, otherSchemas, typeof(int), "m_Timeout");
                EditorGUI.BeginChangeCheck();
                int newTimeout = (int)EditorGUILayout.IntField(prop.displayName, Timeout);
                if (EditorGUI.EndChangeCheck())
                {
                    Undo.RecordObject(this, "BundledAssetGroupSchemaTimeout" + name);
                    Timeout = newTimeout;
                    foreach (var schema in otherBundledSchemas)
                    {
                        m_QueuedChanges.Add(() => schema.Timeout = Timeout);
                    }
                }
                EditorGUI.showMixedValue = false;

                // ChunkedTransfer
                prop = so.FindProperty("m_ChunkedTransfer");
                ShowMixedValue(prop, otherSchemas, typeof(bool), "m_ChunkedTransfer");
                EditorGUI.BeginChangeCheck();
                bool newChunkedTransfer = (bool)EditorGUILayout.Toggle(prop.displayName, ChunkedTransfer);
                if (EditorGUI.EndChangeCheck())
                {
                    Undo.RecordObject(this, "BundledAssetGroupSchemaChunkedTransfer" + name);
                    ChunkedTransfer = newChunkedTransfer;
                    foreach (var schema in otherBundledSchemas)
                    {
                        m_QueuedChanges.Add(() => schema.ChunkedTransfer = ChunkedTransfer);
                    }
                }
                EditorGUI.showMixedValue = false;

                // RedirectLimit
                prop = so.FindProperty("m_RedirectLimit");
                ShowMixedValue(prop, otherSchemas, typeof(int), "m_RedirectLimit");
                EditorGUI.BeginChangeCheck();
                int newRedirectLimit = (int)EditorGUILayout.IntField(prop.displayName, RedirectLimit);
                if (EditorGUI.EndChangeCheck())
                {
                    Undo.RecordObject(this, "BundledAssetGroupSchemaRedirectLimit" + name);
                    RedirectLimit = newRedirectLimit;
                    foreach (var schema in otherBundledSchemas)
                    {
                        m_QueuedChanges.Add(() => schema.RedirectLimit = RedirectLimit);
                    }
                }
                EditorGUI.showMixedValue = false;

                // RetryCount
                prop = so.FindProperty("m_RetryCount");
                ShowMixedValue(prop, otherSchemas, typeof(int), "m_RetryCount");
                EditorGUI.BeginChangeCheck();
                int newRetryCount = (int)EditorGUILayout.IntField(prop.displayName, RetryCount);
                if (EditorGUI.EndChangeCheck())
                {
                    Undo.RecordObject(this, "BundledAssetGroupSchemaRetryCount" + name);
                    RetryCount = newRetryCount;
                    foreach (var schema in otherBundledSchemas)
                    {
                        m_QueuedChanges.Add(() => schema.RetryCount = RetryCount);
                    }
                }
                EditorGUI.showMixedValue = false;

                // BundleMode
                prop = so.FindProperty("m_BundleMode");
                ShowMixedValue(prop, otherSchemas, typeof(Enum), "m_BundleMode");
                EditorGUI.BeginChangeCheck();
                BundlePackingMode newBundleMode = (BundlePackingMode)EditorGUILayout.EnumPopup(prop.displayName, BundleMode);
                if (EditorGUI.EndChangeCheck())
                {
                    Undo.RecordObject(this, "BundledAssetGroupSchemaBundleMode" + name);
                    BundleMode = newBundleMode;
                    foreach (var schema in otherBundledSchemas)
                    {
                        m_QueuedChanges.Add(() => schema.BundleMode = BundleMode);
                    }
                }
                EditorGUI.showMixedValue = false;

                //Bundle Naming
                prop = so.FindProperty("m_BundleNaming");
                ShowMixedValue(prop, otherSchemas, typeof(Enum), "m_BundleNaming");
                EditorGUI.BeginChangeCheck();
                EditorGUILayout.PropertyField(prop, true);
                if (EditorGUI.EndChangeCheck())
                {
                    Undo.RecordObject(this, "BundledAssetGroupSchemaBundleNaming" + name);
                    BundleNamingStyle newNamingStyle = (BundleNamingStyle)prop.enumValueIndex;
                    BundleNaming = newNamingStyle;
                    foreach (var schema in otherBundledSchemas)
                    {
                        m_QueuedChanges.Add(() => schema.BundleNaming = BundleNaming);
                    }
                }
                EditorGUI.showMixedValue = false;

                //Bundled Asset Provider Type
                prop = so.FindProperty("m_BundledAssetProviderType");
                ShowMixedValue(prop, otherSchemas, typeof(SerializedType), "m_BundledAssetProviderType");

                EditorGUI.BeginChangeCheck();
                EditorGUILayout.PropertyField(prop, m_AssetProviderContent, true);
                if (EditorGUI.EndChangeCheck())
                {
                    Undo.RecordObject(this, "BundledAssetGroupSchemaAssetProviderType" + name);
                    foreach (var schema in otherBundledSchemas)
                    {
                        m_QueuedChanges.Add(() => schema.m_BundledAssetProviderType = BundledAssetProviderType);
                    }
                }
                EditorGUI.showMixedValue = false;

                //Asset Bundle Provider Type
                prop = so.FindProperty("m_AssetBundleProviderType");
                ShowMixedValue(prop, otherSchemas, typeof(SerializedType), "m_AssetBundleProviderType");

                EditorGUI.BeginChangeCheck();
                EditorGUILayout.PropertyField(prop, m_BundleProviderContent, true);
                if (EditorGUI.EndChangeCheck())
                {
                    Undo.RecordObject(this, "BundledAssetGroupSchemaAssetBundleProviderType" + name);
                    foreach (var schema in otherBundledSchemas)
                    {
                        m_QueuedChanges.Add(() => schema.m_AssetBundleProviderType = AssetBundleProviderType);
                    }
                }

                EditorGUI.showMixedValue = false;
            }
            if (m_QueuedChanges.Count > 0)
            {
                ProcessOtherSelectedBundledAssetGroupSchemasChanges(otherBundledSchemas);
            }

            so.ApplyModifiedProperties();
            Undo.CollapseUndoOperations(Undo.GetCurrentGroup());
        }