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);
MiniGameSdk.API.showToast("充值成功"); this.openLoad();
cc.fx.GameTool.shopBuy(productId);
// this.openLoad();
//console.log("7.14_____________________", "调用充值接口"); //console.log("7.14_____________________", "调用充值接口");
// Utils.buyProp(id, count, price, (res) => { Utils.buyProp(id, count, price, (res) => {
// //console.log("获得充值结果", res); //console.log("获得充值结果", res);
// if (res == null) { if (res == null) {
// MiniGameSdk.API.showToast("充值失败"); MiniGameSdk.API.showToast("充值失败");
// this.btn_Touch = true; this.btn_Touch = true;
// const dataFail = { const dataFail = {
// outTradeNo: Utils.outTradeNo, outTradeNo: Utils.outTradeNo,
// price: price, price: price,
// payment_name: productId, payment_name: productId,
// payment_num: 1, payment_num: 1,
// type: systemType, type: systemType,
// fail_reason: "网络异常,没有拉起支付", fail_reason: "网络异常,没有拉起支付",
// } }
// cc.fx.GameTool.shushu_Track("payment_fail", dataFail); cc.fx.GameTool.shushu_Track("payment_fail", dataFail);
// this.closeLoad(); this.closeLoad();
// return; return;
// } }
// else if (res.err) { else if (res.err) {
// MiniGameSdk.API.showToast("充值失败"); MiniGameSdk.API.showToast("充值失败");
// //console.log(res); //console.log(res);
// this.btn_Touch = true; this.btn_Touch = true;
// let name = "支付拉起失败"; let name = "支付拉起失败";
// if (res.errCode == -2) { if (res.errCode == -2) {
// name = "用户取消充值"; name = "用户取消充值";
// } }
// const dataFail = { const dataFail = {
// outTradeNo: Utils.outTradeNo, outTradeNo: Utils.outTradeNo,
// price: price, price: price,
// payment_name: productId, payment_name: productId,
// payment_num: 1, payment_num: 1,
// type: systemType, type: systemType,
// fail_reason: name, fail_reason: name,
// } }
// cc.fx.GameTool.shushu_Track("payment_fail", dataFail); cc.fx.GameTool.shushu_Track("payment_fail", dataFail);
// this.closeLoad(); this.closeLoad();
// return; return;
// } }
// else { else {
// Utils.getPayInfo((data) => { Utils.getPayInfo((data) => {
// //console.log("7.14_______________充值成功,准备轮训"); //console.log("7.14_______________充值成功,准备轮训");
// //console.log("获得轮训结果:", data); //console.log("获得轮训结果:", data);
// this.closeLoad(); this.closeLoad();
// if (data.data.pay_state == 1) { if (data.data.pay_state == 1) {
// this.btn_Touch = true; this.btn_Touch = true;
// MiniGameSdk.API.showToast("取消充值"); MiniGameSdk.API.showToast("取消充值");
// const dataFail2 = { const dataFail2 = {
// outTradeNo: Utils.outTradeNo, outTradeNo: Utils.outTradeNo,
// price: price, price: price,
// payment_name: productId, payment_name: productId,
// payment_num: 1, payment_num: 1,
// type: systemType, type: systemType,
// fail_reason: "用户取消支付", fail_reason: "用户取消支付",
// } }
// cc.fx.GameTool.shushu_Track("payment_fail", dataFail2); cc.fx.GameTool.shushu_Track("payment_fail", dataFail2);
// } }
// else if (data.data.pay_state == 2) { else if (data.data.pay_state == 2) {
// this.btn_Touch = true; this.btn_Touch = true;
// const dataSuccess = { const dataSuccess = {
// outTradeNo: Utils.outTradeNo, outTradeNo: Utils.outTradeNo,
// price: price, price: price,
// payment_name: productId, payment_name: productId,
// payment_num: 1, payment_num: 1,
// type: systemType, type: systemType,
// } }
// cc.fx.GameTool.shushu_Track("payment", dataSuccess); cc.fx.GameTool.shushu_Track("payment", dataSuccess);
// let name = "购买金币道具:" + productId; let name = "购买金币道具:" + productId;
// MiniGameSdk.API.yinli_Pay(price, Utils.outTradeNo, name) MiniGameSdk.API.yinli_Pay(price, Utils.outTradeNo, name)
// //console.log("7.14_______________充值成功,轮训成功,准备发货"); //console.log("7.14_______________充值成功,轮训成功,准备发货");
// Utils.setPayInfo( Utils.setPayInfo(
// (res) => { (res) => {
// //console.log("设置轮训结果:", res); //console.log("设置轮训结果:", res);
// if (res.code === 1) { if (res.code === 1) {
// //console.log("7.14_________正式发货"); //console.log("7.14_________正式发货");
// MiniGameSdk.API.showToast("充值成功"); MiniGameSdk.API.showToast("充值成功");
// cc.fx.GameTool.shopBuy(productId); cc.fx.GameTool.shopBuy(productId);
// //console.log("充值成功获得金币"); //console.log("充值成功获得金币");
// } }
// else { else {
// MiniGameSdk.API.showToast("网络异常,充值奖励将在登录后再次发放"); MiniGameSdk.API.showToast("网络异常,充值奖励将在登录后再次发放");
// const dataFail4 = { const dataFail4 = {
// outTradeNo: Utils.outTradeNo, outTradeNo: Utils.outTradeNo,
// price: price, price: price,
// payment_name: productId, payment_name: productId,
// payment_num: 1, payment_num: 1,
// type: systemType, type: systemType,
// fail_reason: "成功付款,但是发货时请求服务器失败,充值成功未发货", fail_reason: "成功付款,但是发货时请求服务器失败,充值成功未发货",
// } }
// cc.fx.GameTool.shushu_Track("payment_fail", dataFail4); cc.fx.GameTool.shushu_Track("payment_fail", dataFail4);
// } }
// NumberToImage.numberToImageNodes(cc.fx.GameConfig.GM_INFO.coin, 30, 15, "coin_", this.coin, true); NumberToImage.numberToImageNodes(cc.fx.GameConfig.GM_INFO.coin, 30, 15, "coin_", this.coin, true);
// if (this.node.parent.getComponent("JiaZai")) if (this.node.parent.getComponent("JiaZai"))
// this.node.parent.getComponent("JiaZai").updateCoin(); this.node.parent.getComponent("JiaZai").updateCoin();
// else if (this.node.parent.getComponent("SceneManager")) { else if (this.node.parent.getComponent("SceneManager")) {
// this.node.parent.getComponent("SceneManager").updateCoin(); this.node.parent.getComponent("SceneManager").updateCoin();
// } }
// }, null) }, null)
// } }
// else { else {
// NumberToImage.numberToImageNodes(cc.fx.GameConfig.GM_INFO.coin, 30, 15, "coin_", this.coin, true); NumberToImage.numberToImageNodes(cc.fx.GameConfig.GM_INFO.coin, 30, 15, "coin_", this.coin, true);
// const dataFail3 = { const dataFail3 = {
// outTradeNo: Utils.outTradeNo, outTradeNo: Utils.outTradeNo,
// price: price, price: price,
// payment_name: productId, payment_name: productId,
// payment_num: 1, payment_num: 1,
// type: systemType, type: systemType,
// fail_reason: "拉起支付后,付款时网络异常付款失败", fail_reason: "拉起支付后,付款时网络异常付款失败",
// } }
// cc.fx.GameTool.shushu_Track("payment_fail", dataFail3); cc.fx.GameTool.shushu_Track("payment_fail", dataFail3);
// this.btn_Touch = true; this.btn_Touch = true;
// if (this.node.parent.getComponent("JiaZai")) if (this.node.parent.getComponent("JiaZai"))
// this.node.parent.getComponent("JiaZai").updateCoin(); this.node.parent.getComponent("JiaZai").updateCoin();
// else if (this.node.parent.getComponent("SceneManager")) { else if (this.node.parent.getComponent("SceneManager")) {
// this.node.parent.getComponent("SceneManager").updateCoin(); this.node.parent.getComponent("SceneManager").updateCoin();
// } }
// } }
// }) })
// } }
// }); });
} }
} }