Skip to content

Commit 67eeb6c

Browse files
authored
Merge pull request #75 from Game-as-a-Service/feat/layout-book
- 修改 ESLint: vue/html-self-closing (ref: https://eslint.vuejs.org/rules/html-self-closing#options) - 新增 showOpenedBook 控制 OpenedBook 顯示狀態 - 調整魔法圓圈動畫
2 parents a7cb6d0 + 0ce12fa commit 67eeb6c

22 files changed

+212
-85
lines changed

.eslintrc.cjs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -130,12 +130,12 @@ module.exports = {
130130
'vue/html-self-closing': [
131131
'error', {
132132
html: {
133-
void: 'never',
133+
void: 'always',
134134
normal: 'never',
135-
component: 'never'
135+
component: 'always'
136136
},
137-
svg: 'never',
138-
math: 'never'
137+
svg: 'always',
138+
math: 'always'
139139
}
140140
],
141141
'vue/component-name-in-template-casing': [ 'error', 'PascalCase', {

src/App.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
:hint-text="'遊戲開始'"
1010
:change-color="'bg-skin'"
1111
></HintBar> -->
12-
<router-view></router-view>
12+
<router-view />
1313
</div>
1414
</template>
1515

src/assets/images/book/CloseIcon.vue

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,20 +8,20 @@
88
fill-rule="evenodd"
99
clip-rule="evenodd"
1010
d="M30 0C13.4315 0 0 13.4315 0 30C0 46.5685 13.4315 60 30 60C46.5685 60 60 46.5685 60 30C60 13.4315 46.5685 0 30 0ZM30 4C15.6406 4 4 15.6406 4 30C4 44.3594 15.6406 56 30 56C44.3594 56 56 44.3594 56 30C56 15.6406 44.3594 4 30 4Z"
11-
></path>
11+
/>
1212
<rect
1313
x="11.6925"
1414
y="49.9668"
1515
width="4"
1616
height="54.0984"
1717
transform="rotate(-134.36 11.6925 49.9668)"
18-
></rect>
18+
/>
1919
<rect
2020
x="49.9667"
2121
y="48.3074"
2222
width="4"
2323
height="54.0984"
2424
transform="rotate(135.64 49.9667 48.3074)"
25-
></rect>
25+
/>
2626
</svg>
2727
</template>

src/components/FinalScoreBoard.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ const emits = defineEmits([ 'exit' ])
2727
class="flex items-center w-[700px] p-2 border-b border-grey70"
2828
>
2929
<div class="w-[60px] h-[60px]">
30-
<img :src="player.imgSrc">
30+
<img :src="player.imgSrc" />
3131
</div>
3232
<h6 class="pl-3 flex items-center text-[28px] ">
3333
<div class="truncate w-[240px]">
@@ -41,7 +41,7 @@ const emits = defineEmits([ 'exit' ])
4141
class="flex justify-evenly pt-4 cursor-pointer"
4242
@click="emits('exit')"
4343
>
44-
<img src="/src/assets/images/sundries/door-leave.svg">
44+
<img src="/src/assets/images/sundries/door-leave.svg" />
4545
</div>
4646
</div>
4747
</template>

src/components/HelloWorld.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
src="/vite.svg"
99
class="logo"
1010
alt="Vite logo"
11-
>
11+
/>
1212
</a>
1313
<a
1414
href="https://vuejs.org/"
@@ -18,7 +18,7 @@
1818
src="@/assets/vue.svg"
1919
class="logo vue"
2020
alt="Vue logo"
21-
>
21+
/>
2222
</a>
2323
</div>
2424
</template>

src/components/LadderBoard.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,6 @@ const usedMagic = computed(() => {
2121
:key="number"
2222
:magic-number="number"
2323
:used="usedMagic[number - 1]"
24-
></LadderStep>
24+
/>
2525
</div>
2626
</template>

src/components/LadderStep.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ const getMagicStoneUrl = (magicStone) => magicStones[`magic${ magicStone }`]
2121
<img
2222
class="opacity-50"
2323
:src="getMagicStoneUrl(magicNumber)"
24-
>
24+
/>
2525
</div>
2626
<div
2727
v-for="number in magicNumber"
@@ -31,7 +31,7 @@ const getMagicStoneUrl = (magicStone) => magicStones[`magic${ magicStone }`]
3131
<img
3232
v-if="used >= number"
3333
:src="getMagicStoneUrl(magicNumber)"
34-
>
34+
/>
3535
</div>
3636
<div></div>
3737
</div>

src/components/LeaveBtn.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<template>
22
<div class=" bg-white20 w-[200px] h-[76px] flex items-center place-content-center gap-2 ">
33
<div class=" w-[60px] h-[60px] bg-contain flex items-center mix-blend-soft-light ">
4-
<img src="/src/assets/images/sundries/door.png">
4+
<img src="/src/assets/images/sundries/door.png" />
55
</div>
66
<p class="text-center inline text-grey50 text-2xl font-large items-center">
77
離開遊戲

src/components/MainLayout.vue

Lines changed: 27 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import BroadcastArea from '@/components/BroadcastArea.vue'
88
import OpponentTable from '@/components/OpponentTable.vue'
99
import MyState from '@/components/MyState.vue'
1010
import OpenedBook from './OpenedBook.vue'
11+
import SmallBook from './SmallBook.vue'
1112
import SpellMagicBoard from './SpellMagicBoard.vue'
1213
import SecretSelectTable from './SecretSelectTable.vue'
1314
import HintBar from '@/components/common/HintBar.vue'
@@ -16,7 +17,8 @@ import io from 'socket.io-client'
1617
import { useGameStore } from '@/stores/game'
1718
import PlayDice from '@/components/PlayDice.vue'
1819
import {
19-
ref, computed, watch, onMounted
20+
ref, computed, watch, onMounted,
21+
provide
2022
} from 'vue'
2123
import axios from 'axios'
2224
import {
@@ -142,6 +144,8 @@ const handleJoinGame = async () => {
142144
gameRoomID,
143145
})
144146
}
147+
const showOpenedBook = ref(false)
148+
provide('showOpenedBook', showOpenedBook)
145149
watch(
146150
() => gameStore.gameStatus.current_player,
147151
(newVal, oldVal) => {
@@ -224,70 +228,74 @@ const handleExit = () => {
224228
class="bg-no-repeat bg-center bg-cover p-8 relative w-full h-full"
225229
>
226230
<div class="flex gap-11 top-8 left-8 absolute">
227-
<PlayDice v-if="gameStore.showDice"></PlayDice>
231+
<PlayDice v-if="gameStore.showDice" />
228232
229-
<ScoreBoard></ScoreBoard>
233+
<div class="flex gap-4">
234+
<ScoreBoard />
235+
<SmallBook />
236+
</div>
230237
</div>
231238
<div class="absolute top-8 right-8">
232239
</div>
233240
<div class="absolute bottom-8 left-8">
234-
<LadderBoard></LadderBoard>
241+
<LadderBoard />
235242
</div>
236243
<div class="absolute left-[40%] top-1/2 translate-y-[-50%] translate-x-[-50%] z-40 max-[1400px]:scale-75">
237-
<TableWithPlayer></TableWithPlayer>
238-
<OpenedBook></OpenedBook>
244+
<TableWithPlayer />
239245
</div>
246+
<OpenedBook />
247+
<!-- <div class="absolute left-[40%] top-8 translate-y-[-50%] translate-x-[-50%] z-40 max-[1400px]:scale-75">
248+
<OpenedBook></OpenedBook>
249+
</div> -->
250+
240251
<!-- 右側排版 -->
241252
<div class="absolute right-0 top-0 p-4 h-[100dvh]">
242253
<div class="h-full flex flex-col justify-between items-end">
243254
<div class="w-auto flex flex-row ">
244-
<OpponentTable></OpponentTable>
255+
<OpponentTable />
245256
</div>
246257
<div class="flex gap-8 max-w-[40vw] flex-row justify-end mb-4 ">
247-
<WarehouseMix :class="{ 'show-warehouse': showWarehouse }"></WarehouseMix>
248-
<MyState></MyState>
258+
<WarehouseMix :class="{ 'show-warehouse': showWarehouse }" />
259+
<MyState />
249260
</div>
250-
<BroadcastArea></BroadcastArea>
261+
<BroadcastArea />
251262
</div>
252263
</div>
253264
254265
<div v-if="gameStore.showVideo">
255-
<PlayVideo>
256-
</PlayVideo>
266+
<PlayVideo />
257267
</div>
258268
<div
259269
v-if="gameStore.showSecretTable"
260270
class="flex justify-center items-center bg-grey50 top-0 z-50 left-0 w-full h-full backgroundBlur absolute"
261271
>
262-
<SecretSelectTable></SecretSelectTable>
272+
<SecretSelectTable />
263273
</div>
264274
265275
<HintBar
266276
v-if="showHint1"
267277
:hint-text="'輪到你了! 請選擇魔法!'"
268278
:change-color="'bg-purple text-white'"
269279
class="z-50"
270-
>
271-
</HintBar>
280+
/>
272281
<HintBar
273282
v-if="showHintStart"
274283
:hint-text="'按一下,成為魔法師吧!'"
275284
:change-color="'bg-purple text-white'"
276285
class="z-50 cursor-pointer"
277286
@click="clickEvent"
278-
>
279-
</HintBar>
287+
/>
280288
<div
281289
v-if="myTurn && !gameStore.spellFailed && !gameOver"
282290
class="bg-grey50 top-0 left-0 w-full h-full backgroundBlur absolute"
283291
>
284-
<SpellMagicBoard></SpellMagicBoard>
292+
<SpellMagicBoard />
285293
</div>
286294
<div
287295
v-if="gameOver"
288296
class="bg-grey50 z-50 top-1/4 left-0 w-full backgroundBlur absolute flex justify-center items-center"
289297
>
290-
<FinalScoreBoard @exit="handleExit"></FinalScoreBoard>
298+
<FinalScoreBoard @exit="handleExit" />
291299
</div>
292300
</div>
293301
<!-- <div>

src/components/MyState.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ const secretStones = computed(() => {
5959
<img
6060
class="stone-img"
6161
:src="getMagicStoneUrl(stone)"
62-
>
62+
/>
6363
</div>
6464
</div>
6565

0 commit comments

Comments
 (0)