public bool HandleDefaultSettings(List <TextureImporterPlatformSettings> platformSettings, ITexturePlatformSettingsView view)
        {
            int maxTextureSize = platformSettings[0].maxTextureSize;
            TextureImporterCompression textureCompression = platformSettings[0].textureCompression;
            bool crunchedCompression  = platformSettings[0].crunchedCompression;
            int  compressionQuality   = platformSettings[0].compressionQuality;
            bool crunchedCompression2 = crunchedCompression;
            int  compressionQuality2  = compressionQuality;
            bool isMixedValue         = false;
            bool flag          = false;
            bool flag2         = false;
            bool isMixedValue2 = false;
            bool flag3         = false;
            bool flag4         = false;
            bool flag5         = false;
            bool flag6         = false;

            for (int i = 1; i < platformSettings.Count; i++)
            {
                TextureImporterPlatformSettings textureImporterPlatformSettings = platformSettings[i];
                if (textureImporterPlatformSettings.maxTextureSize != maxTextureSize)
                {
                    isMixedValue = true;
                }
                if (textureImporterPlatformSettings.textureCompression != textureCompression)
                {
                    flag = true;
                }
                if (textureImporterPlatformSettings.crunchedCompression != crunchedCompression)
                {
                    flag2 = true;
                }
                if (textureImporterPlatformSettings.compressionQuality != compressionQuality)
                {
                    isMixedValue2 = true;
                }
            }
            int maxTextureSize2 = view.DrawMaxSize(maxTextureSize, isMixedValue, out flag3);
            TextureImporterCompression textureCompression2 = view.DrawCompression(textureCompression, flag, out flag4);

            if (!flag && textureCompression != TextureImporterCompression.Uncompressed)
            {
                crunchedCompression2 = view.DrawUseCrunchedCompression(crunchedCompression, flag2, out flag5);
                if (!flag2 && crunchedCompression)
                {
                    compressionQuality2 = view.DrawCompressionQualitySlider(compressionQuality, isMixedValue2, out flag6);
                }
            }
            bool result;

            if (flag3 || flag4 || flag5 || flag6)
            {
                for (int j = 0; j < platformSettings.Count; j++)
                {
                    if (flag3)
                    {
                        platformSettings[j].maxTextureSize = maxTextureSize2;
                    }
                    if (flag4)
                    {
                        platformSettings[j].textureCompression = textureCompression2;
                    }
                    if (flag5)
                    {
                        platformSettings[j].crunchedCompression = crunchedCompression2;
                    }
                    if (flag6)
                    {
                        platformSettings[j].compressionQuality = compressionQuality2;
                    }
                }
                result = true;
            }
            else
            {
                result = false;
            }
            return(result);
        }
        public bool HandleDefaultSettings(List <TextureImporterPlatformSettings> platformSettings, ITexturePlatformSettingsView view, ITexturePlatformSettingsFormatHelper formatHelper)
        {
            Assert.IsTrue(platformSettings.Count > 0, "At least 1 platform setting is needed to display the texture platform setting UI.");

            var allSize                   = platformSettings[0].maxTextureSize;
            var allFormat                 = platformSettings[0].format;
            var allCompression            = platformSettings[0].textureCompression;
            var allUseCrunchedCompression = platformSettings[0].crunchedCompression;
            var allCompressionQuality     = platformSettings[0].compressionQuality;

            var mixedSize                   = false;
            var mixedFormat                 = false;
            var mixedCompression            = false;
            var mixedUseCrunchedCompression = false;
            var mixedCompressionQuality     = false;

            var sizeChanged                   = false;
            var formatChanged                 = false;
            var compressionChanged            = false;
            var useCrunchedCompressionChanged = false;
            var compressionQualityChanged     = false;

            for (var i = 1; i < platformSettings.Count; ++i)
            {
                var settings = platformSettings[i];
                if (settings.maxTextureSize != allSize)
                {
                    mixedSize = true;
                }
                if (settings.format != allFormat)
                {
                    mixedFormat = true;
                }
                if (settings.textureCompression != allCompression)
                {
                    mixedCompression = true;
                }
                if (settings.crunchedCompression != allUseCrunchedCompression)
                {
                    mixedUseCrunchedCompression = true;
                }
                if (settings.compressionQuality != allCompressionQuality)
                {
                    mixedCompressionQuality = true;
                }
            }

            allSize = view.DrawMaxSize(allSize, mixedSize, false, out sizeChanged);

            int[]    formatValues  = null;
            string[] formatStrings = null;
            formatHelper.AcquireDefaultTextureFormatValuesAndStrings(out formatValues, out formatStrings);

            allFormat = view.DrawFormat(allFormat, formatValues, formatStrings, mixedFormat, false, out formatChanged);

            if (allFormat == TextureImporterFormat.Automatic && (!mixedFormat || formatChanged))
            {
                allCompression = view.DrawCompression(allCompression, mixedCompression, false, out compressionChanged);

                if (allCompression != TextureImporterCompression.Uncompressed && (!mixedCompression || compressionChanged))
                {
                    allUseCrunchedCompression = view.DrawUseCrunchedCompression(allUseCrunchedCompression,
                                                                                mixedUseCrunchedCompression, false, out useCrunchedCompressionChanged);

                    if (allUseCrunchedCompression && (!mixedUseCrunchedCompression || useCrunchedCompressionChanged))
                    {
                        allCompressionQuality = view.DrawCompressionQualitySlider(allCompressionQuality,
                                                                                  mixedCompressionQuality, false, out compressionQualityChanged);
                    }
                }
            }

            if (sizeChanged || compressionChanged || formatChanged || useCrunchedCompressionChanged || compressionQualityChanged)
            {
                for (var i = 0; i < platformSettings.Count; ++i)
                {
                    if (sizeChanged)
                    {
                        platformSettings[i].maxTextureSize = allSize;
                    }
                    if (formatChanged)
                    {
                        platformSettings[i].format = allFormat;
                    }
                    if (compressionChanged)
                    {
                        platformSettings[i].textureCompression = allCompression;
                    }
                    if (useCrunchedCompressionChanged)
                    {
                        platformSettings[i].crunchedCompression = allUseCrunchedCompression;
                    }
                    if (compressionQualityChanged)
                    {
                        platformSettings[i].compressionQuality = allCompressionQuality;
                    }
                }
                return(true);
            }
            else
            {
                return(false);
            }
        }
