-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathboard.html
199 lines (199 loc) · 6.75 KB
/
board.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8" />
<script type="text/javascript" src="frontend.js">
</script>
<style>
body {
margin: 0;
}
#container {
display: flex;
justify-content: center;
align-items: center;
width: 100vw;
height: 100vh;
}
#board {
width: 90vh;
height: 90vh;
}
#board { border: 2px solid black; }
text { -webkit-user-select: none; }
.piece { cursor: default; }
.piece.selectable { cursor: pointer; }
.element > rect {
stroke-width: 0.5;
transform: translate(-50%, -50%);
}
.piece > rect { stroke: black; }
.placeholder > rect { stroke: none; fill: none; }
.piece.red > rect { fill: url(#red); }
.piece.purple > rect { fill: url(#purple); }
.piece.green > rect { fill: url(#green); }
.piece.blue > rect { fill: url(#blue); }
.placeholder.target > rect { stroke: red; }
.piece.target.red > rect { fill: url(#light_red); }
.piece.target.purple > rect { fill: url(#light_purple); }
.piece.target.green > rect { fill: url(#light_green); }
.piece.target.blue > rect { fill: url(#light_blue); }
.piece > text {
font-family: sans-serif, "思源黑体 CN", "微软雅黑";
text-anchor: middle;
fill: white;
cursor: inherit;
}
.element.reachable{ cursor: pointer; }
.placeholder.reachable > rect {
stroke: hsla(0, 0%, 0%, 0.3);
fill: hsla(50, 95%, 50%, 0.3);
}
.piece.reachable > rect {
stroke: hsl(0, 100%, 45%);
stroke-width: 0.75;
opacity: 0.5;
}
.piece.selected > rect { stroke: red; fill: hsla(30, 90%, 50%, 0.3); }
.piece.selected > text { fill: black; }
.button { cursor: pointer; }
.button:hover rect { fill: hsla(0, 0%, 80%, 0.8); }
.clock > rect {
fill: none;
stroke: black;
stroke-width: 1;
transform: translate(-50%, -50%);
}
.clock > text {
cursor: default;
-webkit-user-select: none;
text-anchor: middle;
}
#panel {
position: absolute;
border: 2px solid black;
background-color: hsla(0, 0%, 100%, 0.8);
font-family: sans-serif;
font-size: 1em;
text-align: center;
}
#panel td {
cursor: pointer;
-wekit-user-select: none;
}
#arrow_path {
fill: url(#arrow_color);
stroke: black;
stroke-width: 0.5;
}
</style>
</head>
<body>
<div id="container">
<svg id="board" viewBox="-100 -100 200 200">
<defs>
<linearGradient id="red">
<stop offset="0%" stop-color="hsl(0, 90%, 25%)" />
<stop offset="100%" stop-color="hsl(0, 90%, 30%)" />
</linearGradient>
<linearGradient id="light_red">
<stop offset="0%" stop-color="hsl(0, 90%, 45%)" />
<stop offset="100%" stop-color="hsl(0, 90%, 50%)" />
</linearGradient>
<linearGradient id="purple">
<stop offset="0%" stop-color="hsl(275, 90%, 25%)" />
<stop offset="100%" stop-color="hsl(275, 90%, 30%)" />
</linearGradient>
<linearGradient id="light_purple">
<stop offset="0%" stop-color="hsl(275, 90%, 50%)" />
<stop offset="100%" stop-color="hsl(275, 90%, 55%)" />
</linearGradient>
<linearGradient id="green">
<stop offset="0%" stop-color="hsl(130, 90%, 25%)" />
<stop offset="100%" stop-color="hsl(130, 90%, 30%)" />
</linearGradient>
<linearGradient id="light_green">
<stop offset="0%" stop-color="hsl(130, 90%, 35%)" />
<stop offset="100%" stop-color="hsl(130, 90%, 40%)" />
</linearGradient>
<linearGradient id="blue">
<stop offset="0%" stop-color="hsl(233, 90%, 25%)" />
<stop offset="100%" stop-color="hsl(233, 90%, 30%)" />
</linearGradient>
<linearGradient id="light_blue">
<stop offset="0%" stop-color="hsl(233, 90%, 50%)" />
<stop offset="100%" stop-color="hsl(233, 90%, 55%)" />
</linearGradient>
<linearGradient id="arrow_color">
<stop offset="0%" stop-color="hsl(60, 95%, 46%)" />
<stop offset="100%" stop-color="hsl(60, 95%, 50%)" />
</linearGradient>
<pattern id="grid" width="10" height="10" patternUnits="userSpaceOnUse" patternTransform="translate(-5,0)">
<path d="M 10 0 L 0 0 0 10" fill="none" stroke="gray" stroke-width="1" stroke-dasharray="1" />
</pattern>
<rect id="central_grid" width="10" height="10" fill="none" stroke="gray" stroke-width="0.5" stroke-dasharray="1" />
<rect id="player_grid" x="-25" y="30" width="50.2" height="60.2" fill="url(#grid)" stroke="none" />
<path id="arrow_path" d="M5 0v2h-5v2h5v2l3-3.03-3-2.97z" transform="translate(-4, -4) translate(0 1)"/> <!-- from open-iconic -->
</defs>
<use xlink:href="#central_grid" x="-5" y="-5" />
<use xlink:href="#central_grid" x="15" y="15" />
<use xlink:href="#central_grid" x="15" y="15" transform="rotate(90)"/>
<use xlink:href="#central_grid" x="15" y="15" transform="rotate(180)"/>
<use xlink:href="#central_grid" x="15" y="15" transform="rotate(270)"/>
<use xlink:href="#central_grid" x="-5" y="15"/>
<use xlink:href="#central_grid" x="-5" y="15" transform="rotate(90)"/>
<use xlink:href="#central_grid" x="-5" y="15" transform="rotate(180)"/>
<use xlink:href="#central_grid" x="-5" y="15" transform="rotate(270)"/>
<use xlink:href="#player_grid" />
<use xlink:href="#player_grid" transform="rotate(90)" />
<use xlink:href="#player_grid" transform="rotate(180)" />
<use xlink:href="#player_grid" transform="rotate(270)" />
<g id="clock_container">
</g>
<g id="route_signs">
</g>
<g id="pieces">
</g>
<g id="buttons">
<g class="button" id="ready_button" style="display: none;">
<rect x="45" y="45" width="28" height="10" fill="none" stroke="black" />
<text x="59" y="45" dy="7" font-size="8" text-anchor="middle">Ready</text>
</g>
</g>
</svg>
<div id="panel" style="display:none;">
<table>
<tr>
<td class="mark_button">7</td>
<td class="mark_button">8</td>
<td class="mark_button">9</td>
<td class="mark_button">大</td>
</tr>
<tr>
<td class="mark_button">4</td>
<td class="mark_button">5</td>
<td class="mark_button">6</td>
<td class="mark_button">小</td>
</tr>
<tr>
<td class="mark_button">1</td>
<td class="mark_button">2</td>
<td class="mark_button">3</td>
<td class="mark_button">兵</td>
</tr>
<tr>
<td class="mark_button">0</td>
<td class="mark_button">?</td>
<td class="mark_button">!</td>
<td class="mark_button">雷</td>
</tr>
<tr>
<td class="clear_button" colspan="4">
Clear
</td>
</tr>
</table>
</div>
</div>
</body>
</html>