mirror of
https://ghproxy.com/https://github.com/StreakingMan/solvable-sheep-game
synced 2025-05-24 06:21:51 +08:00
fix: 通关成功状态判断,完成游戏后无法点击问题
This commit is contained in:
parent
c6671038a8
commit
331b96c8f0
|
@ -171,6 +171,7 @@ const Game: FC<{
|
|||
Record<MySymbol['id'], number>
|
||||
>({});
|
||||
const [finished, setFinished] = useState<boolean>(false);
|
||||
const [success, setSuccess] = useState<boolean>(false);
|
||||
const [animating, setAnimating] = useState<boolean>(false);
|
||||
|
||||
// 音效
|
||||
|
@ -326,6 +327,7 @@ const Game: FC<{
|
|||
// 重开
|
||||
const restart = () => {
|
||||
setFinished(false);
|
||||
setSuccess(false);
|
||||
setScore(0);
|
||||
setLevel(1);
|
||||
setQueue([]);
|
||||
|
@ -395,21 +397,25 @@ const Game: FC<{
|
|||
// 输了
|
||||
if (updateQueue.length === 7) {
|
||||
setFinished(true);
|
||||
setSuccess(false);
|
||||
}
|
||||
|
||||
if (!updateScene.find((s) => s.status !== 2)) {
|
||||
// 胜利
|
||||
// 队列清空了
|
||||
if (level === maxLevel) {
|
||||
// 胜利
|
||||
setFinished(true);
|
||||
return;
|
||||
}
|
||||
setSuccess(true);
|
||||
} else {
|
||||
// 升级
|
||||
// 通关奖励关卡对应数值分数
|
||||
setScore(score + level);
|
||||
setLevel(level + 1);
|
||||
setQueue([]);
|
||||
checkCover(makeScene(level + 1, theme.icons));
|
||||
}
|
||||
} else {
|
||||
// 更新队列
|
||||
setQueue(updateQueue);
|
||||
checkCover(updateScene);
|
||||
}
|
||||
|
@ -496,7 +502,7 @@ const Game: FC<{
|
|||
level={level}
|
||||
time={usedTime}
|
||||
score={score}
|
||||
success={level === maxLevel}
|
||||
success={success}
|
||||
pure={theme.pure}
|
||||
restartMethod={restart}
|
||||
/>
|
||||
|
|
|
@ -2,7 +2,7 @@ import React, { FC, MouseEventHandler, useState } from 'react';
|
|||
import style from './WxQrCode.module.scss';
|
||||
import classNames from 'classnames';
|
||||
const WxQrCode: FC<{ title?: string; onClick?: MouseEventHandler }> = ({
|
||||
title = '【广告位招租中】同时如果您喜欢这个项目的话,可以点击扫描下方收款码分摊后台相关费用,感谢~😘',
|
||||
title = '如果您喜欢这个项目的话,可以点击扫描下方收款码分担后台相关费用(或请我喝杯咖啡),感谢~😘',
|
||||
onClick,
|
||||
}) => {
|
||||
const [fullScreen, setFullScreen] = useState<Record<number, boolean>>({
|
||||
|
|
|
@ -25,7 +25,7 @@ export const getDefaultTheme: () => Theme<DefaultSoundNames> = () => {
|
|||
title: '有解的羊了个羊',
|
||||
desc: '真的可以通关~',
|
||||
dark: true,
|
||||
maxLevel: 20,
|
||||
maxLevel: 5,
|
||||
backgroundColor: '#8dac85',
|
||||
icons: icons.map((icon) => ({
|
||||
name: icon,
|
||||
|
|
Loading…
Reference in New Issue
Block a user