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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<!DOCTYPE html>
|
| 2 |
+
<html lang="zh-CN">
|
| 3 |
+
<head>
|
| 4 |
+
<meta charset="UTF-8">
|
| 5 |
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
| 6 |
+
<title>轮盘赌游戏</title>
|
| 7 |
+
<meta name="description" content="在线轮盘赌游戏,体验真实的赌场乐趣">
|
| 8 |
+
<link rel="stylesheet" href="assets/css/styles.css">
|
| 9 |
+
</head>
|
| 10 |
+
<body>
|
| 11 |
+
<div class="container">
|
| 12 |
+
<header class="header">
|
| 13 |
+
<h1>🎰 轮盘赌游戏</h1>
|
| 14 |
+
<p class="subtitle">体验真实的赌场乐趣</p>
|
| 15 |
+
</header>
|
| 16 |
+
|
| 17 |
+
<main class="game-area">
|
| 18 |
+
<div class="wheel-container">
|
| 19 |
+
<div class="wheel-wrapper">
|
| 20 |
+
<div class="wheel" id="wheel">
|
| 21 |
+
<!-- 轮盘数字将通过JavaScript生成 -->
|
| 22 |
+
</div>
|
| 23 |
+
<div class="ball" id="ball"></div>
|
| 24 |
+
<div class="wheel-pointer">▼</div>
|
| 25 |
+
</div>
|
| 26 |
+
</div>
|
| 27 |
+
|
| 28 |
+
<div class="game-controls">
|
| 29 |
+
<div class="balance-info">
|
| 30 |
+
<div class="balance">
|
| 31 |
+
<span>余额:¥</span>
|
| 32 |
+
<span id="balance">1000</span>
|
| 33 |
+
</div>
|
| 34 |
+
<div class="last-result" id="lastResult">
|
| 35 |
+
点击开始按钮开始游戏
|
| 36 |
+
</div>
|
| 37 |
+
</div>
|
| 38 |
+
|
| 39 |
+
<div class="betting-section">
|
| 40 |
+
<div class="bet-input">
|
| 41 |
+
<label for="betAmount">投注金额:</label>
|
| 42 |
+
<input type="number" id="betAmount" min="1" max="1000" value="10">
|
| 43 |
+
<button id="clearBet" class="btn-secondary">清空</button>
|
| 44 |
+
</div>
|
| 45 |
+
|
| 46 |
+
<div class="number-selection">
|
| 47 |
+
<label>选择号码 (0-36):</label>
|
| 48 |
+
<div class="number-grid" id="numberGrid">
|
| 49 |
+
<!-- 数字按钮将通过JavaScript生成 -->
|
| 50 |
+
</div>
|
| 51 |
+
</div>
|
| 52 |
+
|
| 53 |
+
<div class="current-bet">
|
| 54 |
+
<span>当前投注:</span>
|
| 55 |
+
<span id="currentBetDisplay">无</span>
|
| 56 |
+
</div>
|
| 57 |
+
|
| 58 |
+
<div class="action-buttons">
|
| 59 |
+
<button id="spinButton" class="btn-primary">开始旋转</button>
|
| 60 |
+
<button id="resetButton" class="btn-secondary">重置游戏</button>
|
| 61 |
+
</div>
|
| 62 |
+
</div>
|
| 63 |
+
</div>
|
| 64 |
+
|
| 65 |
+
<div class="game-stats">
|
| 66 |
+
<div class="stat-item">
|
| 67 |
+
<span>总游戏次数:</span>
|
| 68 |
+
<span id="totalGames">0</span>
|
| 69 |
+
</div>
|
| 70 |
+
<div class="stat-item">
|
| 71 |
+
<span>获胜次数:</span>
|
| 72 |
+
<span id="winGames">0</span>
|
| 73 |
+
</div>
|
| 74 |
+
<div class="stat-item">
|
| 75 |
+
<span>胜率:</span>
|
| 76 |
+
<span id="winRate">0%</span>
|
| 77 |
+
</div>
|
| 78 |
+
</div>
|
| 79 |
+
</main>
|
| 80 |
+
|
| 81 |
+
<footer class="footer">
|
| 82 |
+
<p>Built with <a href="https://huggingface.co/spaces/akhaliq/anycoder" target="_blank">anycoder</a></p>
|
| 83 |
+
</footer>
|
| 84 |
+
</div>
|
| 85 |
+
|
| 86 |
+
<script src="assets/js/roulette.js"></script>
|
| 87 |
+
</body>
|
| 88 |
</html>
|
| 89 |
+
|
| 90 |
+
=== assets/css/styles.css ===
|
| 91 |
+
* {
|
| 92 |
+
margin: 0;
|
| 93 |
+
padding: 0;
|
| 94 |
+
box-sizing: border-box;
|
| 95 |
+
}
|
| 96 |
+
|
| 97 |
+
body {
|
| 98 |
+
font-family: 'Arial', sans-serif;
|
| 99 |
+
background: linear-gradient(135deg, #1e3c72 0%, #2a5298 100%);
|
| 100 |
+
min-height: 100vh;
|
| 101 |
+
color: #fff;
|
| 102 |
+
}
|
| 103 |
+
|
| 104 |
+
.container {
|
| 105 |
+
max-width: 1200px;
|
| 106 |
+
margin: 0 auto;
|
| 107 |
+
padding: 20px;
|
| 108 |
+
}
|
| 109 |
+
|
| 110 |
+
.header {
|
| 111 |
+
text-align: center;
|
| 112 |
+
margin-bottom: 30px;
|
| 113 |
+
}
|
| 114 |
+
|
| 115 |
+
.header h1 {
|
| 116 |
+
font-size: 2.5rem;
|
| 117 |
+
margin-bottom: 10px;
|
| 118 |
+
text-shadow: 2px 2px 4px rgba(0,0,0,0.5);
|
| 119 |
+
}
|
| 120 |
+
|
| 121 |
+
.subtitle {
|
| 122 |
+
font-size: 1.2rem;
|
| 123 |
+
opacity: 0.9;
|
| 124 |
+
}
|
| 125 |
+
|
| 126 |
+
.game-area {
|
| 127 |
+
display: grid;
|
| 128 |
+
grid-template-columns: 1fr 1fr;
|
| 129 |
+
gap: 40px;
|
| 130 |
+
align-items: start;
|
| 131 |
+
}
|
| 132 |
+
|
| 133 |
+
.wheel-container {
|
| 134 |
+
display: flex;
|
| 135 |
+
justify-content: center;
|
| 136 |
+
align-items: center;
|
| 137 |
+
}
|
| 138 |
+
|
| 139 |
+
.wheel-wrapper {
|
| 140 |
+
position: relative;
|
| 141 |
+
width: 400px;
|
| 142 |
+
height: 400px;
|
| 143 |
+
}
|
| 144 |
+
|
| 145 |
+
.wheel {
|
| 146 |
+
width: 100%;
|
| 147 |
+
height: 100%;
|
| 148 |
+
border-radius: 50%;
|
| 149 |
+
border: 8px solid #8B4513;
|
| 150 |
+
position: relative;
|
| 151 |
+
overflow: hidden;
|
| 152 |
+
transition: transform 4s cubic-bezier(0.23, 1, 0.32, 1);
|
| 153 |
+
background: conic-gradient(
|
| 154 |
+
#ff0000 0deg 19.35deg,
|
| 155 |
+
#000 19.35deg 38.7deg,
|
| 156 |
+
#ff0000 38.7deg 58.05deg,
|
| 157 |
+
#000 58.05deg 77.4deg,
|
| 158 |
+
#ff0000 77.4deg 96.75deg,
|
| 159 |
+
#000 96.75deg 116.1deg,
|
| 160 |
+
#ff0000 116.1deg 135.45deg,
|
| 161 |
+
#000 135.45deg 154.8deg,
|
| 162 |
+
#ff0000 154.8deg 174.15deg,
|
| 163 |
+
#000 174.15deg 193.5deg,
|
| 164 |
+
#ff0000 193.5deg 212.85deg,
|
| 165 |
+
#000 212.85deg 232.2deg,
|
| 166 |
+
#ff0000 232.2deg 251.55deg,
|
| 167 |
+
#000 251.55deg 270.9deg,
|
| 168 |
+
#ff0000 270.9deg 290.25deg,
|
| 169 |
+
#000 290.25deg 309.6deg,
|
| 170 |
+
#ff0000 309.6deg 328.95deg,
|
| 171 |
+
#000 328.95deg 348.3deg,
|
| 172 |
+
#ff0000 348.3deg 367.65deg,
|
| 173 |
+
#008000 367.65deg 378.95deg,
|
| 174 |
+
#008000 378.95deg 390.25deg
|
| 175 |
+
);
|
| 176 |
+
box-shadow:
|
| 177 |
+
0 0 20px rgba(0,0,0,0.5),
|
| 178 |
+
inset 0 0 20px rgba(255,255,255,0.1);
|
| 179 |
+
}
|
| 180 |
+
|
| 181 |
+
.wheel-number {
|
| 182 |
+
position: absolute;
|
| 183 |
+
width: 40px;
|
| 184 |
+
height: 40px;
|
| 185 |
+
border-radius: 50%;
|
| 186 |
+
display: flex;
|
| 187 |
+
align-items: center;
|
| 188 |
+
justify-content: center;
|
| 189 |
+
font-weight: bold;
|
| 190 |
+
font-size: 14px;
|
| 191 |
+
color: white;
|
| 192 |
+
text-shadow: 1px 1px 2px rgba(0,0,0,0.8);
|
| 193 |
+
transform-origin: 50% 200px;
|
| 194 |
+
}
|
| 195 |
+
|
| 196 |
+
.number-red { background-color: #c41e3a; }
|
| 197 |
+
.number-black { background-color: #000; }
|
| 198 |
+
.number-green { background-color: #228b22; }
|
| 199 |
+
|
| 200 |
+
.ball {
|
| 201 |
+
position: absolute;
|
| 202 |
+
width: 20px;
|
| 203 |
+
height: 20px;
|
| 204 |
+
border-radius: 50%;
|
| 205 |
+
background: radial-gradient(circle at 30% 30%, #fff, #ccc);
|
| 206 |
+
top: 50%;
|
| 207 |
+
left: 50%;
|
| 208 |
+
transform: translate(-50%, -50%);
|
| 209 |
+
z-index: 10;
|
| 210 |
+
box-shadow: 0 2px 10px rgba(0,0,0,0.5);
|
| 211 |
+
transition: all 0.1s ease;
|
| 212 |
+
}
|
| 213 |
+
|
| 214 |
+
.ball.spinning {
|
| 215 |
+
animation: ballSpin 4s cubic-bezier(0.23, 1, 0.32, 1) forwards;
|
| 216 |
+
}
|
| 217 |
+
|
| 218 |
+
@keyframes ballSpin {
|
| 219 |
+
0% {
|
| 220 |
+
transform: translate(-50%, -50%) rotate(0deg);
|
| 221 |
+
}
|
| 222 |
+
100% {
|
| 223 |
+
transform: translate(-50%, -50%) rotate(1440deg);
|
| 224 |
+
}
|
| 225 |
+
}
|
| 226 |
+
|
| 227 |
+
.wheel-pointer {
|
| 228 |
+
position: absolute;
|
| 229 |
+
top: -20px;
|
| 230 |
+
left: 50%;
|
| 231 |
+
transform: translateX(-50%);
|
| 232 |
+
font-size: 30px;
|
| 233 |
+
color: #fff;
|
| 234 |
+
text-shadow: 2px 2px 4px rgba(0,0,0,0.8);
|
| 235 |
+
z-index: 15;
|
| 236 |
+
}
|
| 237 |
+
|
| 238 |
+
.game-controls {
|
| 239 |
+
background: rgba(255,255,255,0.1);
|
| 240 |
+
border-radius: 15px;
|
| 241 |
+
padding: 30px;
|
| 242 |
+
backdrop-filter: blur(10px);
|
| 243 |
+
}
|
| 244 |
+
|
| 245 |
+
.balance-info {
|
| 246 |
+
margin-bottom: 30px;
|
| 247 |
+
}
|
| 248 |
+
|
| 249 |
+
.balance {
|
| 250 |
+
font-size: 1.5rem;
|
| 251 |
+
font-weight: bold;
|
| 252 |
+
margin-bottom: 15px;
|
| 253 |
+
color: #ffd700;
|
| 254 |
+
}
|
| 255 |
+
|
| 256 |
+
.last-result {
|
| 257 |
+
background: rgba(0,0,0,0.3);
|
| 258 |
+
padding: 10px;
|
| 259 |
+
border-radius: 8px;
|
| 260 |
+
text-align: center;
|
| 261 |
+
font-size: 1.1rem;
|
| 262 |
+
}
|
| 263 |
+
|
| 264 |
+
.betting-section {
|
| 265 |
+
margin-bottom: 30px;
|
| 266 |
+
}
|
| 267 |
+
|
| 268 |
+
.bet-input {
|
| 269 |
+
display: flex;
|
| 270 |
+
align-items: center;
|
| 271 |
+
gap: 10px;
|
| 272 |
+
margin-bottom: 20px;
|
| 273 |
+
}
|
| 274 |
+
|
| 275 |
+
.bet-input label {
|
| 276 |
+
font-weight: bold;
|
| 277 |
+
min-width: 80px;
|
| 278 |
+
}
|
| 279 |
+
|
| 280 |
+
.bet-input input {
|
| 281 |
+
flex: 1;
|
| 282 |
+
padding: 8px;
|
| 283 |
+
border: none;
|
| 284 |
+
border-radius: 5px;
|
| 285 |
+
font-size: 1rem;
|
| 286 |
+
}
|
| 287 |
+
|
| 288 |
+
.number-selection label {
|
| 289 |
+
display: block;
|
| 290 |
+
font-weight: bold;
|
| 291 |
+
margin-bottom: 15px;
|
| 292 |
+
}
|
| 293 |
+
|
| 294 |
+
.number-grid {
|
| 295 |
+
display: grid;
|
| 296 |
+
grid-template-columns: repeat(6, 1fr);
|
| 297 |
+
gap: 8px;
|
| 298 |
+
margin-bottom: 20px;
|
| 299 |
+
}
|
| 300 |
+
|
| 301 |
+
.number-btn {
|
| 302 |
+
padding: 10px 5px;
|
| 303 |
+
border: none;
|
| 304 |
+
border-radius: 5px;
|
| 305 |
+
font-weight: bold;
|
| 306 |
+
cursor: pointer;
|
| 307 |
+
transition: all 0.3s ease;
|
| 308 |
+
text-align: center;
|
| 309 |
+
}
|
| 310 |
+
|
| 311 |
+
.number-btn.red {
|
| 312 |
+
background-color: #c41e3a;
|
| 313 |
+
color: white;
|
| 314 |
+
}
|
| 315 |
+
|
| 316 |
+
.number-btn.black {
|
| 317 |
+
background-color: #333;
|
| 318 |
+
color: white;
|
| 319 |
+
}
|
| 320 |
+
|
| 321 |
+
.number-btn.green {
|
| 322 |
+
background-color: #228b22;
|
| 323 |
+
color: white;
|
| 324 |
+
}
|
| 325 |
+
|
| 326 |
+
.number-btn:hover {
|
| 327 |
+
transform: scale(1.1);
|
| 328 |
+
}
|
| 329 |
+
|
| 330 |
+
.number-btn.selected {
|
| 331 |
+
transform: scale(1.2);
|
| 332 |
+
box-shadow: 0 0 15px rgba(255,255,255,0.5);
|
| 333 |
+
}
|
| 334 |
+
|
| 335 |
+
.current-bet {
|
| 336 |
+
font-weight: bold;
|
| 337 |
+
margin-bottom: 20px;
|
| 338 |
+
color: #ffd700;
|
| 339 |
+
}
|
| 340 |
+
|
| 341 |
+
.action-buttons {
|
| 342 |
+
display: flex;
|
| 343 |
+
gap: 15px;
|
| 344 |
+
}
|
| 345 |
+
|
| 346 |
+
.btn-primary, .btn-secondary {
|
| 347 |
+
flex: 1;
|
| 348 |
+
padding: 12px 20px;
|
| 349 |
+
border: none;
|
| 350 |
+
border-radius: 8px;
|
| 351 |
+
font-size: 1rem;
|
| 352 |
+
font-weight: bold;
|
| 353 |
+
cursor: pointer;
|
| 354 |
+
transition: all 0.3s ease;
|
| 355 |
+
}
|
| 356 |
+
|
| 357 |
+
.btn-primary {
|
| 358 |
+
background: linear-gradient(45deg, #ff6b6b, #ff8e8e);
|
| 359 |
+
color: white;
|
| 360 |
+
}
|
| 361 |
+
|
| 362 |
+
.btn-primary:hover:not(:disabled) {
|
| 363 |
+
background: linear-gradient(45deg, #ff5252, #ff7979);
|
| 364 |
+
transform: translateY(-2px);
|
| 365 |
+
}
|
| 366 |
+
|
| 367 |
+
.btn-primary:disabled {
|
| 368 |
+
background: #666;
|
| 369 |
+
cursor: not-allowed;
|
| 370 |
+
transform: none;
|
| 371 |
+
}
|
| 372 |
+
|
| 373 |
+
.btn-secondary {
|
| 374 |
+
background: linear-gradient(45deg, #667eea, #764ba2);
|
| 375 |
+
color: white;
|
| 376 |
+
}
|
| 377 |
+
|
| 378 |
+
.btn-secondary:hover {
|
| 379 |
+
background: linear-gradient(45deg, #5a67d8, #6b46c1);
|
| 380 |
+
transform: translateY(-2px);
|
| 381 |
+
}
|
| 382 |
+
|
| 383 |
+
.game-stats {
|
| 384 |
+
display: flex;
|
| 385 |
+
justify-content: space-around;
|
| 386 |
+
background: rgba(255,255,255,0.1);
|
| 387 |
+
padding: 20px;
|
| 388 |
+
border-radius: 15px;
|
| 389 |
+
backdrop-filter: blur(10px);
|
| 390 |
+
}
|
| 391 |
+
|
| 392 |
+
.stat-item {
|
| 393 |
+
text-align: center;
|
| 394 |
+
}
|
| 395 |
+
|
| 396 |
+
.stat-item span:first-child {
|
| 397 |
+
display: block;
|
| 398 |
+
font-size: 0.9rem;
|
| 399 |
+
opacity: 0.8;
|
| 400 |
+
margin-bottom: 5px;
|
| 401 |
+
}
|
| 402 |
+
|
| 403 |
+
.stat-item span:last-child {
|
| 404 |
+
font-size: 1.2rem;
|
| 405 |
+
font-weight: bold;
|
| 406 |
+
color: #ffd700;
|
| 407 |
+
}
|
| 408 |
+
|
| 409 |
+
.footer {
|
| 410 |
+
text-align: center;
|
| 411 |
+
margin-top: 40px;
|
| 412 |
+
padding-top: 20px;
|
| 413 |
+
border-top: 1px solid rgba(255,255,255,0.2);
|
| 414 |
+
}
|
| 415 |
+
|
| 416 |
+
.footer a {
|
| 417 |
+
color: #ffd700;
|
| 418 |
+
text-decoration: none;
|
| 419 |
+
}
|
| 420 |
+
|
| 421 |
+
.footer a:hover {
|
| 422 |
+
text-decoration: underline;
|
| 423 |
+
}
|
| 424 |
+
|
| 425 |
+
/* 响应式设计 */
|
| 426 |
+
@media (max-width: 768px) {
|
| 427 |
+
.game-area {
|
| 428 |
+
grid-template-columns: 1fr;
|
| 429 |
+
gap: 30px;
|
| 430 |
+
}
|
| 431 |
+
|
| 432 |
+
.wheel-wrapper {
|
| 433 |
+
width: 300px;
|
| 434 |
+
height: 300px;
|
| 435 |
+
}
|
| 436 |
+
|
| 437 |
+
.header h1 {
|
| 438 |
+
font-size: 2rem;
|
| 439 |
+
}
|
| 440 |
+
|
| 441 |
+
.number-grid {
|
| 442 |
+
grid-template-columns: repeat(5, 1fr);
|
| 443 |
+
}
|
| 444 |
+
|
| 445 |
+
.action-buttons {
|
| 446 |
+
flex-direction: column;
|
| 447 |
+
}
|
| 448 |
+
}
|
| 449 |
+
|
| 450 |
+
@media (max-width: 480px) {
|
| 451 |
+
.container {
|
| 452 |
+
padding: 15px;
|
| 453 |
+
}
|
| 454 |
+
|
| 455 |
+
.wheel-wrapper {
|
| 456 |
+
width: 250px;
|
| 457 |
+
height: 250px;
|
| 458 |
+
}
|
| 459 |
+
|
| 460 |
+
.number-grid {
|
| 461 |
+
grid-template-columns: repeat(4, 1fr);
|
| 462 |
+
}
|
| 463 |
+
|
| 464 |
+
.game-stats {
|
| 465 |
+
flex-direction: column;
|
| 466 |
+
gap: 15px;
|
| 467 |
+
}
|
| 468 |
+
}
|
| 469 |
+
|
| 470 |
+
=== assets/js/roulette.js ===
|
| 471 |
+
class RouletteGame {
|
| 472 |
+
constructor() {
|
| 473 |
+
this.balance = 1000;
|
| 474 |
+
this.currentBet = null;
|
| 475 |
+
this.betAmount = 10;
|
| 476 |
+
this.totalGames = 0;
|
| 477 |
+
this.winGames = 0;
|
| 478 |
+
this.isSpinning = false;
|
| 479 |
+
|
| 480 |
+
this.wheelNumbers = [
|
| 481 |
+
0, 32, 15, 19, 4, 21, 2, 25, 17, 34, 6, 27, 13, 36, 11, 30, 8, 23,
|
| 482 |
+
10, 5, 24, 16, 33, 1, 20, 14, 31, 9, 22, 18, 29, 7, 28, 12, 35, 3, 26
|
| 483 |
+
];
|
| 484 |
+
|
| 485 |
+
this.redNumbers = [1, 3, 5, 7, 9, 12, 14, 16, 18, 19, 21, 23, 25, 27, 30, 32, 34, 36];
|
| 486 |
+
this.blackNumbers = [2, 4, 6, 8, 10, 11, 13, 15, 17, 20, 22, 24, 26, 28, 29, 31, 33, 35];
|
| 487 |
+
|
| 488 |
+
this.init();
|
| 489 |
+
}
|
| 490 |
+
|
| 491 |
+
init() {
|
| 492 |
+
this.createWheelNumbers();
|
| 493 |
+
this.createNumberGrid();
|
| 494 |
+
this.bindEvents();
|
| 495 |
+
this.updateDisplay();
|
| 496 |
+
}
|
| 497 |
+
|
| 498 |
+
createWheelNumbers() {
|
| 499 |
+
const wheel = document.getElementById('wheel');
|
| 500 |
+
const angleStep = 360 / 37;
|
| 501 |
+
|
| 502 |
+
this.wheelNumbers.forEach((number, index) => {
|
| 503 |
+
const numberElement = document.createElement('div');
|
| 504 |
+
numberElement.className = 'wheel-number';
|
| 505 |
+
numberElement.textContent = number;
|
| 506 |
+
|
| 507 |
+
// 确定颜色
|
| 508 |
+
if (number === 0) {
|
| 509 |
+
numberElement.classList.add('number-green');
|
| 510 |
+
} else if (this.redNumbers.includes(number)) {
|
| 511 |
+
numberElement.classList.add('number-red');
|
| 512 |
+
} else {
|
| 513 |
+
numberElement.classList.add('number-black');
|
| 514 |
+
}
|
| 515 |
+
|
| 516 |
+
// 设置位置
|
| 517 |
+
const angle = index * angleStep;
|
| 518 |
+
numberElement.style.transform = `rotate(${angle}deg) translateY(-180px)`;
|
| 519 |
+
|
| 520 |
+
wheel.appendChild(numberElement);
|
| 521 |
+
});
|
| 522 |
+
}
|
| 523 |
+
|
| 524 |
+
createNumberGrid() {
|
| 525 |
+
const grid = document.getElementById('numberGrid');
|
| 526 |
+
|
| 527 |
+
for (let i = 0; i <= 36; i++) {
|
| 528 |
+
const button = document.createElement('button');
|
| 529 |
+
button.className = 'number-btn';
|
| 530 |
+
button.textContent = i;
|
| 531 |
+
button.dataset.number = i;
|
| 532 |
+
|
| 533 |
+
if (i === 0) {
|
| 534 |
+
button.classList.add('green');
|
| 535 |
+
} else if (this.redNumbers.includes(i)) {
|
| 536 |
+
button.classList.add('red');
|
| 537 |
+
} else {
|
| 538 |
+
button.classList.add('black');
|
| 539 |
+
}
|
| 540 |
+
|
| 541 |
+
button.addEventListener('click', () => this.selectNumber(i, button));
|
| 542 |
+
grid.appendChild(button);
|
| 543 |
+
}
|
| 544 |
+
}
|
| 545 |
+
|
| 546 |
+
selectNumber(number, button) {
|
| 547 |
+
// 清除之前的选择
|
| 548 |
+
document.querySelectorAll('.number-btn').forEach(btn => {
|
| 549 |
+
btn.classList.remove('selected');
|
| 550 |
+
});
|
| 551 |
+
|
| 552 |
+
// 选择新号码
|
| 553 |
+
button.classList.add('selected');
|
| 554 |
+
this.currentBet = number;
|
| 555 |
+
this.updateDisplay();
|
| 556 |
+
}
|
| 557 |
+
|
| 558 |
+
bindEvents() {
|
| 559 |
+
document.getElementById('spinButton').addEventListener('click', () => this.spin());
|
| 560 |
+
document.getElementById('resetButton').addEventListener('click', () => this.reset());
|
| 561 |
+
document.getElementById('clearBet').addEventListener('click', () => this.clearBet());
|
| 562 |
+
|
| 563 |
+
const betAmountInput = document.getElementById('betAmount');
|
| 564 |
+
betAmountInput.addEventListener('change', (e) => {
|
| 565 |
+
this.betAmount = Math.max(1, Math.min(1000, parseInt(e.target.value) || 10));
|
| 566 |
+
e.target.value = this.betAmount;
|
| 567 |
+
});
|
| 568 |
+
}
|
| 569 |
+
|
| 570 |
+
async spin() {
|
| 571 |
+
if (this.isSpinning || this.currentBet === null) {
|
| 572 |
+
this.showMessage('请先选择一个号码!');
|
| 573 |
+
return;
|
| 574 |
+
}
|
| 575 |
+
|
| 576 |
+
if (this.betAmount > this.balance) {
|
| 577 |
+
this.showMessage('余额不足!');
|
| 578 |
+
return;
|
| 579 |
+
}
|
| 580 |
+
|
| 581 |
+
this.isSpinning = true;
|
| 582 |
+
this.balance -= this.betAmount;
|
| 583 |
+
this.updateDisplay();
|
| 584 |
+
|
| 585 |
+
// 重置轮盘和球的动画
|
| 586 |
+
const wheel = document.getElementById('wheel');
|
| 587 |
+
const ball = document.getElementById('ball');
|
| 588 |
+
const spinButton = document.getElementById('spinButton');
|
| 589 |
+
|
| 590 |
+
wheel.style.transition = 'none';
|
| 591 |
+
ball.classList.remove('spinning');
|
| 592 |
+
|
| 593 |
+
// 强制重绘
|
| 594 |
+
wheel.offsetHeight;
|
| 595 |
+
|
| 596 |
+
// 随机结果
|
| 597 |
+
const winningNumber = Math.floor(Math.random() * 37);
|
| 598 |
+
const targetAngle = this.getTargetAngle(winningNumber);
|
| 599 |
+
|
| 600 |
+
// 设置最终旋转角度
|
| 601 |
+
wheel.style.transition = 'transform 4s cubic-bezier(0.23, 1, 0.32, 1)';
|
| 602 |
+
wheel.style.transform = `rotate(${targetAngle}deg)`;
|
| 603 |
+
|
| 604 |
+
// 开始球的旋转动画
|
| 605 |
+
setTimeout(() => {
|
| 606 |
+
ball.classList.add('spinning');
|
| 607 |
+
}, 100);
|
| 608 |
+
|
| 609 |
+
// 等待动画完成
|
| 610 |
+
await new Promise(resolve => setTimeout(resolve, 4000));
|
| 611 |
+
|
| 612 |
+
// 检查结果
|
| 613 |
+
this.checkResult(winningNumber);
|
| 614 |
+
this.totalGames++;
|
| 615 |
+
|
| 616 |
+
if (this.currentBet === winningNumber) {
|
| 617 |
+
this.winGames++;
|
| 618 |
+
const winnings = this.betAmount * 35; // 35倍赔率
|
| 619 |
+
this.balance += winnings;
|
| 620 |
+
this.showMessage(`🎉 恭喜!您赢了 ¥${winnings}!`);
|
| 621 |
+
} else {
|
| 622 |
+
this.showMessage(`💔 很遗憾,号码 ${winningNumber} 获胜。您输了 ¥${this.betAmount}。`);
|
| 623 |
+
}
|
| 624 |
+
|
| 625 |
+
this.updateDisplay();
|
| 626 |
+
this.isSpinning = false;
|
| 627 |
+
spinButton.disabled = false;
|
| 628 |
+
|
| 629 |
+
// 重置选择
|
| 630 |
+
this.clearBet();
|
| 631 |
+
}
|
| 632 |
+
|
| 633 |
+
getTargetAngle(winningNumber) {
|
| 634 |
+
const index = this.wheelNumbers.indexOf(winningNumber);
|
| 635 |
+
const angleStep = 360 / 37;
|
| 636 |
+
const baseAngle = index * angleStep;
|
| 637 |
+
|
| 638 |
+
// 轮盘逆时针旋转,我们需要让获胜号码转到指针位置
|
| 639 |
+
// 指针在12点钟位置,所以轮盘需要旋转到获胜号码在顶部
|
| 640 |
+
return 360 - baseAngle + (Math.random() * angleStep - angleStep/2);
|
| 641 |
+
}
|
| 642 |
+
|
| 643 |
+
checkResult(winningNumber) {
|
| 644 |
+
// 这里可以添加更复杂的游戏逻辑
|
| 645 |
+
// 比如红黑、大小、奇偶等投注
|
| 646 |
+
}
|
| 647 |
+
|
| 648 |
+
clearBet() {
|
| 649 |
+
this.currentBet = null;
|
| 650 |
+
document.querySelectorAll('.number-btn').forEach(btn => {
|
| 651 |
+
btn.classList.remove('selected');
|
| 652 |
+
});
|
| 653 |
+
this.updateDisplay();
|
| 654 |
+
}
|
| 655 |
+
|
| 656 |
+
reset() {
|
| 657 |
+
if (this.isSpinning) return;
|
| 658 |
+
|
| 659 |
+
this.balance = 1000;
|
| 660 |
+
this.totalGames = 0;
|
| 661 |
+
this.winGames = 0;
|
| 662 |
+
this.clearBet();
|
| 663 |
+
this.showMessage('游戏已重置!');
|
| 664 |
+
this.updateDisplay();
|
| 665 |
+
}
|
| 666 |
+
|
| 667 |
+
updateDisplay() {
|
| 668 |
+
document.getElementById('balance').textContent = this.balance;
|
| 669 |
+
document.getElementById('currentBetDisplay').textContent =
|
| 670 |
+
this.currentBet !== null ? `${this.currentBet}号 (¥${this.betAmount})` : '无';
|
| 671 |
+
document.getElementById('totalGames').textContent = this.totalGames;
|
| 672 |
+
document.getElementById('winGames').textContent = this.winGames;
|
| 673 |
+
|
| 674 |
+
const winRate = this.totalGames > 0 ? ((this.winGames / this.totalGames) * 100).toFixed(1) : '0.0';
|
| 675 |
+
document.getElementById('winRate').textContent = `${winRate}%`;
|
| 676 |
+
|
| 677 |
+
const spinButton = document.getElementById('spinButton');
|
| 678 |
+
spinButton.disabled = this.isSpinning || this.currentBet === null || this.betAmount > this.balance;
|
| 679 |
+
spinButton.textContent = this.isSpinning ? '旋转中...' : '开始旋转';
|
| 680 |
+
}
|
| 681 |
+
|
| 682 |
+
showMessage(message) {
|
| 683 |
+
const lastResult = document.getElementById('lastResult');
|
| 684 |
+
lastResult.textContent = message;
|
| 685 |
+
}
|
| 686 |
+
}
|
| 687 |
+
|
| 688 |
+
// 游戏初始化
|
| 689 |
+
document.addEventListener('DOMContentLoaded', () => {
|
| 690 |
+
new RouletteGame();
|
| 691 |
+
});
|
| 692 |
+
|
| 693 |
+
// 添加一些额外的功能
|
| 694 |
+
document.addEventListener('keydown', (e) => {
|
| 695 |
+
if (e.code === 'Space') {
|
| 696 |
+
e.preventDefault();
|
| 697 |
+
const spinButton = document.getElementById('spinButton');
|
| 698 |
+
if (!spinButton.disabled) {
|
| 699 |
+
spinButton.click();
|
| 700 |
+
}
|
| 701 |
+
}
|
| 702 |
+
});
|
| 703 |
+
|
| 704 |
+
// 添加音效(如果需要的话)
|
| 705 |
+
function playSound(type) {
|
| 706 |
+
// 这里可以添加音效
|
| 707 |
+
// const audio = new Audio(`assets/sounds/${type}.mp3`);
|
| 708 |
+
// audio.play().catch(() => {}); // 忽略播放错误
|
| 709 |
+
}
|