This commit is contained in:
YZ\249929363 2025-07-18 17:41:47 +08:00
parent a8250acd35
commit d80656fa89
2 changed files with 120 additions and 123 deletions

View File

@ -198,9 +198,8 @@ export default class JiaZai extends cc.Component {
if (cc.fx.GameConfig.GM_INFO.hp < 5) { if (cc.fx.GameConfig.GM_INFO.hp < 5) {
this.startHeathTimeCutDown(timeNode); 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],只显示第二个按钮 // 体力为0显示spriteFrames[1],只显示第二个按钮
if (switchButtons[0]) { switchButtons[0].active = false; swichs[0].active = false; } if (switchButtons[0]) { switchButtons[0].active = false; swichs[0].active = false; }
if (switchButtons[1]) { switchButtons[1].active = true; swichs[1].active = true; } 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) { } else if (cc.fx.GameConfig.GM_INFO.hp < 5 && cc.fx.GameConfig.GM_INFO.hp > 0) {

View File

@ -384,128 +384,126 @@ export default class NewClass extends cc.Component {
type: systemType, type: systemType,
} }
cc.fx.GameTool.shushu_Track("init_order", data); cc.fx.GameTool.shushu_Track("init_order", data);
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("充值成功"); MiniGameSdk.API.showToast("充值成功");
cc.fx.GameTool.shopBuy(productId); cc.fx.GameTool.shopBuy(productId);
// this.openLoad(); //console.log("充值成功获得金币");
//console.log("7.14_____________________", "调用充值接口"); }
// Utils.buyProp(id, count, price, (res) => { else {
// //console.log("获得充值结果", res); MiniGameSdk.API.showToast("网络异常,充值奖励将在登录后再次发放");
// if (res == null) { const dataFail4 = {
// MiniGameSdk.API.showToast("充值失败"); outTradeNo: Utils.outTradeNo,
// this.btn_Touch = true; price: price,
// const dataFail = { payment_name: productId,
// outTradeNo: Utils.outTradeNo, payment_num: 1,
// price: price, type: systemType,
// payment_name: productId, fail_reason: "成功付款,但是发货时请求服务器失败,充值成功未发货",
// payment_num: 1, }
// type: systemType, cc.fx.GameTool.shushu_Track("payment_fail", dataFail4);
// fail_reason: "网络异常,没有拉起支付", }
// } NumberToImage.numberToImageNodes(cc.fx.GameConfig.GM_INFO.coin, 30, 15, "coin_", this.coin, true);
// cc.fx.GameTool.shushu_Track("payment_fail", dataFail); if (this.node.parent.getComponent("JiaZai"))
// this.closeLoad(); this.node.parent.getComponent("JiaZai").updateCoin();
// return; else if (this.node.parent.getComponent("SceneManager")) {
// } this.node.parent.getComponent("SceneManager").updateCoin();
// else if (res.err) { }
// MiniGameSdk.API.showToast("充值失败"); }, null)
// //console.log(res); }
// this.btn_Touch = true; else {
// let name = "支付拉起失败"; NumberToImage.numberToImageNodes(cc.fx.GameConfig.GM_INFO.coin, 30, 15, "coin_", this.coin, true);
// if (res.errCode == -2) { const dataFail3 = {
// name = "用户取消充值"; outTradeNo: Utils.outTradeNo,
// } price: price,
// const dataFail = { payment_name: productId,
// outTradeNo: Utils.outTradeNo, payment_num: 1,
// price: price, type: systemType,
// payment_name: productId, fail_reason: "拉起支付后,付款时网络异常付款失败",
// payment_num: 1, }
// type: systemType, cc.fx.GameTool.shushu_Track("payment_fail", dataFail3);
// fail_reason: name, this.btn_Touch = true;
// } if (this.node.parent.getComponent("JiaZai"))
// cc.fx.GameTool.shushu_Track("payment_fail", dataFail); this.node.parent.getComponent("JiaZai").updateCoin();
// this.closeLoad(); else if (this.node.parent.getComponent("SceneManager")) {
// return; this.node.parent.getComponent("SceneManager").updateCoin();
// } }
// 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();
// }
// }
// })
// }
// });
} }
} }