wangfukang 4 days ago
parent
commit
46f20a5a91
  1. 37
      package1/planet/adventure.vue

37
package1/planet/adventure.vue

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

Loading…
Cancel
Save