Ejemplo n.º 3
0
        public bool HandleDefaultSettings(List <TextureImporterPlatformSettings> platformSettings, ITexturePlatformSettingsView view)
        {
            Assert.IsTrue(platformSettings.Count > 0, "At least 1 platform setting is needed to display the texture platform setting UI.");

            var allSize                   = platformSettings[0].maxTextureSize;
            var allCompression            = platformSettings[0].textureCompression;
            var allUseCrunchedCompression = platformSettings[0].crunchedCompression;
            var allCompressionQuality     = platformSettings[0].compressionQuality;

            var newSize                   = allSize;
            var newCompression            = allCompression;
            var newUseCrunchedCompression = allUseCrunchedCompression;
            var newCompressionQuality     = allCompressionQuality;

            var mixedSize                   = false;
            var mixedCompression            = false;
            var mixedUseCrunchedCompression = false;
            var mixedCompressionQuality     = false;

            var sizeChanged                   = false;
            var compressionChanged            = false;
            var useCrunchedCompressionChanged = false;
            var compressionQualityChanged     = false;

            for (var i = 1; i < platformSettings.Count; ++i)
            {
                var settings = platformSettings[i];
                if (settings.maxTextureSize != allSize)
                {
                    mixedSize = true;
                }
                if (settings.textureCompression != allCompression)
                {
                    mixedCompression = true;
                }
                if (settings.crunchedCompression != allUseCrunchedCompression)
                {
                    mixedUseCrunchedCompression = true;
                }
                if (settings.compressionQuality != allCompressionQuality)
                {
                    mixedCompressionQuality = true;
                }
            }

            newSize        = view.DrawMaxSize(allSize, mixedSize, out sizeChanged);
            newCompression = view.DrawCompression(allCompression, mixedCompression, out compressionChanged);
            if (!mixedCompression && allCompression != TextureImporterCompression.Uncompressed)
            {
                newUseCrunchedCompression = view.DrawUseCrunchedCompression(allUseCrunchedCompression, mixedUseCrunchedCompression, out useCrunchedCompressionChanged);

                if (!mixedUseCrunchedCompression && allUseCrunchedCompression)
                {
                    newCompressionQuality = view.DrawCompressionQualitySlider(allCompressionQuality, mixedCompressionQuality, out compressionQualityChanged);
                }
            }

            if (sizeChanged || compressionChanged || useCrunchedCompressionChanged || compressionQualityChanged)
            {
                for (var i = 0; i < platformSettings.Count; ++i)
                {
                    if (sizeChanged)
                    {
                        platformSettings[i].maxTextureSize = newSize;
                    }
                    if (compressionChanged)
                    {
                        platformSettings[i].textureCompression = newCompression;
                    }
                    if (useCrunchedCompressionChanged)
                    {
                        platformSettings[i].crunchedCompression = newUseCrunchedCompression;
                    }
                    if (compressionQualityChanged)
                    {
                        platformSettings[i].compressionQuality = newCompressionQuality;
                    }
                }
                return(true);
            }
            else
            {
                return(false);
            }
        }