コード例 #1
0
        public void DisplayPlatformSetting(TexturePlatformNorm tpn)
        {
            EditorGUILayout.BeginHorizontal();
            EditorGUILayout.LabelField(Platform, tpn.setting.name);
            //format
            string format = tpn.setting.format.ToString();

            ResUtils.ColorLabelFieldTooltip(Title_Format, format, string.Format(Formnat_Format, tpn.normRecommend), tpn.formatLevel);
            ResUtils.ColorLabelFieldTooltip(Title_MaxSize, tpn.setting.maxTextureSize.ToString(), string.Format(Formnat_MaxSize, tpn.setting.maxTextureSize), tpn.maxSizeLevel);
            EditorGUILayout.EndHorizontal();
        }
コード例 #2
0
        public TexturePlatformNorm GetPlatformNorm(TextureImporterPlatformSettings setting, TextureFormatKey[] normRecommend, TextureFormatKey[] normForbid)
        {
            TexturePlatformNorm tpn = new TexturePlatformNorm()
            {
                setting       = setting,
                normRecommend = normRecommend,
            };
            string format = setting.format.ToString();

            if (isInclude(normRecommend, format))
            {
                tpn.formatLevel = 0;
            }
            else if (isInclude(normForbid, format))
            {
                tpn.formatLevel = 2;
                errorNum++;
            }
            else
            {
                tpn.formatLevel = 1;
                warnNum++;
            }

            //maxSize
            int maxSize = setting.maxTextureSize;

            if (maxSize <= textureSize)
            {
                if (maxSize >= ResourceAuditingSetting.GetIntance().Tex_Recommend_Size&& maxSize < ResourceAuditingSetting.GetIntance().Tex_Max_Size)
                {
                    tpn.maxSizeLevel = 1;
                    warnNum++;
                }
                else if (maxSize >= ResourceAuditingSetting.GetIntance().Tex_Max_Size)
                {
                    tpn.maxSizeLevel = 2;
                    errorNum++;
                }
            }
            return(tpn);
        }
コード例 #3
0
        public override void SetResObj(Object obj)
        {
            resObj          = obj;
            texture         = obj as Texture2D;
            textureImporter = AssetImporter.GetAtPath(path) as TextureImporter;

            //format
            standalone_setting = GetPlatformNorm(textureImporter.GetPlatformTextureSettings(EditPlatform.Standalone), new TextureFormatKey[] { }, new TextureFormatKey[] { });
            ios_setting        = GetPlatformNorm(textureImporter.GetPlatformTextureSettings(EditPlatform.iPhone), ResourceAuditingSetting.GetIntance().Tex_Format_Recommend_IOS, ResourceAuditingSetting.GetIntance().Tex_Format_Forbid_IOS);
            android_setting    = GetPlatformNorm(textureImporter.GetPlatformTextureSettings(EditPlatform.Android), ResourceAuditingSetting.GetIntance().Tex_Format_Recommend_Android, ResourceAuditingSetting.GetIntance().Tex_Format_Forbid_Android);
            //maxSize
            textureSize      = Mathf.Max(texture.width, texture.height);
            textureSizeLevel = 0;
            if (textureSize >= ResourceAuditingSetting.GetIntance().Tex_Recommend_Size&& textureSize < ResourceAuditingSetting.GetIntance().Tex_Max_Size)
            {
                textureSizeLevel = 1;
                warnNum++;
            }
            else if (textureSize >= ResourceAuditingSetting.GetIntance().Tex_Max_Size)
            {
                textureSizeLevel = 2;
                errorNum++;
            }
            string[] fs = ResourceAuditingSetting.GetIntance().Forbid_Texture_FileTypes;
            fileType = Path.GetFileName(path);
            // file type
            for (int i = 0; i < fs.Length; i++)
            {
                if (path.EndsWith(fs[i]))
                {
                    fileLevel = 2;
                    errorNum++;
                    break;
                }
            }
        }