From a8f7e90d2efe8d58fc58680176532bd93d531583 Mon Sep 17 00:00:00 2001 From: "YZ\\249929363" <249929363@qq.com> Date: Fri, 4 Jul 2025 16:10:48 +0800 Subject: [PATCH] =?UTF-8?q?=E6=97=A5=E5=B8=B8=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- assets/Scene/GameScene.fire | 139 +++++++++++++++++++++++--- assets/Scene/HomeScene.fire | 131 ++++++++++++++++++++++-- assets/Script/JiaZai.ts | 2 +- assets/Script/Sdk/MiniGameSdk.ts | 2 +- assets/Script/heathnum.ts | 35 +++++-- assets/Script/module/Tool/GameTool.ts | 2 +- assets/res/font/font.png.meta | 4 +- assets/shop/prefab/shop.prefab | 2 +- assets/shop/script/shop.ts | 8 +- 9 files changed, 281 insertions(+), 44 deletions(-) diff --git a/assets/Scene/GameScene.fire b/assets/Scene/GameScene.fire index f914cc6..67a8565 100644 --- a/assets/Scene/GameScene.fire +++ b/assets/Scene/GameScene.fire @@ -86,17 +86,17 @@ ], "_active": true, "_components": [ - { - "__id__": 485 - }, - { - "__id__": 486 - }, - { - "__id__": 487 - }, { "__id__": 488 + }, + { + "__id__": 489 + }, + { + "__id__": 490 + }, + { + "__id__": 491 } ], "_prefab": null, @@ -7785,7 +7785,7 @@ "__type__": "TypedArray", "ctor": "Float64Array", "array": [ - -128.643, + -149.37, 6.074, 0, 0, @@ -7942,7 +7942,7 @@ "__type__": "TypedArray", "ctor": "Float64Array", "array": [ - 125.9, + 137.448, 3.914, 0, 0, @@ -23109,14 +23109,18 @@ "_parent": { "__id__": 2 }, - "_children": [], + "_children": [ + { + "__id__": 483 + } + ], "_active": false, "_components": [ { - "__id__": 483 + "__id__": 486 }, { - "__id__": 484 + "__id__": 487 } ], "_prefab": null, @@ -23167,6 +23171,113 @@ "groupIndex": 0, "_id": "28bp64kpJEtISf041jwpP2" }, + { + "__type__": "cc.Node", + "_name": "New Sprite(Splash)", + "_objFlags": 0, + "_parent": { + "__id__": 482 + }, + "_children": [], + "_active": true, + "_components": [ + { + "__id__": 484 + }, + { + "__id__": 485 + } + ], + "_prefab": null, + "_opacity": 0, + "_color": { + "__type__": "cc.Color", + "r": 0, + "g": 0, + "b": 0, + "a": 255 + }, + "_contentSize": { + "__type__": "cc.Size", + "width": 2000, + "height": 3000 + }, + "_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": "3e0GHgNVlCVKRJJmM43pTE" + }, + { + "__type__": "cc.Sprite", + "_name": "", + "_objFlags": 0, + "node": { + "__id__": 483 + }, + "_enabled": true, + "_materials": [ + { + "__uuid__": "eca5d2f2-8ef6-41c2-bbe6-f9c79d09c432" + } + ], + "_srcBlendFactor": 770, + "_dstBlendFactor": 771, + "_spriteFrame": { + "__uuid__": "a23235d1-15db-4b95-8439-a2e005bfff91" + }, + "_type": 0, + "_sizeMode": 0, + "_fillType": 0, + "_fillCenter": { + "__type__": "cc.Vec2", + "x": 0, + "y": 0 + }, + "_fillStart": 0, + "_fillRange": 0, + "_isTrimmedMode": true, + "_atlas": null, + "_id": "bcrt45wsxKIbeKPmjTLtAE" + }, + { + "__type__": "cc.BlockInputEvents", + "_name": "", + "_objFlags": 0, + "node": { + "__id__": 483 + }, + "_enabled": true, + "_id": "4fwjz1lnFLD45L1lqUY038" + }, { "__type__": "sp.Skeleton", "_name": "", diff --git a/assets/Scene/HomeScene.fire b/assets/Scene/HomeScene.fire index 6b0377a..68e62de 100644 --- a/assets/Scene/HomeScene.fire +++ b/assets/Scene/HomeScene.fire @@ -196,13 +196,13 @@ "_active": true, "_components": [ { - "__id__": 261 + "__id__": 264 }, { - "__id__": 262 + "__id__": 265 }, { - "__id__": 263 + "__id__": 266 } ], "_prefab": null, @@ -1553,7 +1553,7 @@ "__type__": "TypedArray", "ctor": "Float64Array", "array": [ - -120.21, + -142.952, -1.322, 0, 0, @@ -1649,7 +1649,7 @@ "__type__": "TypedArray", "ctor": "Float64Array", "array": [ - 147.114, + 161.719, -3, 0, 0, @@ -1837,7 +1837,7 @@ "__type__": "TypedArray", "ctor": "Float64Array", "array": [ - -135.56, + -155.524, 1.821, 0, 0, @@ -2249,7 +2249,7 @@ "__type__": "TypedArray", "ctor": "Float64Array", "array": [ - -120.21, + -138.728, -1.322, 0, 0, @@ -2345,7 +2345,7 @@ "__type__": "TypedArray", "ctor": "Float64Array", "array": [ - 147.114, + 140.987, -3, 0, 0, @@ -12220,11 +12220,15 @@ "_parent": { "__id__": 4 }, - "_children": [], + "_children": [ + { + "__id__": 260 + } + ], "_active": false, "_components": [ { - "__id__": 260 + "__id__": 263 } ], "_prefab": null, @@ -12275,6 +12279,113 @@ "groupIndex": 0, "_id": "4dk5MkoBVFl4geCGUjwbma" }, + { + "__type__": "cc.Node", + "_name": "New Sprite(Splash)", + "_objFlags": 0, + "_parent": { + "__id__": 259 + }, + "_children": [], + "_active": true, + "_components": [ + { + "__id__": 261 + }, + { + "__id__": 262 + } + ], + "_prefab": null, + "_opacity": 0, + "_color": { + "__type__": "cc.Color", + "r": 0, + "g": 0, + "b": 0, + "a": 255 + }, + "_contentSize": { + "__type__": "cc.Size", + "width": 2000, + "height": 3000 + }, + "_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": "47E0EHcF5PS7feadzO9WgK" + }, + { + "__type__": "cc.Sprite", + "_name": "", + "_objFlags": 0, + "node": { + "__id__": 260 + }, + "_enabled": true, + "_materials": [ + { + "__uuid__": "eca5d2f2-8ef6-41c2-bbe6-f9c79d09c432" + } + ], + "_srcBlendFactor": 770, + "_dstBlendFactor": 771, + "_spriteFrame": { + "__uuid__": "a23235d1-15db-4b95-8439-a2e005bfff91" + }, + "_type": 0, + "_sizeMode": 0, + "_fillType": 0, + "_fillCenter": { + "__type__": "cc.Vec2", + "x": 0, + "y": 0 + }, + "_fillStart": 0, + "_fillRange": 0, + "_isTrimmedMode": true, + "_atlas": null, + "_id": "029GSNO8ZAUbP+l1fq7/aU" + }, + { + "__type__": "cc.BlockInputEvents", + "_name": "", + "_objFlags": 0, + "node": { + "__id__": 260 + }, + "_enabled": true, + "_id": "59BOMZmhdPJajqBGyoUDBU" + }, { "__type__": "sp.Skeleton", "_name": "", diff --git a/assets/Script/JiaZai.ts b/assets/Script/JiaZai.ts index 04b5466..5739c3c 100644 --- a/assets/Script/JiaZai.ts +++ b/assets/Script/JiaZai.ts @@ -256,7 +256,7 @@ stopHeathTimeCutDown() { setHealthInfo() { - if (cc.fx.GameConfig.GM_INFO.hp == 5) { + if (cc.fx.GameConfig.GM_INFO.hp >= 5) { this.Stamina.getChildByName("man").active = true; this.Stamina.getChildByName("health").active = false; this.Stamina.getChildByName("time").active = false; diff --git a/assets/Script/Sdk/MiniGameSdk.ts b/assets/Script/Sdk/MiniGameSdk.ts index 3a378f0..7cf6edc 100644 --- a/assets/Script/Sdk/MiniGameSdk.ts +++ b/assets/Script/Sdk/MiniGameSdk.ts @@ -1119,7 +1119,7 @@ export namespace MiniGameSdk { var config = { // appId: "73e1ec654f15b47a1a7354fbabec05ad", // 项目 APP ID appId: appId, - serverUrl: "https://data.nika4fun.com", // 上报地址 + serverUrl: "https://data.nika4fun.com/sync_data", // 上报地址 autoTrack: { appShow: true, // 自动采集 ta_mg_show appHide: true // 自动采集 ta_mg_hide diff --git a/assets/Script/heathnum.ts b/assets/Script/heathnum.ts index 1b81d1e..f58bf82 100644 --- a/assets/Script/heathnum.ts +++ b/assets/Script/heathnum.ts @@ -25,7 +25,14 @@ export default class NewClass extends cc.Component { //金币花费数 @property(cc.Node) coin: cc.Node = null; + + btn_Touch: boolean = true; + + onLoad() { + this.btn_Touch = true; + } start() { + this.btn_Touch = true; this.openPop(); } //打开商店界面 @@ -52,28 +59,35 @@ export default class NewClass extends cc.Component { //购买体力 buyHeath(){ + if(!this.btn_Touch){ + return; + } + this.btn_Touch = false; //获取当前体力 let curHeath = cc.fx.GameConfig.GM_INFO.hp; //获取当前金币 let curCoin = cc.fx.GameConfig.GM_INFO.coin; if(curCoin >= 1000){ + this.switchButtons[1].active = false; cc.fx.GameTool.changeCoin(-1000); - cc.fx.GameTool.setUserHealth(5, (data) => { - cc.fx.GameTool.getHealth(null); - const parentNode = cc.find("Canvas"); // 假设 JiaZai 挂在 Canvas 节点 - if (parentNode) { - const jiazaiComp = parentNode.getComponent(JiaZai); - if (jiazaiComp) { - jiazaiComp.setHealthInfo(); - jiazaiComp.updateCoin(); - } + cc.fx.GameConfig.GM_INFO.hp = 5; + const parentNode = cc.find("Canvas"); // 假设 JiaZai 挂在 Canvas 节点 + if (parentNode) { + const jiazaiComp = parentNode.getComponent(JiaZai); + if (jiazaiComp) { + jiazaiComp.setHealthInfo(); + jiazaiComp.updateCoin(); } - this.closePop(); + } + this.switchButtons[0].active = true; + cc.fx.GameTool.setUserHealth(0, (data) => { + cc.fx.GameTool.getHealth(null); }) } else{ MiniGameSdk.API.showToast("金币不足,无法购买体力"); setTimeout(() => { + this.btn_Touch = true; this.openShop(); }, 500); } @@ -93,6 +107,7 @@ export default class NewClass extends cc.Component { //关闭弹窗 closePop() { + this.btn_Touch = true; //销毁预制体 console.log("关闭heath弹窗"); //关闭计时器 diff --git a/assets/Script/module/Tool/GameTool.ts b/assets/Script/module/Tool/GameTool.ts index df269ff..3511cc3 100644 --- a/assets/Script/module/Tool/GameTool.ts +++ b/assets/Script/module/Tool/GameTool.ts @@ -837,7 +837,7 @@ var GameTool = { price = 12800; MiniGameSdk.API.showToast("充值成功,获得32000金币"); break; - case "gold_5": + case "gold_pack_5": cc.fx.GameTool.changeCoin(100000); coin = 100000; price = 32800; diff --git a/assets/res/font/font.png.meta b/assets/res/font/font.png.meta index 5f83131..8760b74 100644 --- a/assets/res/font/font.png.meta +++ b/assets/res/font/font.png.meta @@ -8,8 +8,8 @@ "premultiplyAlpha": false, "genMipmaps": false, "packable": true, - "width": 1784, - "height": 252, + "width": 1739, + "height": 255, "platformSettings": {}, "subMetas": {} } \ No newline at end of file diff --git a/assets/shop/prefab/shop.prefab b/assets/shop/prefab/shop.prefab index ffa270a..6caeb07 100644 --- a/assets/shop/prefab/shop.prefab +++ b/assets/shop/prefab/shop.prefab @@ -4428,7 +4428,7 @@ "component": "", "_componentId": "48bfeZuYFZE2qmgxbW2IigB", "handler": "buyProduct", - "customEventData": "gold_5" + "customEventData": "gold_pack_5" }, { "__type__": "de906iE/HVHpI6VO7IMvKaI", diff --git a/assets/shop/script/shop.ts b/assets/shop/script/shop.ts index 3e6c122..79c304c 100644 --- a/assets/shop/script/shop.ts +++ b/assets/shop/script/shop.ts @@ -35,7 +35,7 @@ export default class NewClass extends cc.Component { { product_id: "gold_2", name: "金币包2", price: 3600, coin:8000, title: "" }, { product_id: "gold_3", name: "金币包3", price: 6800, coin:16000, title: "" }, { product_id: "gold_4", name: "金币包4", price: 12800, coin:32000, title: "" }, - { product_id: "gold_5", name: "金币包5", price: 32800, coin:100000, title: "" }, + { product_id: "gold_pack_5", name: "金币包5", price: 32800, coin:100000, title: "" }, { product_id: "gold_6", name: "金币包6", price: 64800, coin:240000, title: "" }, ]; for (let i = 1; i <= 6 && i < this.itemList.children.length; i++) { @@ -97,8 +97,8 @@ export default class NewClass extends cc.Component { case "gold_4": price = 12800; break; - case "gold_5": - price = 32800; + case "gold_pack_5": + price = 100; break; case "gold_6": price = 64800; @@ -172,7 +172,7 @@ export default class NewClass extends cc.Component { payment_num:1, type:systemType, } - cc.fx.GameTool.shushu_Track("payment_fail",dataSuccess); + cc.fx.GameTool.shushu_Track("payment",dataSuccess); } else{ MiniGameSdk.API.showToast("网络异常,充值奖励将在登录后再次发放");