Skip to content

Commit

Permalink
store
Browse files Browse the repository at this point in the history
  • Loading branch information
hsyhhssyy committed Jun 25, 2024
1 parent e43fa0e commit 4c10011
Show file tree
Hide file tree
Showing 6 changed files with 29 additions and 34 deletions.
2 changes: 2 additions & 0 deletions src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ const layoutComponent = computed(() => {
})
const handleResize = () => {
if(route.path=="/") return
if (window.innerWidth < 768 && !route.path.startsWith('/m/')) {
router.replace(`/m${route.fullPath}`)
}
Expand Down
4 changes: 2 additions & 2 deletions src/desktop/views/game/CypherChallenge.vue
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
</div>
</div>
<div class="game-guide">
<amiya-face @on-hit="onFaceHit"></amiya-face>
<amiya-face @on-hit="onFaceHit" :players="players"></amiya-face>
</div>
</div>
</n-card>
Expand All @@ -74,7 +74,7 @@ import GameBase from '@/desktop/views/GameBase.vue'
import ResultTable from '@/desktop/components/cypherChallenge/ResultTable.vue'
import NextQuestion from '@/universal/components/NextQuestion.vue'
import PlayerRanking from '@/desktop/components/PlayerRanking.vue'
import AmiyaFace from '@/desktop/components/AmiyaFace.vue'
import AmiyaFace from '@/universal/components/AmiyaFace.vue'
const route = useRoute()
const gameHub = useGameHubStore()
Expand Down
26 changes: 13 additions & 13 deletions src/desktop/views/game/SkinGuess.vue
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,16 @@
</div>
<div class="question-prompt" v-if="settlementDialogShown">
这是哪位干员立绘的一部分呢({{ (currentQuestionIndex??0) }} / {{ game?.MaxQuestionCount }})?
</div>
<div v-if="rallyReached">
<icon-button :icon="Tips" type="info" @click="handleRequestHint"
:disabled="currentQuestion?.HintLevel=='1'"
style="margin: 10px;">提示</icon-button>
<icon-button :icon="Tips" type="error"
@click="handleGiveUp"
:disabled="giveUpPressed"
v-if="isHost"
>放弃</icon-button>
</div>
<div class="question-prompt" v-if="!rallyReached">
正在加载,请稍等...
Expand All @@ -53,19 +63,9 @@
<canvas id="masked-image" class="masked-image" v-show="rallyReached"></canvas>
</div>
</div>
<div class="hint-area">
<icon-button :icon="Tips" type="info" @click="handleRequestHint"
:disabled="currentQuestion?.HintLevel=='1'"
style="margin: 10px;">提示</icon-button>
<icon-button :icon="Tips" type="error"
@click="handleGiveUp"
:disabled="giveUpPressed"
v-if="isHost"
>放弃</icon-button>
</div>
</div>
<div class="game-guide">
<amiya-face @on-hit="onFaceHit"></amiya-face>
<amiya-face @on-hit="onFaceHit" :players="players"></amiya-face>
</div>
</div>
</n-card>
Expand All @@ -91,7 +91,7 @@ import HitEffect from '@/desktop/components/effects/HitEffect.vue'
import GameBase from '@/desktop/views/GameBase.vue'
import NextQuestion from '@/universal/components/NextQuestion.vue'
import PlayerRanking from '@/desktop/components/PlayerRanking.vue'
import AmiyaFace from '@/desktop/components/AmiyaFace.vue'
import AmiyaFace from '@/universal/components/AmiyaFace.vue'
import IconButton from '@/universal/components/IconButton.vue'
import Loading from '@/universal/components/Loading.vue'
Expand Down Expand Up @@ -525,7 +525,7 @@ $guideHeight: 160px;
.game-card {
position: relative;
overflow: hidden;
width: 1080px; // 此处固定宽度,是因为amiya face,会改变宽度,因此偷懒临时固定宽度
width: 600px; // 此处固定宽度,是因为amiya face,会改变宽度,因此偷懒临时固定宽度
.overlay {
Expand Down
6 changes: 2 additions & 4 deletions src/mobile/views/game/CypherChallenge.vue
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
</div>
</div>
<div style="display: none;">
<amiya-face @on-hit="onFaceHit"></amiya-face>
<amiya-face @on-hit="onFaceHit" :players="players"></amiya-face>
</div>
</div>
<template v-slot:players>
Expand All @@ -60,7 +60,7 @@ import NextQuestion from '@/universal/components/NextQuestion.vue'
import type { Question } from '@/def/cypher-challenge'
import type { Message } from '@/def/signalr-common'
import PlayerRanking from '@/mobile/components/PlayerRanking.vue'
import AmiyaFace from '@/desktop/components/AmiyaFace.vue'
import AmiyaFace from '@/universal/components/AmiyaFace.vue'
const route = useRoute()
const gameHub = useGameHubStore()
Expand Down Expand Up @@ -263,8 +263,6 @@ onUnmounted(() => {
position: relative;
overflow: hidden;
max-width: 1000px;
.game-panel {
height: 100%;
background: url(@/assets/images/cypherChallenge/loading.jpg) center / cover no-repeat;
Expand Down
8 changes: 4 additions & 4 deletions src/mobile/views/game/SkinGuess.vue
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@
</div>
</div>
<div style="display: none;">
<amiya-face @on-hit="onFaceHit"></amiya-face>
<amiya-face @on-hit="onFaceHit" :players="players"></amiya-face>
</div>
</div>
</n-card>
Expand All @@ -91,7 +91,7 @@ import HitEffect from '@/mobile/components/effects/HitEffect.vue'
import GameBase from '@/mobile/views/GameBase.vue'
import NextQuestion from '@/universal/components/NextQuestion.vue'
import PlayerRanking from '@/mobile/components/PlayerRanking.vue'
import AmiyaFace from '@/desktop/components/AmiyaFace.vue'
import AmiyaFace from '@/universal/components/AmiyaFace.vue'
import IconButton from '@/universal/components/IconButton.vue'
import Loading from '@/universal/components/Loading.vue'
Expand Down Expand Up @@ -353,8 +353,8 @@ function imageLoadingCompleted() {
rallyReached.value = true;
}
function onFaceHit(face: HitType, _: string) {
hit.value.hit(face)
function onFaceHit(face: HitType, msg: string) {
hit.value.hit(face,msg)
}
function prepareNextQuestion() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,11 @@ let timeRecord = 0
let timeRecordChat = 0
let timeRecordInterval: any = null
const players = ref<GamePlayer[]>([])
interface AmiyaFaceProps {
players: GamePlayer[]
}
const props = defineProps<AmiyaFaceProps>()
const amiyaFace = ref<HitType>('smile')
const amiyaChat = ref(
Expand Down Expand Up @@ -81,19 +85,10 @@ function gameInfoListener(response: SignalrResponse) {
}
}
}
players.value = response.PlayerList.map((p: any) => {
return {
id: p.UserId,
name: p.UserName,
avatar: p.UserAvatar ? p.UserAvatar : '/avatar.webp',
score: p.Score
}
})
}
function receiveMoveListener(response: SignalrResponse) {
const player = players.value.find((p) => p.id === response.Payload.PlayerId)
const player = props.players.find((p) => p.id === response.Payload.PlayerId)
const result = response.Payload.Result
const characterName = response.Payload.CharacterName
Expand Down

0 comments on commit 4c10011

Please sign in to comment.