From 9ac1f11be4f8ac62a98d819cb8e6a09ade90378c Mon Sep 17 00:00:00 2001 From: guanchao <18612113337@163.com> Date: Mon, 19 Oct 2026 17:27:11 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E6=AF=8F=E6=97=A5=E4=BB=BB=E5=8A=A1?= =?UTF-8?q?=E9=83=A8=E5=88=86=E5=86=85=E5=AE=B9=E6=9C=AA=E4=BD=BF=E7=94=A8?= =?UTF-8?q?=E5=9B=BE=E7=89=87=E8=B5=84=E6=BA=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- assets/action_bundle/img/dailyQuest/claim.png | Bin 0 -> 1599 bytes .../img/dailyQuest/claim.png.meta | 38 ++++++ .../img/dailyQuest/num/cheng.png | Bin 0 -> 1553 bytes .../img/dailyQuest/num/cheng.png.meta | 38 ++++++ .../action_bundle/img/dailyQuest/num/hour.png | Bin 0 -> 2565 bytes .../img/dailyQuest/num/hour.png.meta | 38 ++++++ .../img/dailyQuest/num/minute.png | Bin 0 -> 3146 bytes .../img/dailyQuest/num/minute.png.meta | 38 ++++++ .../action_bundle/prefab/dailyQuests.prefab | 128 +++++++++++++----- assets/action_bundle/script/DailyQuests.ts | 8 +- tools/test-daily-reward-animation.cjs | 22 +-- 11 files changed, 259 insertions(+), 51 deletions(-) create mode 100644 assets/action_bundle/img/dailyQuest/claim.png create mode 100644 assets/action_bundle/img/dailyQuest/claim.png.meta create mode 100644 assets/action_bundle/img/dailyQuest/num/cheng.png create mode 100644 assets/action_bundle/img/dailyQuest/num/cheng.png.meta create mode 100644 assets/action_bundle/img/dailyQuest/num/hour.png create mode 100644 assets/action_bundle/img/dailyQuest/num/hour.png.meta create mode 100644 assets/action_bundle/img/dailyQuest/num/minute.png create mode 100644 assets/action_bundle/img/dailyQuest/num/minute.png.meta diff --git a/assets/action_bundle/img/dailyQuest/claim.png b/assets/action_bundle/img/dailyQuest/claim.png new file mode 100644 index 0000000000000000000000000000000000000000..7d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^naLp=kKw_pl=eeo;J&4sHjE(uCSxEHIz z#UYgisro^w#rdU0$-u} zxZPrm(>$o&6x?nx!Kqgt=oo!a+#ZeW|!c!RAYxABL8fIQ=)y*xJ>jRd3_Kh`SPHTyDh3*F}GSkAmr zZdR&70cXeT#tPmk@ythNI_R`6`DPvRUt~pV!hwz_&D|Mo$;`qHHv~G~eq8aBX=@GV zCjMKU1~M#M9RY`#zn%=7;6GzQQ{f3MpJZ)Grdwf6nKcd$aqW(Gb*DKxUFVyvy465l zL%ChmV{&J_$PC?;tBx+n$T_=VrDE&D|ht*R5;ayYr11Z)I7ziOKu|JO+4HC&NN8#F=b8b?6brC_(qs>bw| zlES(MPPv(ZM?bv08q8LfXV-SS-K<&nD4WBpxcj@$EqM8W`PqHzVh(4{HEzNUVcnZt zROaYk_%u)A0;Bgb`308m4H7 Oq&;2zT-G@yGywoyfhc+a literal 0 HcmV?d00001 diff --git a/assets/action_bundle/img/dailyQuest/num/cheng.png.meta b/assets/action_bundle/img/dailyQuest/num/cheng.png.meta new file mode 100644 index 00000000..16861e0d --- /dev/null +++ b/assets/action_bundle/img/dailyQuest/num/cheng.png.meta @@ -0,0 +1,38 @@ +{ + "ver": "2.3.7", + "uuid": "11dea71a-c01d-41f5-9c79-e0e9c98bbf8a", + "importer": "texture", + "type": "sprite", + "wrapMode": "clamp", + "filterMode": "bilinear", + "premultiplyAlpha": false, + "genMipmaps": false, + "packable": true, + "width": 24, + "height": 24, + "platformSettings": {}, + "subMetas": { + "cheng": { + "ver": "1.0.6", + "uuid": "2cb7aad3-b171-49ff-965b-5b586285a081", + "importer": "sprite-frame", + "rawTextureUuid": "11dea71a-c01d-41f5-9c79-e0e9c98bbf8a", + "trimType": "auto", + "trimThreshold": 1, + "rotated": false, + "offsetX": 0, + "offsetY": 0, + "trimX": 0, + "trimY": 0, + "width": 24, + "height": 24, + "rawWidth": 24, + "rawHeight": 24, + "borderTop": 0, + "borderBottom": 0, + "borderLeft": 0, + "borderRight": 0, + "subMetas": {} + } + } +} \ No newline at end of file diff --git a/assets/action_bundle/img/dailyQuest/num/hour.png b/assets/action_bundle/img/dailyQuest/num/hour.png new file mode 100644 index 0000000000000000000000000000000000000000..cb40683e9868a984ad3a61bdff18ae3b18df748a GIT binary patch literal 2565 zcmaJ@c|25Y8y>}klEi15Vwxh`tj02j2{U6W6OFyqEXSD4X6DEYl|m&xA?i&EC3&?? zBx#XUN-0ZdCfc-;D2d)u`9^Pgzdydd^ZT9iJkR~Ruj{_<=f3_pJA;<{>gk&6!eB5x ze?J;Sz0%e1Vr{tkyEMA--|EE-@{WLlMbS_KQv$-gI3gB^^cOI>AOmD_@!NoXo+<1Y$KB26Ok2iJ9zJ5JIv*E>B2Cy}MYCLh?9dRJaozM;BAU z7@l9E1Po4G9>PwHWs^84k0nTV8K5Q*fDjWY6YzynKt@LW;04tC$uJg${E-61l2Lz) zil7G}sUiu8#N#kHG#iJ*Azerq4vxrXSZJ@tucu?Nn=D}B*6tk zK-$omY@Tp3V*3L^rvv^%DZ~`AL4O(&09>#301K$F{F?o}Ut`5zRjO)pWqyU_Rp9tML;{ApexvhEiv zHwEkoHT9@+)9}zO)7PE9-7!m_xs$K+>6n)hCSqAhnPcjH|JwZI1Kw~3b0E7K?E`+! zJs!q12nrLAKRxVZ5Ik$nd@VyQii+;nP!F_T99i3vG$enL^f-IjxzV1YM|GC3FTWdi zYn2y0k+u|s6&UXLUas8`&22f$LJW7cMYpH^fq#9m(uqBw?^%^n8Om%{)|MBjM#6Sm ze~9vQJFg&Y@r!*bGtCTP*{bHfZA7N(8!wnOCvy z9a^Vn-k#XYEQZ~t(^1|v&z^bS)FBR8wDH;bM7Qy$t4wa#32On>j>JG>8y4nr=U+Ni zM)#U#Hsc)wPR~zE1Nd3011mK-#`U)?ea;W>%{!|7#WR921}F-5?fSMYahI}c&|I^4 zcy7%aI2pfJHJe|ix_#2(xtGoRoahvs@x`WzTjCBA(dznFT_qEg8Q8p)cBHRcp_7>g z!?TSDg&vGh76XX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/minute.png.meta new file mode 100644 index 00000000..8998bb23 --- /dev/null +++ b/assets/action_bundle/img/dailyQuest/num/minute.png.meta @@ -0,0 +1,38 @@ +{ + "ver": "2.3.7", + "uuid": "1d943456-267e-485e-a6b9-013a9d8a1c8a", + "importer": "texture", + "type": "sprite", + "wrapMode": "clamp", + "filterMode": "bilinear", + "premultiplyAlpha": false, + "genMipmaps": false, + "packable": true, + "width": 76, + "height": 40, + "platformSettings": {}, + "subMetas": { + "minute": { + "ver": "1.0.6", + "uuid": "74687579-da83-456d-8442-e0ceb23cbcb1", + "importer": "sprite-frame", + "rawTextureUuid": "1d943456-267e-485e-a6b9-013a9d8a1c8a", + "trimType": "auto", + "trimThreshold": 1, + "rotated": false, + "offsetX": 0, + "offsetY": 0, + "trimX": 0, + "trimY": 0, + "width": 76, + "height": 40, + "rawWidth": 76, + "rawHeight": 40, + "borderTop": 0, + "borderBottom": 0, + "borderLeft": 0, + "borderRight": 0, + "subMetas": {} + } + } +} \ No newline at end of file diff --git a/assets/action_bundle/prefab/dailyQuests.prefab b/assets/action_bundle/prefab/dailyQuests.prefab index 4bb805c2..18247452 100644 --- a/assets/action_bundle/prefab/dailyQuests.prefab +++ b/assets/action_bundle/prefab/dailyQuests.prefab @@ -2275,15 +2275,13 @@ "_parent": { "__id__": 20 }, - "_children": [], - "_active": false, - "_components": [ - { - "__id__": 61 - }, + "_children": [ { "__id__": 62 - }, + } + ], + "_active": false, + "_components": [ { "__id__": 63 } @@ -2339,11 +2337,11 @@ "_id": "" }, { - "__type__": "cc.Label", + "__type__": "cc.Sprite", "_name": "", "_objFlags": 0, "node": { - "__id__": 60 + "__id__": 62 }, "_enabled": true, "_materials": [ @@ -2353,40 +2351,85 @@ ], "_srcBlendFactor": 770, "_dstBlendFactor": 771, - "_string": "领 取", - "_N$string": "领 取", - "_fontSize": 56, - "_lineHeight": 60, - "_enableWrapText": true, - "_N$file": null, - "_isSystemFontUsed": true, - "_spacingX": 0, - "_batchAsBitmap": false, - "_styleFlags": 1, - "_underlineHeight": 0, - "_N$horizontalAlign": 1, - "_N$verticalAlign": 1, - "_N$fontFamily": "Arial", - "_N$overflow": 2, - "_N$cacheMode": 0, + "_spriteFrame": { + "__uuid__": "7558ccd2-51a1-44bd-8ee8-cccdfc6ed930" + }, + "_type": 0, + "_sizeMode": 0, + "_fillType": 0, + "_fillCenter": { + "__type__": "cc.Vec2", + "x": 0, + "y": 0 + }, + "_fillStart": 0, + "_fillRange": 0, + "_isTrimmedMode": false, + "_atlas": null, "_id": "" }, { - "__type__": "cc.LabelOutline", - "_name": "", + "__type__": "cc.Node", + "_name": "claim", "_objFlags": 0, - "node": { + "_parent": { "__id__": 60 }, - "_enabled": true, + "_children": [], + "_active": true, + "_components": [ + { + "__id__": 61 + } + ], + "_prefab": { + "__id__": 271 + }, + "_opacity": 255, "_color": { "__type__": "cc.Color", - "r": 90, - "g": 142, - "b": 40, + "r": 255, + "g": 255, + "b": 255, "a": 255 }, - "_width": 3, + "_contentSize": { + "__type__": "cc.Size", + "width": 146, + "height": 59 + }, + "_anchorPoint": { + "__type__": "cc.Vec2", + "x": 0.5, + "y": 0.5 + }, + "_trs": { + "__type__": "TypedArray", + "ctor": "Float64Array", + "array": [ + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 1 + ] + }, + "_eulerAngles": { + "__type__": "cc.Vec3", + "x": 0, + "y": 0, + "z": 0 + }, + "_skewX": 0, + "_skewY": 0, + "_is3DNode": false, + "_groupIndex": 0, + "groupIndex": 0, "_id": "" }, { @@ -9856,13 +9899,13 @@ } ], "rewardMultiply": { - "__uuid__": "1d8908e8-0fc8-41b9-86b3-82c56da62633" + "__uuid__": "2cb7aad3-b171-49ff-965b-5b586285a081" }, "rewardMinutes": { - "__uuid__": "252d346a-227c-4602-8a60-5d0511c84ea8" + "__uuid__": "74687579-da83-456d-8442-e0ceb23cbcb1" }, "rewardHours": { - "__uuid__": "a30964ac-908f-46f8-ade5-f5b987643f4e" + "__uuid__": "17584c13-6226-4166-9733-0fdbbcbbb298" } }, { @@ -9875,5 +9918,16 @@ }, "fileId": "", "sync": false + }, + { + "__type__": "cc.PrefabInfo", + "root": { + "__id__": 1 + }, + "asset": { + "__id__": 0 + }, + "fileId": "45f5e1951b6d442aaac89bf1e412ae0d", + "sync": false } -] \ No newline at end of file +] diff --git a/assets/action_bundle/script/DailyQuests.ts b/assets/action_bundle/script/DailyQuests.ts index d3282cd4..6ccec40d 100644 --- a/assets/action_bundle/script/DailyQuests.ts +++ b/assets/action_bundle/script/DailyQuests.ts @@ -461,11 +461,11 @@ export default class DailyQuests extends cc.Component { const scales = tokens.map(token => token === "×" || token === "x" ? 0.6 : 1); const widths = tokens.map((token, index) => { const frame = frames[index]; - if (frame) { const size = frame.getOriginalSize(); return height * size.width / size.height; } + if (frame) { const size = frame.getRect(); return height * size.width / size.height; } // Punctuation retains the authored label style. return Array.from(token).reduce((width, char) => width + height * (char === "." ? 0.3 : char === "+" ? 0.65 : 1), 0); }); - const total = widths.reduce((sum, width, index) => sum + width * scales[index], 0) + Math.max(0, tokens.length - 1) * 2; + const total = widths.reduce((sum, width, index) => sum + width * scales[index], 0); content.scale = Math.min(1, node.width / Math.max(1, total), node.height / height); content.setPosition((0.5 - node.anchorX) * node.width, (0.5 - node.anchorY) * node.height); let x = -total / 2; @@ -477,7 +477,7 @@ export default class DailyQuests extends cc.Component { let sprite = glyph.getComponent(cc.Sprite), textLabel = glyph.getComponent(cc.Label); if (frames[index]) { if (!sprite) sprite = glyph.addComponent(cc.Sprite); - sprite.enabled = true; sprite.sizeMode = cc.Sprite.SizeMode.CUSTOM; sprite.trim = false; + sprite.enabled = true; sprite.sizeMode = cc.Sprite.SizeMode.CUSTOM; sprite.trim = true; sprite.spriteFrame = frames[index]; if (textLabel) textLabel.enabled = false; } else { @@ -498,7 +498,7 @@ export default class DailyQuests extends cc.Component { } glyph.setContentSize(widths[index], height); glyph.setPosition(x + widths[index] * scales[index] / 2, 0); - x += widths[index] * scales[index] + 2; + x += widths[index] * scales[index]; }); content.children.forEach((glyph, index) => { if (index >= tokens.length) glyph.active = false; }); } diff --git a/tools/test-daily-reward-animation.cjs b/tools/test-daily-reward-animation.cjs index a7af60f5..d783a08d 100644 --- a/tools/test-daily-reward-animation.cjs +++ b/tools/test-daily-reward-animation.cjs @@ -14,16 +14,15 @@ const trackerSource = fs.readFileSync(path.join(root, 'assets/Script/module/Task .replace(/^export type /gm, 'type ').replace('export default class', 'class'); const code = stripTypeScriptTypes(trackerSource + '\n' + source) + '\nglobalThis.DailyQuests = DailyQuests;'; -test('reward number bindings use dailyQuest digits and publicFont big_cheng', () => { +test('reward number bindings use dailyQuest digits and unit sprites', () => { const component = prefab.find(value => value.rewardIcons); assert.equal(component.rewardDigits.length, 10); component.rewardDigits.forEach((frame, digit) => assert.equal(frame.__uuid__, JSON.parse(fs.readFileSync( path.join(root, `assets/action_bundle/img/dailyQuest/num/${digit}.png.meta`), 'utf8')).subMetas[digit].uuid)); - assert.equal(component.rewardMultiply.__uuid__, JSON.parse(fs.readFileSync( - path.join(root, 'assets/common/publicFont.plist.meta'), 'utf8')).subMetas['big_cheng.png'].uuid); - const publicFont = JSON.parse(fs.readFileSync(path.join(root, 'assets/common/publicFont.plist.meta'), 'utf8')).subMetas; - assert.equal(component.rewardMinutes.__uuid__, publicFont['big_fenzhong.png'].uuid); - assert.equal(component.rewardHours.__uuid__, publicFont['big_xiaoshi.png'].uuid); + for (const [field, name] of [['rewardMultiply', 'cheng'], ['rewardMinutes', 'minute'], ['rewardHours', 'hour']]) { + assert.equal(component[field].__uuid__, JSON.parse(fs.readFileSync( + path.join(root, `assets/action_bundle/img/dailyQuest/num/${name}.png.meta`), 'utf8')).subMetas[name].uuid); + } }); test('daily reward counts render the requested digit art, fit the count box and use the multiply sprite', () => { @@ -224,12 +223,15 @@ function setup(rewards = [{ type: 'coin', count: 50 }, { type: 'hammer', count: const daily = new context.DailyQuests(); daily.node = build(1); canvas.addChild(daily.node); daily.content = daily.node.getChildByName('bg').getChildByName('content'); daily.taskNormal = 'normal-frame'; daily.taskClaimable = 'claimable-frame'; - const numberFrame = meta => ({ uuid: meta.uuid, getOriginalSize: () => ({ width: meta.rawWidth, height: meta.rawHeight }) }); + const numberFrame = meta => ({ uuid: meta.uuid, + getOriginalSize: () => ({ width: meta.rawWidth, height: meta.rawHeight }), + getRect: () => ({ width: meta.width, height: meta.height }) }); daily.rewardDigits = Array.from({ length: 10 }, (_, digit) => numberFrame(JSON.parse(fs.readFileSync( path.join(root, `assets/action_bundle/img/dailyQuest/num/${digit}.png.meta`), 'utf8')).subMetas[digit])); - daily.rewardMultiply = numberFrame(JSON.parse(fs.readFileSync(path.join(root, 'assets/common/publicFont.plist.meta'), 'utf8')).subMetas['big_cheng.png']); - daily.rewardMinutes = numberFrame(JSON.parse(fs.readFileSync(path.join(root, 'assets/common/publicFont.plist.meta'), 'utf8')).subMetas['big_fenzhong.png']); - daily.rewardHours = numberFrame(JSON.parse(fs.readFileSync(path.join(root, 'assets/common/publicFont.plist.meta'), 'utf8')).subMetas['big_xiaoshi.png']); + for (const [field, name] of [['rewardMultiply', 'cheng'], ['rewardMinutes', 'minute'], ['rewardHours', 'hour']]) { + daily[field] = numberFrame(JSON.parse(fs.readFileSync( + path.join(root, `assets/action_bundle/img/dailyQuest/num/${name}.png.meta`), 'utf8')).subMetas[name]); + } daily.rewardIcons = ['xinCoin', 'ice', 'hammer', 'magic', 'skyLine'].map(name => { const meta = JSON.parse(fs.readFileSync(path.join(root, `assets/res/public/${name}.png.meta`), 'utf8')).subMetas[name]; return { getRect: () => ({ width: meta.width, height: meta.height }) };