From ee44973798d14778dc840b4fe6fe2eba5d7227af Mon Sep 17 00:00:00 2001 From: guanchao <18612113337@163.com> Date: Tue, 3 Nov 2026 20:19:36 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E8=B0=83=E6=95=B4=E5=A5=96=E5=8A=B1?= =?UTF-8?q?=E6=B8=B2=E6=9F=93=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- assets/Script/Reward.ts | 40 ++++-------------------- assets/publicUI/prefab/rewardNode.prefab | 12 +++---- 2 files changed, 12 insertions(+), 40 deletions(-) diff --git a/assets/Script/Reward.ts b/assets/Script/Reward.ts index bb1cbe91..20df0f42 100644 --- a/assets/Script/Reward.ts +++ b/assets/Script/Reward.ts @@ -9,8 +9,6 @@ export default class Reward extends cc.Component { @property(cc.Prefab) rewardNode: cc.Prefab = null; - @property(cc.SpriteFrame) - battlePassCoin: cc.SpriteFrame = null; actionOver: boolean; speedTime: number = 50; private originalTimeScale: number = 1; // 记录原始时间缩放比例 @@ -23,17 +21,13 @@ export default class Reward extends cc.Component { } start() { - // ... 已有代码 ... this.node.on(cc.Node.EventType.TOUCH_END, this.onNodeClick, this); - } /** * 节点点击事件处理函数 */ onNodeClick() { - // console.log('Reward 节点被点击了', this.actionOver); - // 这里可以添加点击后的具体逻辑 if (this.actionOver == true) { cc.fx.AudioManager._instance.playEffect("anniu_little", null); if (this.callBack != null) { @@ -41,10 +35,6 @@ export default class Reward extends cc.Component { } this.node.destroy(); } - else { - // 游戏整体加速 - // this.speedUpGame(); - } } @@ -134,13 +124,7 @@ export default class Reward extends cc.Component { // 查找 rewardNode 的子节点 icon const iconNode = rewardNode.getChildByName('icon'); const rewardData = data[index]; - const rewardIcon = this.getOrCreateRewardIcon(iconNode, - rewardData.battlePass && rewardData.type === 'coin' - ? { ...rewardData, spriteFrame: this.battlePassCoin } : rewardData); - if (rewardData.battlePass && rewardData.type !== 'coin' && rewardData.type !== 'infinite_health') { - const prefix = rewardNode.getChildByName('xnode'); - prefix.getComponent(cc.Sprite).spriteFrame = NumberToImage.publicFont.getSpriteFrame('big_cheng'); - } + const rewardIcon = this.getOrCreateRewardIcon(iconNode, rewardData); if (rewardIcon) { rewardIcon.active = true; } @@ -148,16 +132,9 @@ export default class Reward extends cc.Component { if (rewardData.type == 'coin') NumberToImage.numberToImageNodesNumber(rewardData.count, 45, 5, "big_", label, true); else if (rewardData.type == 'infinite_health') { - if (durationUnits || rewardData.battlePass) { - this.renderDuration(label, rewardData.count); - rewardNode.getChildByName('xnode').active = false; - } else { - NumberToImage.getTimeMargin2(rewardData.count, 45, "coins", label, true); - if (rewardData.count > 3600) label.x -= 10; - rewardNode.getChildByName('xnode').opacity = 1; - } - } - else { + this.renderDuration(label, rewardData.count); + rewardNode.getChildByName('xnode').active = false; + } else { NumberToImage.numberToImageNodesNumber(rewardData.count, 50, 15, "big_", label, true); const xnode = rewardNode.getChildByName('xnode'); xnode.opacity = 0; @@ -175,8 +152,7 @@ export default class Reward extends cc.Component { xnode.x = label.x + (firstDigit.x - firstDigit.width * firstDigit.anchorX) * label.scaleX - 6 - xnode.width * (1 - xnode.anchorX) * xnode.scaleX; } - if (rewardData.type !== 'infinite_health' || durationUnits || rewardData.battlePass) - this.alignAmount(rewardNode, rewardData.type !== 'coin' && rewardData.type !== 'infinite_health'); + this.alignAmount(rewardNode, rewardData.type !== 'coin' && rewardData.type !== 'infinite_health'); rewardNode.getChildByName('label').active = false; if (iconNode) { cc.tween(iconNode) @@ -188,8 +164,7 @@ export default class Reward extends cc.Component { rewardNode.getChildByName('label').active = true; if (rewardNode.getChildByName('xnode').opacity == 1) { rewardNode.getChildByName('xnode').opacity = 0; - } - else if (rewardNode.getChildByName('xnode').opacity != 255) { + } else if (rewardNode.getChildByName('xnode').opacity != 255) { rewardNode.getChildByName('xnode').active = true; rewardNode.getChildByName('xnode').opacity = 255; } @@ -271,7 +246,4 @@ export default class Reward extends cc.Component { rewardIcon.setScale(rewardData.type === "cat_skin" ? 1.1 : 1); return rewardIcon; } - - - } diff --git a/assets/publicUI/prefab/rewardNode.prefab b/assets/publicUI/prefab/rewardNode.prefab index 67dc9606..b91ea01f 100644 --- a/assets/publicUI/prefab/rewardNode.prefab +++ b/assets/publicUI/prefab/rewardNode.prefab @@ -305,8 +305,8 @@ }, "_contentSize": { "__type__": "cc.Size", - "width": 84, - "height": 95 + "width": 190, + "height": 147 }, "_anchorPoint": { "__type__": "cc.Vec2", @@ -358,7 +358,7 @@ "_srcBlendFactor": 770, "_dstBlendFactor": 771, "_spriteFrame": { - "__uuid__": "d22678f9-a73b-4c94-af07-62a134fd2d30" + "__uuid__": "c331a597-3361-4765-8e44-9989c8e6648a" }, "_type": 0, "_sizeMode": 1, @@ -1356,8 +1356,8 @@ }, "_contentSize": { "__type__": "cc.Size", - "width": 36, - "height": 34 + "width": 31, + "height": 32 }, "_anchorPoint": { "__type__": "cc.Vec2", @@ -1409,7 +1409,7 @@ "_srcBlendFactor": 770, "_dstBlendFactor": 771, "_spriteFrame": { - "__uuid__": "fafa9ef2-f250-47c7-b198-49971d3a380d" + "__uuid__": "1d8908e8-0fc8-41b9-86b3-82c56da62633" }, "_type": 0, "_sizeMode": 1,