ShopUI.ts 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. // Learn TypeScript:
  2. // - https://docs.cocos.com/creator/2.4/manual/en/scripting/typescript.html
  3. // Learn Attribute:
  4. // - https://docs.cocos.com/creator/2.4/manual/en/scripting/reference/attributes.html
  5. // Learn life-cycle callbacks:
  6. // - https://docs.cocos.com/creator/2.4/manual/en/scripting/life-cycle-callbacks.html
  7. import UIbase from "../utils/UIbase";
  8. import PrefabUtil from "../utils/manager/PrefabUtil";
  9. import ShopSkinItem from "./ShopSkinItem";
  10. const { ccclass, property } = cc._decorator;
  11. @ccclass
  12. export default class ShopUI extends UIbase {
  13. private static _inst: ShopUI;
  14. public static get inst() {
  15. if (this._inst == null) {
  16. let v = cc.instantiate(PrefabUtil.get("ShopUI"));
  17. this._inst = v.getComponent(ShopUI);
  18. }
  19. return this._inst;
  20. }
  21. @property([cc.Node])
  22. nodes: cc.Node[] = [];
  23. protected start(): void {
  24. }
  25. protected onEnable(): void {
  26. this.updateNodesData()
  27. }
  28. updateNodesData() {
  29. this.nodes.forEach(item => {
  30. item.getComponent(ShopSkinItem).setData()
  31. })
  32. }
  33. // update (dt) {}
  34. }