WelfareThree.ts 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. import { _decorator, Component, Node, Animation } from 'cc';
  2. import { oops } from 'db://oops-framework/core/Oops';
  3. import { GameComponent } from 'db://oops-framework/module/common/GameComponent';
  4. import { UIID } from '../../common/config/GameUIConfig';
  5. const { ccclass, property } = _decorator;
  6. @ccclass('WelfareThree')
  7. export class WelfareThree extends GameComponent {
  8. @property(Node)
  9. private showNode1: Node = null!;
  10. @property(Node)
  11. private showNode2: Node = null!;
  12. start() {
  13. //3秒后打开官方承诺,关闭当前窗口
  14. this.showNode1.active = true;
  15. this.showNode2.active = false;
  16. this.scheduleOnce(() => {
  17. this.showNode1.active = false;
  18. this.showNode2.active = true;
  19. //播放动画
  20. const animation = this.showNode2.getComponent(Animation);
  21. if (animation) {
  22. animation.play();
  23. }
  24. //3秒后打开官方承诺,关闭当前窗口
  25. this.scheduleOnce(() => {
  26. oops.gui.remove(UIID.WelfareThree);
  27. }, 5)
  28. }, 3)
  29. }
  30. update(deltaTime: number) {
  31. }
  32. }