== 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

@@ -33,7 +33,7 @@ export const MONTH_LIST = [
export function G_getMonthInfo(year: number, month: number): any {
for (let i = 0; i < MONTH_LIST.length; i++) {
const obj = MONTH_LIST[i]
if (obj.year == year && obj.month == month) {
if (obj.year === year && obj.month === month) {
return obj
}
}

View File

@@ -11,7 +11,7 @@ export class DOBlock {
this.data = dataBlock
this.preset = preset
this.correct = correct
this.checked = preset || (dataBlock.show == correct)
this.checked = preset || (dataBlock.show === correct)
}
// ====================================持久化数据
@@ -25,7 +25,7 @@ export class DOBlock {
public set_show(show: number): void {
this.data.show = show
this.checked = show == this.get_correct()
this.checked = show === this.get_correct()
StorageManager.getInstance().onStageChanged()
}

View File

@@ -51,7 +51,7 @@ export class DOUser {
let find: StageProgress
for (let i = 0; i < this.data.dones.length; i++) {
const obj = this.data.dones[i]
if (obj.stageID == stageID) {
if (obj.stageID === stageID) {
find = obj
break
}
@@ -71,7 +71,7 @@ export class DOUser {
let find: TrophyRecord
for (let i = 0; i < this.data.trophy_records.length; i++) {
const obj = this.data.trophy_records[i]
if (obj.year == year && obj.month == month) {
if (obj.year === year && obj.month === month) {
find = obj
break
}
@@ -102,7 +102,7 @@ export class DOUser {
let unread = false
for (let i = 0; i < this.data.trophy_records.length; i++) {
const obj = this.data.trophy_records[i]
if (obj.read == false) {
if (obj.read === false) {
unread = true
break
}
@@ -114,7 +114,7 @@ export class DOUser {
let changed = false
for (let i = 0; i < this.data.trophy_records.length; i++) {
const obj = this.data.trophy_records[i]
if (obj.read == false) {
if (obj.read === false) {
obj.read = true
changed = true
}
@@ -128,7 +128,7 @@ export class DOUser {
let find
for (let i = 0; i < this.data.trophy_records.length; i++) {
const obj = this.data.trophy_records[i]
if (obj.year == year && obj.month == month) {
if (obj.year === year && obj.month === month) {
find = obj
break
}
@@ -144,7 +144,7 @@ export class DOUser {
let find: DataProgress
for (let i = 0; i < this.data.progresses.length; i++) {
const obj = this.data.progresses[i]
if (obj.difficulty == difficulty) {
if (obj.difficulty === difficulty) {
find = obj
break
}
@@ -159,7 +159,7 @@ export class DOUser {
let find: DataProgress
for (let i = 0; i < this.data.progresses.length; i++) {
const obj = this.data.progresses[i]
if (obj.difficulty == difficulty) {
if (obj.difficulty === difficulty) {
find = obj
break
}

View File

@@ -17,7 +17,7 @@ export class EventManager {
private listeners: Map<string, Array<any>> = new Map()
public RegisterEvent(eventID: string, func: any): void {
if (this.listeners.has(eventID) == false) {
if (this.listeners.has(eventID) === false) {
this.listeners.set(eventID, [])
}
const list: Array<any> = this.listeners.get(eventID)

View File

@@ -59,14 +59,14 @@ export class StorageManager {
this.stageChanged = true
let index
if (type == config.STAGE_TYPE.MAIN) { // 主线关卡
if (type === config.STAGE_TYPE.MAIN) { // 主线关卡
index = this.user.get_progress(difficulty)
const levelStr = LevelManager.getInstance().getLevelStr(difficulty, index)
if (!levelStr || levelStr.length <= 0) { // 说明当前难度已经打通了,所以给他从头开始
index = 0
this.user.update_progress(difficulty, index)
}
} else if (type == config.STAGE_TYPE.DC) { // 每天调整如果已经创建过关卡那么就用之前的关卡配置
} else if (type === config.STAGE_TYPE.DC) { // 每天调整如果已经创建过关卡那么就用之前的关卡配置
const value = this.getStage(stageID)
if (value) {
difficulty = value.get_difficulty()

View File

@@ -17,15 +17,15 @@ export function Utility_ConvertSecondToString(second: number) {
export function Utility_CalculateScore(difficulty: string, second: number): number {
let score = 0
const currentTime = Math.min(120, second)
if (difficulty == config.DIFFICULTY_TYPE.Easy) {
if (difficulty === config.DIFFICULTY_TYPE.Easy) {
score = 270 - currentTime
} else if (difficulty == config.DIFFICULTY_TYPE.Medium) {
} else if (difficulty === config.DIFFICULTY_TYPE.Medium) {
score = 420 - currentTime * 2
} else if (difficulty == config.DIFFICULTY_TYPE.Hard) {
} else if (difficulty === config.DIFFICULTY_TYPE.Hard) {
score = 760 - currentTime * 3
} else if (difficulty == config.DIFFICULTY_TYPE.Expert) {
} else if (difficulty === config.DIFFICULTY_TYPE.Expert) {
score = 1120 - currentTime * 3
} else if (difficulty == config.DIFFICULTY_TYPE.Extreme) {
} else if (difficulty === config.DIFFICULTY_TYPE.Extreme) {
score = 1320 - currentTime * 4
}
// console.log("计算积分 >>>>>", difficulty, second, score)

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
}