63 lines
1.3 KiB
JavaScript
63 lines
1.3 KiB
JavaScript
|
|
const 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( _idx, _data, _key ) {
|
||
|
|
|
||
|
|
this._super( _idx, _data, _key );
|
||
|
|
|
||
|
|
// 刷新
|
||
|
|
this.setData(_data,_key)
|
||
|
|
|
||
|
|
},
|
||
|
|
|
||
|
|
onLoad () {
|
||
|
|
},
|
||
|
|
|
||
|
|
start () {
|
||
|
|
},
|
||
|
|
|
||
|
|
onFocus(){
|
||
|
|
if( nx.dt.objEmpty( this.mdata ) ) {
|
||
|
|
return false;
|
||
|
|
}
|
||
|
|
var input_str = "#" + this.mdata.id;
|
||
|
|
let params = {};
|
||
|
|
params.face_text =input_str;
|
||
|
|
gcore.GlobalEvent.fire(ChatEvent.INPUT_SELECT_ITEM,this.key,params);
|
||
|
|
},
|
||
|
|
|
||
|
|
outFocus(){
|
||
|
|
|
||
|
|
},
|
||
|
|
|
||
|
|
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) {},
|
||
|
|
});
|