From d80656fa89e0ee086b66f70b27caab942724eb06 Mon Sep 17 00:00:00 2001 From: "YZ\\249929363" <249929363@qq.com> Date: Fri, 18 Jul 2025 17:41:47 +0800 Subject: [PATCH] =?UTF-8?q?=E6=97=A5=E6=9B=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- assets/Script/JiaZai.ts | 3 +- assets/shop/script/shop.ts | 240 ++++++++++++++++++------------------- 2 files changed, 120 insertions(+), 123 deletions(-) diff --git a/assets/Script/JiaZai.ts b/assets/Script/JiaZai.ts index 6da0c37..b29186c 100644 --- a/assets/Script/JiaZai.ts +++ b/assets/Script/JiaZai.ts @@ -198,9 +198,8 @@ export default class JiaZai extends cc.Component { if (cc.fx.GameConfig.GM_INFO.hp < 5) { this.startHeathTimeCutDown(timeNode); } - if (cc.fx.GameConfig.GM_INFO.hp == 0) { + if (cc.fx.GameConfig.GM_INFO.hp == 0 && cc.fx.GameConfig.GM_INFO.userPowerTime == 0) { // 体力为0,显示spriteFrames[1],只显示第二个按钮 - if (switchButtons[0]) { switchButtons[0].active = false; swichs[0].active = false; } if (switchButtons[1]) { switchButtons[1].active = true; swichs[1].active = true; } } else if (cc.fx.GameConfig.GM_INFO.hp < 5 && cc.fx.GameConfig.GM_INFO.hp > 0) { diff --git a/assets/shop/script/shop.ts b/assets/shop/script/shop.ts index 2fc1171..af50017 100644 --- a/assets/shop/script/shop.ts +++ b/assets/shop/script/shop.ts @@ -384,128 +384,126 @@ export default class NewClass extends cc.Component { type: systemType, } cc.fx.GameTool.shushu_Track("init_order", data); - MiniGameSdk.API.showToast("充值成功"); - cc.fx.GameTool.shopBuy(productId); - // this.openLoad(); + this.openLoad(); //console.log("7.14_____________________", "调用充值接口"); - // Utils.buyProp(id, count, price, (res) => { - // //console.log("获得充值结果", res); - // if (res == null) { - // MiniGameSdk.API.showToast("充值失败"); - // this.btn_Touch = true; - // const dataFail = { - // outTradeNo: Utils.outTradeNo, - // price: price, - // payment_name: productId, - // payment_num: 1, - // type: systemType, - // fail_reason: "网络异常,没有拉起支付", - // } - // cc.fx.GameTool.shushu_Track("payment_fail", dataFail); - // this.closeLoad(); - // return; - // } - // else if (res.err) { - // MiniGameSdk.API.showToast("充值失败"); - // //console.log(res); - // this.btn_Touch = true; - // let name = "支付拉起失败"; - // if (res.errCode == -2) { - // name = "用户取消充值"; - // } - // const dataFail = { - // outTradeNo: Utils.outTradeNo, - // price: price, - // payment_name: productId, - // payment_num: 1, - // type: systemType, - // fail_reason: name, - // } - // cc.fx.GameTool.shushu_Track("payment_fail", dataFail); - // this.closeLoad(); - // return; - // } - // else { - // Utils.getPayInfo((data) => { - // //console.log("7.14_______________充值成功,准备轮训"); - // //console.log("获得轮训结果:", data); - // this.closeLoad(); - // if (data.data.pay_state == 1) { - // this.btn_Touch = true; - // MiniGameSdk.API.showToast("取消充值"); - // const dataFail2 = { - // outTradeNo: Utils.outTradeNo, - // price: price, - // payment_name: productId, - // payment_num: 1, - // type: systemType, - // fail_reason: "用户取消支付", - // } - // cc.fx.GameTool.shushu_Track("payment_fail", dataFail2); - // } - // else if (data.data.pay_state == 2) { - // this.btn_Touch = true; - // const dataSuccess = { - // outTradeNo: Utils.outTradeNo, - // price: price, - // payment_name: productId, - // payment_num: 1, - // type: systemType, - // } - // cc.fx.GameTool.shushu_Track("payment", dataSuccess); - // let name = "购买金币道具:" + productId; - // MiniGameSdk.API.yinli_Pay(price, Utils.outTradeNo, name) - // //console.log("7.14_______________充值成功,轮训成功,准备发货"); - // Utils.setPayInfo( - // (res) => { - // //console.log("设置轮训结果:", res); - // if (res.code === 1) { - // //console.log("7.14_________正式发货"); - // MiniGameSdk.API.showToast("充值成功"); - // cc.fx.GameTool.shopBuy(productId); - // //console.log("充值成功获得金币"); - // } - // else { - // MiniGameSdk.API.showToast("网络异常,充值奖励将在登录后再次发放"); - // const dataFail4 = { - // outTradeNo: Utils.outTradeNo, - // price: price, - // payment_name: productId, - // payment_num: 1, - // type: systemType, - // fail_reason: "成功付款,但是发货时请求服务器失败,充值成功未发货", - // } - // cc.fx.GameTool.shushu_Track("payment_fail", dataFail4); - // } - // NumberToImage.numberToImageNodes(cc.fx.GameConfig.GM_INFO.coin, 30, 15, "coin_", this.coin, true); - // if (this.node.parent.getComponent("JiaZai")) - // this.node.parent.getComponent("JiaZai").updateCoin(); - // else if (this.node.parent.getComponent("SceneManager")) { - // this.node.parent.getComponent("SceneManager").updateCoin(); - // } - // }, null) - // } - // else { - // NumberToImage.numberToImageNodes(cc.fx.GameConfig.GM_INFO.coin, 30, 15, "coin_", this.coin, true); - // const dataFail3 = { - // outTradeNo: Utils.outTradeNo, - // price: price, - // payment_name: productId, - // payment_num: 1, - // type: systemType, - // fail_reason: "拉起支付后,付款时网络异常付款失败", - // } - // cc.fx.GameTool.shushu_Track("payment_fail", dataFail3); - // this.btn_Touch = true; - // if (this.node.parent.getComponent("JiaZai")) - // this.node.parent.getComponent("JiaZai").updateCoin(); - // else if (this.node.parent.getComponent("SceneManager")) { - // this.node.parent.getComponent("SceneManager").updateCoin(); - // } - // } - // }) - // } - // }); + Utils.buyProp(id, count, price, (res) => { + //console.log("获得充值结果", res); + if (res == null) { + MiniGameSdk.API.showToast("充值失败"); + this.btn_Touch = true; + const dataFail = { + outTradeNo: Utils.outTradeNo, + price: price, + payment_name: productId, + payment_num: 1, + type: systemType, + fail_reason: "网络异常,没有拉起支付", + } + cc.fx.GameTool.shushu_Track("payment_fail", dataFail); + this.closeLoad(); + return; + } + else if (res.err) { + MiniGameSdk.API.showToast("充值失败"); + //console.log(res); + this.btn_Touch = true; + let name = "支付拉起失败"; + if (res.errCode == -2) { + name = "用户取消充值"; + } + const dataFail = { + outTradeNo: Utils.outTradeNo, + price: price, + payment_name: productId, + payment_num: 1, + type: systemType, + fail_reason: name, + } + cc.fx.GameTool.shushu_Track("payment_fail", dataFail); + this.closeLoad(); + return; + } + else { + Utils.getPayInfo((data) => { + //console.log("7.14_______________充值成功,准备轮训"); + //console.log("获得轮训结果:", data); + this.closeLoad(); + if (data.data.pay_state == 1) { + this.btn_Touch = true; + MiniGameSdk.API.showToast("取消充值"); + const dataFail2 = { + outTradeNo: Utils.outTradeNo, + price: price, + payment_name: productId, + payment_num: 1, + type: systemType, + fail_reason: "用户取消支付", + } + cc.fx.GameTool.shushu_Track("payment_fail", dataFail2); + } + else if (data.data.pay_state == 2) { + this.btn_Touch = true; + const dataSuccess = { + outTradeNo: Utils.outTradeNo, + price: price, + payment_name: productId, + payment_num: 1, + type: systemType, + } + cc.fx.GameTool.shushu_Track("payment", dataSuccess); + let name = "购买金币道具:" + productId; + MiniGameSdk.API.yinli_Pay(price, Utils.outTradeNo, name) + //console.log("7.14_______________充值成功,轮训成功,准备发货"); + Utils.setPayInfo( + (res) => { + //console.log("设置轮训结果:", res); + if (res.code === 1) { + //console.log("7.14_________正式发货"); + MiniGameSdk.API.showToast("充值成功"); + cc.fx.GameTool.shopBuy(productId); + //console.log("充值成功获得金币"); + } + else { + MiniGameSdk.API.showToast("网络异常,充值奖励将在登录后再次发放"); + const dataFail4 = { + outTradeNo: Utils.outTradeNo, + price: price, + payment_name: productId, + payment_num: 1, + type: systemType, + fail_reason: "成功付款,但是发货时请求服务器失败,充值成功未发货", + } + cc.fx.GameTool.shushu_Track("payment_fail", dataFail4); + } + NumberToImage.numberToImageNodes(cc.fx.GameConfig.GM_INFO.coin, 30, 15, "coin_", this.coin, true); + if (this.node.parent.getComponent("JiaZai")) + this.node.parent.getComponent("JiaZai").updateCoin(); + else if (this.node.parent.getComponent("SceneManager")) { + this.node.parent.getComponent("SceneManager").updateCoin(); + } + }, null) + } + else { + NumberToImage.numberToImageNodes(cc.fx.GameConfig.GM_INFO.coin, 30, 15, "coin_", this.coin, true); + const dataFail3 = { + outTradeNo: Utils.outTradeNo, + price: price, + payment_name: productId, + payment_num: 1, + type: systemType, + fail_reason: "拉起支付后,付款时网络异常付款失败", + } + cc.fx.GameTool.shushu_Track("payment_fail", dataFail3); + this.btn_Touch = true; + if (this.node.parent.getComponent("JiaZai")) + this.node.parent.getComponent("JiaZai").updateCoin(); + else if (this.node.parent.getComponent("SceneManager")) { + this.node.parent.getComponent("SceneManager").updateCoin(); + } + } + }) + } + }); } }