== to ===

This commit is contained in:
2025-05-28 19:15:32 +08:00
parent ccfcc4f840
commit 34eec38036
16 changed files with 64 additions and 64 deletions

View File

@@ -168,7 +168,7 @@ export class Block extends Laya.Script {
this.tips_labels[i].color = "#ffffff"
}
} else {
if (this.data.get_show() == this.data.get_correct()) {
if (this.data.get_show() === this.data.get_correct()) {
if (this.data.get_preset()) {
this.label_show.color = "#2d3138"
} else {

View File

@@ -69,12 +69,12 @@ export class GameDone extends Laya.Script {
this.btn_home.on(Laya.Event.CLICK, this, (evt: Laya.Event) => {
if (config.H_SCREEN) {
UIManager.getInstance().closeDCUI()
if (doStage.get_stageType() == config.STAGE_TYPE.MAIN) {
if (doStage.get_stageType() === config.STAGE_TYPE.MAIN) {
const user = StorageManager.getInstance().getUser()
user.update_progress(doStage.get_difficulty(), doStage.get_stageIndex() + 1)// 主线关卡更新难度进度
StorageManager.getInstance().newStage(config.DEFAULT_STAGE_ID, config.STAGE_TYPE.MAIN, doStage.get_difficulty(), doStage.get_difficulty())
UIManager.getInstance().loadStageUI(config.DEFAULT_STAGE_ID)
} else if (doStage.get_stageType() == config.STAGE_TYPE.DC) {
} else if (doStage.get_stageType() === config.STAGE_TYPE.DC) {
UIManager.getInstance().setTopbarTo(true)
}
} else {

View File

@@ -41,7 +41,7 @@ export class GameOver extends Laya.Script {
})
const type = doStage.get_stageType()
if (type == config.STAGE_TYPE.MAIN) {
if (type === config.STAGE_TYPE.MAIN) {
this.label_newOrClose.text = "New Game"
this.btn_newOrClose.on(Laya.Event.CLICK, this, (evt: Laya.Event) => {
if (config.H_SCREEN) {

View File

@@ -83,7 +83,7 @@ export class Stage extends Laya.Script {
Stage._instance = this
this.btn_back.on(Laya.Event.CLICK, this, () => {
if (this.data.get_stageType() == config.STAGE_TYPE.MAIN) {
if (this.data.get_stageType() === config.STAGE_TYPE.MAIN) {
UIManager.getInstance().loadHomeUI()
UIManager.getInstance().closeStageUI()
} else {
@@ -111,14 +111,14 @@ export class Stage extends Laya.Script {
const block = hbox.getChildAt(j).getComponent(Block)
this.blocks.push(block)
let XGroup = 0
if (j == 3 || j == 4 || j == 5)
if (j === 3 || j === 4 || j === 5)
XGroup = 1
if (j == 6 || j == 7 || j == 8)
if (j === 6 || j === 7 || j === 8)
XGroup = 2
let YGroup = 0
if (i == 3 || i == 4 || i == 5)
if (i === 3 || i === 4 || i === 5)
YGroup = 1
if (i == 6 || i == 7 || i == 8)
if (i === 6 || i === 7 || i === 8)
YGroup = 2
const l_vbox = l_hbox.getChildAt(j) as Laya.Box
block.onInit(j, i, XGroup, YGroup, l_vbox, this, this.onClickBlock)
@@ -172,8 +172,8 @@ export class Stage extends Laya.Script {
this.paused = false
if (config.H_SCREEN) {
this.btn_back.visible = this.data.get_stageType() == config.STAGE_TYPE.DC
this.btn_new.visible = this.data.get_stageType() == config.STAGE_TYPE.MAIN
this.btn_back.visible = this.data.get_stageType() === config.STAGE_TYPE.DC
this.btn_new.visible = this.data.get_stageType() === config.STAGE_TYPE.MAIN
}
this.score_last = 0
@@ -183,7 +183,7 @@ export class Stage extends Laya.Script {
this.label_score.text = `Score: ${this.score_last}`
this.label_name.text = this.data.get_stageName()
if (this.data.get_stageType() == config.STAGE_TYPE.MAIN && config.H_SCREEN)
if (this.data.get_stageType() === config.STAGE_TYPE.MAIN && config.H_SCREEN)
this.label_name.text = ""
this.onUpdateMistake()
@@ -285,7 +285,7 @@ export class Stage extends Laya.Script {
} else { // 错误
if (animated) { // 填数状态播放闪动效果
for (var i = 0; i < relateds.length; i++) { // 相关且数字相同
if (relateds[i].getData().get_show() == block.getData().get_show()) { // 播放变红动效
if (relateds[i].getData().get_show() === block.getData().get_show()) { // 播放变红动效
if (relateds[i].getData().get_index() != block.getData().get_index()) {
// relateds[i].setBlockColor(config.BLOCK_COLOR.WHITE)
relateds[i].setBlockColor(config.BLOCK_COLOR.RED, 0.4, true, config.BLOCK_COLOR.GREY, 1)
@@ -294,7 +294,7 @@ export class Stage extends Laya.Script {
}
} else {
for (var i = 0; i < relateds.length; i++) { // 相关且数字相同
if (relateds[i].getData().get_show() == block.getData().get_show()) { // 直接变红
if (relateds[i].getData().get_show() === block.getData().get_show()) { // 直接变红
if (relateds[i].getData().get_index() != block.getData().get_index()) {
relateds[i].setBlockColor(config.BLOCK_COLOR.RED, 0.4)
}
@@ -342,7 +342,7 @@ export class Stage extends Laya.Script {
}
onClickErase(evt: Laya.Event): void {
if (this.selectedBlock.getData().get_checked() == false) { // 未完成且有数字或者笔记才可以使用橡皮
if (this.selectedBlock.getData().get_checked() === false) { // 未完成且有数字或者笔记才可以使用橡皮
const show = this.selectedBlock.getData().get_show()
const notes = this.selectedBlock.getData().get_notes()
if (show > 0 || notes.length > 0) {
@@ -358,7 +358,7 @@ export class Stage extends Laya.Script {
if (evt != null) {
this.data.set_note_open(!this.data.get_note_open())
}
this.btn_note_normal.visible = this.data.get_note_open() == false
this.btn_note_normal.visible = this.data.get_note_open() === false
this.btn_note_checked.visible = this.data.get_note_open()
this.label_note.color = this.data.get_note_open() ? "#1d5cdc" : "#545962"
for (let i = 0; i < this.candys.length; i++) {
@@ -369,7 +369,7 @@ export class Stage extends Laya.Script {
onClickHint(evt: Laya.Event): void {
const hint = this.data.get_hint()
if (hint > 0) {
if (this.selectedBlock.getData().get_checked() == false) { // 当前选中的格子没有完成
if (this.selectedBlock.getData().get_checked() === false) { // 当前选中的格子没有完成
var correct = this.selectedBlock.getData().get_correct()
this.onApplyCandy(correct, true)
this.data.set_hint(hint - 1)
@@ -378,7 +378,7 @@ export class Stage extends Laya.Script {
const list: Array<Block> = []
for (let i = 0; i < this.blocks.length; i++) {
var block = this.blocks[i]
if (block.getData().get_checked() == false)
if (block.getData().get_checked() === false)
list.push(block)
}
if (list.length > 0) {
@@ -411,36 +411,36 @@ export class Stage extends Laya.Script {
public onApplyCandy(showNumber: number, hint: boolean): void {
const show = this.selectedBlock.getData().get_show()
const notes = this.selectedBlock.getData().get_notes()
if (this.selectedBlock.getData().get_checked() == false) {
if (this.data.get_note_open() && hint == false) {
if (this.selectedBlock.getData().get_checked() === false) {
if (this.data.get_note_open() && hint === false) {
const relateds = this.findRelatedBlocks(this.selectedBlock)
let find = false
for (var i = 0; i < relateds.length; i++) {
if (relateds[i].getData().get_show() == showNumber) {
if (relateds[i].getData().get_show() === showNumber) {
find = true
break
}
}
if (find == false) {
if (find === false) {
this.data.add_undo(this.selectedBlock.getData().get_index(), show, notes)
this.selectedBlock.addNoteNumber(showNumber)
this.onSetBlock(this.selectedBlock)
} else {
for (var i = 0; i < relateds.length; i++) {
const obj = relateds[i]
if (obj.getData().get_show() == showNumber && obj.getData().get_index() != this.selectedBlock.getData().get_index()) {
if (obj.getData().get_show() === showNumber && obj.getData().get_index() != this.selectedBlock.getData().get_index()) {
obj.setFadeAnimation()
}
}
}
} else {
this.data.add_undo(this.selectedBlock.getData().get_index(), show, notes)
if (this.selectedBlock.getData().get_show() == showNumber) {
if (this.selectedBlock.getData().get_show() === showNumber) {
this.selectedBlock.setShowNumber(0, 0)
this.onSetBlock(this.selectedBlock)
} else {
let blockScore = 0
if (hint == false) {
if (hint === false) {
const duration = this.data.get_duration() - this.data.get_last_hit_time()
blockScore = Utility_CalculateScore(this.data.get_difficulty(), duration)
}
@@ -454,7 +454,7 @@ export class Stage extends Laya.Script {
let finished = 0
const blocks = this.data.get_blocks()
for (var i = 0; i < blocks.length; i++) {
if (blocks[i].get_preset() == false) {
if (blocks[i].get_preset() === false) {
all++
if (blocks[i].get_checked()) {
finished++
@@ -466,10 +466,10 @@ export class Stage extends Laya.Script {
if (this.getIsComplete()) {
console.log("完成关卡", finished, all, progress)
this.paused = true
if (this.data.get_stageType() == config.STAGE_TYPE.MAIN) { // 主线关卡更新难度进度
if (this.data.get_stageType() === config.STAGE_TYPE.MAIN) { // 主线关卡更新难度进度
user.update_progress(this.data.get_difficulty(), this.data.get_stageIndex() + 1)
UIManager.getInstance().loadGameDoneUI(true, this.data)
} else if (this.data.get_stageType() == config.STAGE_TYPE.DC) { // dc
} else if (this.data.get_stageType() === config.STAGE_TYPE.DC) { // dc
if (progress >= 1) { // 完成每日挑战关卡检查是否或者当月奖杯
const now = new Date()
const nowYear = now.getFullYear()
@@ -523,7 +523,7 @@ export class Stage extends Laya.Script {
list.set(i, 0)
for (var i = 0; i < this.blocks.length; i++) {
const block = this.blocks[i]
if (block.getData().get_checked() == false) {
if (block.getData().get_checked() === false) {
const correct = block.getData().get_correct()
list.set(correct, list.get(correct) + 1)
}
@@ -540,11 +540,11 @@ export class Stage extends Laya.Script {
const list: Array<Block> = []
for (let i = 0; i < this.blocks.length; i++) {
const block = this.blocks[i]
if (block.XIndex == obj.XIndex)
if (block.XIndex === obj.XIndex)
list.push(block)
else if (block.YIndex == obj.YIndex)
else if (block.YIndex === obj.YIndex)
list.push(block)
else if (block.XGroup == obj.XGroup && block.YGroup == obj.YGroup)
else if (block.XGroup === obj.XGroup && block.YGroup === obj.YGroup)
list.push(block)
}
return list
@@ -554,7 +554,7 @@ export class Stage extends Laya.Script {
const list: Array<Block> = []
for (let i = 0; i < this.blocks.length; i++) {
const block = this.blocks[i]
if (block.getData().get_show() == obj.getData().get_show())
if (block.getData().get_show() === obj.getData().get_show())
list.push(block)
}
return list
@@ -576,7 +576,7 @@ export class Stage extends Laya.Script {
let b = true
for (let i = 1; i < this.blocks.length; i++) {
const block = this.blocks[i]
if (block.getData().get_checked() == false) {
if (block.getData().get_checked() === false) {
b = false
break
}

View File

@@ -60,7 +60,7 @@ export class TopBar extends Laya.Script {
}
this.btn_classic.on(Laya.Event.CLICK, this, () => {
if (this.isClassic == false) {
if (this.isClassic === false) {
this.onClickTab(true)
}
})
@@ -88,7 +88,7 @@ export class TopBar extends Laya.Script {
const common = evt.target.getComponent(CommonData)
const difficulty = Laya.LocalStorage.getItem("difficulty")
if (common.strValue != difficulty) {
if (Laya.LocalStorage.getItem("showToggle") == "true") {
if (Laya.LocalStorage.getItem("showToggle") === "true") {
const title = "Start New Game"
const content = "Current game progress will be lost"
G_ShowCommonTips(title, content, true, (ok: boolean, toggleValue: boolean) => {

View File

@@ -88,7 +88,7 @@ export class CalendarUnit extends Laya.Script {
}
updateUnit(): void {
if (this.open == false) {
if (this.open === false) {
return
}

View File

@@ -131,7 +131,7 @@ export class DailyChallenge extends Laya.Script {
const nowMonth = now.getMonth() + 1
for (var i = 0; i < MONTH_LIST.length; i++) {
const obj = MONTH_LIST[i]
if (nowYear == obj.year && nowMonth == obj.month) {
if (nowYear === obj.year && nowMonth === obj.month) {
this.indexMax = i
break
}
@@ -169,7 +169,7 @@ export class DailyChallenge extends Laya.Script {
this.currentIndex = 0
for (let i = 0; i < MONTH_LIST.length; i++) {
const obj = MONTH_LIST[i]
if (nowYear == obj.year && nowMonth == obj.month) {
if (nowYear === obj.year && nowMonth === obj.month) {
this.currentIndex = i
break
}
@@ -212,10 +212,10 @@ export class DailyChallenge extends Laya.Script {
let open = true
if (info.year > nowYear) {
open = false
} else if (info.year == nowYear) {
} else if (info.year === nowYear) {
if (info.month > nowMonth) {
open = false
} else if (info.month == nowMonth) {
} else if (info.month === nowMonth) {
if (day > nowDay) {
open = false
}
@@ -234,7 +234,7 @@ export class DailyChallenge extends Laya.Script {
}
}
unit.setCalendarUnit(info.year, info.month, day, open, progress, this, this.onClickUnit)
if (info.year == nowYear && info.month == nowMonth && day == nowDay) {
if (info.year === nowYear && info.month === nowMonth && day === nowDay) {
this.selectedUnit = unit
}
day++

View File

@@ -20,7 +20,7 @@ export class TrophyClaim extends Laya.Script {
public onSetShow(record: TrophyRecord): void {
for (let i = 0; i < MONTH_LIST.length; i++) {
const obj = MONTH_LIST[i]
if (obj.year == record.year && obj.month == record.month) {
if (obj.year === record.year && obj.month === record.month) {
this.icon.skin = obj.icon_res
break
}

View File

@@ -34,7 +34,7 @@ export class TrophyRoom extends Laya.Script {
for (var i = 0; i < MONTH_LIST.length; i++) {
var obj = MONTH_LIST[i]
infos.push(obj)
if (obj.year == nowYear && obj.month == nowMonth) {
if (obj.year === nowYear && obj.month === nowMonth) {
break
}
}
@@ -48,7 +48,7 @@ export class TrophyRoom extends Laya.Script {
if (find < 0) {
years.push(obj.year)
}
if (monthMap.has(obj.year) == false) {
if (monthMap.has(obj.year) === false) {
monthMap.set(obj.year, [])
}
const list = monthMap.get(obj.year)

View File

@@ -20,7 +20,7 @@ export class TrophyShow extends Laya.Script {
public onSetShow(record: TrophyRecord): void {
for (let i = 0; i < MONTH_LIST.length; i++) {
const obj = MONTH_LIST[i]
if (obj.year == record.year && obj.month == record.month) {
if (obj.year === record.year && obj.month === record.month) {
this.icon.skin = obj.icon_res
break
}