50 lines
1.4 KiB
JavaScript
50 lines
1.4 KiB
JavaScript
|
|
"use strict";
|
||
|
|
cc._RF.push(module, '876f2QajYtJwY7JCRMkyfGM', 'cmp.adventure.item.buff');
|
||
|
|
// Scripts/mod/pve/adventure/cmp/cmp.adventure.item.buff.js
|
||
|
|
|
||
|
|
"use strict";
|
||
|
|
|
||
|
|
var ItemBase = require("nx.fx.sv.expand.item");
|
||
|
|
var ADVCT = require("adventure_controller");
|
||
|
|
cc.Class({
|
||
|
|
"extends": ItemBase,
|
||
|
|
properties: {
|
||
|
|
ico: {
|
||
|
|
"default": null,
|
||
|
|
type: cc.Node
|
||
|
|
},
|
||
|
|
isShowText: false
|
||
|
|
},
|
||
|
|
// LIFE-CYCLE CALLBACKS:
|
||
|
|
rebind: function rebind(_idx, _data, _key) {
|
||
|
|
this._super(_idx, _data, _key);
|
||
|
|
this.setData(_data);
|
||
|
|
},
|
||
|
|
setData: function setData(data) {
|
||
|
|
if (nx.dt.objEmpty(data)) return;
|
||
|
|
var model_type = ADVCT.getInstance().getPlayModel();
|
||
|
|
var cfg = null;
|
||
|
|
if (model_type == 1) {
|
||
|
|
cfg = game.configs.adventure_endless_data.data_buff_icon[data.bid];
|
||
|
|
} else {
|
||
|
|
cfg = game.configs.adventure_weekly_data.data_buff_icon[data.bid];
|
||
|
|
}
|
||
|
|
this.cfg = cfg;
|
||
|
|
var res_path = cc.js.formatStr("prefab/pve/starlost/icons/%s", cfg.icon[data.time - 1]);
|
||
|
|
nx.gui.setSpriteFrame(this.ico, "", res_path);
|
||
|
|
if (this.isShowText) {
|
||
|
|
//顯示描述文本
|
||
|
|
nx.gui.setString(this.node, "scroll/txt", cfg.desc);
|
||
|
|
}
|
||
|
|
},
|
||
|
|
start: function start() {},
|
||
|
|
onTouchBuffTip: function onTouchBuffTip() {
|
||
|
|
if (!this.mdata) return;
|
||
|
|
nx.bridge.createPanel("WndAdventureMsg", {
|
||
|
|
type: 2,
|
||
|
|
data: this.cfg
|
||
|
|
});
|
||
|
|
} // update (dt) {},
|
||
|
|
});
|
||
|
|
|
||
|
|
cc._RF.pop();
|