Example #1
0
        private void GetImagesRecursively(DirectoryInfo dirPath, string prefix)
        {
            var files = SystemTool.GetDirectoryFiles(dirPath);

            foreach (var file in files)
            {
                if (!file.Name.EndsWith(".png"))
                {
                    Logger.LogInfoLine("{0}Only accept png image:{1}", prefix, file);
                    continue;
                }
                var imageFile = new ImageFile(file, true, true);
                //Logger.LogInfoLine("{0}File:\t{1}", prefix, file.FullName.Replace(PathManager.InputImagesPath.FullName, string.Empty));
                bool isPacked = !file.Directory.FullName.Contains(PathManager.InputImageOtherPath.FullName);

                bool isPVREnabled = false;
                if (PublishTarget.Current.IsPVR)
                {
                    isPVREnabled = mPVREnabledDirectoryNames.Any(pvrEnabledDirectoryName => file.Directory.FullName.Contains(pvrEnabledDirectoryName));
                }
                //bool isEffectAnimation = file.Directory.FullName.Contains("EffectAnimation");
                //isPacked &= !isEffectAnimation;
                //bool isOptimzed = !isEffectAnimation;
                if (!PublishTarget.Current.IsPack)
                {
                    isPacked = false;
                }

                bool isOptimzed = PublishTarget.Current.IsOptimzed;
                bool isPOT      = PublishTarget.Current.IsPOT;
                bool isSquare   = PublishTarget.Current.IsSquare;
                if (isPVREnabled)
                {
                    isPOT    = true;
                    isSquare = true;
                }

                ImagePacker.AddImage(imageFile, PublishTarget.Current, isPacked, isOptimzed, isPVREnabled, isPOT, isSquare);
                FilterImage(file);
            }
        }