适配 3.8.6

This commit is contained in:
Nice 2025-07-29 14:04:44 +08:00
parent 0d90c0b6dd
commit 64603ad87e
5 changed files with 69 additions and 57 deletions

View File

@ -2011,12 +2011,20 @@
this._isItalic = false;
this._isBold = false;
this._isUnderline = false;
this._enableOutline = false;
this._outlineColor = new CCColor(255, 255, 255, 255);
this._outlineWidth = 0;
}
updateWithLayer(psdLayer) {
this._fontSize = psdLayer.fontSize;
// this._actualFontSize = this._fontSize;
this._string = this._N$string = psdLayer.text;
this._lineHeight = this._fontSize + config.textLineHeightOffset;
if (psdLayer.outline) {
this._enableOutline = true;
this._outlineColor.set(psdLayer.outline.color);
this._outlineWidth = psdLayer.outline.width;
}
if (config.editorVersion >= EditorVersion.v342) {
this._srcBlendFactor = 2;
this._dstBlendFactor = 4;
@ -2113,31 +2121,19 @@
__decorate([
ccversion(EditorVersion.v342)
], CCLabel.prototype, "_isUnderline", void 0);
__decorate([
ccversion(EditorVersion.v342)
], CCLabel.prototype, "_enableOutline", void 0);
__decorate([
ccversion(EditorVersion.v342)
], CCLabel.prototype, "_outlineColor", void 0);
__decorate([
ccversion(EditorVersion.v342)
], CCLabel.prototype, "_outlineWidth", void 0);
CCLabel = __decorate([
cctype("cc.Label")
], CCLabel);
let CCLabelOutline = class CCLabelOutline extends CCComponent {
constructor() {
super(...arguments);
this._color = new CCColor(255, 255, 255, 255);
this._width = 1;
}
updateWithLayer(psdLayer) {
this._width = psdLayer.outline.width;
this._color.set(psdLayer.outline.color);
}
};
__decorate([
ccversion(EditorVersion.all)
], CCLabelOutline.prototype, "_color", void 0);
__decorate([
ccversion(EditorVersion.all)
], CCLabelOutline.prototype, "_width", void 0);
CCLabelOutline = __decorate([
cctype("cc.LabelOutline")
], CCLabelOutline);
class ExportImageMgr {
constructor() {
this.textObjects = [];
@ -2602,13 +2598,13 @@
});
label.updateWithLayer(layer);
this.applyConfig(label);
// 有描边
if (layer.outline) {
let labelOutline = new CCLabelOutline();
node.addComponent(labelOutline);
labelOutline.updateWithLayer(layer);
this.applyConfig(labelOutline);
}
// // 有描边
// if (layer.outline) {
// let labelOutline = new CCLabelOutline();
// node.addComponent(labelOutline);
// labelOutline.updateWithLayer(layer);
// this.applyConfig(labelOutline);
// }
}
// Button / Toggle / ProgressBar
if (layer.attr) {

View File

@ -10,7 +10,7 @@
"license": "ISC",
"dependencies": {
"ag-psd": "^15.0.0",
"canvas": "^2.10.2",
"canvas": "^2.11.2",
"fs-extra": "^10.1.0",
"minimist": "^1.2.7",
"pinyin-pro": "^3.16.0"
@ -495,10 +495,11 @@
}
},
"node_modules/canvas": {
"version": "2.10.2",
"resolved": "https://registry.npmmirror.com/canvas/-/canvas-2.10.2.tgz",
"integrity": "sha512-FSmlsip0nZ0U4Zcfht0qBJqDhlfGuevTZKE8h+dBOYrJjGvY3iqMGSzzbvkaFhvMXiVxfcMaPHS/kge++T5SKg==",
"version": "2.11.2",
"resolved": "https://registry.npmjs.org/canvas/-/canvas-2.11.2.tgz",
"integrity": "sha512-ItanGBMrmRV7Py2Z+Xhs7cT+FNt5K0vPL4p9EZ/UX/Mu7hFbkxSjKF2KVtPwX7UYWp7dRKnrTvReflgrItJbdw==",
"hasInstallScript": true,
"license": "MIT",
"dependencies": {
"@mapbox/node-pre-gyp": "^1.0.0",
"nan": "^2.17.0",
@ -2040,9 +2041,9 @@
"dev": true
},
"canvas": {
"version": "2.10.2",
"resolved": "https://registry.npmmirror.com/canvas/-/canvas-2.10.2.tgz",
"integrity": "sha512-FSmlsip0nZ0U4Zcfht0qBJqDhlfGuevTZKE8h+dBOYrJjGvY3iqMGSzzbvkaFhvMXiVxfcMaPHS/kge++T5SKg==",
"version": "2.11.2",
"resolved": "https://registry.npmjs.org/canvas/-/canvas-2.11.2.tgz",
"integrity": "sha512-ItanGBMrmRV7Py2Z+Xhs7cT+FNt5K0vPL4p9EZ/UX/Mu7hFbkxSjKF2KVtPwX7UYWp7dRKnrTvReflgrItJbdw==",
"requires": {
"@mapbox/node-pre-gyp": "^1.0.0",
"nan": "^2.17.0",

View File

@ -7,7 +7,7 @@
"build": "tsc -b",
"watch": "tsc -w",
"rollup": "rollup -c",
"test": "ts-node src/index.ts --engine-version v342 --force-img --input ./test/blank.psd --project-assets ./out/ --cache ./cache/cache.json --output ./out/",
"test": "ts-node src/index.ts --engine-version v342 --force-img --input ./test/demo.psd --project-assets ./out/ --cache ./cache/cache.json --output ./out/",
"help": "node dist/index.js --h",
"test-init": "node dist/index.js --init --project-assets ./out/ --cache E:\\Git\\ccc-framework-3d\\tools\\psd2ui\\cache\\cache.json",
"test-png9": "ts-node src/index.ts --engine-version v342 --pinyin --input ./test/png9.psd --output ./out/",
@ -19,7 +19,7 @@
"license": "ISC",
"dependencies": {
"ag-psd": "^15.0.0",
"canvas": "^2.10.2",
"canvas": "^2.11.2",
"fs-extra": "^10.1.0",
"minimist": "^1.2.7",
"pinyin-pro": "^3.16.0"

View File

@ -370,13 +370,13 @@ export class Main {
});
label.updateWithLayer(layer);
this.applyConfig(label);
// 有描边
if (layer.outline) {
let labelOutline = new CCLabelOutline();
node.addComponent(labelOutline);
labelOutline.updateWithLayer(layer);
this.applyConfig(labelOutline);
}
// // 有描边
// if (layer.outline) {
// let labelOutline = new CCLabelOutline();
// node.addComponent(labelOutline);
// labelOutline.updateWithLayer(layer);
// this.applyConfig(labelOutline);
// }
}
// Button / Toggle / ProgressBar

View File

@ -8,7 +8,7 @@ import { CCUUIDObject } from "./CCObject";
import { CCColor } from "./values/CCColor";
@cctype("cc.Label")
export class CCLabel extends CCComponent{
export class CCLabel extends CCComponent {
@ccversion(EditorVersion.all)
_srcBlendFactor: number = 770; // 3.4.x = 2
@ -69,7 +69,7 @@ export class CCLabel extends CCComponent{
// 3.4.x
@ccversion(EditorVersion.v342)
_color: CCColor = new CCColor(255,255,255,255);
_color: CCColor = new CCColor(255, 255, 255, 255);
// 3.4.x
@ccversion(EditorVersion.v342)
@ -97,6 +97,15 @@ export class CCLabel extends CCComponent{
@ccversion(EditorVersion.v342)
_isUnderline = false;
@ccversion(EditorVersion.v342)
_enableOutline = false;
@ccversion(EditorVersion.v342)
_outlineColor: CCColor = new CCColor(255, 255, 255, 255);
@ccversion(EditorVersion.v342)
_outlineWidth = 0;
updateWithLayer(psdLayer: PsdText) {
this._fontSize = psdLayer.fontSize;
// this._actualFontSize = this._fontSize;
@ -104,7 +113,13 @@ export class CCLabel extends CCComponent{
this._lineHeight = this._fontSize + config.textLineHeightOffset;
if(config.editorVersion >= EditorVersion.v342){
if (psdLayer.outline) {
this._enableOutline = true;
this._outlineColor.set(psdLayer.outline.color);
this._outlineWidth = psdLayer.outline.width;
}
if (config.editorVersion >= EditorVersion.v342) {
this._srcBlendFactor = 2;
this._dstBlendFactor = 4;
}