UnlockDoubleSpeed.ts 1.1 KB

12345678910111213141516171819202122232425262728293031323334
  1. import { _decorator, Component, Node } from 'cc';
  2. import { GameComponent } from 'db://oops-framework/module/common/GameComponent';
  3. import { GameEvent } from '../../common/config/GameEvent';
  4. import { oops } from 'db://oops-framework/core/Oops';
  5. import { UIID } from '../../common/config/GameUIConfig';
  6. import { ServerHandler } from '../../common/manager/ServerHandler';
  7. import { smc } from '../../common/SingletonModuleComp';
  8. const { ccclass, property } = _decorator;
  9. @ccclass('UnlockDoubleSpeed')
  10. export class UnlockDoubleSpeed extends GameComponent {
  11. start() {
  12. this.setButton();
  13. oops.message.dispatchEvent(GameEvent.updateGameState, "paused");
  14. }
  15. btn_confirm() {
  16. oops.gui.remove(UIID.UnlockDoubleSpeed);
  17. //发送开始自动玩游戏
  18. oops.message.dispatchEvent(GameEvent.DoubleSpeedOpenSuccess);
  19. this.updateState();
  20. }
  21. //更新状态
  22. updateState() {
  23. ServerHandler.inst.updatePopupState({
  24. level: smc.account.AccountModel.curLevel,
  25. type: smc.game.GameModel.popupType
  26. })
  27. }
  28. }