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": {
"__id__": 96
},
"monthCardBtn": null,
"monthCardBtn2": null,
"monthCardTime": null,
"monthCard": null,
"monthCardReward": {
"__id__": 322
},
"cardTime": {
"__id__": 341
},
"_id": "0dna+7W/NMp6RyIrSQLx5u"
},
{

View File

@ -64,14 +64,20 @@ export default class JiaZai extends cc.Component {
setUi: cc.Node = null;
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)
monthCardBtn: cc.Node = null;
monthCardReward: cc.Node = null;
//剩余天数
@property(cc.Node)
monthCardBtn2: cc.Node = null;
@property(cc.Node)
monthCardTime: cc.Node = null;
@property(cc.Node)
monthCard: cc.Node = null;
cardTime: cc.Node = null;
// LIFE-CYCLE CALLBACKS:
onLoad() {
@ -131,17 +137,7 @@ export default class JiaZai extends cc.Component {
this.setFirstInfo();
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 {
if (cc.fx.GameConfig.GM_INFO.first) {
@ -197,8 +193,9 @@ export default class JiaZai extends cc.Component {
// //打开heath弹窗
// this.openHeath();
this.uploadToCloud(cc.fx.GameConfig.GM_INFO.level + 1);
// this.rewarded();
// this.getMonthlyCardValidityDays();
this.getMonthlyCardValidityDays();
this.rewarded();
Utils.getMonthlyCard((data) => {
if (data.code == 1) {
cc.fx.GameConfig.GM_INFO.hp_Max = 7;
@ -763,63 +760,53 @@ export default class JiaZai extends cc.Component {
openMonthCard() {
this.openMonthlyCard();
this.monthlyCardNode.getComponent("monthlyCard").home = 1;
// this.monthCard.active = true;
// 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(25, 35, 20, "month_", this.monthCardTime, true);
// }
// })
}
//关闭界面
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();
// 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() {
Utils.setMonthlyCard(0, (data) => {
console.log("购买月卡'✅ ", data.code);
if (data.code == 1) {
let rewardData = [
{ type: "coin", count: 6000 },
]
cc.fx.GameConfig.GM_INFO.hp_Max = 7;
cc.fx.GameConfig.GM_INFO.hp = 7;
cc.fx.GameTool.changeCoin(6000);
setTimeout(() => {
this.updateCoin();
this.setHealthInfo(false);
this.startTimeCutDown();
this.openRewardWindow(rewardData, 1);
}, 300);
cc.fx.GameTool.setUserHealth(0, (data) => {
cc.fx.GameTool.getHealth(null);
})
this.monthCardBtn.active = false;
this.monthCardBtn2.active = true;
NumberToImage.numberToImageNodes(cc.fx.GameConfig.GM_INFO.monthTime, 35, 20, "month_", this.monthCardTime, true);
// }
// //购买月卡
// buyMonthCard() {
// Utils.setMonthlyCard(0, (data) => {
// console.log("购买月卡'✅ ", data.code);
// if (data.code == 1) {
// let rewardData = [
// { type: "coin", count: 6000 },
// ]
// cc.fx.GameConfig.GM_INFO.hp_Max = 7;
// cc.fx.GameConfig.GM_INFO.hp = 7;
// cc.fx.GameTool.changeCoin(6000);
// setTimeout(() => {
// this.updateCoin();
// this.setHealthInfo(false);
// this.startTimeCutDown();
// this.openRewardWindow(rewardData, 1);
// }, 300);
// cc.fx.GameTool.setUserHealth(0, (data) => {
// cc.fx.GameTool.getHealth(null);
// })
// this.monthCardBtn.active = false;
// this.monthCardBtn2.active = true;
// NumberToImage.numberToImageNodes(cc.fx.GameConfig.GM_INFO.monthTime, 35, 20, "month_", this.monthCardTime, true);
}
})
}
// }
// })
// }
rewarded() {
rewarded() {
Utils.monthGetReward((data) => {
if (data.data == null) {
console.log("到期");
@ -837,33 +824,17 @@ export default class JiaZai extends cc.Component {
this.startTimeCutDown();
}, 300);
}
if (data.data != null && data.code == 0) {
console.log("未到期已领取");
}
if (data.code == 1) {
cc.fx.GameTool.changeCoin(500);
this.updateCoin();
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);
this.monthCardReward.active = true;
NumberToImage.numberToImageNodes(cc.fx.GameConfig.GM_INFO.monthTime, 40, 20, "month_", this.cardTime, true);
}
})
}
//缓存弹窗
monthH() {
// return;
@ -913,7 +884,8 @@ export default class JiaZai extends cc.Component {
const remainingDays = Math.max(0, days);
cc.fx.GameConfig.GM_INFO.monthTime = remainingDays;
console.log('月卡剩余天数 (零点刷新):', remainingDays);
console.log('%c月卡剩余天数 (零点刷新): ' + remainingDays,
'color: green; font-weight: bold;');
} 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) {}
}

View File

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

View File

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