import { _decorator, Component, Node, Label } from 'cc'; import { Tools } from './Tools'; const { ccclass, property } = _decorator; @ccclass('time') export class time extends Component { public isStart:boolean =false; public curTimme:number =0; public initTimme:number =0; delta:number = 1; start() { } update(deltaTime: number) { if(this.isStart){ if(this.delta>=1){ if(this.curTimme<0){ }else{ this.node.getComponent(Label).string = Tools.ms_time(this.curTimme) this.curTimme-=1; } this.delta = 0; } this.delta+=deltaTime; } } startAni(_cur:number){ if(this.initTimme!=_cur){ this.initTimme = _cur; this.curTimme = _cur; } if(this.isStart==true){ }else{ this.node.getComponent(Label).string = Tools.ms_time(this.curTimme) this.initTimme = _cur // this.isStart = true; } } stopAni(){ this.isStart = false; } }