Skip to content

Commit a00422f

Browse files
committed
feat: New maps and add deploy support to Github pages
1 parent 736e074 commit a00422f

File tree

5 files changed

+85
-137
lines changed

5 files changed

+85
-137
lines changed

.github/workflows/deploy.yml

+43
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
name: Deploy to GitHub Pages
2+
3+
on:
4+
push:
5+
branches: ['main']
6+
workflow_dispatch:
7+
8+
permissions:
9+
contents: read
10+
pages: write
11+
id-token: write
12+
13+
concurrency:
14+
group: 'pages'
15+
cancel-in-progress: true
16+
17+
jobs:
18+
deploy:
19+
environment:
20+
name: github-pages
21+
url: ${{ steps.deployment.outputs.page_url }}
22+
runs-on: ubuntu-latest
23+
steps:
24+
- name: Checkout
25+
uses: actions/checkout@v3
26+
- name: Set up Node
27+
uses: actions/setup-node@v3
28+
with:
29+
node-version: 18
30+
cache: 'npm'
31+
- name: Install dependencies
32+
run: npm install
33+
- name: Build
34+
run: npm run build
35+
- name: Setup Pages
36+
uses: actions/configure-pages@v3
37+
- name: Upload artifact
38+
uses: actions/upload-pages-artifact@v1
39+
with:
40+
path: 'dist'
41+
- name: Deploy to GitHub Pages
42+
id: deployment
43+
uses: actions/deploy-pages@v1

src/game.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ export class HuarongGame {
4545
}
4646

4747
async promptForUserId(): Promise<string | null> {
48-
const id = prompt("Enter your user ID to save your score:");
48+
const id = prompt("Congratulations, you won! Enter your user ID to save your score:");
4949
if (id) {
5050
this.userId = id;
5151
const existingBestScore = localStorage.getItem(`bestScore_${id}`);

src/gameLayout.tsx

+36-37
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// <!-- 前六个关卡(横刀立马、指挥若定、将撞曹营、齐头并进、兵分三路、雨声淅沥) -->
22

33
interface Block {
4-
type: 'VERTICAL' | 'CAO_CAO' | 'HORIZONTAL' | 'SINGLE';
4+
type: "VERTICAL" | "CAO_CAO" | "HORIZONTAL" | "SINGLE";
55
x: number;
66
y: number;
77
}
@@ -24,8 +24,8 @@ const LEVELS: Level[] = [
2424
{ type: "SINGLE", x: 1, y: 3 },
2525
{ type: "SINGLE", x: 2, y: 3 },
2626
{ type: "SINGLE", x: 0, y: 4 },
27-
{ type: "SINGLE", x: 3, y: 4 }
28-
]
27+
{ type: "SINGLE", x: 3, y: 4 },
28+
],
2929
},
3030
{
3131
name: "指挥若定",
@@ -39,40 +39,39 @@ const LEVELS: Level[] = [
3939
{ type: "SINGLE", x: 0, y: 2 },
4040
{ type: "SINGLE", x: 1, y: 3 },
4141
{ type: "SINGLE", x: 2, y: 3 },
42-
{ type: "SINGLE", x: 3, y: 2 }
43-
]
42+
{ type: "SINGLE", x: 3, y: 2 },
43+
],
4444
},
4545
{
46-
"name": "四面楚歌",
46+
"name": "水泄不通",
4747
"layout": [
48-
{ "type": "CAO_CAO", "x": 1, "y": 0 },
48+
{ "type": "VERTICAL", "x": 0, "y": 0 },
49+
{ "type": "CAO_CAO", "x": 1, "y": 0 },
50+
{ "type": "SINGLE", "x": 3, "y": 0 },
51+
{ "type": "SINGLE", "x": 3, "y": 1 },
52+
{ "type": "HORIZONTAL", "x": 0, "y": 2 },
53+
{ "type": "HORIZONTAL", "x": 0, "y": 3 },
54+
{ "type": "HORIZONTAL", "x": 2, "y": 3 },
55+
{ "type": "HORIZONTAL", "x": 2, "y": 2 },
56+
{ "type": "SINGLE", "x": 0, "y": 4 },
57+
{ "type": "SINGLE", "x": 3, "y": 4 },
58+
]
59+
},
60+
{
61+
"name": "四面楚歌",
62+
"layout": [
4963
{ "type": "VERTICAL", "x": 0, "y": 0 },
64+
{ "type": "CAO_CAO", "x": 1, "y": 1 },
5065
{ "type": "VERTICAL", "x": 3, "y": 0 },
51-
{ "type": "HORIZONTAL", "x": 1, "y": 2 },
66+
{ "type": "VERTICAL", "x": 0, "y": 3 },
67+
{ "type": "VERTICAL", "x": 3, "y": 2 },
68+
{ "type": "HORIZONTAL", "x": 1, "y": 3 },
5269
{ "type": "SINGLE", "x": 0, "y": 2 },
53-
{ "type": "SINGLE", "x": 3, "y": 2 },
54-
{ "type": "SINGLE", "x": 1, "y": 3 },
55-
{ "type": "SINGLE", "x": 2, "y": 3 },
56-
{ "type": "SINGLE", "x": 0, "y": 4 },
57-
{ "type": "SINGLE", "x": 3, "y": 4 }
58-
]
59-
},
60-
{
61-
name: "齐头并进",
62-
layout: [
63-
{ type: "VERTICAL", x: 0, y: 0 },
64-
{ type: "CAO_CAO", x: 1, y: 0 },
65-
{ type: "VERTICAL", x: 3, y: 0 },
66-
{ type: "HORIZONTAL", x: 0, y: 2 },
67-
{ type: "HORIZONTAL", x: 2, y: 2 },
68-
{ type: "SINGLE", x: 0, y: 3 },
69-
{ type: "SINGLE", x: 1, y: 3 },
70-
{ type: "SINGLE", x: 2, y: 3 },
71-
{ type: "SINGLE", x: 3, y: 3 },
72-
{ type: "SINGLE", x: 0, y: 4 },
73-
{ type: "SINGLE", x: 3, y: 4 }
74-
]
75-
},
70+
{ "type": "SINGLE", "x": 3, "y": 4 },
71+
{ "type": "SINGLE", "x": 1, "y": 0 },
72+
{ "type": "SINGLE", "x": 2, "y": 0 }
73+
]
74+
},
7675
{
7776
name: "兵分三路",
7877
layout: [
@@ -86,8 +85,8 @@ const LEVELS: Level[] = [
8685
{ type: "SINGLE", x: 2, y: 3 },
8786
{ type: "SINGLE", x: 3, y: 3 },
8887
{ type: "SINGLE", x: 0, y: 4 },
89-
{ type: "SINGLE", x: 3, y: 4 }
90-
]
88+
{ type: "SINGLE", x: 3, y: 4 },
89+
],
9190
},
9291
{
9392
name: "雨声淅沥",
@@ -102,9 +101,9 @@ const LEVELS: Level[] = [
102101
{ type: "SINGLE", x: 2, y: 3 },
103102
{ type: "SINGLE", x: 3, y: 3 },
104103
{ type: "SINGLE", x: 0, y: 4 },
105-
{ type: "SINGLE", x: 3, y: 4 }
106-
]
107-
}
104+
{ type: "SINGLE", x: 3, y: 4 },
105+
],
106+
},
108107
];
109108

