"use strict"; cc._RF.push(module, '38215Q8ZSROKaC5Wmg6Q9JE', 'cmp.item.chat.goods'); // Scripts/mod/chat/cmp/cmp.item.chat.goods.js "use strict"; var SvcItem = require("nx.fx.sv.expand.item"); var PathTool = require("pathtool"); var ChatEvent = require("chat_event"); cc.Class({ "extends": SvcItem, properties: { bg: { "default": null, type: cc.Sprite }, icon: { "default": null, type: cc.Sprite } }, // LIFE-CYCLE CALLBACKS: // 数据重置 rebind: function rebind(_idx, _data, _key) { this._super(_idx, _data, _key); // 刷新 this.setData(_data, _key); }, onLoad: function onLoad() {}, start: function start() {}, onFocus: function onFocus() { if (nx.dt.objEmpty(this.mdata)) { return false; } var params = {}; if (this.type_key == 2) { params.item_data = this.mdata.info; gcore.GlobalEvent.fire(ChatEvent.INPUT_SELECT_ITEM, this.type_key, params); } else { params.hero_info = this.mdata.hero_info; params.item_data = this.mdata.item_data; gcore.GlobalEvent.fire(ChatEvent.INPUT_SELECT_ITEM, this.type_key, params); } }, outFocus: function outFocus() {}, setData: function setData(data, _key) { if (nx.dt.objEmpty(data)) { return false; } this.type_key = _key; if (_key == 2) { // 图标设置 nx.bridge.setIcon(this.icon, "", data.info.config.icon); this.setQuality(data.info.config.quality); this.select_cb = data.cb; } else if (_key == 3) { // 图标设置 nx.bridge.setIcon(this.icon, "", data.item_data.config.icon); this.setQuality(data.item_data.quality); this.select_cb = data.cb; } }, // 单设:品质 setQuality: function setQuality(_qa) { if (this.bg) { var qa = null; if (nx.dt.numPositive(_qa)) { qa = cc.path.join("coms/images", "bg_qa" + _qa); } nx.gui.setSpriteFrame(this.bg, "", qa); } // if( this.nodName ) { // let color = BackPackConst.quality_color( _qa ); // let cur = this.nodName.node.color; // cur.fromHEX( color ); // this.nodName.node.color = cur; // } } // update (dt) {}, }); cc._RF.pop();