添加测试用例
@ -874,9 +874,21 @@ function s2t(t) { return stringIDToTypeID(t) }
|
||||
}
|
||||
this.baseFolder.remove();
|
||||
}
|
||||
|
||||
this.baseFolder.create();
|
||||
|
||||
// 导出整个psd作为png参考图
|
||||
saveFile = new File(this.baseFolder.fsName + "/" + "__background__.png");
|
||||
options = new ExportOptionsSaveForWeb();
|
||||
options.format = SaveDocumentType.PNG;
|
||||
options.PNG8 = false;
|
||||
options.optimized = true;
|
||||
options.interlaced = false;
|
||||
document.exportDocument(saveFile, ExportType.SAVEFORWEB, options);
|
||||
|
||||
targets = this.allLayers(document);
|
||||
//snapShotId = Util.takeSnapshot(document);
|
||||
|
||||
results = [];
|
||||
for (k = 0, len = targets.length; k < len; k++) {
|
||||
target = targets[k];
|
||||
|
1
.psd2uguiExamples/Sample/Sample.layout.txt
Normal file
@ -0,0 +1 @@
|
||||
{"info":{"version":"0.6.1","canvas":{"image":{"w":930,"h":2048},"size":{"w":930,"h":2048},"base":{"x":465,"y":1024}}},"root":{"type":"Root","name":"Sample","elements":[{"type":"Group","elements":[{"type":"Text","text":"神仙","font":"AdobeHeitiStd-Regular","size":35,"color":"E7E3B1","align":"center","x":605,"y":1406,"w":66,"h":33,"opacity":100,"imageName":"shenxian","name":"shenxian"},{"type":"Text","text":"修仙","font":"AdobeHeitiStd-Regular","size":48,"color":"FFFFFF","align":"center","x":151,"y":859,"w":90,"h":44,"opacity":100,"imageName":"xiuxian","name":"xiuxian"},{"type":"Button","elements":[{"type":"Image","image":"shitou1","x":94,"y":1351,"w":112,"h":121,"opacity":100,"imageName":"shitou1","name":"shitou1"},{"type":"Image","image":"shitou3","x":342,"y":1408,"w":79,"h":80,"opacity":100,"imageName":"shitou3","name":"shitou3"},{"type":"Image","image":"shitou2","x":209,"y":1393,"w":108,"h":100,"opacity":100,"imageName":"shitou2","name":"shitou2"},{"type":"Image","image":"Background_1","x":20,"y":360,"w":878,"h":353,"opacity":100,"imageName":"Background_1","name":"Background_1"}],"pivot":"top","imageName":"buttonWZZT","name":"buttonWZZT"},{"type":"Button","elements":[{"type":"Image","image":"bgJingjie","x":76,"y":834,"w":339,"h":92,"opacity":100,"imageName":"bgJingjie","name":"bgJingjie"},{"type":"Image","image":"person","x":546,"y":1299,"w":181,"h":136,"opacity":100,"imageName":"person","name":"person"},{"type":"Image","image":"person","x":437,"y":761,"w":429,"h":330,"opacity":100,"imageName":"person","name":"person"},{"type":"Image","image":"Background_2","x":20,"y":1139,"w":871,"h":354,"opacity":100,"imageName":"Background_2","name":"Background_2"},{"type":"Image","image":"Background_2","x":28,"y":749,"w":871,"h":354,"opacity":100,"imageName":"Background_2","name":"Background_2"}],"pivot":"top","imageName":"buttonXiuLian","name":"buttonXiuLian"},{"type":"Image","image":"title","x":287,"y":140,"w":363,"h":114,"opacity":100,"pivot":"top","imageName":"title","name":"title"},{"type":"Image","image":"bj_mo_2","x":0,"y":0,"w":930,"h":2048,"opacity":100,"imageName":"bj_mo_2","name":"bj_mo_2"}],"full":"True","stretchxy":"True","imageName":"panel","name":"panel"}]}}
|
BIN
.psd2uguiExamples/Sample/Sample/Background_1.png
Normal file
After Width: | Height: | Size: 358 KiB |
BIN
.psd2uguiExamples/Sample/Sample/Background_2.png
Normal file
After Width: | Height: | Size: 438 KiB |
BIN
.psd2uguiExamples/Sample/Sample/__background__.png
Normal file
After Width: | Height: | Size: 1.7 MiB |
BIN
.psd2uguiExamples/Sample/Sample/bgJingjie.png
Normal file
After Width: | Height: | Size: 47 KiB |
BIN
.psd2uguiExamples/Sample/Sample/bj_mo_2.png
Normal file
After Width: | Height: | Size: 1.0 MiB |
BIN
.psd2uguiExamples/Sample/Sample/person.png
Normal file
After Width: | Height: | Size: 46 KiB |
BIN
.psd2uguiExamples/Sample/Sample/shitou1.png
Normal file
After Width: | Height: | Size: 19 KiB |
BIN
.psd2uguiExamples/Sample/Sample/shitou2.png
Normal file
After Width: | Height: | Size: 17 KiB |
BIN
.psd2uguiExamples/Sample/Sample/shitou3.png
Normal file
After Width: | Height: | Size: 11 KiB |
BIN
.psd2uguiExamples/Sample/Sample/title.png
Normal file
After Width: | Height: | Size: 12 KiB |
BIN
.psd2uguiExamples/ui_image/Background.png
Normal file
After Width: | Height: | Size: 358 KiB |
BIN
.psd2uguiExamples/ui_image/__background__.png
Normal file
After Width: | Height: | Size: 1.7 MiB |
BIN
.psd2uguiExamples/ui_image/bgJingjie.png
Normal file
After Width: | Height: | Size: 47 KiB |
BIN
.psd2uguiExamples/ui_image/bj_mo_2.png
Normal file
After Width: | Height: | Size: 1.0 MiB |
BIN
.psd2uguiExamples/ui_image/person.png
Normal file
After Width: | Height: | Size: 229 KiB |
BIN
.psd2uguiExamples/ui_image/shitou2.png
Normal file
After Width: | Height: | Size: 17 KiB |
BIN
.psd2uguiExamples/ui_image/title.png
Normal file
After Width: | Height: | Size: 12 KiB |
@ -10,16 +10,17 @@ namespace UguiToolkit.Editor
|
||||
{
|
||||
public static class CommandHelper
|
||||
{
|
||||
public static void CalcRotScale(string srcImgDirPath, string targetImgDirPath, Action<RotScaleJsonData> callback)
|
||||
public static void CalcRotScale(string srcImgDirPath, string targetImgDirPath, float distanceDifference, Action<RotScaleJsonData> callback)
|
||||
{
|
||||
var rotScaleInfoFilePath = Path.GetFullPath(EditorConst.RotScaleInfoFilePath);
|
||||
var rotScaleInfoToolFilePath = Path.GetFullPath(EditorConst.RotScaleInfoToolFilePath);
|
||||
if (File.Exists(rotScaleInfoFilePath)) File.Delete(rotScaleInfoFilePath);
|
||||
|
||||
_ = RunCmdAsync(string.Format("{0} -src {1} -target {2} -distance_difference 0.06 -output_path {3}",
|
||||
_ = RunCmdAsync(string.Format("{0} -src {1} -target {2} -distance_difference {3} -output_path {4}",
|
||||
rotScaleInfoToolFilePath,
|
||||
Path.GetFullPath(srcImgDirPath),
|
||||
Path.GetFullPath(targetImgDirPath),
|
||||
distanceDifference,
|
||||
Path.GetFullPath(rotScaleInfoFilePath)), (output, error) =>
|
||||
{
|
||||
Debug.Log(output);
|
||||
|
@ -130,7 +130,8 @@ namespace UguiToolkit.Editor
|
||||
|
||||
private void UpdatePanelCache(string srcImgDirPath, string targetImgDirPath)
|
||||
{
|
||||
CacheScriptObject.CalcRotScaleInfos(srcImgDirPath, targetImgDirPath, (rotScaleInfoMap) =>
|
||||
float distanceDifference = GlobalManager.Instance.setting.distanceDifference;
|
||||
CacheScriptObject.CalcRotScaleInfos(srcImgDirPath, targetImgDirPath, distanceDifference,(rotScaleInfoMap) =>
|
||||
{
|
||||
if (!m_stageManager) return;
|
||||
// 拷贝数据
|
||||
|
@ -46,10 +46,10 @@ namespace UguiToolkit.Editor
|
||||
}
|
||||
}
|
||||
|
||||
public static void CalcRotScaleInfos(string srcImgDirPath, string targetImgDirPath, Action<Dictionary<string, List<RotScaleInfoItem>>> callback)
|
||||
public static void CalcRotScaleInfos(string srcImgDirPath, string targetImgDirPath, float distanceDifference, Action<Dictionary<string, List<RotScaleInfoItem>>> callback)
|
||||
{
|
||||
// 执行cmd
|
||||
CommandHelper.CalcRotScale(srcImgDirPath, targetImgDirPath, (jsonData) =>
|
||||
CommandHelper.CalcRotScale(srcImgDirPath, targetImgDirPath, distanceDifference,(jsonData) =>
|
||||
{
|
||||
if (jsonData == null || jsonData.data == null) return;
|
||||
Dictionary<string, List<RotScaleInfoItem>> rotScaleInfos = new();
|
||||
|
@ -8,6 +8,8 @@ namespace UguiToolkit.Editor
|
||||
{
|
||||
[LabelText("ui预制体存放的路径"), FolderPath]
|
||||
public string prefabForUIDirPath;
|
||||
|
||||
public float distanceDifference = 0.2f;
|
||||
}
|
||||
}
|
||||
#endif
|
@ -35,7 +35,8 @@ namespace UguiToolkit.Editor.Windows
|
||||
if (m_panelCache == null)
|
||||
{
|
||||
var targetImgDirPath = PanelCache.GetTargetImgDirPath(m_layoutInfoFilePath);
|
||||
CacheScriptObject.CalcRotScaleInfos(m_srcImgDirPath, targetImgDirPath, (rotScaleInfos) =>
|
||||
float distanceDifference = GlobalManager.Instance.setting.distanceDifference;
|
||||
CacheScriptObject.CalcRotScaleInfos(m_srcImgDirPath, targetImgDirPath, distanceDifference, (rotScaleInfos) =>
|
||||
{
|
||||
if (!stageManager) return;
|
||||
|
||||
|