133 lines
4.1 KiB
JavaScript
133 lines
4.1 KiB
JavaScript
|
|
"use strict";
|
||
|
|
cc._RF.push(module, 'e46629X2fpK37gz2dotOtDP', 'cmp.act.accumulative.wnd');
|
||
|
|
// Scripts/mod/acts/accumulative/cmp/cmp.act.accumulative.wnd.js
|
||
|
|
|
||
|
|
"use strict";
|
||
|
|
|
||
|
|
/******************************************************************
|
||
|
|
*
|
||
|
|
* 新服纍充
|
||
|
|
*
|
||
|
|
******************************************************************/
|
||
|
|
var ActPage = require("act.page.base");
|
||
|
|
var NxSpine = require("nx.fx.spine");
|
||
|
|
var Mod = require("act.accumulative.mod");
|
||
|
|
var themeMod = require("acts.mod");
|
||
|
|
var FID = require("bridge.function.ids");
|
||
|
|
cc.Class({
|
||
|
|
"extends": ActPage,
|
||
|
|
properties: {
|
||
|
|
nodGift: {
|
||
|
|
type: cc.Node,
|
||
|
|
"default": null
|
||
|
|
},
|
||
|
|
spRole: {
|
||
|
|
"default": null,
|
||
|
|
type: NxSpine
|
||
|
|
},
|
||
|
|
nodEndTime: {
|
||
|
|
"default": null,
|
||
|
|
type: cc.Node
|
||
|
|
}
|
||
|
|
},
|
||
|
|
// 初始化
|
||
|
|
build: function build(_data) {
|
||
|
|
var _this = this;
|
||
|
|
this._super(_data);
|
||
|
|
this.spRole.load("resDB/models/H30097/show", function (_e) {
|
||
|
|
if (!_e) {
|
||
|
|
_this.spRole.action("action1", true);
|
||
|
|
} else {
|
||
|
|
_this.spRole.stop();
|
||
|
|
}
|
||
|
|
});
|
||
|
|
|
||
|
|
// 活动监听
|
||
|
|
this.mod.vbind(this, [["accumulative", this.freshGift.bind(this)]]);
|
||
|
|
},
|
||
|
|
onEnable: function onEnable() {
|
||
|
|
// 请求信息
|
||
|
|
this.mod.reqAccumulativeData();
|
||
|
|
},
|
||
|
|
// 销毁
|
||
|
|
onDestroy: function onDestroy() {
|
||
|
|
// 活动监听解除
|
||
|
|
if (this.mod) {
|
||
|
|
this.mod.vunbind(this);
|
||
|
|
}
|
||
|
|
delete this.mod;
|
||
|
|
this._super();
|
||
|
|
},
|
||
|
|
freshGift: function freshGift(_data) {
|
||
|
|
var _this2 = this;
|
||
|
|
this.accumulative = _data;
|
||
|
|
if (!this.accumulative) {
|
||
|
|
return;
|
||
|
|
}
|
||
|
|
var left = this.accumulative.remain_sec != 0 ? this.accumulative.remain_sec : 0.1;
|
||
|
|
nx.gui.setCdTxt(this.nodEndTime, "txt", left, function () {
|
||
|
|
nx.gui.setString(_this2.nodEndTime, "txt", nx.text.getKey("lab_planesafk_main_have_over"));
|
||
|
|
});
|
||
|
|
this.gifts = this.accumulative.aim_list;
|
||
|
|
this.gifts.sort(function (a, b) {
|
||
|
|
return a.aim - b.aim;
|
||
|
|
});
|
||
|
|
nx.gui.gocChildren(this.nodGift, "view/content", this.gifts.length);
|
||
|
|
var chd = nx.gui.find(this.nodGift, "view/content").children;
|
||
|
|
for (var i = 0; i < chd.length; i++) {
|
||
|
|
var nod = chd[i];
|
||
|
|
var giftInfo = this.gifts[i];
|
||
|
|
if (giftInfo) {
|
||
|
|
nx.gui.setStringRich(nod, "cnt/title", giftInfo.aim_str);
|
||
|
|
var cmp = nx.gui.getComponent(nod, "cnt/list", "cmp.common.itemlayout");
|
||
|
|
if (cmp) {
|
||
|
|
cmp.rebuild(giftInfo.item_list);
|
||
|
|
}
|
||
|
|
nod.zIndex = i;
|
||
|
|
|
||
|
|
/**{"aim":21,"aim_str":"累充21圓",
|
||
|
|
* "status":1,"item_list":[{"bid":3,"num":50},{"bid":10403,"num":1},{"bid":10002,"num":5}],
|
||
|
|
* "aim_args":[]}* */
|
||
|
|
nx.gui.setStringRich(nod, "cnt/show", nx.text.format("ChargeShow", this.accumulative.finish, giftInfo.aim));
|
||
|
|
nx.gui.setActive(nod, "cnt/charge", giftInfo.status == 0);
|
||
|
|
nx.gui.setActive(nod, "cnt/get", giftInfo.status != 0);
|
||
|
|
var btn = nx.gui.getComponent(nod, "cnt/get", cc.Button);
|
||
|
|
if (btn) {
|
||
|
|
btn.interactable = giftInfo.status == 1;
|
||
|
|
nx.gui.setActive(nod, "cnt/get/tip", giftInfo.status == 1);
|
||
|
|
giftInfo.status == 1 ? nx.gui.setOutlineColor(nod, "cnt/get/num", new cc.color("#b85833")) : nx.gui.setOutlineColor(nod, "cnt/get/num", cc.Color.BLACK);
|
||
|
|
giftInfo.status == 1 ? nx.gui.setString(nod, "cnt/get/num", nx.text.getKey("Get")) : nx.gui.setString(nod, "cnt/get/num", nx.text.getKey("Got"));
|
||
|
|
}
|
||
|
|
}
|
||
|
|
}
|
||
|
|
},
|
||
|
|
onTouchBuy: function onTouchBuy(_btn) {
|
||
|
|
if (this.accumulative.remain_sec == 0) {
|
||
|
|
nx.tbox("lab_recruit_hero_window_tip_6");
|
||
|
|
return;
|
||
|
|
}
|
||
|
|
var number = _btn.parent.parent.zIndex;
|
||
|
|
var aim = this.gifts[number].aim;
|
||
|
|
if (this.gifts[number].status == 2) {
|
||
|
|
var show = nx.text.getKey("ReWards") + nx.text.getKey("Got");
|
||
|
|
nx.tbox(show);
|
||
|
|
return;
|
||
|
|
}
|
||
|
|
this.mod.reqAccumulativeGift(this.accumulative.bid, aim);
|
||
|
|
},
|
||
|
|
onTouchCharge: function onTouchCharge() {
|
||
|
|
nx.bridge.createPanel("WndPayment", {
|
||
|
|
key: "recharge"
|
||
|
|
});
|
||
|
|
}
|
||
|
|
|
||
|
|
// close: function(){
|
||
|
|
|
||
|
|
// let theme = themeMod.getInstance().queryTheme( this.mod.data.theme_id );
|
||
|
|
|
||
|
|
// nx.bridge.jumper.jump2Window( FID.ActOpenServer, theme );
|
||
|
|
// this._super();
|
||
|
|
// },
|
||
|
|
});
|
||
|
|
|
||
|
|
cc._RF.pop();
|