Skip to content

Commit ca414d3

Browse files
committed
feat: add audio control and new favicon
1 parent 82fae42 commit ca414d3

File tree

5 files changed

+6
-3
lines changed

5 files changed

+6
-3
lines changed

index.html

+1
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
<meta property="og:image" content="public/CaocaoFailed.webp" />
1212
<meta property="og:type" content="website" />
1313
<title>华容道 - Huarong Dao</title>
14+
<link rel="icon" type="image/x-icon" href="icon.png">
1415
<link rel="stylesheet" href="src/styles.css" />
1516
</head>
1617
<body>

package-lock.json

+2-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

public/icon.png

9.45 KB
Loading

public/slideBlock.mp3

13.6 KB
Binary file not shown.

src/game.ts

+3-1
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ export class HuarongGame {
3131
private userId: string | null = null;
3232
private currentLevel: number;
3333
private language: Language = navigator.language.toLowerCase().startsWith('en') ? 'en' : 'zh';
34+
private slideSound = new Audio("slideBlock.mp3");
3435

3536
private generals = ["张飞", "马超", "赵云", "黄忠"];
3637
private generalIndex = 0;
@@ -58,7 +59,7 @@ export class HuarongGame {
5859
HORIZONTAL: { width: 2, height: 1, char: "将军" },
5960
SINGLE: { width: 1, height: 1, char: "兵" },
6061
};
61-
62+
this.slideSound.volume = 0.2;
6263
this.currentLevel = level;
6364
this.bestScore = "-";
6465
this.blocks = JSON.parse(JSON.stringify(LEVELS[level].layout));
@@ -333,6 +334,7 @@ export class HuarongGame {
333334
block.x = position.x;
334335
block.y = position.y;
335336
this.moves++;
337+
this.slideSound.play();
336338
this.updateStats();
337339
this.renderPieces();
338340
this.checkWin(block);

0 commit comments

Comments
 (0)