qipan_shop_item.ts 1.1 KB

123456789101112131415161718192021222324252627282930313233343536
  1. import { _decorator, Component, Node, Label } from 'cc';
  2. import { ContentType } from '../adapter/define/enum';
  3. import { itemData } from '../config/ItemDataConfig';
  4. import { ResMng } from '../gcommon/ResMng';
  5. import { UIButton } from '../gcommon/UIButton';
  6. const { ccclass, property } = _decorator;
  7. @ccclass('qipan_shop_item')
  8. export class qipan_shop_item extends Component {
  9. @property(Node) lab_name:Node = null;
  10. @property(Node) lab_sell:Node = null;
  11. @property(Node) sp_icon:Node = null;
  12. private m_item_data:itemData = null;
  13. private m_contentType: ContentType = null;
  14. start() {
  15. UIButton.BindClick(this.node,()=>{
  16. console.log("当前选中商品",this.m_item_data)
  17. },this)
  18. }
  19. update(deltaTime: number) {
  20. }
  21. show(item_data:itemData,ct:ContentType){
  22. this.m_item_data = item_data;
  23. this.m_contentType = ct;
  24. this.lab_name.getComponent(Label).string = this.m_item_data.name
  25. this.lab_sell.getComponent(Label).string = this.m_item_data.sell
  26. //ResMng.LoadItem(this.m_item_data.id,this.sp_icon.getComponent(Sprite))
  27. }
  28. }