80 lines
2.3 KiB
JavaScript
80 lines
2.3 KiB
JavaScript
"use strict";
|
|
cc._RF.push(module, 'd5a8bweRbJDkb3z+8KzUo8N', 'cmp.adventure.item.goods');
|
|
// Scripts/mod/pve/adventure/cmp/cmp.adventure.item.goods.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
|
|
},
|
|
num: {
|
|
"default": null,
|
|
type: cc.Node
|
|
},
|
|
gname: {
|
|
"default": null,
|
|
type: cc.Node
|
|
}
|
|
},
|
|
// 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 res_id = null;
|
|
var good_name = "";
|
|
if (model_type == 1) {
|
|
res_id = game.configs.adventure_endless_data.data_item_icon[data.bid];
|
|
good_name = game.configs.adventure_endless_data.data_item_name[data.bid];
|
|
} else {
|
|
res_id = game.configs.adventure_weekly_data.data_adventure_event[data.bid].item_icon;
|
|
}
|
|
nx.gui.setSpriteFrame(this.ico, "", cc.js.formatStr("prefab/pve/starlost/icons/%s", res_id));
|
|
|
|
//設置數量
|
|
nx.gui.setString(this.num, "", data.num);
|
|
nx.gui.setString(this.gname, "", good_name);
|
|
this.setNameColor(good_name);
|
|
},
|
|
// update (dt) {},
|
|
setNameColor: function setNameColor(str) {
|
|
if (str.indexOf("ATK") != -1) {
|
|
this.gname.color = new cc.Color(218, 133, 240);
|
|
} else if (str.indexOf("CRIT") != -1) {
|
|
this.gname.color = new cc.Color(254, 110, 60);
|
|
} else if (str.indexOf("LV") != -1) {
|
|
this.gname.color = new cc.Color(117, 231, 136);
|
|
} else if (str.indexOf("DEF") != -1) {
|
|
this.gname.color = new cc.Color(218, 133, 240);
|
|
} else {
|
|
this.gname.color = new cc.Color(255, 255, 255);
|
|
}
|
|
},
|
|
onTouchBuffTip: function onTouchBuffTip() {
|
|
if (!this.mdata) return;
|
|
nx.bridge.createPanel("WndAdventureMsg", {
|
|
type: 3,
|
|
data: this.mdata
|
|
});
|
|
},
|
|
useProp: function useProp() {
|
|
if (!this.mdata) return;
|
|
if (this.mdata.can_use == 1) {
|
|
ADVCT.getInstance().send29507(this.mdata.bid, ADVCT.getInstance().getPlayModel());
|
|
} else {
|
|
//查看詳細
|
|
}
|
|
}
|
|
});
|
|
|
|
cc._RF.pop(); |