fix(POSTV1-TEMPLATE-PLACEMENT-18): 修复文字模板坐标与描边解析
Dada P0-A isolated Windows CI / validate-and-package (push) Waiting to run
Dada P0-A isolated Windows CI / validate-and-package (push) Waiting to run
This commit is contained in:
@@ -491,15 +491,14 @@ function prefabLayers(prefab, input) {
|
||||
if (textMesh) {
|
||||
const textRenderer = nodeComponents.find((item) => item.typeId === "TextRenderer")?.object;
|
||||
const style = textMesh.m_fontStyleInfo ?? {};
|
||||
const outline = style.outlineInfo?.outlineSize > 0 ? style.outlineInfo
|
||||
: style.shadowInfos?.find((item) => item?.outlineInfo?.outlineSize > 0)?.outlineInfo;
|
||||
const outline = style.outlineInfo?.outlineSize > 0 ? style.outlineInfo : undefined;
|
||||
const shadow = style.shadowInfos?.find((item) => Number(item?.offset?.x ?? 0) !== 0 || Number(item?.offset?.y ?? 0) !== 0);
|
||||
const fontUuid = textMesh.m_font?.uuid?.uuid;
|
||||
layers.push({
|
||||
align: Number(style.alignment ?? 0) === 2 ? "right" : Number(style.alignment ?? 0) === 1 ? "left" : "center",
|
||||
...(transform.alpha === 1 ? {} : { alpha: transform.alpha }),
|
||||
...(transform.anchorX === 0.5 ? {} : { anchor_x: transform.anchorX }),
|
||||
...(transform.anchorY === 0.5 ? {} : { anchor_y: transform.anchorY }),
|
||||
...(transform.anchorY === 0.5 ? {} : { anchor_y: 1 - transform.anchorY }),
|
||||
fill_color: colorHex(style.color),
|
||||
fill_pattern_asset_id: firstMaterialTextureAssetId(textRenderer, input),
|
||||
font_file: typeof fontUuid === "string" ? input.manifestMappings.get(fontUuid) : undefined,
|
||||
@@ -508,7 +507,7 @@ function prefabLayers(prefab, input) {
|
||||
letter_spacing: Number(style.characterSpacing ?? 1),
|
||||
line_height: Number(style.lineSpacing ?? 1),
|
||||
order: order++,
|
||||
rotation: transform.rotation,
|
||||
rotation: -transform.rotation,
|
||||
scale_x: Math.sign(scaleX) || 1,
|
||||
scale_y: Math.sign(scaleY) || 1,
|
||||
shadow_blur: Math.max(0, Number(shadow?.blur ?? shadow?.SDFFontBorder ?? 0)),
|
||||
@@ -521,7 +520,7 @@ function prefabLayers(prefab, input) {
|
||||
type: "text",
|
||||
width: Math.max(1, Number(object.m_contentSize?.width ?? 1) * Math.abs(scaleX)),
|
||||
x: transform.x,
|
||||
y: transform.y,
|
||||
y: -transform.y,
|
||||
});
|
||||
for (const underline of localUnderlines.filter((item) => item?.p1?.enable !== false && item?.p0 === object.m_Name)) {
|
||||
const config = underline.p1?.exportParams ?? {};
|
||||
@@ -540,13 +539,13 @@ function prefabLayers(prefab, input) {
|
||||
asset_id: assetId,
|
||||
height: targetHeight,
|
||||
order: order++,
|
||||
rotation: transform.rotation,
|
||||
rotation: -transform.rotation,
|
||||
scale_x: Math.sign(scaleX) || 1,
|
||||
scale_y: Math.sign(scaleY) || 1,
|
||||
type: "image",
|
||||
width: targetWidth,
|
||||
x: transform.x,
|
||||
y: transform.y + Number(object.m_contentSize?.height ?? 48) * Math.abs(scaleY) / 2
|
||||
y: -transform.y + Number(object.m_contentSize?.height ?? 48) * Math.abs(scaleY) / 2
|
||||
+ Number(config.relativeDistance ?? 0) + targetHeight / 2,
|
||||
});
|
||||
}
|
||||
@@ -559,7 +558,7 @@ function prefabLayers(prefab, input) {
|
||||
layers.push({
|
||||
alpha: transform.alpha * Math.max(0, Math.min(1, Number(particleComponent.m_AlphaIdensity ?? 1))),
|
||||
anchor_x: transform.anchorX,
|
||||
anchor_y: transform.anchorY,
|
||||
anchor_y: 1 - transform.anchorY,
|
||||
asset_id: assetId,
|
||||
atlas_columns: Math.max(1, Number(particleComponent.m_altasUcount ?? 1)),
|
||||
atlas_rows: Math.max(1, Number(particleComponent.m_altasVcount ?? 1)),
|
||||
@@ -571,13 +570,13 @@ function prefabLayers(prefab, input) {
|
||||
particle_width: Math.max(1, Number(particleComponent.m_particlesRenderSize?.x ?? 8)),
|
||||
randomize_angle: Number(particleComponent.m_particlesRandomizeAngle ?? 0),
|
||||
randomize_position: Number(particleComponent.m_particlesRandomizePosition ?? 0),
|
||||
rotation: transform.rotation,
|
||||
rotation: -transform.rotation,
|
||||
scale_x: Math.sign(scaleX) || 1,
|
||||
scale_y: Math.sign(scaleY) || 1,
|
||||
type: "particles",
|
||||
width: Math.max(1, Number(object.m_contentSize?.width ?? 1) * Math.abs(scaleX)),
|
||||
x: transform.x,
|
||||
y: transform.y,
|
||||
y: -transform.y,
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -606,17 +605,17 @@ function prefabLayers(prefab, input) {
|
||||
layers.push({
|
||||
...(transform.alpha === 1 ? {} : { alpha: transform.alpha }),
|
||||
...(transform.anchorX === 0.5 ? {} : { anchor_x: transform.anchorX }),
|
||||
...(transform.anchorY === 0.5 ? {} : { anchor_y: transform.anchorY }),
|
||||
...(transform.anchorY === 0.5 ? {} : { anchor_y: 1 - transform.anchorY }),
|
||||
asset_id: assetId,
|
||||
height: Math.max(1, Number(object.m_contentSize?.height ?? 1) * Math.abs(scaleY)),
|
||||
order: order++,
|
||||
rotation: transform.rotation,
|
||||
rotation: -transform.rotation,
|
||||
scale_x: Math.sign(scaleX) || 1,
|
||||
scale_y: Math.sign(scaleY) || 1,
|
||||
type: "image",
|
||||
width: Math.max(1, Number(object.m_contentSize?.width ?? 1) * Math.abs(scaleX)),
|
||||
x: transform.x,
|
||||
y: transform.y,
|
||||
y: -transform.y,
|
||||
...(ninePatch ? { nine_patch: ninePatch } : {}),
|
||||
});
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user