格式化代码 var to let or const

This commit is contained in:
2025-05-28 20:29:24 +08:00
parent 8da20ab53e
commit 19d4c52c5e
15 changed files with 88 additions and 87 deletions

View File

@@ -97,7 +97,7 @@ export class DailyChallenge extends Laya.Script {
UIManager.getInstance().loadTrophyUI()
})
this.btn_play.on(Laya.Event.CLICK, this, (evt: Laya.Event) => {
this.btn_play.on(Laya.Event.CLICK, this, () => {
// console.log(">>>>>>>>>>>>>>>>>>>>>>>", this.selectedUnit.day)
const now = new Date()
const year = now.getFullYear()
@@ -114,7 +114,7 @@ export class DailyChallenge extends Laya.Script {
this.owner.destroy()
})
for (var i = 0; i < this.obj_items.numChildren; i++) {
for (let i = 0; i < this.obj_items.numChildren; i++) {
const hbox = this.obj_items.getChildAt(i)
const l_hbox = this.obj_labels.getChildAt(i)
for (let j = 0; j < hbox.numChildren; j++) {
@@ -129,7 +129,7 @@ export class DailyChallenge extends Laya.Script {
const now = new Date()
const nowYear = now.getFullYear()
const nowMonth = now.getMonth() + 1
for (var i = 0; i < MONTH_LIST.length; i++) {
for (let i = 0; i < MONTH_LIST.length; i++) {
const obj = MONTH_LIST[i]
if (nowYear === obj.year && nowMonth === obj.month) {
this.indexMax = i
@@ -261,14 +261,14 @@ export class DailyChallenge extends Laya.Script {
if (progress >= 1) {
this.btn_play.visible = false
this.obj_summary.visible = true
var doStage = StorageManager.getInstance().getStage(stageID)
const doStage = StorageManager.getInstance().getStage(stageID)
this.label_diffucuty.text = doStage.get_difficulty()
this.label_score.text = doStage.get_score().toString()
this.label_time.text = Utility_ConvertSecondToString(doStage.get_duration())
} else {
this.btn_play.visible = true
this.obj_summary.visible = false
var doStage = StorageManager.getInstance().getStage(stageID)
const doStage = StorageManager.getInstance().getStage(stageID)
if (doStage) {
this.label_play.text = "Continue"
} else {