格式化代码 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

@@ -72,7 +72,7 @@ export class CalendarUnit extends Laya.Script {
} else {
this.label_show.text = this.day.toString()
this.label_show.color = "#d3d5db"
this.owner.on(Laya.Event.CLICK, this, (evt: Laya.Event) => {
this.owner.on(Laya.Event.CLICK, this, () => {
})
this.obj_selected.visible = false

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 {

View File

@@ -31,8 +31,8 @@ export class TrophyRoom 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++) {
var obj = MONTH_LIST[i]
for (let i = 0; i < MONTH_LIST.length; i++) {
const obj = MONTH_LIST[i]
infos.push(obj)
if (obj.year === nowYear && obj.month === nowMonth) {
break
@@ -42,8 +42,8 @@ export class TrophyRoom extends Laya.Script {
const years: Array<number> = []
const monthMap: Map<number, Array<any>> = new Map()
for (var i = 0; i < infos.length; i++) {
obj = infos[i]
for (let i = 0; i < infos.length; i++) {
const obj = infos[i]
const find = years.indexOf(obj.year)
if (find < 0) {
years.push(obj.year)