WelfareThree.ts 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. /*
  2. * @Author: mojunshou 1637302775@qq.com
  3. * @Date: 2025-04-19 10:27:15
  4. * @LastEditors: mojunshou 1637302775@qq.com
  5. * @LastEditTime: 2025-04-27 18:53:00
  6. * @Description:官方承诺
  7. */
  8. import { _decorator, Component, Node, Animation } from 'cc';
  9. import { oops } from 'db://oops-framework/core/Oops';
  10. import { GameComponent } from 'db://oops-framework/module/common/GameComponent';
  11. import { UIID } from '../../common/config/GameUIConfig';
  12. import { ServerHandler } from '../../common/manager/ServerHandler';
  13. import { smc } from '../../common/SingletonModuleComp';
  14. const { ccclass, property } = _decorator;
  15. @ccclass('WelfareThree')
  16. export class WelfareThree extends GameComponent {
  17. @property(Node)
  18. private showNode1: Node = null!;
  19. @property(Node)
  20. private showNode2: Node = null!;
  21. start() {
  22. //3秒后打开官方承诺,关闭当前窗口
  23. this.showNode1.active = true;
  24. this.showNode2.active = false;
  25. this.scheduleOnce(() => {
  26. this.showNode1.active = false;
  27. this.showNode2.active = true;
  28. //播放动画
  29. const animation = this.showNode2.getComponent(Animation);
  30. if (animation) {
  31. animation.play();
  32. }
  33. //3秒后打开官方承诺,关闭当前窗口
  34. this.scheduleOnce(() => {
  35. this.updateState();
  36. oops.gui.remove(UIID.WelfareThree);
  37. }, 5)
  38. }, 3)
  39. }
  40. updateState() {
  41. ServerHandler.inst.updatePopupState({
  42. level: smc.account.AccountModel.curLevel,
  43. type: smc.game.GameModel.popupType
  44. })
  45. }
  46. }