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

@@ -35,9 +35,9 @@ export class Block extends Laya.Script {
this.YGroup = YGroup
let VBox = this.owner.getChildByName("VBox")
for (var i = 0; i < VBox.numChildren; i++) {
var hbox = VBox.getChildAt(i)
for (var j = 0; j < hbox.numChildren; j++) {
for (let i = 0; i < VBox.numChildren; i++) {
const hbox = VBox.getChildAt(i)
for (let j = 0; j < hbox.numChildren; j++) {
const sp = hbox.getChildAt(j) as Laya.Sprite
this.tips_bgs.push(sp)
}
@@ -45,9 +45,9 @@ export class Block extends Laya.Script {
this.label_show = label_obj.getChildByName("label_show") as Laya.Label
// this.label_show.text = XGroup + "" + YGroup
VBox = label_obj.getChildByName("VBox")
for (var i = 0; i < VBox.numChildren; i++) {
var hbox = VBox.getChildAt(i)
for (var j = 0; j < hbox.numChildren; j++) {
for (let i = 0; i < VBox.numChildren; i++) {
const hbox = VBox.getChildAt(i)
for (let j = 0; j < hbox.numChildren; j++) {
const Label = hbox.getChildAt(j) as Laya.Label
Label.text = ""
this.tips_labels.push(Label)
@@ -101,14 +101,14 @@ export class Block extends Laya.Script {
if (config.H_SCREEN)
blockSize = 30
if (visible) {
var obj = this.tips_bgs[noteNumber - 1]
const obj = this.tips_bgs[noteNumber - 1]
obj.visible = true
obj.graphics.clear()
obj.graphics.drawRect(0, 0, blockSize, blockSize, color)
obj.alpha = alpha
} else {
for (let i = 0; i < this.tips_bgs.length; i++) {
var obj = this.tips_bgs[i]
const obj = this.tips_bgs[i]
obj.visible = false
}
}
@@ -164,7 +164,7 @@ export class Block extends Laya.Script {
// 设置文字颜色
if (this.selected) {
this.label_show.color = "#ffffff"
for (var i = 0; i < this.tips_labels.length; i++) {
for (let i = 0; i < this.tips_labels.length; i++) {
this.tips_labels[i].color = "#ffffff"
}
} else {
@@ -177,12 +177,12 @@ export class Block extends Laya.Script {
} else {
this.label_show.color = "#cb3256"
}
for (var i = 0; i < this.tips_labels.length; i++) {
for (let i = 0; i < this.tips_labels.length; i++) {
this.tips_labels[i].color = "#2d3138"
}
}
for (var i = 0; i < this.tips_labels.length; i++) {
for (let i = 0; i < this.tips_labels.length; i++) {
this.tips_labels[i].text = ""
}
if (this.data.get_show() > 0) {
@@ -190,7 +190,7 @@ export class Block extends Laya.Script {
} else {
this.label_show.text = ""
const note_numbers = this.data.get_notes()
for (var i = 0; i < note_numbers.length; i++) {
for (let i = 0; i < note_numbers.length; i++) {
const value = note_numbers[i]
const label = this.tips_labels[value - 1]
label.text = value.toString()