public TPistInfo(TpFileInfo pngFile, TpFileInfo plistFile) { this.pngFile = pngFile; this.plistFile = plistFile; this.pngFile.bePng = true; this.pngFile.beInPlist = true; this.plistFile.beInPlist = true; }
private string CreateTxtResource(string name, List <TpFileInfo> lst) { string content = "var res_" + name + "={\n"; for (int index = 0; index < lst.Count; index++) { TpFileInfo each = lst[index]; content += "\t" + GetResContent(each, index == (lst.Count - 1)) + "\n"; } content += "};\n\n"; return(content); }
/// <summary> /// 获取单个文件的TexturePacker命令行 /// </summary> /// <returns></returns> string GetEachPngFormatCMDStr(TpFileInfo file, ref TpCmd cmd) { cmd.lstTpFile.Add(file); string outputDic = PathAlign(GetOutputDirectory(file.parent.directoryInfo)) + "/"; string outFormat = outputDic + GetFormatName(file.info.Name, this.m_format); string outFormatPlist = GetSinglePlistDirectory() + "/" + GetFormatName(file.info.Name, TPFormat.PLIST); file.tagFileName = GetCocostudioRelatePath(file.parent.directoryInfo.FullName + "/" + GetFormatName(file.info.Name, this.m_format)); cmd.outFormat = outFormat; cmd.outPlist = outFormatPlist; string cmdStr = "TexturePacker " + file.info.FullName + TPConfig.singleCmdStr + " --data " + outFormatPlist + " --sheet " + outFormat; cmdStr = cmdStr + "\n"; cmd.cmd = cmdStr; m_tpInfos[GetCocostudioRelatePath(file.parent.directoryInfo.FullName) + "/" + file.info.Name] = file; return(cmdStr); }
bool BePlistInPlist(List <TpFileInfo> infoList, string pngFileName) { string name = pngFileName.Replace(".plist", ""); TpFileInfo result = infoList.Find( delegate(TpFileInfo content) { if (content.info.Name.EndsWith(".png")) { return(content.info.Name.Replace(".png", "") == name); //contentName = } else { return(false); } //return content == key; }); if (result == null) { return(false); } return(true); }
private string GetResContent(TpFileInfo tpInfo,bool beLast) { string result = ""; string last = ""; bool beConcostudio = tpInfo.parent.beCocosStudioProject; FileInfo info = tpInfo.info; string path = GetCocostudioRelatePath(info.FullName); string name = info.Name.Replace(".", "_"); string qianzhui = ""; if (info.Name.EndsWith(".png") || info.Name.EndsWith(".plist")) { qianzhui = "p_"; } else if (info.Name.EndsWith(".json") || info.Name.EndsWith(".ExportJson") || info.Name.EndsWith(".csb")) { qianzhui = "j_"; } else if (info.Name.EndsWith(".mp3") || info.Name.EndsWith(".ogg")) { qianzhui = "o_"; } else if (info.Name.EndsWith(".tmx")) { qianzhui = "m_"; } if (beConcostudio) { if (m_tpInfos.ContainsKey(path)) { TpFileInfo file = m_tpInfos[path]; string outputDic = this.m_rootDic.directoryInfo.Name + "/" + GetRelatePath(file.parent.directoryInfo.FullName) + "/"; string outFormat = outputDic + GetFormatName(file.info.Name, this.m_format); path = outFormat; } else { path = this.m_rootDic.directoryInfo.Name + "/" + GetRelatePath(PathAlign(info.FullName)); } } else { if ((tpInfo.parent.beTMXMapPath || tpInfo.parent.bePlistBuildList) && tpInfo.bePng) { string outputDic = this.m_rootDic.directoryInfo.Name + "/" + GetRelatePath(tpInfo.parent.directoryInfo.FullName) + "/"; string outFormat = outputDic + GetFormatName(tpInfo.info.Name, this.m_format); path = outFormat; } else { path = this.m_rootDic.directoryInfo.Name + "/" + GetRelatePath(PathAlign(info.FullName)); } } result = qianzhui + name + " : \"" + path + "\""; if (!beLast) { result += ","; } return result; }
/// <summary> /// 获取单个文件的TexturePacker命令行 /// </summary> /// <returns></returns> string GetEachPngFormatCMDStr(TpFileInfo file,ref TpCmd cmd) { cmd.lstTpFile.Add(file); string outputDic = PathAlign(GetOutputDirectory(file.parent.directoryInfo)) + "/"; string outFormat = outputDic + GetFormatName(file.info.Name, this.m_format); string outFormatPlist = GetSinglePlistDirectory() + "/" + GetFormatName(file.info.Name,TPFormat.PLIST); file.tagFileName = GetCocostudioRelatePath(file.parent.directoryInfo.FullName + "/" + GetFormatName(file.info.Name, this.m_format)); cmd.outFormat = outFormat; cmd.outPlist = outFormatPlist; string cmdStr = "TexturePacker " + file.info.FullName + TPConfig.singleCmdStr + " --data " + outFormatPlist + " --sheet " + outFormat; cmdStr = cmdStr + "\n"; cmd.cmd = cmdStr; m_tpInfos[GetCocostudioRelatePath(file.parent.directoryInfo.FullName) + "/"+file.info.Name] = file; return cmdStr; }
private string GetResContent(TpFileInfo tpInfo, bool beLast) { string result = ""; string last = ""; bool beConcostudio = tpInfo.parent.beCocosStudioProject; FileInfo info = tpInfo.info; string path = GetCocostudioRelatePath(info.FullName); string name = info.Name.Replace(".", "_"); string qianzhui = ""; if (info.Name.EndsWith(".png") || info.Name.EndsWith(".plist")) { qianzhui = "p_"; } else if (info.Name.EndsWith(".json") || info.Name.EndsWith(".ExportJson") || info.Name.EndsWith(".csb")) { qianzhui = "j_"; } else if (info.Name.EndsWith(".mp3") || info.Name.EndsWith(".ogg")) { qianzhui = "o_"; } else if (info.Name.EndsWith(".tmx")) { qianzhui = "m_"; } if (beConcostudio) { if (m_tpInfos.ContainsKey(path)) { TpFileInfo file = m_tpInfos[path]; string outputDic = this.m_rootDic.directoryInfo.Name + "/" + GetRelatePath(file.parent.directoryInfo.FullName) + "/"; string outFormat = outputDic + GetFormatName(file.info.Name, this.m_format); path = outFormat; } else { path = this.m_rootDic.directoryInfo.Name + "/" + GetRelatePath(PathAlign(info.FullName)); } } else { if ((tpInfo.parent.beTMXMapPath || tpInfo.parent.bePlistBuildList) && tpInfo.bePng) { string outputDic = this.m_rootDic.directoryInfo.Name + "/" + GetRelatePath(tpInfo.parent.directoryInfo.FullName) + "/"; string outFormat = outputDic + GetFormatName(tpInfo.info.Name, this.m_format); path = outFormat; } else { path = this.m_rootDic.directoryInfo.Name + "/" + GetRelatePath(PathAlign(info.FullName)); } } result = qianzhui + name + " : \"" + path + "\""; if (!beLast) { result += ","; } return(result); }
public TpDicInfo(DirectoryInfo directoryInfo, TpDicInfo parent) { this.directoryInfo = directoryInfo; this.parent = parent; if (parent == null) { this.beNotBuild = false; this.beSingleBuild = false; this.beCocosStudioProject = false; this.bePlistBuildList = false; this.beTMXMapPath = false; } else { this.beNotBuild = parent.beNotBuild; this.beSingleBuild = parent.beSingleBuild; this.beCocosStudioProject = parent.beCocosStudioProject; this.bePlistBuildList = parent.bePlistBuildList; this.beTMXMapPath = parent.beTMXMapPath; } if (!this.beNotBuild) { if (TPConfig.BeInNotBuildList(this.directoryInfo.Name)) { this.beNotBuild = true; } } if (!this.beSingleBuild) { if (TPConfig.BeInSingleBuildList(this.directoryInfo.Name)) { this.beSingleBuild = true; } } if (!this.beCocosStudioProject) { if (TPConfig.BeInCocoStudioList(this.directoryInfo.Name)) { this.beCocosStudioProject = true; } } if (!this.bePlistBuildList) { if (TPConfig.BeInPlistBuildList(this.directoryInfo.Name)) { this.bePlistBuildList = true; } } if (!this.beTMXMapPath) { if (TPConfig.BeTmxMap(this.directoryInfo.Name)) { this.beTMXMapPath = true; } } FileInfo [] fs = directoryInfo.GetFiles(); foreach (FileInfo info in fs) { files.Add(new TpFileInfo(info, this)); } for (int index = 0; index < files.Count; index++) { TpFileInfo info = files[index]; if (info.bePng) { if (BePngInPlist(files, info.info.Name)) { files[index].beInPlist = true; } } else { if (info.info.Name.EndsWith(".plist")) { if (BePlistInPlist(files, info.info.Name)) { files[index].beInPlist = true; } } } } DirectoryInfo[] dicInfos = directoryInfo.GetDirectories(); foreach (DirectoryInfo info in dicInfos) { directorys.Add(new TpDicInfo(info, this)); } }