更新BUG
This commit is contained in:
parent
7fa2297b81
commit
d5ab6e2611
|
@ -2170,7 +2170,7 @@
|
||||||
},
|
},
|
||||||
"_contentSize": {
|
"_contentSize": {
|
||||||
"__type__": "cc.Size",
|
"__type__": "cc.Size",
|
||||||
"width": 160.12,
|
"width": 0,
|
||||||
"height": 50.4
|
"height": 50.4
|
||||||
},
|
},
|
||||||
"_anchorPoint": {
|
"_anchorPoint": {
|
||||||
|
|
|
@ -1593,7 +1593,7 @@ export default class Block extends cc.Component {
|
||||||
effectNode.zIndex = 9999;
|
effectNode.zIndex = 9999;
|
||||||
|
|
||||||
// 添加到 Canvas 节点下
|
// 添加到 Canvas 节点下
|
||||||
canvas.addChild(effectNode);
|
MapConroler._instance.node.parent.addChild(effectNode);
|
||||||
|
|
||||||
this.playMagicAnimation(skeletonComponent, index);
|
this.playMagicAnimation(skeletonComponent, index);
|
||||||
|
|
||||||
|
|
|
@ -191,7 +191,9 @@ export default class JiaZai extends cc.Component {
|
||||||
this.onHideListener = () => {
|
this.onHideListener = () => {
|
||||||
this.onGameHide();
|
this.onGameHide();
|
||||||
};
|
};
|
||||||
|
//@ts-ignore
|
||||||
wx.onShow(this.onShowListener);
|
wx.onShow(this.onShowListener);
|
||||||
|
//@ts-ignore
|
||||||
wx.onHide(this.onHideListener);
|
wx.onHide(this.onHideListener);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -205,7 +207,7 @@ export default class JiaZai extends cc.Component {
|
||||||
}
|
}
|
||||||
|
|
||||||
onGameShow() {
|
onGameShow() {
|
||||||
|
console.log("执行开始游戏gameshow")
|
||||||
cc.fx.GameTool.getHealth((data) => {
|
cc.fx.GameTool.getHealth((data) => {
|
||||||
NumberToImage.numberToImageNodes((cc.fx.GameConfig.GM_INFO.level + 1), 43, 15, "level_", this.level, true);
|
NumberToImage.numberToImageNodes((cc.fx.GameConfig.GM_INFO.level + 1), 43, 15, "level_", this.level, true);
|
||||||
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);
|
||||||
|
@ -260,6 +262,7 @@ export default class JiaZai extends cc.Component {
|
||||||
// //打开heath弹窗
|
// //打开heath弹窗
|
||||||
// this.openHeath();
|
// this.openHeath();
|
||||||
this.uploadToCloud(cc.fx.GameConfig.GM_INFO.level + 1);
|
this.uploadToCloud(cc.fx.GameConfig.GM_INFO.level + 1);
|
||||||
|
console.log("________________1");
|
||||||
this.getMonthlyCardValidityDays();
|
this.getMonthlyCardValidityDays();
|
||||||
this.rewarded();
|
this.rewarded();
|
||||||
console.log('月卡剩余天数 (零点刷新):', cc.fx.GameConfig.GM_INFO.monthTime);
|
console.log('月卡剩余天数 (零点刷新):', cc.fx.GameConfig.GM_INFO.monthTime);
|
||||||
|
@ -468,7 +471,26 @@ export default class JiaZai extends cc.Component {
|
||||||
|
|
||||||
setHealthInfo(type) {
|
setHealthInfo(type) {
|
||||||
if (cc.fx.GameConfig.GM_INFO.hp >= cc.fx.GameConfig.GM_INFO.hp_Max) {
|
if (cc.fx.GameConfig.GM_INFO.hp >= cc.fx.GameConfig.GM_INFO.hp_Max) {
|
||||||
|
if (cc.fx.GameConfig.GM_INFO.userPowerTime != 0) {
|
||||||
|
let nowTime = Math.floor(Date.now() / 1000);
|
||||||
|
if (cc.fx.GameConfig.GM_INFO.userPowerTime > nowTime) {
|
||||||
|
this.stopPowerTime();
|
||||||
|
this.startPowerTime();
|
||||||
|
console.log("还有无限体力时间_____________", (cc.fx.GameConfig.GM_INFO.userPowerTime - nowTime));
|
||||||
|
this.Stamina.getChildByName("skyLine").active = true;
|
||||||
|
this.Stamina.getChildByName("time").opacity = 0;
|
||||||
|
this.Stamina.getChildByName("man").active = false;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
this.Stamina.getChildByName("skyLine").active = false;
|
||||||
|
console.log("无限体力时间已过期");
|
||||||
this.Stamina.getChildByName("man").active = true;
|
this.Stamina.getChildByName("man").active = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
this.Stamina.getChildByName("man").active = true;
|
||||||
|
}
|
||||||
|
|
||||||
this.Stamina.getChildByName("health").active = true;
|
this.Stamina.getChildByName("health").active = true;
|
||||||
NumberToImage.numberToImageNodes(cc.fx.GameConfig.GM_INFO.hp, 25, 15, "hp_", this.Stamina.getChildByName("health"), false);
|
NumberToImage.numberToImageNodes(cc.fx.GameConfig.GM_INFO.hp, 25, 15, "hp_", this.Stamina.getChildByName("health"), false);
|
||||||
this.Stamina.getChildByName("time").active = false;
|
this.Stamina.getChildByName("time").active = false;
|
||||||
|
@ -503,8 +525,11 @@ export default class JiaZai extends cc.Component {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (typeof wx !== 'undefined') {
|
if (typeof wx !== 'undefined') {
|
||||||
|
console.log("执行开始游戏start")
|
||||||
//@ts-ignore
|
//@ts-ignore
|
||||||
|
|
||||||
wx.offShow(this.onShowListener);
|
wx.offShow(this.onShowListener);
|
||||||
|
//@ts-ignore
|
||||||
wx.offHide(this.onHideListener);
|
wx.offHide(this.onHideListener);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -568,11 +593,12 @@ export default class JiaZai extends cc.Component {
|
||||||
this.shopNode.getComponent("shop").init();
|
this.shopNode.getComponent("shop").init();
|
||||||
}
|
}
|
||||||
if (typeof wx !== 'undefined') {
|
if (typeof wx !== 'undefined') {
|
||||||
|
console.log("执行开始游戏shop")
|
||||||
//@ts-ignore
|
//@ts-ignore
|
||||||
wx.offShow(this.onShowListener);
|
wx.offShow(this.onShowListener);
|
||||||
|
//@ts-ignore
|
||||||
wx.offHide(this.onHideListener);
|
wx.offHide(this.onHideListener);
|
||||||
}
|
}
|
||||||
// //console.log("shopNode parent:", this.shopNode.parent);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
openRewardWindow(data, month?: number) {
|
openRewardWindow(data, month?: number) {
|
||||||
|
@ -616,8 +642,10 @@ export default class JiaZai extends cc.Component {
|
||||||
this.monthlyCardNode.getComponent("monthlyCard").juwai = true;
|
this.monthlyCardNode.getComponent("monthlyCard").juwai = true;
|
||||||
}
|
}
|
||||||
if (typeof wx !== 'undefined') {
|
if (typeof wx !== 'undefined') {
|
||||||
|
console.log("执行开始游戏monthlyCard")
|
||||||
//@ts-ignore
|
//@ts-ignore
|
||||||
wx.offShow(this.onShowListener);
|
wx.offShow(this.onShowListener);
|
||||||
|
//@ts-ignore
|
||||||
wx.offHide(this.onHideListener);
|
wx.offHide(this.onHideListener);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -968,8 +996,11 @@ export default class JiaZai extends cc.Component {
|
||||||
|
|
||||||
//获取月卡有效期距离今天的天数
|
//获取月卡有效期距离今天的天数
|
||||||
getMonthlyCardValidityDays(): Promise<number> {
|
getMonthlyCardValidityDays(): Promise<number> {
|
||||||
|
console.log("________________2");
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
Utils.getMonthlyCard((data) => {
|
Utils.getMonthlyCard((data) => {
|
||||||
|
console.log("月卡返回时间:", data);
|
||||||
|
if (data) {
|
||||||
if (data.code === 1) {
|
if (data.code === 1) {
|
||||||
const validityTime = data.data.monthCardTime; // 后端返回的到期时间戳(毫秒)
|
const validityTime = data.data.monthCardTime; // 后端返回的到期时间戳(毫秒)
|
||||||
const today = new Date();
|
const today = new Date();
|
||||||
|
@ -986,6 +1017,10 @@ export default class JiaZai extends cc.Component {
|
||||||
} else {
|
} else {
|
||||||
resolve(0); // 或 reject(data) 根据需要
|
resolve(0); // 或 reject(data) 根据需要
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
resolve(0); // 或 reject(data) 根据需要
|
||||||
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -109,10 +109,14 @@ export default class NewClass extends cc.Component {
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
|
let img = "https://mmocgame.qpic.cn/wechatgame/OiaWk33I6QjgWiatrb5YVUq2p0QRmQgO6rLUWxEQDZ4ib9Ny4Pr8iaHnHI6WdxibY2nPL/0";
|
||||||
|
if (Math.random() < 0.5) {
|
||||||
|
img = "https://mmocgame.qpic.cn/wechatgame/CG5xBibollws251aYD4msEPWCiafrcn4Fgtic4T2wME6sWmdfAUtfibgsWoxm59VadDD/0";
|
||||||
|
}
|
||||||
wx.showShareMenu(() => {
|
wx.showShareMenu(() => {
|
||||||
return {
|
return {
|
||||||
title: '你想玩上怎样的游戏?',
|
title: '你想玩上怎样的游戏?',
|
||||||
imageUrl: '',
|
imageUrl: img,
|
||||||
query: ''
|
query: ''
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
|
@ -49,13 +49,13 @@ export default class NumberToImage extends cc.Component {
|
||||||
for (let i = 0; i < digitNodes.length; i++) {
|
for (let i = 0; i < digitNodes.length; i++) {
|
||||||
const node = digitNodes[i];
|
const node = digitNodes[i];
|
||||||
node.x = startX + i * width;
|
node.x = startX + i * width;
|
||||||
node.parent = targetNode;
|
if (targetNode) node.parent = targetNode;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
for (let i = 0; i < digitNodes.length; i++) {
|
for (let i = 0; i < digitNodes.length; i++) {
|
||||||
const node = digitNodes[i];
|
const node = digitNodes[i];
|
||||||
node.x = i * width + cha;
|
node.x = i * width + cha;
|
||||||
node.parent = targetNode;
|
if (targetNode) node.parent = targetNode;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -100,7 +100,7 @@ export default class NumberToImage extends cc.Component {
|
||||||
// 将节点添加到目标节点下
|
// 将节点添加到目标节点下
|
||||||
node.x = i * width;
|
node.x = i * width;
|
||||||
if (i > 1) node.x += 35;
|
if (i > 1) node.x += 35;
|
||||||
node.parent = targetNode;
|
if (targetNode) node.parent = targetNode;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -166,7 +166,7 @@ export default class NumberToImage extends cc.Component {
|
||||||
node.x = startX + i * width;
|
node.x = startX + i * width;
|
||||||
if (i > 1) node.x += 20;
|
if (i > 1) node.x += 20;
|
||||||
if (i > 3) node.x += 20;
|
if (i > 3) node.x += 20;
|
||||||
node.parent = targetNode;
|
if (targetNode) node.parent = targetNode;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
for (let i = 0; i < digitNodes.length; i++) {
|
for (let i = 0; i < digitNodes.length; i++) {
|
||||||
|
@ -174,7 +174,7 @@ export default class NumberToImage extends cc.Component {
|
||||||
node.x = i * width;
|
node.x = i * width;
|
||||||
if (i > 1) node.x += 20;
|
if (i > 1) node.x += 20;
|
||||||
if (i > 3) node.x += 20;
|
if (i > 3) node.x += 20;
|
||||||
node.parent = targetNode;
|
if (targetNode) node.parent = targetNode;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -181,6 +181,7 @@ export default class Revive extends cc.Component {
|
||||||
let shopComp = shop.getComponent("shop");
|
let shopComp = shop.getComponent("shop");
|
||||||
if (shopComp) {
|
if (shopComp) {
|
||||||
shopComp.openShop();
|
shopComp.openShop();
|
||||||
|
shopComp.init();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
cc.fx.GameConfig.GM_INFO.revive = 1;
|
cc.fx.GameConfig.GM_INFO.revive = 1;
|
||||||
|
@ -392,6 +393,7 @@ export default class Revive extends cc.Component {
|
||||||
|
|
||||||
// 移除 wx.onShow 监听器
|
// 移除 wx.onShow 监听器
|
||||||
if (cc.sys.platform === cc.sys.WECHAT_GAME && this.onShowListener) {
|
if (cc.sys.platform === cc.sys.WECHAT_GAME && this.onShowListener) {
|
||||||
|
console.log("复活移除监听");
|
||||||
//@ts-ignore
|
//@ts-ignore
|
||||||
wx.offShow(this.onShowListener);
|
wx.offShow(this.onShowListener);
|
||||||
console.log("🔥🔥🔥🔥🔥🔥🔥🔥")
|
console.log("🔥🔥🔥🔥🔥🔥🔥🔥")
|
||||||
|
|
|
@ -105,7 +105,7 @@ export default class Reward extends cc.Component {
|
||||||
const createNodeWithDelay = (row: number, col: number) => {
|
const createNodeWithDelay = (row: number, col: number) => {
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
const rewardNode = cc.instantiate(this.rewardNode);
|
const rewardNode = cc.instantiate(this.rewardNode);
|
||||||
rewardNode.parent = this.node;
|
if (this.node) rewardNode.parent = this.node;
|
||||||
// 计算当前行的总宽度
|
// 计算当前行的总宽度
|
||||||
// let startX = 0;
|
// let startX = 0;
|
||||||
// if (row === 0) {
|
// if (row === 0) {
|
||||||
|
|
|
@ -77,6 +77,7 @@ export default class NewClass extends cc.Component {
|
||||||
}
|
}
|
||||||
cc.fx.GameTool.shushu_Track("resource_cost", data);
|
cc.fx.GameTool.shushu_Track("resource_cost", data);
|
||||||
cc.fx.GameConfig.GM_INFO.hp = cc.fx.GameConfig.GM_INFO.hp_Max;
|
cc.fx.GameConfig.GM_INFO.hp = cc.fx.GameConfig.GM_INFO.hp_Max;
|
||||||
|
cc.fx.GameConfig.GM_INFO.min_Time = 0;
|
||||||
const parentNode = cc.find("Canvas"); // 假设 JiaZai 挂在 Canvas 节点
|
const parentNode = cc.find("Canvas"); // 假设 JiaZai 挂在 Canvas 节点
|
||||||
if (parentNode) {
|
if (parentNode) {
|
||||||
const jiazaiComp = parentNode.getComponent(JiaZai);
|
const jiazaiComp = parentNode.getComponent(JiaZai);
|
||||||
|
|
|
@ -147,12 +147,12 @@ export default class Utils {
|
||||||
Utils.POST("wx/getOrderReward", { outTradeNo: orderTemp }, res => {
|
Utils.POST("wx/getOrderReward", { outTradeNo: orderTemp }, res => {
|
||||||
//console.log("告知服务器发货:", res);
|
//console.log("告知服务器发货:", res);
|
||||||
if (res.code === 1) {
|
if (res.code === 1) {
|
||||||
//console.log("告知服务器发货成功:", res);
|
console.log("告知服务器发货成功:", res);
|
||||||
// 请求成功,调用回调并返回结果
|
// 请求成功,调用回调并返回结果
|
||||||
callBack(res);
|
callBack(res);
|
||||||
} else {
|
} else {
|
||||||
// 请求失败,增加重试次数并设置下一次请求的延迟
|
// 请求失败,增加重试次数并设置下一次请求的延迟
|
||||||
//console.log("告知服务器发货失败:", res);
|
console.log("告知服务器发货失败:", res);
|
||||||
attempt++;
|
attempt++;
|
||||||
if (attempt <= delays.length) {
|
if (attempt <= delays.length) {
|
||||||
setTimeout(sendRequest, delays[attempt - 1]);
|
setTimeout(sendRequest, delays[attempt - 1]);
|
||||||
|
|
|
@ -176,7 +176,7 @@ export default class NewClass extends cc.Component {
|
||||||
//购买月卡
|
//购买月卡
|
||||||
buyMonthCard(id) {
|
buyMonthCard(id) {
|
||||||
Utils.setMonthlyCard(0, (data) => {
|
Utils.setMonthlyCard(0, (data) => {
|
||||||
console.log("购买月卡'✅ ", data.code);
|
console.log("购买月卡", data.code);
|
||||||
if (data.code == 1) {
|
if (data.code == 1) {
|
||||||
// let rewardData = [
|
// let rewardData = [
|
||||||
// { type: "coin", count: 6000 },
|
// { type: "coin", count: 6000 },
|
||||||
|
@ -188,11 +188,13 @@ export default class NewClass extends cc.Component {
|
||||||
// cc.fx.GameTool.changeCoin(6000);
|
// cc.fx.GameTool.changeCoin(6000);
|
||||||
const jiazaiNode = cc.find("Canvas"); // 假设 JiaZai 挂在 Canvas 节点
|
const jiazaiNode = cc.find("Canvas"); // 假设 JiaZai 挂在 Canvas 节点
|
||||||
const jiazaiComp = jiazaiNode.getComponent(JiaZai);
|
const jiazaiComp = jiazaiNode.getComponent(JiaZai);
|
||||||
|
|
||||||
|
if (jiazaiComp) {
|
||||||
|
console.log("获取到JiaZai组件", jiazaiComp);
|
||||||
jiazaiComp.getMonthlyCardValidityDays().then(days => {
|
jiazaiComp.getMonthlyCardValidityDays().then(days => {
|
||||||
cc.fx.GameConfig.GM_INFO.monthTime = days;
|
cc.fx.GameConfig.GM_INFO.monthTime = days;
|
||||||
NumberToImage.numberToImageNodes(days, 35, 20, "month_", this.monthCardTime, true);
|
NumberToImage.numberToImageNodes(days, 35, 20, "month_", this.monthCardTime, true);
|
||||||
});
|
});
|
||||||
if (jiazaiComp) {
|
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
jiazaiComp.setHealthInfo(false);
|
jiazaiComp.setHealthInfo(false);
|
||||||
jiazaiComp.startTimeCutDown();
|
jiazaiComp.startTimeCutDown();
|
||||||
|
@ -207,46 +209,6 @@ export default class NewClass extends cc.Component {
|
||||||
this.monthCardBtn2.active = true;
|
this.monthCardBtn2.active = true;
|
||||||
this.monthCardTime.active = true;
|
this.monthCardTime.active = true;
|
||||||
cc.fx.GameConfig.GM_INFO.doubleCoin = 2;
|
cc.fx.GameConfig.GM_INFO.doubleCoin = 2;
|
||||||
// if (this.juwai == true) {
|
|
||||||
// if (jiazaiComp) {
|
|
||||||
// setTimeout(() => {
|
|
||||||
// jiazaiComp.openRewardWindow(rewardData, 1);
|
|
||||||
// }, 300);
|
|
||||||
// }
|
|
||||||
// console.log("月卡奖励juwai");
|
|
||||||
// } else {
|
|
||||||
// // 尝试获取SceneManager组件
|
|
||||||
// const jiazaiComp1 = jiazaiNode.getComponent(SceneManager);
|
|
||||||
// if (jiazaiComp1) {
|
|
||||||
// setTimeout(() => {
|
|
||||||
// jiazaiComp1.updateCoin();
|
|
||||||
// // 确保openRewardWindow方法存在
|
|
||||||
// if (typeof jiazaiComp1.openRewardWindow === 'function') {
|
|
||||||
// jiazaiComp1.openRewardWindow(rewardData);
|
|
||||||
// } else {
|
|
||||||
// console.error("SceneManager组件中没有openRewardWindow方法");
|
|
||||||
// // 尝试使用JiaZai组件的openRewardWindow方法作为备选
|
|
||||||
// const jiazaiComp2 = jiazaiNode.getComponent(JiaZai);
|
|
||||||
// if (jiazaiComp2 && typeof jiazaiComp2.openRewardWindow === 'function') {
|
|
||||||
// jiazaiComp2.openRewardWindow(rewardData);
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// }, 300);
|
|
||||||
// console.log("月卡奖励junei");
|
|
||||||
// } else {
|
|
||||||
// console.log("无法获取SceneManager组件,尝试获取JiaZai组件");
|
|
||||||
// // 尝试获取JiaZai组件作为备选
|
|
||||||
// const jiazaiComp2 = jiazaiNode.getComponent(JiaZai);
|
|
||||||
// if (jiazaiComp2) {
|
|
||||||
// setTimeout(() => {
|
|
||||||
// jiazaiComp2.updateCoin();
|
|
||||||
// jiazaiComp2.openRewardWindow(rewardData);
|
|
||||||
// }, 300);
|
|
||||||
// } else {
|
|
||||||
// console.error("无法获取JiaZai组件和SceneManager组件");
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
cc.fx.GameTool.setUserHealth(0, (data) => {
|
cc.fx.GameTool.setUserHealth(0, (data) => {
|
||||||
cc.fx.GameTool.getHealth(null);
|
cc.fx.GameTool.getHealth(null);
|
||||||
})
|
})
|
||||||
|
@ -270,6 +232,7 @@ export default class NewClass extends cc.Component {
|
||||||
let shopComp = shop.getComponent("shop");
|
let shopComp = shop.getComponent("shop");
|
||||||
if (shopComp) {
|
if (shopComp) {
|
||||||
shopComp.openShop();
|
shopComp.openShop();
|
||||||
|
shopComp.init();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -58,19 +58,21 @@ export default class NewClass extends cc.Component {
|
||||||
start() {
|
start() {
|
||||||
this.btn_Touch = true;
|
this.btn_Touch = true;
|
||||||
this.openShop();
|
this.openShop();
|
||||||
this.init();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
init() {
|
init() {
|
||||||
let flag = cc.fx.GameTool.getSetScreenResolutionFlag();
|
let flag = cc.fx.GameTool.getSetScreenResolutionFlag();
|
||||||
if (flag) {
|
if (flag) {
|
||||||
|
console.log("shop设置分辨率");
|
||||||
|
if (this.node.getChildByName("itemcontent"))
|
||||||
this.node.getChildByName("itemcontent").getChildByName("view").height = 1500;
|
this.node.getChildByName("itemcontent").getChildByName("view").height = 1500;
|
||||||
}
|
}
|
||||||
this.onShowListener = null;
|
this.onShowListener = null;
|
||||||
if (cc.sys.platform === cc.sys.WECHAT_GAME) {
|
if (cc.sys.platform === cc.sys.WECHAT_GAME) {
|
||||||
// 定义监听函数
|
// 定义监听函数
|
||||||
|
console.log("shop添加监听");
|
||||||
this.onShowListener = () => {
|
this.onShowListener = () => {
|
||||||
console.log("回到前台");
|
console.log("回到前台,shop");
|
||||||
this.onShow();
|
this.onShow();
|
||||||
};
|
};
|
||||||
//@ts-ignore
|
//@ts-ignore
|
||||||
|
@ -163,7 +165,7 @@ export default class NewClass extends cc.Component {
|
||||||
closeShop(data, currentCoin) {
|
closeShop(data, currentCoin) {
|
||||||
// 移除 wx.onShow 监听器
|
// 移除 wx.onShow 监听器
|
||||||
if (cc.sys.platform === cc.sys.WECHAT_GAME && this.onShowListener) {
|
if (cc.sys.platform === cc.sys.WECHAT_GAME && this.onShowListener) {
|
||||||
console.log("!!!!!!!!!!移除onshow");
|
console.log("shop移除onshow");
|
||||||
console.log(currentCoin);
|
console.log(currentCoin);
|
||||||
//@ts-ignore
|
//@ts-ignore
|
||||||
wx.offShow(this.onShowListener);
|
wx.offShow(this.onShowListener);
|
||||||
|
@ -194,10 +196,6 @@ export default class NewClass extends cc.Component {
|
||||||
|
|
||||||
onShow() {
|
onShow() {
|
||||||
console.log("从后台进入前台 onShow");
|
console.log("从后台进入前台 onShow");
|
||||||
//如果月卡打开就return
|
|
||||||
if (this.monthCard) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
const systemInfo = wx.getSystemInfoSync();
|
const systemInfo = wx.getSystemInfoSync();
|
||||||
if (systemInfo.platform === 'ios') {
|
if (systemInfo.platform === 'ios') {
|
||||||
if (cc.sys.platform === cc.sys.WECHAT_GAME) {
|
if (cc.sys.platform === cc.sys.WECHAT_GAME) {
|
||||||
|
@ -227,10 +225,7 @@ export default class NewClass extends cc.Component {
|
||||||
}
|
}
|
||||||
cc.fx.GameTool.shushu_Track("payment", dataSuccess);
|
cc.fx.GameTool.shushu_Track("payment", dataSuccess);
|
||||||
let name = "购买金币道具:" + iosID;
|
let name = "购买金币道具:" + iosID;
|
||||||
let version = cc.fx.GameTool.getWechatGameVersion();
|
|
||||||
if (version == "正式版") {
|
|
||||||
MiniGameSdk.API.yinli_Pay(iosAmount, iosOutTradeNo, name)
|
MiniGameSdk.API.yinli_Pay(iosAmount, iosOutTradeNo, name)
|
||||||
}
|
|
||||||
|
|
||||||
Utils.setPayInfo(
|
Utils.setPayInfo(
|
||||||
(res) => {
|
(res) => {
|
||||||
|
@ -329,9 +324,13 @@ export default class NewClass extends cc.Component {
|
||||||
this.Stamina.getChildByName("time").active = false;
|
this.Stamina.getChildByName("time").active = false;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
this.Stamina.getChildByName("man").active = false;
|
const winCOIN = cc.find("Canvas"); // 假设 Canvas 节点
|
||||||
this.Stamina.getChildByName("health").active = true;
|
if (winCOIN) {
|
||||||
NumberToImage.numberToImageNodes(cc.fx.GameConfig.GM_INFO.hp, 25, 15, "hp_", this.Stamina.getChildByName("health"), false);
|
const wincoin = winCOIN.getComponent(SceneManager);
|
||||||
|
if (wincoin) {
|
||||||
|
MapConroler._instance.setPropNum();
|
||||||
|
console.log("局内");
|
||||||
|
cc.fx.GameTool.getHealth((data) => {
|
||||||
this.Stamina.getChildByName("time").active = true;
|
this.Stamina.getChildByName("time").active = true;
|
||||||
if (cc.fx.GameConfig.GM_INFO.min_Time != 0) {
|
if (cc.fx.GameConfig.GM_INFO.min_Time != 0) {
|
||||||
let time = cc.fx.GameTool.getTimeMargin(cc.fx.GameConfig.GM_INFO.min_Time);
|
let time = cc.fx.GameTool.getTimeMargin(cc.fx.GameConfig.GM_INFO.min_Time);
|
||||||
|
@ -342,6 +341,25 @@ export default class NewClass extends cc.Component {
|
||||||
this.stopTimeCutDown();
|
this.stopTimeCutDown();
|
||||||
this.startTimeCutDown();
|
this.startTimeCutDown();
|
||||||
}
|
}
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
this.Stamina.getChildByName("time").active = true;
|
||||||
|
if (cc.fx.GameConfig.GM_INFO.min_Time != 0) {
|
||||||
|
let time = cc.fx.GameTool.getTimeMargin(cc.fx.GameConfig.GM_INFO.min_Time);
|
||||||
|
this.Stamina.getChildByName("time").getComponent(cc.Label).string = time;
|
||||||
|
let power = cc.fx.GameTool.getUserPowerTime();
|
||||||
|
if (!power) this.Stamina.getChildByName("time").opacity = 255;
|
||||||
|
else this.Stamina.getChildByName("time").opacity = 0;
|
||||||
|
this.stopTimeCutDown();
|
||||||
|
this.startTimeCutDown();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
this.Stamina.getChildByName("man").active = false;
|
||||||
|
this.Stamina.getChildByName("health").active = true;
|
||||||
|
NumberToImage.numberToImageNodes(cc.fx.GameConfig.GM_INFO.hp, 25, 15, "hp_", this.Stamina.getChildByName("health"), false);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -551,17 +569,16 @@ export default class NewClass extends cc.Component {
|
||||||
}
|
}
|
||||||
cc.fx.GameTool.shushu_Track("payment", dataSuccess);
|
cc.fx.GameTool.shushu_Track("payment", dataSuccess);
|
||||||
let name = "购买金币道具:" + productId;
|
let name = "购买金币道具:" + productId;
|
||||||
let version = cc.fx.GameTool.getWechatGameVersion();
|
|
||||||
if (version == "正式版") {
|
|
||||||
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_________正式发货", Utils.outTradeNo);
|
||||||
MiniGameSdk.API.showToast("充值成功");
|
MiniGameSdk.API.showToast("充值成功");
|
||||||
cc.fx.GameTool.shopBuy(productId, false);
|
cc.fx.GameTool.shopBuy(productId, false);
|
||||||
if (productId == "unlimited_health_bundle_10" ||
|
if (productId == "unlimited_health_bundle_10" ||
|
||||||
|
@ -698,7 +715,11 @@ export default class NewClass extends cc.Component {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
openmonthCard() {
|
openmonthCard() {
|
||||||
|
if (cc.sys.platform === cc.sys.WECHAT_GAME && this.onShowListener) {
|
||||||
|
console.log("shop移除onshow11111");
|
||||||
|
//@ts-ignore
|
||||||
|
wx.offShow(this.onShowListener);
|
||||||
|
}
|
||||||
const winCOIN = cc.find("Canvas"); // 假设 Canvas 节点
|
const winCOIN = cc.find("Canvas"); // 假设 Canvas 节点
|
||||||
if (winCOIN) {
|
if (winCOIN) {
|
||||||
const wincoin = winCOIN.getComponent(SceneManager);
|
const wincoin = winCOIN.getComponent(SceneManager);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user