Commit d82cb786 authored by 陈冲's avatar 陈冲

fix: 修复

parent 5e0ea925
......@@ -827,6 +827,10 @@ async fn handle_room_command(
round_id,
GAME_START_COUNTDOWN_SECS + GAME_RUNNING_SECS + GAME_RESULT_WAIT_SECS,
);
// broadcast_msgpack_all_player(evt, &ok_resp(Some(json!({
// "index":game_index,
// ""
// }))));
broadcast_msgpack_all_player(evt, &ok_resp(Some(json!(game_index))));
//通知管理员
emit_msgpack(&socket, evt, &ok_resp(Some(json!(game_index))));
......
......@@ -2,7 +2,7 @@
import { computed, onBeforeUnmount, onMounted, ref } from 'vue'
import { cssAssetUrl } from '@/commons/assets.ts'
import MobileStage from '@/components/MobileStage.vue'
import { useGameSocket, sendGameMessage, userJoinStatus, joinSharedRoom } from '@/composables/useGameSocket'
import { useGameSocket, sendGameMessage, userJoinStatus, userTop10RankStatus, joinSharedRoom } from '@/composables/useGameSocket'
import LoadingView from './views/LoadingView.vue'
import PlayingView from './views/PlayingView.vue'
import { $format_str, $getWechat, $toast } from '@/commons/utils.ts'
......@@ -116,9 +116,16 @@ function startGameCountdown(seconds = 60) {
if (countdownInterval.value <= 0) {
countdownInterval.value = 0
gameCountdownTimer = undefined
currentView.value === 'loading'
if (userTop10RankStatus.value) {
userJoinStatus.value = false;
showGameRank.value = false;
$toast('一人只能上榜领奖一次,您的福利已到手,把机会留给其他玩家吧', 30000)
} else {
setDivDescVisible(false)
submitScore(true)
showGameOverRank()
}
return
}
......
......@@ -6,7 +6,7 @@ defineProps<{
countdownInterval: number
isDivDescVisible: boolean
tick: number
rank: number
rank: number,
// currentGu: string
}>()
......
......@@ -2,7 +2,7 @@
import { computed, onBeforeUnmount, onMounted, ref } from 'vue'
import { cssAssetUrl } from '@/commons/assets.ts'
import MobileStage from '@/components/MobileStage.vue'
import { useGameSocket, joinSharedRoom, sendGameMessage, userJoinStatus } from '@/composables/useGameSocket'
import { useGameSocket, joinSharedRoom, sendGameMessage, userJoinStatus, userTop10RankStatus } from '@/composables/useGameSocket'
import LoadingView from './views/LoadingView.vue'
import PlayingView from './views/PlayingView.vue'
import { $getWechat, $toast, $is_run_local } from '@/commons/utils.ts'
......@@ -134,9 +134,16 @@ function startGameCountdown(seconds = 60) {
if (countdownInterval.value <= 0) {
countdownInterval.value = 0
gameCountdownTimer = undefined
currentView.value === 'loading'
if (userTop10RankStatus.value) {
userJoinStatus.value = false;
showGameRank.value = false;
$toast('一人只能上榜领奖一次,您的福利已到手,把机会留给其他玩家吧', 30000)
} else {
setDivDescVisible(false)
submitScore(true)
showGameOverRank()
}
return
}
......@@ -321,8 +328,8 @@ const rankCloseHandler = () => {
</script>
<template>
<MobileStage v-if="token || isLocalMode" :showGameRule="showGameRule" :showGameRank="showGameRank" ref="mobileStageRef"
:background="`${renderBG()}`">
<MobileStage v-if="token || isLocalMode" :showGameRule="showGameRule" :showGameRank="showGameRank"
ref="mobileStageRef" :background="`${renderBG()}`">
<template #gameRule>
<div class="rule-container">
<div class="rule-txt-container">
......
......@@ -7,6 +7,7 @@ import {
sendGameMessage,
userJoinStatus,
joinSharedRoom,
userTop10RankStatus,
} from "@/composables/useGameSocket";
import LoadingView from "./views/LoadingView.vue";
import PlayingView from "./views/PlayingView.vue";
......@@ -111,9 +112,15 @@ function startGameCountdown(seconds = 60) {
if (countdownInterval.value <= 0) {
countdownInterval.value = 0;
gameCountdownTimer = undefined;
if (userTop10RankStatus.value) {
userJoinStatus.value = false;
// showGameRank.value = false;
$toast('一人只能上榜领奖一次,您的福利已到手,把机会留给其他玩家吧', 30000)
} else {
setDivDescVisible(false);
submitScore(true);
showScoreView();
}
return;
}
......@@ -173,9 +180,9 @@ function replayGame() {
startGameView();
}
function backToWaiting() {}
function backToWaiting() { }
function handleRoomBack() {}
function handleRoomBack() { }
const touchHandler = () => {
tick.value += 5;
......@@ -257,12 +264,7 @@ onBeforeUnmount(() => {
</script>
<template>
<MobileStage
v-if="token"
:showGameRule="showGameRule"
ref="mobileStageRef"
:background="stageBackground"
>
<MobileStage v-if="token" :showGameRule="showGameRule" ref="mobileStageRef" :background="stageBackground">
<template #gameRule>
<div class="rule-container">
<div class="rule-txt-container">
......@@ -280,43 +282,21 @@ onBeforeUnmount(() => {
</div>
</div>
</template>
<LoadingView
v-if="currentView === 'loading'"
:image-urls="imageUrls"
:user-join-status="userJoinStatus"
@touchGameRule="showGameRuleHandler"
/>
<LoadingView v-if="currentView === 'loading'" :image-urls="imageUrls" :user-join-status="userJoinStatus"
@touchGameRule="showGameRuleHandler" />
<!-- <PlayingView v-else :image-urls="imageUrls" :tick="tick" :rank="rank" -->
<PlayingView
v-else-if="currentView === 'playing'"
:image-urls="imageUrls"
:tick="tick"
:rank="rank"
:currentHorse="currentHorse"
:currentYaoyiyao="currentYaoyiyao"
:countdown-interval="countdownInterval"
:is-div-desc-visible="isDivDescVisible"
@touch="touchHandler"
/>
<ScoreView
v-else
:image-urls="imageUrls"
:tick="tick"
:level="rank"
@replay="replayGame"
@back="backToWaiting"
/>
<PlayingView v-else-if="currentView === 'playing'" :image-urls="imageUrls" :tick="tick" :rank="rank"
:currentHorse="currentHorse" :currentYaoyiyao="currentYaoyiyao" :countdown-interval="countdownInterval"
:is-div-desc-visible="isDivDescVisible" @touch="touchHandler" />
<ScoreView v-else :image-urls="imageUrls" :tick="tick" :level="rank" @replay="replayGame" @back="backToWaiting" />
</MobileStage>
<div
v-else
style="
<div v-else style="
text-align: center;
width: 100vw;
height: 100vh;
line-height: 30;
font-size: 20px;
"
>
">
请使用微信扫码进入游戏
</div>
</template>
......
......@@ -34,7 +34,8 @@ onMounted(() => {
<div></div>
<div>{{ tick }}</div>
<div>最终排名</div>
<div><label>{{ level }}</label></div>
<div v-if="level>0"><label>{{ level }}</label></div>
<div v-else>未上榜</div>
</div>
</div>
<!-- <div class="btn-group">
......
......@@ -2,7 +2,7 @@
import { computed, onBeforeUnmount, onMounted, ref } from 'vue'
import { assetUrl, cssAssetUrl } from '@/commons/assets.ts'
import MobileStage from '@/components/MobileStage.vue'
import { useGameSocket, sendGameMessage, userJoinStatus, joinSharedRoom } from '@/composables/useGameSocket'
import { useGameSocket, sendGameMessage, userJoinStatus, joinSharedRoom, userTop10RankStatus } from '@/composables/useGameSocket'
import LoadingView from './views/LoadingView.vue'
import PlayingView from './views/PlayingView.vue'
import ScoreView from './views/ScoreView.vue'
......@@ -162,9 +162,15 @@ function startGameCountdown(seconds = 60) {
if (countdownInterval.value <= 0) {
countdownInterval.value = 0
gameCountdownTimer = undefined
if (userTop10RankStatus.value) {
userJoinStatus.value = false;
// showGameRank.value = false;
$toast('一人只能上榜领奖一次,您的福利已到手,把机会留给其他玩家吧', 30000)
} else {
setDivDescVisible(false)
submitScore(true)
showGameOverRank()
}
return
}
......@@ -363,7 +369,7 @@ const rankCloseHandler = () => {
<div class="row row-3">
<div class="col-1">{{ rank > 0 ? rank : '未上榜' }}</div>
<div class="col-2">
<div class="avatar" :style="{ backgroundImage: `url(${avatar})`,top: '27px' }"></div>
<div class="avatar" :style="{ backgroundImage: `url(${avatar})`, top: '27px' }"></div>
<div>{{ nickname }}</div>
</div>
<div class="col-3">{{ tick }}</div>
......
......@@ -370,7 +370,7 @@ const rankCloseHandler = () => {
<LoadingView v-if="currentView === 'loading'" :image-urls="imageUrls" :user-join-status="userJoinStatus"
@touchGameRule="showGameRuleHandler" />
<PlayingView v-else :image-urls="imageUrls" :tick="score" :rank="rank" :countdown-interval="countdownInterval"
:is-div-desc-visible="isDivDescVisible" @touch="touchHandler" :userTop10RankStatus="userTop10RankStatus" />
:is-div-desc-visible="isDivDescVisible" @touch="touchHandler" />
</MobileStage>
<div v-else style="text-align: center; width: 100vw; height: 100vh; line-height: 30; font-size: 20px;">
请使用微信扫码进入游戏
......
......@@ -7,7 +7,6 @@ defineProps<{
isDivDescVisible: boolean
tick: number
rank: number
userTop10RankStatus:boolean
}>()
const emit = defineEmits<{
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment