/** 农场仓库Item */ import { ProductType } from "../../../game/data/GameData"; const { ccclass, property } = cc._decorator; @ccclass export default class FarmLevelStoreItem extends cc.Component { @property({ type: cc.Label, displayName: '数量' }) lbl_num: cc.Label = null; @property({ type: cc.Sprite, displayName: '物品名称' }) sp_name: cc.Sprite = null; @property({ type: cc.Sprite, displayName: '物品图片' }) sp_food: cc.Sprite = null; itemData = null; /** * list_data * @param data item数据 */ public async setItemData(bData) { let times = gData.gameData.getProductMakeTimesById(bData.picture); this.lbl_num.string = `${times}`; let plantPath = ''; let namePath = ''; if (bData.tab == ProductType.nzw) { plantPath = 'game/coregame/texture/plant_icons/plantIcon_'; namePath = 'game/coregame/texture/plant_icons/nameIcon/plant_name_'; } else { plantPath = 'game/coregame/texture/factory_icons/factory_'; namePath = 'game/coregame/texture/factory_icons/factoryNams/factory_name_icon_'; } this.sp_food.spriteFrame = await mk.loader.load(plantPath + bData.picture, cc.SpriteFrame); this.sp_name.spriteFrame = await mk.loader.load(namePath + bData.picture, cc.SpriteFrame); } }