public bool IsPublish(PublishTarget target) { var info = target.PublishInfo; if ((info.Version & Version) != 0) { return(true); } if ((info.Device & Device) != 0) { return(true); } if ((info.Language & Language) != 0) { return(true); } return(false); }
public static void AddImage(ImageFile imageFile, PublishTarget target,bool isPacked=true,bool isOptimzed=true,bool isPVREnabled=false,bool isPOT=false,bool isSquare=false) { if (!Images.ContainsKey(imageFile) && !ImageFilePathDict.ContainsKey(imageFile.FileInfo.FullName) && !ImageFileNameDict.ContainsKey(imageFile.FileInfo.Name)) { Images.Add(imageFile, false); ImageFilePathDict.Add(imageFile.FileInfo.FullName,imageFile); ImageFileNameDict.Add(imageFile.FileInfo.Name, imageFile); imageFile.IsPacked = isPacked; imageFile.IsOptimzed = isOptimzed; imageFile.IsPVREnabled = isPVREnabled; imageFile.IsPOT = isPOT; imageFile.IsSquare = isSquare; } else { Logger.LogErrorLine("\tDuplicate File name: {0}\tVS\t{1}", imageFile, Images[imageFile]); } if (imageFile.PublishGroup != null && !imageFile.PublishGroup.PublishInfo.IsPublish(target)) { //Logger.LogInfoLine("DON'T pack {0}", imageFile.FileInfo.Name); return; } if (!isPacked) { //Logger.LogInfoLine("DON'T pack {0}", imageFile.FileInfo.Name); return; } MySortedList<ImageFile> groupFiles; if (!ImageGroups.TryGetValue(imageFile.PublishGroup, out groupFiles)) { groupFiles = new MySortedList<ImageFile>(); ImageGroups.Add(imageFile.PublishGroup, groupFiles); } groupFiles.Add(imageFile); }
public bool IsPublish(PublishTarget target) { var info = target.PublishInfo; if ((info.Version & Version) != 0) { return true; } if ((info.Device & Device) != 0) { return true; } if ((info.Language & Language) != 0) { return true; } return false; }
public static void Pack(PublishTarget target) { if (target.IsOptimzed) { Optimze(); } Logger.LogInfoLine("Packing:"); var merger = new ImageMerger(); foreach (var imageGroup in ImageGroups) { if (imageGroup.Value.Count>1||PublishTarget.Current.IsPVR) { var resultImages = merger.Generate(imageGroup.Key, imageGroup.Value); foreach (var resultImage in resultImages) { resultImage.Key.Save(); resultImage.Key.TryConvertSelfToPVR(); uint id=FileSystemGenerator.AddFileAndTag(resultImage.Key); if (id!=uint.MaxValue) { foreach (var subImage in resultImage.Value.UsedImages) { FileSystemGenerator.AddImageTagItem(subImage,id); } } } } else { if (imageGroup.Value.Count>0) { imageGroup.Value[0].IsPacked = false; } //FileSystemGenerator.AddFileAndTag(imageGroup.Value[0]); } OnPackingProgressEvent(1); } foreach (var image in Images) { if (!image.Key.IsPacked) { FileSystemGenerator.CopyFileToOutput(image.Key); } else { if (!PublishTarget.Current.IsPack) { Logger.LogErrorLine("Lose file:{0}",image.Key.FileInfo.FullName); } } } }