|
@@ -840,25 +840,25 @@ const draw = () => {
|
|
|
drawText(ctx, 'Game Over', clientObj.value.width / 2, 200, 80);
|
|
|
drawText(ctx, '成绩:' + gameState.score, clientObj.value.width / 2, 400, 50);
|
|
|
ctx.textAlign = 'center';
|
|
|
-
|
|
|
+ emit('confirmExit', { type: 2, area: props.currentGameArea });
|
|
|
// 游戏结束后2秒自动退出
|
|
|
- if (!gameState.exitTimer) {
|
|
|
- gameState.exitTimer = setTimeout(() => {
|
|
|
- // 退出游戏,这里可以根据实际需求调整,比如返回主菜单或跳转到其他页面
|
|
|
- gameState.gameOver = false;
|
|
|
- gameState.started = false;
|
|
|
- gameState.score = 0;
|
|
|
- gameState.time = 60;
|
|
|
- gameState.balls = [];
|
|
|
- //gameState.state = 'menu';
|
|
|
- gameState.click = false;
|
|
|
- gameState.exitTimer = null;
|
|
|
-
|
|
|
- // 如果需要跳转到其他页面,可以使用路由
|
|
|
- // router.push('/');
|
|
|
- emit('confirmExit', { type: 2, area: props.currentGameArea });
|
|
|
- }, 500);
|
|
|
- }
|
|
|
+ // if (!gameState.exitTimer) {
|
|
|
+ // gameState.exitTimer = setTimeout(() => {
|
|
|
+ // // 退出游戏,这里可以根据实际需求调整,比如返回主菜单或跳转到其他页面
|
|
|
+ // gameState.gameOver = false;
|
|
|
+ // gameState.started = false;
|
|
|
+ // gameState.score = 0;
|
|
|
+ // gameState.time = 60;
|
|
|
+ // gameState.balls = [];
|
|
|
+ // //gameState.state = 'menu';
|
|
|
+ // gameState.click = false;
|
|
|
+ // gameState.exitTimer = null;
|
|
|
+
|
|
|
+ // // 如果需要跳转到其他页面,可以使用路由
|
|
|
+ // // router.push('/');
|
|
|
+ // emit('confirmExit', { type: 2, area: props.currentGameArea });
|
|
|
+ // }, 500);
|
|
|
+ // }
|
|
|
|
|
|
// 保留点击退出的功能
|
|
|
if (gameState.click) {
|