2025-04-24 17:03:28 +08:00

51 lines
1003 B
JavaScript

import ItemUtil from "../../ts/core/ItemUtil";
import SKDataUtil from "../../ts/gear_2.3.4/util/SKDataUtil";
cc.Class({
extends: cc.Component,
properties: {
item_icon: cc.Sprite
},
setData(info) {
let data;
if(info.type == 0){
data = SKDataUtil.clone(ItemUtil.getItemData(info.itemid));
data.type = 2;
}else{
data = info.info;
data.id = data.EquipID;
data.name = data.EName;
data.type = 1;
}
if (data == null) {
this.item_icon.spriteFrame = ItemUtil.getItemIcon(1000);
return;
}
this.itemInfo = data;
this.item_icon.spriteFrame = ItemUtil.getItemIconBy(data);
},
setCallback(callback) {
this.mCallback = callback;
},
onPropClick() {
if(this.mCallback){
this.mCallback(this.itemInfo);
}
},
// LIFE-CYCLE CALLBACKS:
// onLoad () {},
start () {
},
// update (dt) {},
});