mirror of
https://github.com/unanmed/HumanBreak.git
synced 2025-10-11 05:31:47 +08:00
chore: 选择难度的返回按钮用专门的 magic number 避免冲突
This commit is contained in:
parent
b670614e92
commit
234ea701b7
@ -38,7 +38,8 @@ import { adjustCover } from '../utils';
|
|||||||
const enum TitleButton {
|
const enum TitleButton {
|
||||||
StartGame,
|
StartGame,
|
||||||
LoadGame,
|
LoadGame,
|
||||||
Replay
|
Replay,
|
||||||
|
HardBack = -114514
|
||||||
}
|
}
|
||||||
|
|
||||||
interface ButtonItem {
|
interface ButtonItem {
|
||||||
@ -126,7 +127,7 @@ export const GameTitle = defineComponent<GameTitleProps>(props => {
|
|||||||
});
|
});
|
||||||
// 返回按钮
|
// 返回按钮
|
||||||
hard.push({
|
hard.push({
|
||||||
code: main.levelChoose.length,
|
code: TitleButton.HardBack,
|
||||||
color: '#aaa',
|
color: '#aaa',
|
||||||
name: '返回',
|
name: '返回',
|
||||||
hard: '',
|
hard: '',
|
||||||
@ -217,11 +218,11 @@ export const GameTitle = defineComponent<GameTitleProps>(props => {
|
|||||||
*/
|
*/
|
||||||
const clickButton = (code: number) => {
|
const clickButton = (code: number) => {
|
||||||
if (selectHard.value) {
|
if (selectHard.value) {
|
||||||
if (code === hard.length - 1) {
|
if (code === TitleButton.HardBack) {
|
||||||
toggleHard();
|
toggleHard();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const item = hard[code];
|
const item = hard.find(v => v.code === code)!;
|
||||||
startGame(item.name);
|
startGame(item.name);
|
||||||
} else {
|
} else {
|
||||||
switch (code) {
|
switch (code) {
|
||||||
|
Loading…
Reference in New Issue
Block a user