bggg.ts 779 B

123456789101112131415161718192021222324252627282930313233
  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. const { ccclass, property } = cc._decorator;
  8. @ccclass
  9. export default class NewClass extends cc.Component {
  10. @property(cc.Label)
  11. label: cc.Label = null;
  12. @property
  13. text: string = 'hello';
  14. // LIFE-CYCLE CALLBACKS:
  15. protected start(): void {
  16. }
  17. click() {
  18. window['clickbg']=this.node
  19. }
  20. clickbgItem() {
  21. window['clickbg'].getComponent(cc.Sprite).Sprite=this.node['sp1']
  22. }
  23. // update (dt) {}
  24. }