1234567891011121314151617181920212223242526272829303132333435363738394041424344454647 |
- import DataMgr from "../data/DataMgr";
- import { GameMode, RESTART_GAME } from "../data/Define";
- import UIBase from "../fgui/core/UIBase";
- import ui_UIInvitation from "../fgui/res/game/ui_UIInvitation";
- import { xGame } from "../xGame";
- /**
- * 摆球达人界面,选择关卡界面
- */
- export default class UIInvitation extends UIBase {
- public ui: ui_UIInvitation;
- public constructor() {
- super();
- }
- public onConstructor(): void {
- this.ui = ui_UIInvitation.createInstance();
- this.contentPane = this.ui;
- this.isEject = false;
- //
- this.addUIClick(this.ui.myNode.enterBtn, this.enterGame);
- }
- public show(): void {
- super.show();
- }
- public enterGame() {
- xGame.common.gameMode = GameMode.classic;
- DataMgr.setChallengeTimes(1);
- xGame.common.passAwardCoin = 2000;
- let need = xGame.common.classicNiceNeddCoin;
- if (DataMgr.coinEnough(need)) {
- DataMgr.setCoin(-need);
- //开始游戏
- xGame.eventMgr.event(RESTART_GAME, true);
- Moyu.sendDataEvent("enterChallenge", { mode: xGame.common.gameMode });
- //
- }
- else {
- //金币不够时也强制进入
- xGame.eventMgr.event(RESTART_GAME, true);
- }
- this.hide();
- }
- public hide() {
- super.hide();
- }
- }
- UIInvitation.uiName = "UIInvitation";
|