import { _decorator, Component, Node, Label } from 'cc'; import { GameMng } from '../GameMng'; import GBaseUI from '../gcommon/GBaseUI'; import { UIButton } from '../gcommon/UIButton'; import { UIManager } from '../gcommon/UIManager'; const { ccclass, property } = _decorator; @ccclass('waitView') export class waitView extends GBaseUI { @property(Label) lab_des: Node = null; @property(Node) btn_cancel:Node = null @property(Node) lab_loading:Node = null @property(Node) sp_loading:Node = null static dialog_des:string = null; static _cancel_call:any = false; private status_string = ["。","。。","。。。"] private status_count = 0; private time_count:number = 0; start() { UIButton.BindClick(this.btn_cancel,()=>{ if(waitView._cancel_call){ waitView._cancel_call() } },this) this.schedule(this.dt,0.01) } onDestroy(){ this.unschedule(this.dt) } static Show(waitText:string,cancel_cllback:any=null){ waitView.dialog_des = waitText; waitView._cancel_call = cancel_cllback; UIManager.AddPrefab(GameMng.Instance.uiWaitView); } dt(){ this.sp_loading.angle = this.sp_loading.angle+2 } update(deltaTime: number) { // this.time_count+=deltaTime; // if(this.time_count>0.5){ // this.time_count = 0; // if(this.status_count>=this.status_string.length){ // this.status_count = 0; // } // this.lab_loading.getComponent(Label).string = this.status_string[this.status_count] // this.status_count++; // } if(waitView.dialog_des){ if(waitView._cancel_call){ // this.btn_cancel.active = true; } this.lab_des.getComponent(Label).string = waitView.dialog_des; waitView.dialog_des = null; } } }