55 lines
1.4 KiB
JavaScript
55 lines
1.4 KiB
JavaScript
"use strict";
|
|
cc._RF.push(module, '0adf7AqT0NPWKFVgR21Ulxj', 'cmp.item.chat.face');
|
|
// Scripts/mod/chat/cmp/cmp.item.chat.face.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: {
|
|
icon: {
|
|
"default": null,
|
|
type: cc.Sprite
|
|
},
|
|
atlas: {
|
|
"default": null,
|
|
type: cc.SpriteAtlas
|
|
}
|
|
},
|
|
// 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 input_str = "#" + this.mdata.id;
|
|
var params = {};
|
|
params.face_text = input_str;
|
|
gcore.GlobalEvent.fire(ChatEvent.INPUT_SELECT_ITEM, this.key, params);
|
|
},
|
|
outFocus: function outFocus() {},
|
|
setData: function setData(data, _key) {
|
|
if (nx.dt.objEmpty(data)) {
|
|
return false;
|
|
}
|
|
this.key = _key;
|
|
this.icon.spriteFrame = this.atlas.getSpriteFrame(data.name);
|
|
// var face_path = cc.path.join("resDB/emoj",data.name);
|
|
// cc.loader.loadRes( face_path, cc.SpriteFrame, ( err,face_sd ) =>{
|
|
// this.icon.spriteFrame = face_sd;
|
|
// } );
|
|
} // update (dt) {},
|
|
});
|
|
|
|
cc._RF.pop(); |