1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465 |
- /** @format */
- import {UI} from '../enums/UI'
- import {BaseUI} from './BaseUI'
- import {Data, Mgr} from '../GameControl'
- import {ccUtils} from '../utils/ccUtils'
- import {observer, render, node, label, editBox, list} from '../mobx/observer'
- import {msgCmd} from '../proto/msg_cmd'
- import {AD_ID, DIS_ID, LOCAL} from '../enums/Enum'
- import {i18nLabel} from '../uiutils/i18nLabel'
- import {DataConfig} from '../config/DataConfig'
- import {speedUpBuy, speedUpBuyRsp} from '../proto/game'
- const {ccclass, property} = cc._decorator
- @ccclass
- @observer
- export class GameSpeedUI extends BaseUI {
- onShow(args, fromUI: number) {
- Mgr.net.add(msgCmd.cmd_speed_up_buy_rsp, this, this.speedUpBuyRsp)
- let timeLb = cc.find('timeLb', this.node).getComponent(i18nLabel)
- timeLb.setParamByIndex(Math.floor(DataConfig[DIS_ID.gameSpeed].data2 / 60).toString(), 0)
- ccUtils.setLabel(DataConfig[DIS_ID.gameSpeed].data3.toString(), this.node, 'btn_yellow/lb')
- }
- onOpenAniOver() {
- //cc.director.pause()
- }
- onHide(): any {
- Mgr.event.removeAll(this)
- Mgr.ui.callOnShow(UI.GameUI, {isStop: false})
- //cc.director.resume()
- }
- speedUpBuyRsp(rsp: speedUpBuyRsp) {
- Data.game.gameSpeed = 2
- Data.game.speedUpTime = rsp.time
- this.hide()
- }
- //UI或者其他函数=======================================
- //网络事件=======================================
- // onXXXRsp() {}
- //触发事件=======================================
- // @render
- // showRender() {}
- // 点击事件=======================================
- onFreeClick() {
- Mgr.platform.playVideoAD(AD_ID.gamespeed, () => {
- let data = speedUpBuy.create()
- data.free = true
- Mgr.net.send(msgCmd.cmd_speed_up_buy, data)
- })
- }
- onBuyClick() {
- let data = speedUpBuy.create()
- data.free = false
- Mgr.net.send(msgCmd.cmd_speed_up_buy, data)
- }
- }
|