| 1234567891011121314151617181920212223242526272829303132333435363738 |
- import { _decorator, Component, Node } from 'cc';
- import { GameComponent } from 'db://oops-framework/module/common/GameComponent';
- import { GameEvent } from '../../common/config/GameEvent';
- import { oops } from 'db://oops-framework/core/Oops';
- import { UIID } from '../../common/config/GameUIConfig';
- import { ServerHandler } from '../../common/manager/ServerHandler';
- import { smc } from '../../common/SingletonModuleComp';
- const { ccclass, property } = _decorator;
- @ccclass('UnlockDoubleSpeed')
- export class UnlockDoubleSpeed extends GameComponent {
- start() {
- oops.message.dispatchEvent(GameEvent.updateGameState, "paused");
- this.startDoubleSpeed();
- }
- startDoubleSpeed() {
- this.scheduleOnce(() => {
- smc.game.GameModel.doubleSpeedTime = 180;
- this.updateState();
- //还要自己更新状态
- oops.message.dispatchEvent(GameEvent.updateGameState, "playing");
- oops.message.dispatchEvent(GameEvent.DoubleSpeedOpenSuccess);
- oops.gui.remove(UIID.UnlockDoubleSpeed);
- }, 3)
- }
- //更新状态
- updateState() {
- ServerHandler.inst.updatePopupState({
- level: smc.account.AccountModel.curLevel,
- type: smc.game.GameModel.popupType
- })
- }
- }
|