Compare commits

..

No commits in common. "634de5cc35796ab1e22dae6eb6ce24677512356f" and "fe660408e201017aad614d4cad305624dba9a4fe" have entirely different histories.

4 changed files with 86 additions and 98 deletions

View File

@ -16731,10 +16731,12 @@
"setUi": { "setUi": {
"__id__": 96 "__id__": 96
}, },
"monthCardBtn": null, "monthCardReward": {
"monthCardBtn2": null, "__id__": 322
"monthCardTime": null, },
"monthCard": null, "cardTime": {
"__id__": 341
},
"_id": "0dna+7W/NMp6RyIrSQLx5u" "_id": "0dna+7W/NMp6RyIrSQLx5u"
}, },
{ {

View File

@ -64,14 +64,20 @@ export default class JiaZai extends cc.Component {
setUi: cc.Node = null; setUi: cc.Node = null;
scheduleCallback2: any; scheduleCallback2: any;
//月卡 //月卡
// @property(cc.Node)
// monthCardBtn: cc.Node = null;
// @property(cc.Node)
// monthCardBtn2: cc.Node = null;
// @property(cc.Node)
// monthCardTime: cc.Node = null;
// @property(cc.Node)
// monthCard: cc.Node = null;
@property(cc.Node) @property(cc.Node)
monthCardBtn: cc.Node = null; monthCardReward: cc.Node = null;
//剩余天数
@property(cc.Node) @property(cc.Node)
monthCardBtn2: cc.Node = null; cardTime: cc.Node = null;
@property(cc.Node)
monthCardTime: cc.Node = null;
@property(cc.Node)
monthCard: cc.Node = null;
// LIFE-CYCLE CALLBACKS: // LIFE-CYCLE CALLBACKS:
onLoad() { onLoad() {
@ -131,18 +137,8 @@ export default class JiaZai extends cc.Component {
this.setFirstInfo(); this.setFirstInfo();
cc.fx.GameConfig.GM_INFO.first = false; cc.fx.GameConfig.GM_INFO.first = false;
} }
let power = cc.fx.GameTool.getUserPowerTime();
if (cc.fx.GameConfig.GM_INFO.hp < 1 && power == false) {
MiniGameSdk.API.showToast("体力值不足,无法进入好友关卡");
setTimeout(() => {
this.openHeath();
}, 1000);
return;
}
else {
cc.fx.GameConfig.LEVEL_INFO_init(true, 1000); cc.fx.GameConfig.LEVEL_INFO_init(true, 1000);
} }
}
else { else {
if (cc.fx.GameConfig.GM_INFO.first) { if (cc.fx.GameConfig.GM_INFO.first) {
//console.log("————————准备注册事件", cc.fx.GameConfig.GM_INFO.openid); //console.log("————————准备注册事件", cc.fx.GameConfig.GM_INFO.openid);
@ -197,8 +193,9 @@ 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);
// this.rewarded();
// this.getMonthlyCardValidityDays(); this.getMonthlyCardValidityDays();
this.rewarded();
Utils.getMonthlyCard((data) => { Utils.getMonthlyCard((data) => {
if (data.code == 1) { if (data.code == 1) {
cc.fx.GameConfig.GM_INFO.hp_Max = 7; cc.fx.GameConfig.GM_INFO.hp_Max = 7;
@ -763,7 +760,10 @@ export default class JiaZai extends cc.Component {
openMonthCard() { openMonthCard() {
this.openMonthlyCard(); this.openMonthlyCard();
this.monthlyCardNode.getComponent("monthlyCard").home = 1; this.monthlyCardNode.getComponent("monthlyCard").home = 1;
// this.monthCard.active = true;
}
//关闭界面
// closeMonthCard() {
// Utils.getMonthlyCard((data) => { // Utils.getMonthlyCard((data) => {
// if (data.msg == "不在有效期") { // if (data.msg == "不在有效期") {
// this.monthCardBtn.active = true; // this.monthCardBtn.active = true;
@ -771,53 +771,40 @@ export default class JiaZai extends cc.Component {
// } else { // } else {
// this.monthCardBtn.active = false; // this.monthCardBtn.active = false;
// this.monthCardBtn2.active = true; // this.monthCardBtn2.active = true;
// NumberToImage.numberToImageNodes(25, 35, 20, "month_", this.monthCardTime, true); // NumberToImage.numberToImageNodes(cc.fx.GameConfig.GM_INFO.monthTime, 35, 20, "month_", this.monthCardTime, true);
// } // }
// }) // })
} // this.monthCard.active = false;
//关闭界面 // this.rewarded();
closeMonthCard() {
Utils.getMonthlyCard((data) => {
if (data.msg == "不在有效期") {
this.monthCardBtn.active = true;
this.monthCardBtn2.active = false;
} else {
this.monthCardBtn.active = false;
this.monthCardBtn2.active = true;
NumberToImage.numberToImageNodes(cc.fx.GameConfig.GM_INFO.monthTime, 35, 20, "month_", this.monthCardTime, true);
}
})
this.monthCard.active = false;
this.rewarded();
} // }
//购买月卡 // //购买月卡
buyMonthCard() { // buyMonthCard() {
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 },
] // ]
cc.fx.GameConfig.GM_INFO.hp_Max = 7; // cc.fx.GameConfig.GM_INFO.hp_Max = 7;
cc.fx.GameConfig.GM_INFO.hp = 7; // cc.fx.GameConfig.GM_INFO.hp = 7;
cc.fx.GameTool.changeCoin(6000); // cc.fx.GameTool.changeCoin(6000);
setTimeout(() => { // setTimeout(() => {
this.updateCoin(); // this.updateCoin();
this.setHealthInfo(false); // this.setHealthInfo(false);
this.startTimeCutDown(); // this.startTimeCutDown();
this.openRewardWindow(rewardData, 1); // this.openRewardWindow(rewardData, 1);
}, 300); // }, 300);
cc.fx.GameTool.setUserHealth(0, (data) => { // cc.fx.GameTool.setUserHealth(0, (data) => {
cc.fx.GameTool.getHealth(null); // cc.fx.GameTool.getHealth(null);
}) // })
this.monthCardBtn.active = false; // this.monthCardBtn.active = false;
this.monthCardBtn2.active = true; // this.monthCardBtn2.active = true;
NumberToImage.numberToImageNodes(cc.fx.GameConfig.GM_INFO.monthTime, 35, 20, "month_", this.monthCardTime, true); // NumberToImage.numberToImageNodes(cc.fx.GameConfig.GM_INFO.monthTime, 35, 20, "month_", this.monthCardTime, true);
} // }
}) // })
} // }
rewarded() { rewarded() {
Utils.monthGetReward((data) => { Utils.monthGetReward((data) => {
@ -837,33 +824,17 @@ export default class JiaZai extends cc.Component {
this.startTimeCutDown(); this.startTimeCutDown();
}, 300); }, 300);
} }
if (data.data != null && data.code == 0) { if (data.data != null && data.code == 0) {
console.log("未到期已领取"); console.log("未到期已领取");
} }
if (data.code == 1) { if (data.code == 1) {
cc.fx.GameTool.changeCoin(500); this.monthCardReward.active = true;
this.updateCoin(); NumberToImage.numberToImageNodes(cc.fx.GameConfig.GM_INFO.monthTime, 40, 20, "month_", this.cardTime, true);
let rewardData = [
{ type: "coin", count: 500 },
]
setTimeout(() => {
this.openRewardWindow(rewardData);
}, 500);
const dataTemp = {
change_reason: "month",
id: "1001",
num: 500,
compensate: false
}
cc.fx.GameTool.shushu_Track("resource_get", dataTemp);
} }
}) })
} }
//缓存弹窗 //缓存弹窗
monthH() { monthH() {
// return; // return;
@ -913,7 +884,8 @@ export default class JiaZai extends cc.Component {
const remainingDays = Math.max(0, days); const remainingDays = Math.max(0, days);
cc.fx.GameConfig.GM_INFO.monthTime = remainingDays; cc.fx.GameConfig.GM_INFO.monthTime = remainingDays;
console.log('月卡剩余天数 (零点刷新):', remainingDays); console.log('%c月卡剩余天数 (零点刷新): ' + remainingDays,
'color: green; font-weight: bold;');
} else { } else {
} }
}); });
@ -967,5 +939,19 @@ export default class JiaZai extends cc.Component {
} }
} }
onCardReward() {
cc.fx.GameTool.changeCoin(500);
this.updateCoin();
const dataTemp = {
change_reason: "month",
id: "1001",
num: 500,
compensate: false
}
cc.fx.GameTool.shushu_Track("resource_get", dataTemp);
this.monthCardReward.active = false;
}
// update (dt) {} // update (dt) {}
} }

View File

@ -391,8 +391,8 @@
0, 0,
0, 0,
1, 1,
1, 2,
1, 2,
1 1
] ]
}, },

View File

@ -1,7 +1,7 @@
{ {
"title": "ColorBlock", "title": "ColorBlock",
"packageName": "org.cocos2d.demo", "packageName": "org.cocos2d.demo",
"startScene": "9c08062d-4cf1-4b6e-a8ba-4a3881cc7e7d", "startScene": "2de37ca5-4d32-4e18-88c6-c12770e085e9",
"excludeScenes": [], "excludeScenes": [],
"orientation": { "orientation": {
"landscapeRight": true, "landscapeRight": true,