110-
export default LEVELS;
109+
export default LEVELS;

src/styles.css

-99
Original file line numberDiff line numberDiff line change
@@ -113,8 +113,6 @@ button:hover {
113113
}
114114

115115
.direction-arrow svg {
116-
width: 20px;
117-
height: 20px;
118116
fill: var(--text-color);
119117
}
120118

@@ -136,100 +134,3 @@ button:hover {
136134
.level-selector select:hover {
137135
border-color: var(--cao-color);
138136
}
139-
140-
/* :root {
141-
font-family: Inter, system-ui, Avenir, Helvetica, Arial, sans-serif;
142-
line-height: 1.5;
143-
font-weight: 400;
144-
145-
color-scheme: light dark;
146-
color: rgba(255, 255, 255, 0.87);
147-
background-color: #242424;
148-
149-
font-synthesis: none;
150-
text-rendering: optimizeLegibility;
151-
-webkit-font-smoothing: antialiased;
152-
-moz-osx-font-smoothing: grayscale;
153-
}
154-
155-
a {
156-
font-weight: 500;
157-
color: #646cff;
158-
text-decoration: inherit;
159-
}
160-
a:hover {
161-
color: #535bf2;
162-
}
163-
164-
body {
165-
margin: 0;
166-
display: flex;
167-
place-items: center;
168-
min-width: 320px;
169-
min-height: 100vh;
170-
}
171-
172-
h1 {
173-
font-size: 3.2em;
174-
line-height: 1.1;
175-
}
176-
177-
#app {
178-
max-width: 1280px;
179-
margin: 0 auto;
180-
padding: 2rem;
181-
text-align: center;
182-
}
183-
184-
.logo {
185-
height: 6em;
186-
padding: 1.5em;
187-
will-change: filter;
188-
transition: filter 300ms;
189-
}
190-
.logo:hover {
191-
filter: drop-shadow(0 0 2em #646cffaa);
192-
}
193-
.logo.vanilla:hover {
194-
filter: drop-shadow(0 0 2em #3178c6aa);
195-
}
196-
197-
.card {
198-
padding: 2em;
199-
}
200-
201-
.read-the-docs {
202-
color: #888;
203-
}
204-
205-
button {
206-
border-radius: 8px;
207-
border: 1px solid transparent;
208-
padding: 0.6em 1.2em;
209-
font-size: 1em;
210-
font-weight: 500;
211-
font-family: inherit;
212-
background-color: #1a1a1a;
213-
cursor: pointer;
214-
transition: border-color 0.25s;
215-
}
216-
button:hover {
217-
border-color: #646cff;
218-
}
219-
button:focus,
220-
button:focus-visible {
221-
outline: 4px auto -webkit-focus-ring-color;
222-
}
223-
224-
@media (prefers-color-scheme: light) {
225-
:root {
226-
color: #213547;
227-
background-color: #ffffff;
228-
}
229-
a:hover {
230-
color: #747bff;
231-
}
232-
button {
233-
background-color: #f9f9f9;
234-
}
235-
} */

vite.config.ts

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
import { defineConfig } from 'vite'
2+
3+
export default defineConfig({
4+
base: '/Klotski/', // Replace with your repository name
5+
})

0 commit comments

Comments
 (0)