== to ===
This commit is contained in:
@@ -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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user