[upgrade]渲染随机卡片

This commit is contained in:
zhudaoruyi 2022-09-21 14:45:32 +08:00
parent 3e953a91d4
commit e27e875790

View File

@ -16,50 +16,32 @@
<a-row align="center"> <a-row align="center">
<div v-show="gameStatus > 0" class="level-board"> <div v-show="gameStatus > 0" class="level-board">
<div v-for="(block, idx) in levelBlocksVal" :key="idx"> <div v-for="(block, idx) in levelBlocksVal" :key="idx">
<div <div v-if="block.status === 0" class="block block-1 level-block" :class="{
v-if="block.status === 0" disabled: !isHolyLight && block.lowerThanBlocks.length > 0,
class="block level-block" }" :data-id="block.id" :style="{
:class="{ zIndex: 100 + block.level,
disabled: !isHolyLight && block.lowerThanBlocks.length > 0, left: block.x * widthUnit + 'px',
}" top: block.y * heightUnit + 'px',
:data-id="block.id" }" @click="() => doClickBlock(block)">
:style="{
zIndex: 100 + block.level,
left: block.x * widthUnit + 'px',
top: block.y * heightUnit + 'px',
}"
@click="() => doClickBlock(block)"
>
{{ block.type }} {{ block.type }}
</div> </div>
</div> </div>
</div> </div>
</a-row> </a-row>
<!-- 随机选块 --> <!-- 随机选块 -->
<a-row align="space-between" class="random-board"> <a-row align="space-around" class="random-board">
<div <div v-for="(randomBlock, index) in randomBlocksVal" :key="index" class="random-area">
v-for="(randomBlock, index) in randomBlocksVal"
:key="index"
class="random-area"
>
<div
v-if="randomBlock.length > 0"
:data-id="randomBlock[0].id"
class="block"
@click="() => doClickBlock(randomBlock[0], index)"
>
{{ randomBlock[0].type }}
</div>
<!-- 隐藏 --> <!-- 隐藏 -->
<div <div v-for="num in Math.max(randomBlock.length - 1, 0)" :key="num" class="block block-2 disabled">
v-for="num in Math.max(randomBlock.length - 1, 0)"
:key="num"
class="block disabled"
>
<span v-if="canSeeRandom"> <span v-if="canSeeRandom">
{{ randomBlock[num].type }} {{ randomBlock[num].type }}
</span> </span>
</div> </div>
<!-- 展示 -->
<div v-if="randomBlock.length > 0" :data-id="randomBlock[0].id" class="block block-2"
@click="() => doClickBlock(randomBlock[0], index)">
{{ randomBlock[0].type }}
</div>
</div> </div>
</a-row> </a-row>
<!-- 槽位 --> <!-- 槽位 -->
@ -162,6 +144,17 @@ onMounted(() => {
display: inline-block; display: inline-block;
} }
.block-1 {
border-radius: 4px;
border: 1px solid #666;
}
.block-2 {
margin-left: -30px;
border-radius: 4px;
border: 1px solid #666;
}
.disabled { .disabled {
background: grey; background: grey;
cursor: not-allowed; cursor: not-allowed;