123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475 |
- /** @format */
- import {UI} from '../../enums/UI'
- import {BaseUI} from '../BaseUI'
- import {Data, GameControl, 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 {ILoading} from '../../interface/UIInterface'
- import {LANGUAGE_TYPE} from '../../enums/Enum'
- const {ccclass, property} = cc._decorator
- @ccclass
- @observer
- export class LoadingUI extends BaseUI {
- @label('lb')
- public tip: cc.Label
- @node('ani')
- public aniNode: cc.Node
- private dot = ''
- private str = ''
- public onShow(args: ILoading, fromUI: number) {
- this.unscheduleAllCallbacks()
- this.node.opacity = 0
- if (args.isDelay) {
- this.scheduleOnce(() => {
- if (cc.isValid(this.node)) {
- this.tip.string = ''
- this.node.opacity = 255
- } else {
- }
- this.playAnim()
- }, 3)
- } else {
- this.node.opacity = 255
- this.str = args.str
- this.playAnim()
- }
- if (args.cutNet || args.timeout) {
- this.scheduleOnce(() => {
- this.hide()
- if (args.cutNet) {
- Mgr.ui.message(
- LANGUAGE_TYPE.netCut,
- () => {
- GameControl.resetGame()
- },
- true,
- )
- }
- }, 10)
- }
- }
- public playAnim() {
- cc.tween(this.aniNode)
- .then(cc.tween().by(3, {angle: -360}).repeatForever())
- .start()
- this.schedule(() => {
- if (this.dot.length < 3) {
- this.dot += '.'
- } else {
- this.dot = ''
- }
- this.tip.string = `${Mgr.i18n.getLabel(this.str)}${this.dot}`
- }, 0.33)
- }
- public onDisable() {
- this.node.opacity = 0
- this.tip.string = ''
- }
- }
|