import { _decorator, Component, Node, Label } from 'cc'; import { ContentType } from '../adapter/define/enum'; import { itemData } from '../config/ItemDataConfig'; import { ResMng } from '../gcommon/ResMng'; import { UIButton } from '../gcommon/UIButton'; const { ccclass, property } = _decorator; @ccclass('qipan_shop_item') export class qipan_shop_item extends Component { @property(Node) lab_name:Node = null; @property(Node) lab_sell:Node = null; @property(Node) sp_icon:Node = null; private m_item_data:itemData = null; private m_contentType: ContentType = null; start() { UIButton.BindClick(this.node,()=>{ console.log("当前选中商品",this.m_item_data) },this) } update(deltaTime: number) { } show(item_data:itemData,ct:ContentType){ this.m_item_data = item_data; this.m_contentType = ct; this.lab_name.getComponent(Label).string = this.m_item_data.name this.lab_sell.getComponent(Label).string = this.m_item_data.sell //ResMng.LoadItem(this.m_item_data.id,this.sp_icon.getComponent(Sprite)) } }