Compare commits

...

2 Commits

Author SHA1 Message Date
YZ\249929363 36924eed8a Merge branch 'main' of https://git.sparkus.cn/yangzhao/cb 2025-07-18 17:41:57 +08:00
YZ\249929363 d80656fa89 日更 2025-07-18 17:41:47 +08:00
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) {
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) {

View File

@ -384,128 +384,126 @@ export default class NewClass extends cc.Component {
type: systemType,
}
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("充值成功");
cc.fx.GameTool.shopBuy(productId);
// 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();
// }
// }
// })
// }
// });
//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();
}
}
})
}
});
}
}