Files
fc/dev/project/library/imports/7d/7da635cb-12f4-4fcf-8745-a77917ab825c.js
2026-05-24 10:21:26 +08:00

140 lines
3.3 KiB
JavaScript

"use strict";
cc._RF.push(module, '7da63XLEvRPz4dFp3kXq4Jc', 'act.sign15.page');
// Scripts/mod/acts/sign15/act.sign15.page.js
"use strict";
/******************************************************************
*
* 签到15日
*
******************************************************************/
var ActPage = require("act.page.base");
var NxSpine = require("nx.fx.spine");
var FxSVC = require("nx.fx.sv.expand");
var TipsController = require("tips_controller");
var BridgeItemBinder = require("bridge.binder.item.icon.count");
cc.Class({
"extends": ActPage,
properties: {
spRole: {
"default": null,
type: NxSpine
},
imgLogo: {
"default": null,
type: cc.Node
},
lstTask: {
"default": null,
type: FxSVC
},
nodDate: {
"default": null,
type: cc.Node
},
nodItem1: {
"default": null,
type: BridgeItemBinder
},
nodItem2: {
"default": null,
type: BridgeItemBinder
}
},
// 初始化
build: function build(_data) {
this._super(_data);
// 活动监听
this.mod.vbind(this, [["sign15", this.freshTask.bind(this)]]);
this.freshBasic();
},
// 销毁
onDestroy: function onDestroy() {
// 活动监听解除
if (this.mod) {
this.mod.vunbind(this);
}
this._super();
},
// 置空
setEmpty: function setEmpty() {},
// 基本信息
freshBasic: function freshBasic() {
var _this = this;
// 置空
if (nx.dt.objEmpty(this.data)) {
this.setEmpty();
return;
}
// 刷新活动日期
var time = nx.bridge.time.toNeedTime(this.data.end_time);
nx.gui.setString(this.nodDate, "txt", time);
var cfgs = this.mod.queryConfig();
if (nx.dt.objEmpty(cfgs)) {
return;
}
this.nodItem1.setID(cfgs.item1);
this.nodItem2.setID(cfgs.item2);
// 看板娘
var sp = cc.path.join("resDB/models", cfgs.res, "show");
this.spRole.load(sp, function (_e) {
if (!_e) {
_this.spRole.action(cfgs.action, true);
} else {
_this.spRole.stop();
}
});
// 文本LOGO
var img = cc.path.join("locals/{lang}/images", cfgs.desc);
nx.gui.setSpriteFrame(this.imgLogo, "", nx.res.fmtPath(img));
},
// 任务刷新
freshTask: function freshTask(_lst) {
// 空
var cfgs = this.mod.queryTaskList();
if (nx.dt.arrEmpty(_lst) || nx.dt.objEmpty(cfgs)) {
this.lstTask.rebuild([]);
return;
}
// 重建
this.tasks = [];
for (var i = 0; i < _lst.length; ++i) {
var item = _lst[i];
var task = nx.dt.objClone(cfgs[item.day]);
task.status = item.status;
task.mod = this.mod;
this.tasks.push(task);
}
// 0不可领取 1可领取 2已领取
var PR = [2, 1, 3];
this.tasks.sort(function (a, b) {
if (a.status == b.status) {
return a.day - b.day;
}
return PR[a.status] - PR[b.status];
});
this.lstTask.rebuild(this.tasks);
},
// 点击规则
onTouchRule: function onTouchRule() {
var rule = this.mod ? this.mod.queryRule() : "";
if (nx.dt.strNEmpty(rule)) {
var TC = TipsController.getInstance();
TC.showTextPanel("tip", rule);
}
},
// 点击商城
onTouchShop: function onTouchShop() {
nx.bridge.jumper.jump2Window(474);
}
});
cc._RF.pop();