wangfukang 4 days ago
parent
commit
af21459162
  1. 21
      package1/planet/adventure.vue

21
package1/planet/adventure.vue

@ -72,7 +72,7 @@
:class="card.className" :class="card.className"
:style="card.style" :style="card.style"
@tap="pickCard(card)"> @tap="pickCard(card)">
<text>{{card.icon}}</text> <text>{{card.displayIcon}}</text>
</view> </view>
</view> </view>
@ -80,7 +80,7 @@
<view class="slot-title">助推槽 {{slots.length}}/{{slotLimit}}</view> <view class="slot-title">助推槽 {{slots.length}}/{{slotLimit}}</view>
<view class="slots"> <view class="slots">
<view class="slot" v-for="i in slotLimit" :key="i"> <view class="slot" v-for="i in slotLimit" :key="i">
<text v-if="slots[i - 1]">{{slots[i - 1].icon}}</text> <text v-if="slots[i - 1]">{{slots[i - 1].displayIcon}}</text>
</view> </view>
</view> </view>
</view> </view>
@ -421,6 +421,7 @@
if (!card.icon) { if (!card.icon) {
card.icon = icons[(index + Math.floor(rand() * icons.length)) % icons.length] card.icon = icons[(index + Math.floor(rand() * icons.length)) % icons.length]
} }
card.displayIcon = this.displayIcon(card.icon)
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)};`
}) })
return cards return cards
@ -428,6 +429,7 @@
assignEmergencyIcons(positions, icons, garbageIcons) { assignEmergencyIcons(positions, icons, garbageIcons) {
positions.forEach((card, index) => { positions.forEach((card, index) => {
card.icon = index < 6 ? garbageIcons[Math.floor(index / 2) % garbageIcons.length] : icons[Math.floor((index - 6) / 3) % icons.length] card.icon = index < 6 ? garbageIcons[Math.floor(index / 2) % garbageIcons.length] : icons[Math.floor((index - 6) / 3) % icons.length]
card.displayIcon = this.displayIcon(card.icon)
card.trap = index >= 6 && index < 42 card.trap = index >= 6 && index < 42
card.keyCard = card.trap && card.layer === 0 && this.isCenterCard(card) card.keyCard = card.trap && card.layer === 0 && this.isCenterCard(card)
card.garbage = index < 6 card.garbage = index < 6
@ -512,16 +514,22 @@
return Math.abs(a.x - b.x) < 74 && Math.abs(a.y - b.y) < 74 return Math.abs(a.x - b.x) < 74 && Math.abs(a.y - b.y) < 74
}, },
cardZIndex(card) { cardZIndex(card) {
return (card.layer || 0) * 1000 + (card.order || 0) + 1 return (card.layer || 0) * 100 + (card.order || 0) + 1
}, },
normalizeCards(icons) { normalizeCards(icons) {
this.cards.forEach((card, index) => { this.cards.forEach((card, index) => {
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.locked = false card.locked = false
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)};`
}) })
}, },
displayIcon(icon) {
if (!icon) return '?'
if (this.isGarbageIcon(icon)) return icon
return icon
},
refreshCardState() { refreshCardState() {
this.cards.forEach(card => { this.cards.forEach(card => {
const locked = !card.removed && !card.selected && this.isLocked(card) const locked = !card.removed && !card.selected && this.isLocked(card)
@ -547,6 +555,7 @@
return return
} }
if (this.slots.length >= this.slotLimit) return if (this.slots.length >= this.slotLimit) return
card.displayIcon = this.displayIcon(card.icon)
card.selected = true card.selected = true
this.slots.push(card) this.slots.push(card)
this.moveCount++ this.moveCount++
@ -716,7 +725,7 @@
<style lang="scss" scoped> <style lang="scss" scoped>
.boost { min-height: 100vh; background: linear-gradient(155deg, #F3FFF4 0%, #EAF8FF 46%, #FFF7DE 100%); color: #12342F; } .boost { min-height: 100vh; background: linear-gradient(155deg, #F3FFF4 0%, #EAF8FF 46%, #FFF7DE 100%); color: #12342F; }
.nav { position: fixed; top: 0; left: 0; right: 0; height: 44px; z-index: 20; display: flex; align-items: flex-end; justify-content: center; padding-bottom: 8rpx; background: rgba(243,255,244,0.86); } .nav { position: fixed; top: 0; left: 0; right: 0; height: 44px; z-index: 200; display: flex; align-items: flex-end; justify-content: center; padding-bottom: 8rpx; background: rgba(243,255,244,0.86); }
.nav-back { position: absolute; left: 20rpx; bottom: 0; width: 70rpx; height: 44px; display: flex; align-items: center; justify-content: center; color: #12342F; font-size: 54rpx; } .nav-back { position: absolute; left: 20rpx; bottom: 0; width: 70rpx; height: 44px; display: flex; align-items: center; justify-content: center; color: #12342F; font-size: 54rpx; }
.nav-title { color: #12342F; font-size: 34rpx; font-weight: 900; } .nav-title { color: #12342F; font-size: 34rpx; font-weight: 900; }
.page { height: 100vh; box-sizing: border-box; padding-left: 24rpx; padding-right: 24rpx; } .page { height: 100vh; box-sizing: border-box; padding-left: 24rpx; padding-right: 24rpx; }
@ -749,7 +758,7 @@
.bar view { height: 100%; border-radius: 999rpx; background: linear-gradient(90deg, #35D6A6, #4FB7FF); } .bar view { height: 100%; border-radius: 999rpx; background: linear-gradient(90deg, #35D6A6, #4FB7FF); }
.score { width: 92rpx; text-align: right; color: #22B889; font-size: 28rpx; font-weight: 900; } .score { width: 92rpx; text-align: right; color: #22B889; font-size: 28rpx; font-weight: 900; }
.empty { margin-top: 18rpx; color: #8AA09C; font-size: 24rpx; } .empty { margin-top: 18rpx; color: #8AA09C; font-size: 24rpx; }
.board { margin-top: 22rpx; height: 620rpx; border-radius: 36rpx; background: linear-gradient(155deg, rgba(234,248,255,0.9), rgba(255,248,222,0.72)); position: relative; overflow: hidden; } .board { margin-top: 22rpx; height: 620rpx; border-radius: 36rpx; background: linear-gradient(155deg, rgba(234,248,255,0.9), rgba(255,248,222,0.72)); position: relative; overflow: hidden; z-index: 1; }
.tile { position: absolute; width: 76rpx; height: 76rpx; border-radius: 22rpx; background: #fff; display: flex; align-items: center; justify-content: center; box-shadow: 0 10rpx 22rpx rgba(66,99,94,0.12); border: 2rpx solid rgba(255,255,255,0.9); transition: transform .12s ease, opacity .12s ease; } .tile { position: absolute; width: 76rpx; height: 76rpx; border-radius: 22rpx; background: #fff; display: flex; align-items: center; justify-content: center; box-shadow: 0 10rpx 22rpx rgba(66,99,94,0.12); border: 2rpx solid rgba(255,255,255,0.9); transition: transform .12s ease, opacity .12s ease; }
.tile text { font-size: 42rpx; } .tile text { font-size: 42rpx; }
.tile.locked{ .tile.locked{
@ -767,7 +776,7 @@
.sub-btn { background: rgba(255,255,255,0.78); color: #42635E; } .sub-btn { background: rgba(255,255,255,0.78); color: #42635E; }
.main-btn { background: linear-gradient(135deg, #35D6A6, #4FB7FF); color: #fff; box-shadow: 0 14rpx 34rpx rgba(53,214,166,0.2); } .main-btn { background: linear-gradient(135deg, #35D6A6, #4FB7FF); color: #fff; box-shadow: 0 14rpx 34rpx rgba(53,214,166,0.2); }
.main-btn.disabled { opacity: .45; } .main-btn.disabled { opacity: .45; }
.modal { position: fixed; inset: 0; z-index: 40; background: rgba(18,52,47,0.2); display: flex; align-items: center; justify-content: center; padding: 46rpx; } .modal { position: fixed; inset: 0; z-index: 9999; background: rgba(18,52,47,0.2); display: flex; align-items: center; justify-content: center; padding: 46rpx; }
.modal-card { width: 100%; border-radius: 42rpx; background: #fff; padding: 42rpx; text-align: center; } .modal-card { width: 100%; border-radius: 42rpx; background: #fff; padding: 42rpx; text-align: center; }
.modal-title { font-size: 40rpx; font-weight: 900; } .modal-title { font-size: 40rpx; font-weight: 900; }
.modal-sub { margin: 18rpx 0 30rpx; color: #6B817D; font-size: 26rpx; line-height: 1.55; } .modal-sub { margin: 18rpx 0 30rpx; color: #6B817D; font-size: 26rpx; line-height: 1.55; }

Loading…
Cancel
Save