|
|
@ -163,8 +163,8 @@ |
|
|
cards: [], |
|
|
cards: [], |
|
|
slots: [], |
|
|
slots: [], |
|
|
slotLimit: 7, |
|
|
slotLimit: 7, |
|
|
timeLimit: 300, |
|
|
timeLimit: 180, |
|
|
timeLeft: 300, |
|
|
timeLeft: 180, |
|
|
timer: null, |
|
|
timer: null, |
|
|
roundSeed: '', |
|
|
roundSeed: '', |
|
|
moveCount: 0, |
|
|
moveCount: 0, |
|
|
@ -201,7 +201,7 @@ |
|
|
}, |
|
|
}, |
|
|
visibleCards() { |
|
|
visibleCards() { |
|
|
return this.cards |
|
|
return this.cards |
|
|
.filter(item => !item.removed && !item.selected) |
|
|
.filter(item => !item.removed && !item.selected && (item.coverDepth || 0) < 2) |
|
|
.sort((a,b)=>this.cardZIndex(a)-this.cardZIndex(b)) |
|
|
.sort((a,b)=>this.cardZIndex(a)-this.cardZIndex(b)) |
|
|
}, |
|
|
}, |
|
|
remainingCount() { |
|
|
remainingCount() { |
|
|
@ -228,7 +228,7 @@ |
|
|
return cells |
|
|
return cells |
|
|
}, |
|
|
}, |
|
|
timerText() { |
|
|
timerText() { |
|
|
return this.playing ? `${this.timeLeft}s` : '300s限时' |
|
|
return this.playing ? `${this.timeLeft}s` : '180s限时' |
|
|
}, |
|
|
}, |
|
|
timerPercent() { |
|
|
timerPercent() { |
|
|
return Math.max(0, Math.min(100, Math.round(this.timeLeft * 100 / this.timeLimit))) |
|
|
return Math.max(0, Math.min(100, Math.round(this.timeLeft * 100 / this.timeLimit))) |
|
|
@ -243,7 +243,7 @@ |
|
|
if (!this.playing) return '开始后进入倒计时' |
|
|
if (!this.playing) return '开始后进入倒计时' |
|
|
if (this.timeLeft <= 30) return '最后冲刺,槽位别满' |
|
|
if (this.timeLeft <= 30) return '最后冲刺,槽位别满' |
|
|
if (this.timeLeft <= 60) return '时间紧张,加快决策' |
|
|
if (this.timeLeft <= 60) return '时间紧张,加快决策' |
|
|
return '300秒内完成助推' |
|
|
return '180秒内完成助推' |
|
|
}, |
|
|
}, |
|
|
riskText() { |
|
|
riskText() { |
|
|
if (this.slots.length >= this.slotLimit - 1) return '危险:差1格就满' |
|
|
if (this.slots.length >= this.slotLimit - 1) return '危险:差1格就满' |
|
|
@ -277,7 +277,7 @@ |
|
|
const elapsed = Math.floor((Date.now() - this.startTs) / 1000) |
|
|
const elapsed = Math.floor((Date.now() - this.startTs) / 1000) |
|
|
this.timeLeft = Math.max(0, this.timeLimit - elapsed) |
|
|
this.timeLeft = Math.max(0, this.timeLimit - elapsed) |
|
|
if (this.timeLeft <= 0) { |
|
|
if (this.timeLeft <= 0) { |
|
|
this.failLevel('时间到了', '超过300秒,本关失败。不消耗次数,调整顺序再来一次。') |
|
|
this.failLevel('时间到了', '超过180秒,本关失败。不消耗次数,调整顺序再来一次。') |
|
|
} else { |
|
|
} else { |
|
|
this.startTimer(false) |
|
|
this.startTimer(false) |
|
|
} |
|
|
} |
|
|
@ -699,6 +699,7 @@ |
|
|
if (!card.icon) card.icon = icons[index % icons.length] |
|
|
if (!card.icon) card.icon = icons[index % icons.length] |
|
|
card.displayIcon = this.displayIcon(card.icon) |
|
|
card.displayIcon = this.displayIcon(card.icon) |
|
|
card.locked = false |
|
|
card.locked = false |
|
|
|
|
|
card.coverDepth = 0 |
|
|
card.className = '' |
|
|
card.className = '' |
|
|
card.style = `left:${card.x}rpx;top:${card.y}rpx;z-index:${this.cardZIndex(card)};` |
|
|
card.style = `left:${card.x}rpx;top:${card.y}rpx;z-index:${this.cardZIndex(card)};` |
|
|
}) |
|
|
}) |
|
|
@ -710,14 +711,25 @@ |
|
|
}, |
|
|
}, |
|
|
refreshCardState() { |
|
|
refreshCardState() { |
|
|
this.cards.forEach(card => { |
|
|
this.cards.forEach(card => { |
|
|
const locked = !card.removed && !card.selected && this.isLocked(card) |
|
|
const depth = this.coverDepth(card) |
|
|
|
|
|
const locked = !card.removed && !card.selected && depth > 0 |
|
|
card.locked = locked |
|
|
card.locked = locked |
|
|
|
|
|
card.coverDepth = depth |
|
|
card.className = [ |
|
|
card.className = [ |
|
|
locked ? 'locked' : '', |
|
|
depth === 1 ? 'locked' : '', |
|
|
|
|
|
depth >= 2 ? 'hidden-deep' : '', |
|
|
card.selected ? 'selected' : '' |
|
|
card.selected ? 'selected' : '' |
|
|
].filter(Boolean).join(' ') |
|
|
].filter(Boolean).join(' ') |
|
|
}) |
|
|
}) |
|
|
}, |
|
|
}, |
|
|
|
|
|
coverDepth(card) { |
|
|
|
|
|
if (card.removed || card.selected) return 0 |
|
|
|
|
|
return this.cards.filter(other => { |
|
|
|
|
|
if (other.id === card.id) return false |
|
|
|
|
|
if (other.removed || other.selected) return false |
|
|
|
|
|
return this.getRealZ(other) > this.getRealZ(card) && this.isOverlap(card, other) |
|
|
|
|
|
}).length |
|
|
|
|
|
}, |
|
|
pickCard(card) { |
|
|
pickCard(card) { |
|
|
if (this.cleared) { |
|
|
if (this.cleared) { |
|
|
this.tui.toast('今日已助推,明天再来') |
|
|
this.tui.toast('今日已助推,明天再来') |
|
|
@ -759,7 +771,7 @@ |
|
|
const elapsed = Math.floor((Date.now() - this.startTs) / 1000) |
|
|
const elapsed = Math.floor((Date.now() - this.startTs) / 1000) |
|
|
this.timeLeft = Math.max(0, this.timeLimit - elapsed) |
|
|
this.timeLeft = Math.max(0, this.timeLimit - elapsed) |
|
|
if (this.timeLeft <= 0) { |
|
|
if (this.timeLeft <= 0) { |
|
|
this.failLevel('时间到了', '超过300秒,本关失败。不消耗次数,调整顺序再来一次。') |
|
|
this.failLevel('时间到了', '超过180秒,本关失败。不消耗次数,调整顺序再来一次。') |
|
|
} |
|
|
} |
|
|
}, 1000) |
|
|
}, 1000) |
|
|
}, |
|
|
}, |
|
|
@ -797,11 +809,7 @@ |
|
|
}) |
|
|
}) |
|
|
}, |
|
|
}, |
|
|
isLocked(card) { |
|
|
isLocked(card) { |
|
|
return this.cards.some(other => { |
|
|
return this.coverDepth(card) > 0 |
|
|
if (other.id === card.id) return false |
|
|
|
|
|
if (other.removed || other.selected) return false |
|
|
|
|
|
return this.getRealZ(other) > this.getRealZ(card) && this.isOverlap(card, other) |
|
|
|
|
|
}) |
|
|
|
|
|
}, |
|
|
}, |
|
|
finishClear() { |
|
|
finishClear() { |
|
|
const duration = Math.max(20, Math.floor((Date.now() - this.startTs) / 1000)) |
|
|
const duration = Math.max(20, Math.floor((Date.now() - this.startTs) / 1000)) |
|
|
@ -995,6 +1003,7 @@ |
|
|
opacity: .42; |
|
|
opacity: .42; |
|
|
pointer-events: none; |
|
|
pointer-events: none; |
|
|
} |
|
|
} |
|
|
|
|
|
.tile.hidden-deep { display: none; pointer-events: none; } |
|
|
.tile.selected { opacity: 0; transform: scale(.5); pointer-events: none; } |
|
|
.tile.selected { opacity: 0; transform: scale(.5); pointer-events: none; } |
|
|
.slot-wrap { margin-top: 24rpx; } |
|
|
.slot-wrap { margin-top: 24rpx; } |
|
|
.slot-title { color: #6B817D; font-size: 24rpx; margin-bottom: 14rpx; } |
|
|
.slot-title { color: #6B817D; font-size: 24rpx; margin-bottom: 14rpx; } |
|
|
|