2024-10-08 15:19:05 +00:00
|
|
|
using System;
|
|
|
|
using System.Collections;
|
|
|
|
using System.Collections.Generic;
|
|
|
|
using Unity.Mathematics;
|
|
|
|
using UnityEngine;
|
|
|
|
using Sirenix.OdinInspector;
|
|
|
|
|
|
|
|
namespace UguiToolkit.Editor
|
|
|
|
{
|
|
|
|
public class CacheScriptObject : SerializedScriptableObject
|
|
|
|
{
|
|
|
|
public Dictionary<GameObject, PanelCache> panelCaches = new();
|
|
|
|
}
|
|
|
|
|
|
|
|
[Serializable]
|
|
|
|
public class PanelCache
|
|
|
|
{
|
|
|
|
[LabelText("源图片文件夹路径"), FolderPath]
|
|
|
|
public string srcImgDirPath;
|
|
|
|
[LabelText("目标图片信息文件(psd导出)"), FolderPath]
|
|
|
|
public string layoutInfoFilePath; // Sample.layout.txt
|
|
|
|
|
|
|
|
[LabelText("目标图片文件夹路径")]
|
|
|
|
public string TargetImgDirPath
|
|
|
|
{
|
|
|
|
get
|
|
|
|
{
|
|
|
|
if (string.IsNullOrWhiteSpace(layoutInfoFilePath)) return "";
|
|
|
|
var dirName = System.IO.Path.GetDirectoryName(layoutInfoFilePath);
|
|
|
|
var fileName = System.IO.Path.GetFileName(layoutInfoFilePath);
|
|
|
|
var split = fileName.Split(".");
|
|
|
|
if (split.Length == 0) return "";
|
|
|
|
|
|
|
|
return System.IO.Path.Join(dirName, split[0]);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2024-10-08 16:32:08 +00:00
|
|
|
// 通过读取layout.txt 获得 position 图片路径(源图) -> Transform信息(效果图)
|
|
|
|
public Dictionary<string, List<TargetImageTransformInfo>> targetImageTransformInfos = new();
|
|
|
|
|
|
|
|
// 通过cmd计算获得 图片路径(源图) -> 旋转缩放信息(效果图)
|
|
|
|
public Dictionary<string, List<RotScaleInfoItem>> rotScaleInfos = new();
|
|
|
|
}
|
|
|
|
|
|
|
|
[Serializable]
|
|
|
|
public class LayoutInfo
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public class ElementInfo
|
|
|
|
{
|
|
|
|
public float x;
|
|
|
|
public float y;
|
|
|
|
public float w;
|
|
|
|
public float h;
|
|
|
|
|
|
|
|
|
|
|
|
public float3 position;
|
|
|
|
}
|
|
|
|
|
|
|
|
public class ImageInfo : ElementInfo
|
|
|
|
{
|
|
|
|
public string imgPath;
|
|
|
|
}
|
|
|
|
|
|
|
|
public class TextInfo : ElementInfo
|
|
|
|
{
|
|
|
|
public string text;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
[Serializable]
|
|
|
|
public struct TargetImageTransformInfo
|
|
|
|
{
|
|
|
|
public float3 position;
|
|
|
|
public RotScaleInfoItem rotScaleInfo;
|
|
|
|
|
|
|
|
public string ImgPath => rotScaleInfo.imgPath;
|
2024-10-08 15:19:05 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
[Serializable]
|
2024-10-08 16:32:08 +00:00
|
|
|
public struct RotScaleInfoItem
|
2024-10-08 15:19:05 +00:00
|
|
|
{
|
2024-10-08 16:32:08 +00:00
|
|
|
public string imgPath; //(效果图)
|
2024-10-08 15:19:05 +00:00
|
|
|
public float rotiation;
|
|
|
|
public float2 scale;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|