|
@@ -3,6 +3,7 @@ import { resLoader } from "db://assets/core_tgx/base/ResLoader";
|
|
import { StormSunderGlobalInstance } from "../StormSunderGlobalInstance";
|
|
import { StormSunderGlobalInstance } from "../StormSunderGlobalInstance";
|
|
import { PropMgr } from "./PropMgr"; // 假设PropMgr在同一个目录下
|
|
import { PropMgr } from "./PropMgr"; // 假设PropMgr在同一个目录下
|
|
import { GameMgr, GameStatus } from "./GameMgr";
|
|
import { GameMgr, GameStatus } from "./GameMgr";
|
|
|
|
+import { GameUtil } from "../GameUtil";
|
|
|
|
|
|
/** 时间管理器*/
|
|
/** 时间管理器*/
|
|
export class TimerMgr {
|
|
export class TimerMgr {
|
|
@@ -28,6 +29,7 @@ export class TimerMgr {
|
|
|
|
|
|
// 开始倒计时
|
|
// 开始倒计时
|
|
public startCountdown(): void {
|
|
public startCountdown(): void {
|
|
|
|
+ this.upateLbTime();
|
|
this.timerId = setInterval(() => {
|
|
this.timerId = setInterval(() => {
|
|
this.countDownTime--;
|
|
this.countDownTime--;
|
|
if (this.countDownTime <= 0) {
|
|
if (this.countDownTime <= 0) {
|
|
@@ -44,7 +46,9 @@ export class TimerMgr {
|
|
private upateLbTime() {
|
|
private upateLbTime() {
|
|
const battleUI = StormSunderGlobalInstance.instance.battleUI;
|
|
const battleUI = StormSunderGlobalInstance.instance.battleUI;
|
|
const lbTime = battleUI.getChildByPath('Times/LbTime')!;
|
|
const lbTime = battleUI.getChildByPath('Times/LbTime')!;
|
|
- lbTime.getComponent(Label).string = this.countDownTime.toString();
|
|
|
|
|
|
+ // lbTime.getComponent(Label).string = this.countDownTime.toString();
|
|
|
|
+ const format = GameUtil.formatToTimeString(this.countDownTime);
|
|
|
|
+ lbTime.getComponent(Label).string = format;
|
|
}
|
|
}
|
|
|
|
|
|
// 停止倒计时
|
|
// 停止倒计时
|