WelfareThree.ts 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  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. import { ServerHandler } from '../../common/manager/ServerHandler';
  6. import { smc } from '../../common/SingletonModuleComp';
  7. const { ccclass, property } = _decorator;
  8. @ccclass('WelfareThree')
  9. export class WelfareThree extends GameComponent {
  10. @property(Node)
  11. private showNode1: Node = null!;
  12. @property(Node)
  13. private showNode2: Node = null!;
  14. start() {
  15. //3秒后打开官方承诺,关闭当前窗口
  16. this.showNode1.active = true;
  17. this.showNode2.active = false;
  18. this.scheduleOnce(() => {
  19. this.showNode1.active = false;
  20. this.showNode2.active = true;
  21. //播放动画
  22. const animation = this.showNode2.getComponent(Animation);
  23. if (animation) {
  24. animation.play();
  25. }
  26. //3秒后打开官方承诺,关闭当前窗口
  27. this.scheduleOnce(() => {
  28. oops.gui.remove(UIID.WelfareThree);
  29. }, 5)
  30. this.updateState();
  31. }, 3)
  32. }
  33. updateState() {
  34. ServerHandler.inst.updatePopupState({
  35. level: smc.account.AccountModel.curLevel,
  36. type: smc.game.GameModel.popupType
  37. })
  38. }
  39. }