84 lines
2.2 KiB
JavaScript
84 lines
2.2 KiB
JavaScript
|
|
"use strict";
|
||
|
|
cc._RF.push(module, '2bc80D7Dr5BO7nsy/F4TcN+', 'cmp.act.custom.item');
|
||
|
|
// Scripts/mod/acts/sevencustomization/cmp/cmp.act.custom.item.js
|
||
|
|
|
||
|
|
"use strict";
|
||
|
|
|
||
|
|
var BridgeComponent = require("bridge.component");
|
||
|
|
var Mod = require("act.sevencustom.mod");
|
||
|
|
/*****
|
||
|
|
* 七日定制 子節點相關設定 包含 對子節點進行 檔位 數值設定等
|
||
|
|
*/
|
||
|
|
|
||
|
|
cc.Class({
|
||
|
|
"extends": BridgeComponent,
|
||
|
|
properties: {
|
||
|
|
nodMask: {
|
||
|
|
"default": null,
|
||
|
|
type: cc.Node
|
||
|
|
},
|
||
|
|
nodGifts: {
|
||
|
|
"default": null,
|
||
|
|
type: cc.Node
|
||
|
|
}
|
||
|
|
},
|
||
|
|
freshInfo: function freshInfo(_data) {
|
||
|
|
var data = _data;
|
||
|
|
var active = data.active;
|
||
|
|
this.day = _data.day;
|
||
|
|
this.reward = _data.reward;
|
||
|
|
this.config = _data.config, nx.gui.setActive(this.nodMask, "", !active);
|
||
|
|
this.freshReward();
|
||
|
|
},
|
||
|
|
freshReward: function freshReward() {
|
||
|
|
var chd = this.nodGifts.children;
|
||
|
|
for (var i = 0; i < chd.length; i++) {
|
||
|
|
var nod = chd[i];
|
||
|
|
var cmp = nx.gui.getComponent(nod, "", cc.Button);
|
||
|
|
if (cmp) {
|
||
|
|
cmp.interactable = false;
|
||
|
|
}
|
||
|
|
for (var n = 0; n < nod.children.length; n++) {
|
||
|
|
var pnod = nod.children[n];
|
||
|
|
pnod.cate = i;
|
||
|
|
pnod.touchId = n + 1;
|
||
|
|
}
|
||
|
|
}
|
||
|
|
},
|
||
|
|
setFun: function setFun(_fun) {
|
||
|
|
this.cb = _fun;
|
||
|
|
},
|
||
|
|
onTouchAdd: function onTouchAdd(_cate) {
|
||
|
|
nx.bridge.createPanel("WndActSevenCustomSelect", {
|
||
|
|
day: this.day,
|
||
|
|
config: this.config,
|
||
|
|
cate: _cate.parent.parent.cate,
|
||
|
|
pos: _cate.parent.parent.touchId
|
||
|
|
});
|
||
|
|
},
|
||
|
|
onTouchChange: function onTouchChange(_cate) {
|
||
|
|
var info = _cate.parent.parent;
|
||
|
|
var select = [];
|
||
|
|
for (var i = 0; i < info.children.length; i++) {
|
||
|
|
var nod = info.children[i];
|
||
|
|
var cmp = nx.gui.getComponent(nod, "item/item", "cmp.item.base");
|
||
|
|
if (cmp) {
|
||
|
|
select.push(cmp.mdata);
|
||
|
|
}
|
||
|
|
}
|
||
|
|
nx.bridge.createPanel("WndActSevenCustomSelect", {
|
||
|
|
day: this.day,
|
||
|
|
config: this.config,
|
||
|
|
cate: _cate.parent.cate,
|
||
|
|
pos: _cate.parent.touchId,
|
||
|
|
select: select
|
||
|
|
});
|
||
|
|
},
|
||
|
|
onTouchGet: function onTouchGet(_cate) {
|
||
|
|
var day = this.day + 1;
|
||
|
|
var cate = _cate.parent.cate + 1;
|
||
|
|
Mod.getInstance().reqMakeSureGift(cate, day);
|
||
|
|
}
|
||
|
|
});
|
||
|
|
|
||
|
|
cc._RF.pop();
|