123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172 |
- const DWTool = require("../utils/DWTool");
- const WeChat = require('../net/WeChat');
- const GameModule = require("../utils/GameModule");
- cc.Class({
- extends: cc.Component,
- properties: {
- btnArr: [cc.Button],
- moneyLabels: [cc.Label],
- titleLabels: [cc.Label],
- recommendSprite: cc.Node,
- },
-
-
- start () {
- },
- init(shopDatas) {
- this._shopDatas = shopDatas;
-
- if (this._shopDatas.length == 1) {
- this.recommendSprite.active = false;
- this.btnArr[0].node.active = false;
- this.btnArr[2].node.active = false;
-
-
- this.titleLabels[1].string = '';
-
- let cdTime = shopDatas[0].cdTime;
- let dayTime = 1000 * 60 * 60 * 24;
- let days = parseInt(cdTime / dayTime);
- let hours = parseInt((parseInt(cdTime) % dayTime ) / (1000 * 60 * 60));
- if (days === 0) {
- if (hours == 0) {
- this.moneyLabels[1].string = DWTool.calculateTime(shopDatas[0].cdTime / 1000);
- } else {
- this.moneyLabels[1].string = '剩余' + hours + '小时';
- }
- } else {
- this.moneyLabels[1].string = '剩余' + days + '天' + hours + '小时';
- }
-
- this.btnArr[1].interactable = false;
-
- } else {
- this.moneyLabels[0].string = '¥' + this._shopDatas[1].price;
- this.moneyLabels[1].string = '¥' + this._shopDatas[0].price;
- this.moneyLabels[2].string = '¥' + this._shopDatas[2].price;
- }
- },
- closeButtonAction() {
- GameModule.audioMng.playClickButton();
- this.node.destroy();
- },
-
- buyAction() {
- GameModule.audioMng.playClickButton();
- WeChat.jumpCustomerServices()
- }
-
- });
|