diff --git a/assets/action_bundle/img/dailyQuest/claim.png b/assets/action_bundle/img/dailyQuest/claim.png new file mode 100644 index 00000000..7d1c1cb6 Binary files /dev/null and b/assets/action_bundle/img/dailyQuest/claim.png differ diff --git a/assets/action_bundle/img/dailyQuest/claim.png.meta b/assets/action_bundle/img/dailyQuest/claim.png.meta new file mode 100644 index 00000000..bccae407 --- /dev/null +++ b/assets/action_bundle/img/dailyQuest/claim.png.meta @@ -0,0 +1,38 @@ +{ + "ver": "2.3.7", + "uuid": "a2e6203f-5c21-4c81-9bac-f2687abd0d4e", + "importer": "texture", + "type": "sprite", + "wrapMode": "clamp", + "filterMode": "bilinear", + "premultiplyAlpha": false, + "genMipmaps": false, + "packable": true, + "width": 146, + "height": 59, + "platformSettings": {}, + "subMetas": { + "claim": { + "ver": "1.0.6", + "uuid": "7558ccd2-51a1-44bd-8ee8-cccdfc6ed930", + "importer": "sprite-frame", + "rawTextureUuid": "a2e6203f-5c21-4c81-9bac-f2687abd0d4e", + "trimType": "auto", + "trimThreshold": 1, + "rotated": false, + "offsetX": 0, + "offsetY": 0, + "trimX": 0, + "trimY": 0, + "width": 146, + "height": 59, + "rawWidth": 146, + "rawHeight": 59, + "borderTop": 0, + "borderBottom": 0, + "borderLeft": 0, + "borderRight": 0, + "subMetas": {} + } + } +} \ No newline at end of file diff --git a/assets/action_bundle/img/dailyQuest/num/cheng.png b/assets/action_bundle/img/dailyQuest/num/cheng.png new file mode 100644 index 00000000..23b1716b Binary files /dev/null and b/assets/action_bundle/img/dailyQuest/num/cheng.png differ 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 00000000..cb40683e Binary files /dev/null and b/assets/action_bundle/img/dailyQuest/num/hour.png differ diff --git a/assets/action_bundle/img/dailyQuest/num/hour.png.meta b/assets/action_bundle/img/dailyQuest/num/hour.png.meta new file mode 100644 index 00000000..153bcc9c --- /dev/null +++ b/assets/action_bundle/img/dailyQuest/num/hour.png.meta @@ -0,0 +1,38 @@ +{ + "ver": "2.3.7", + "uuid": "f732d807-76c2-44a7-b429-0b29a8264001", + "importer": "texture", + "type": "sprite", + "wrapMode": "clamp", + "filterMode": "bilinear", + "premultiplyAlpha": false, + "genMipmaps": false, + "packable": true, + "width": 77, + "height": 39, + "platformSettings": {}, + "subMetas": { + "hour": { + "ver": "1.0.6", + "uuid": "17584c13-6226-4166-9733-0fdbbcbbb298", + "importer": "sprite-frame", + "rawTextureUuid": "f732d807-76c2-44a7-b429-0b29a8264001", + "trimType": "auto", + "trimThreshold": 1, + "rotated": false, + "offsetX": 0, + "offsetY": 0, + "trimX": 0, + "trimY": 0, + "width": 77, + "height": 39, + "rawWidth": 77, + "rawHeight": 39, + "borderTop": 0, + "borderBottom": 0, + "borderLeft": 0, + "borderRight": 0, + "subMetas": {} + } + } +} \ No newline at end of file diff --git a/assets/action_bundle/img/dailyQuest/num/minute.png b/assets/action_bundle/img/dailyQuest/num/minute.png new file mode 100644 index 00000000..ff1e9881 Binary files /dev/null and b/assets/action_bundle/img/dailyQuest/num/minute.png differ diff --git a/assets/action_bundle/img/dailyQuest/num/minute.png.meta b/assets/action_bundle/img/dailyQuest/num/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 83409e3d..6285883b 100644 --- a/assets/action_bundle/prefab/dailyQuests.prefab +++ b/assets/action_bundle/prefab/dailyQuests.prefab @@ -2839,15 +2839,13 @@ "_parent": { "__id__": 20 }, - "_children": [], - "_active": false, - "_components": [ - { - "__id__": 76 - }, + "_children": [ { "__id__": 77 - }, + } + ], + "_active": false, + "_components": [ { "__id__": 78 } @@ -2903,11 +2901,11 @@ "_id": "" }, { - "__type__": "cc.Label", + "__type__": "cc.Sprite", "_name": "", "_objFlags": 0, "node": { - "__id__": 75 + "__id__": 77 }, "_enabled": true, "_materials": [ @@ -2917,40 +2915,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__": 75 }, - "_enabled": true, + "_children": [], + "_active": true, + "_components": [ + { + "__id__": 76 + } + ], + "_prefab": { + "__id__": 326 + }, + "_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": "" }, { @@ -11991,13 +12034,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" }, "countDigits": [ { @@ -12115,5 +12158,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 1d7c965a..c3b0bedb 100644 --- a/assets/action_bundle/script/DailyQuests.ts +++ b/assets/action_bundle/script/DailyQuests.ts @@ -533,11 +533,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; @@ -549,7 +549,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 { @@ -570,7 +570,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/daily-count-test-utils.cjs b/tools/daily-count-test-utils.cjs index d9fe5df5..a3e4d836 100644 --- a/tools/daily-count-test-utils.cjs +++ b/tools/daily-count-test-utils.cjs @@ -15,10 +15,8 @@ function installCountFrames(daily) { daily.countMinutes = frame('fenzhong', '分钟'); daily.countPlus = frame('jiahao', '+'); daily.rewardDigits = daily.countDigits; - const font = JSON.parse(fs.readFileSync(path.resolve(directory, '../../../common/publicFont.plist.meta'))).subMetas; - for (const [field, name, character] of [['rewardMultiply', 'big_cheng.png', '×'], ['rewardMinutes', 'big_fenzhong.png', '分钟'], ['rewardHours', 'big_xiaoshi.png', '小时']]) { - const meta = font[name]; - daily[field] = { character, uuid: meta.uuid, getOriginalSize: () => ({ width: meta.rawWidth, height: meta.rawHeight }) }; + for (const [field, name, character] of [['rewardMultiply', 'cheng', '×'], ['rewardMinutes', 'minute', '分钟'], ['rewardHours', 'hour', '小时']]) { + daily[field] = frame('num/' + name, character); } } function countText(node) { diff --git a/tools/test-daily-reward-animation.cjs b/tools/test-daily-reward-animation.cjs index 50d88fe7..5f00359a 100644 --- a/tools/test-daily-reward-animation.cjs +++ b/tools/test-daily-reward-animation.cjs @@ -15,16 +15,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', () => {