"use strict"; cc._RF.push(module, '75f93q1ynlNDKMBCYPljrBH', 'cmp.act.sign30'); // Scripts/mod/acts/sign30/cmp.act.sign30.js "use strict"; var BasePage = require("act.page.base"); var FxSVC = require("nx.fx.sv.expand"); var NxSpine = require("nx.fx.spine"); var FID = require("bridge.function.ids"); cc.Class({ "extends": BasePage, properties: { nodReward: { "default": null, type: FxSVC }, spRole: { "default": null, type: NxSpine } }, // 初始化 build: function build(_data) { var _this = this; this._super(_data); this.unscheduleAllCallbacks(); var cfgs = gdata(this.data.config, "data_award"); var now = new Date(); var tomon = now.getMonth(); var rlist = []; var rewards = cfgs[tomon + 1]; if (rewards) { for (var mon in rewards) { var reward = rewards[mon]; rlist.push(reward.rewards[0]); } } this.nodReward.rebuild(rlist); this.spRole.load("resDB/models/H30069/show", function (_e) { if (!_e) { _this.spRole.action("action1", true); } else { _this.spRole.stop(); } }); // 视图监听 nx.bridge.acts.vbind(this, [["sign30", this.freshDayReward.bind(this)]]); // this.mod.reqBaseData(); nx.debug("$ActPage onEnable"); // 获取指定主题信息 }, // 开启 onEnable: function onEnable() { var _this2 = this; this.mod.reqBaseData(); if (nx.bridge.plot && nx.bridge.plot.isDoing()) { this.scheduleOnce(function () { _this2.dealPlot(); }, 0.005); // this.nodFocus.getComponent( "cmp.plot.trigger" ).pID = "sign"; // this.nodFocus.getComponent( "cmp.plot.trigger" ).regist(); } // console.log( "當前的首次充值信息" + JSON.stringify( this.mod.reqChargeData() ) ); }, // 销毁 onDestroy: function onDestroy() { // 活动监听解除 if (nx.bridge.acts) { nx.bridge.acts.vunbind(this); } this._super(); }, freshDayReward: function freshDayReward(_data) { if (nx.dt.objEmpty(_data)) { return; } this.chargeinfo = this.mod.reqChargeData(); this.freshState(_data); }, freshState: function freshState(_data) { var _this3 = this; if (!_data) { return; } var day = _data.day; var status = _data.status; var children = this.nodReward.bindSCV.content.children; for (var i = 0; i < children.length; ++i) { var temp = children[i]; if (temp.svItem) { temp.svItem.setAgainFun(function () { if (_this3.chargeinfo && _this3.chargeinfo.status == 0) { // 否则提示退出游戏 nx.mbox("lab_sign_panel_tip1", ["Cancle", "Sure"], function (_key, _box) { _box.close(); if (_key == "Sure") { nx.bridge.jumper.jump2Window(FID.Charge); } }); // nx.tbox( "充值" ); } else { _this3.mod.reqSign(); } // 提示 彈充值相關 }); if (i == day && status == 0) { temp.svItem.onFocus(); temp.svItem.setStaus(0); temp.svItem.setFun(function () { _this3.mod.reqSign(); }); } else if (i == day - 1 && status == 1) { temp.svItem.outFocus(); temp.svItem.setStaus(1, this.chargeinfo && this.chargeinfo.status == 1); } else { if (i < day && status == 2 || i < day) { temp.svItem.outFocus(); var state = 2; temp.svItem.setStaus(state); } } } } }, dealPlot: function dealPlot() { var children = this.nodReward.bindSCV.content.children; var nod = children[0]; var cell = nx.gui.find(this, "plot"); var pos = nod.convertToWorldSpaceAR(cc.Vec2.ZERO); cell.position = cell.parent.convertToNodeSpaceAR(pos); cell.width = nod.width; cell.height = nod.height; }, onTouchSign: function onTouchSign() { this.mod.reqSign(); } }); cc._RF.pop();