import { _decorator, Component, Label, Node } from 'cc'; import { LvData } from '../../game/LvData/LvData'; import { Hall } from '../../hall/Hall'; const { ccclass, property } = _decorator; @ccclass('Life') export class Life extends Component { @property(Label) endTime: Label = null; protected update(dt: number): void { let life =LvData.instance.lifeContor;; if(!life){ this.endTime.node.active = false return } this.endTime.node.active = !life.isMax() let now = chsdk.date.now() life.addLastTime(now) let last = life.needAddTime this.endTime.string = chsdk.date.ms_format(last-now, "$M:$S") } }