shop_page.ts 732 B

1234567891011121314151617181920212223242526272829303132333435
  1. import { _decorator, Component, Node, Prefab, instantiate } from 'cc';
  2. import { Holder } from '../adapter/abstract/Holder';
  3. import { itemData } from '../config/ItemDataConfig';
  4. import { shop_item } from './shop_item';
  5. const { ccclass, property } = _decorator;
  6. @ccclass('shop_page')
  7. export class shop_page extends Component {
  8. start() {
  9. }
  10. update(deltaTime: number) {
  11. }
  12. show(holder:Holder,prefab:Prefab,list:itemData[]){
  13. for (let index = 0; index < list.length; index++) {
  14. const element = list[index];
  15. var item = instantiate(prefab);
  16. this.node.addChild(item)
  17. item.getComponent(shop_item).show(element)
  18. }
  19. }
  20. hide(){
  21. }
  22. }